Modify

Opened 16 months ago

#24906 new defect

gccgo/libgo toolchain support for OpenWrt Chaos Calmer 15.05.1

Reported by: earthGavinLee Owned by: developers
Priority: normal Milestone:
Component: toolchain Version: Chaos Calmer 15.05
Keywords: Cc:

Description

commit 98dc789a23a514b6f0429eaa7a7c61e2f5a68d76
Author: gavin <gavin@gavin-Inspiron>
Date:   Sat Oct 8 03:23:19 2016 +0800

    gccgo/libgo toolchain support for OpenWrt

diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile
index 27865de..40583c1 100644
--- a/package/libs/toolchain/Makefile
+++ b/package/libs/toolchain/Makefile
@@ -254,6 +254,32 @@ define Package/libgfortran/config
 	endmenu
 endef
 
+define Package/libgo
+$(call Package/gcc/Default)
+  TITLE:=Go support library
+  DEPENDS+=@INSTALL_GCCGO
+endef
+
+define Package/libgo/config
+	menu "Configuration"
+		depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgo
+
+	config LIBGO_ROOT_DIR
+		string
+		prompt "libgo shared library base directory"
+		depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgo
+		default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
+		default "/"  if NATIVE_TOOLCHAIN
+
+	config LIBGO_FILE_SPEC
+		string
+		prompt "libgo shared library files (use wildcards)"
+		depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgo
+		default "./usr/lib/libgo.so.*"
+
+	endmenu
+endef
+
 define Package/ldd
 $(call Package/libc/Default)
   DEPENDS:=@!USE_MUSL
@@ -410,6 +436,11 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
 	$(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/
   endef
 
+  define Package/libgo/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(if $(CONFIG_GCC_VERSION_4_6),,$(CP) $(TOOLCHAIN_DIR)/lib/libgo.so.* $(1)/usr/lib/)
+  endef
+
   define Package/libssp/install
 	$(INSTALL_DIR) $(1)/lib
 	$(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
@@ -559,6 +590,14 @@ else
 	done
   endef
 
+  define Package/libgo/install
+	for file in $(call qstrip,$(CONFIG_LIBGO_FILE_SPEC)); do \
+		dir=`dirname $$$$file` ; \
+		$(INSTALL_DIR) $(1)/$$$$dir ; \
+		$(CP) $(call qstrip,$(CONFIG_LIBGO_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
+	done
+  endef
+
   define Package/libssp/install
 	for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
 		dir=`dirname $$$$file` ; \
@@ -642,5 +681,6 @@ $(eval $(call BuildPackage,libpthread))
 $(eval $(call BuildPackage,libthread-db))
 $(eval $(call BuildPackage,librt))
 $(eval $(call BuildPackage,libgfortran))
+$(eval $(call BuildPackage,libgo))
 $(eval $(call BuildPackage,ldd))
 $(eval $(call BuildPackage,ldconfig))
diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
index 0c55048..9107053 100644
--- a/toolchain/gcc/Config.in
+++ b/toolchain/gcc/Config.in
@@ -64,3 +64,10 @@ config INSTALL_GFORTRAN
 	default n
 	help
 	    Build/install GNU fortran compiler ?
+
+config INSTALL_GCCGO
+	bool
+	prompt "Build/install gccgo compiler?" if TOOLCHAINOPTS && !(GCC_VERSION_4_4_7 || GCC_VERSION_4_6 || GCC_VERSION_4_6_LINARO) && !UCLIBC_VERSION_0_9_33
+	default n
+	help
+	    Build/install GNU gccgo compiler ?
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index dece29c..a5de844 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -88,7 +88,7 @@ HOST_STAMP_CONFIGURED:=$(GCC_BUILD_DIR)/.configured
 HOST_STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.gcc_$(GCC_VARIANT)_installed
 
 SEP:=,
-TARGET_LANGUAGES:="c,c++$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)$(if $(CONFIG_INSTALL_GFORTRAN),$(SEP)fortran)"
+TARGET_LANGUAGES:="c,c++$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)$(if $(CONFIG_INSTALL_GFORTRAN),$(SEP)fortran)$(if $(CONFIG_INSTALL_GCCGO),$(SEP)go)"
 
 export libgcc_cv_fixed_point=no
 ifdef CONFIG_USE_UCLIBC
diff --git a/toolchain/gcc/patches/4.8-linaro/400-libgo-do-not-redefine-CPU_COUNT.patch b/toolchain/gcc/patches/4.8-linaro/400-libgo-do-not-redefine-CPU_COUNT.patch
new file mode 100644
index 0000000..a6ba713
--- /dev/null
+++ b/toolchain/gcc/patches/4.8-linaro/400-libgo-do-not-redefine-CPU_COUNT.patch
@@ -0,0 +1,15 @@
+https://sourceware.org/ml/crossgcc/2014-09/msg00034.html
+
+--- a/libgo/runtime/getncpu-linux.c
++++ b/libgo/runtime/getncpu-linux.c
+@@ -5,8 +5,8 @@
+ #include <features.h>
+ #include <sched.h>
+ 
+-// CPU_COUNT is only provided by glibc 2.6 or higher
+-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
++// Define CPU_COUNT if it isn't already.
++#if !defined(CPU_COUNT)
+ #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
+ static int _CPU_COUNT(unsigned int *set, size_t len) {
+ 	int cnt;
diff --git a/toolchain/gcc/patches/4.8-linaro/401-go1-needs-libm.patch b/toolchain/gcc/patches/4.8-linaro/401-go1-needs-libm.patch
new file mode 100644
index 0000000..64db546
--- /dev/null
+++ b/toolchain/gcc/patches/4.8-linaro/401-go1-needs-libm.patch
@@ -0,0 +1,11 @@
+--- a/gcc/go/Make-lang.in	2015-03-05 02:40:05.246555190 +1100
++++ b/gcc/go/Make-lang.in	2015-03-05 02:40:18.414555609 +1100
+@@ -75,7 +75,7 @@
+ 
+ go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+ 	+$(CXX) $(ALL_CXXFLAGS) $(LDFLAGS) -o $@ \
+-	      $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
++	      $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) -lm
+ 
+ # Documentation.
+ 
diff --git a/toolchain/gcc/patches/4.9-linaro/401-go1-needs-libm.patch b/toolchain/gcc/patches/4.9-linaro/401-go1-needs-libm.patch
new file mode 100644
index 0000000..64db546
--- /dev/null
+++ b/toolchain/gcc/patches/4.9-linaro/401-go1-needs-libm.patch
@@ -0,0 +1,11 @@
+--- a/gcc/go/Make-lang.in	2015-03-05 02:40:05.246555190 +1100
++++ b/gcc/go/Make-lang.in	2015-03-05 02:40:18.414555609 +1100
+@@ -75,7 +75,7 @@
+ 
+ go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+ 	+$(CXX) $(ALL_CXXFLAGS) $(LDFLAGS) -o $@ \
+-	      $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
++	      $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) -lm
+ 
+ # Documentation.
+ 

Attachments (0)

Change History (0)

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.