summaryrefslogtreecommitdiff
path: root/toolchain/gcc
diff options
context:
space:
mode:
authorMatteo Croce <matteo.croce@canonical.com>2016-07-15 12:17:20 +0200
committerFelix Fietkau <nbd@nbd.name>2016-08-11 10:45:33 +0200
commit360fd10ac9cb92425709c76ded0cd418662e121e (patch)
tree26d6031217d47f44e751db9a98fc797268858481 /toolchain/gcc
parent1645abffea2785653de27d92ba0e977d1f32a538 (diff)
downloadmtk-20170518-360fd10ac9cb92425709c76ded0cd418662e121e.zip
mtk-20170518-360fd10ac9cb92425709c76ded0cd418662e121e.tar.gz
mtk-20170518-360fd10ac9cb92425709c76ded0cd418662e121e.tar.bz2
gcc: optionally build gccgo compiler
Tested with eglibc on x86 and armv7 so far Signed-off-by: Matteo Croce <matteo.croce@canonical.com>
Diffstat (limited to 'toolchain/gcc')
-rw-r--r--toolchain/gcc/Config.in8
-rw-r--r--toolchain/gcc/common.mk12
-rw-r--r--toolchain/gcc/final/Makefile9
-rw-r--r--toolchain/gcc/patches/5.4.0/960-go_libm.patch11
-rw-r--r--toolchain/gcc/patches/5.4.0/970-warn_bug.patch11
5 files changed, 49 insertions, 2 deletions
diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
index 4742533..41ea61c 100644
--- a/toolchain/gcc/Config.in
+++ b/toolchain/gcc/Config.in
@@ -70,3 +70,11 @@ config INSTALL_GFORTRAN
default n
help
Build/install GNU fortran compiler ?
+
+config INSTALL_GCCGO
+ bool
+ prompt "Build/install Go compiler?" if TOOLCHAINOPTS
+ depends on !GCC_VERSION_4_8 && (USE_GLIBC || BROKEN)
+ default n
+ help
+ Build/install GNU gccgo compiler ?
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index 14b6682..4220cf5 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -69,12 +69,15 @@ 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
export glibcxx_cv_c99_math_tr1=no
endif
+ifdef CONFIG_INSTALL_GCCGO
+ export libgo_cv_c_split_stack_supported=no
+endif
ifdef CONFIG_GCC_USE_GRAPHITE
ifdef CONFIG_GCC_VERSION_4_8
@@ -164,12 +167,17 @@ ifneq ($(CONFIG_SOFT_FLOAT),y)
endif
endif
+ifeq ($(CONFIG_TARGET_x86)$(CONFIG_USE_GLIBC)$(CONFIG_INSTALL_GCCGO),yyy)
+ TARGET_CFLAGS+=-fno-split-stack
+endif
+
GCC_MAKE:= \
export SHELL="$(BASH)"; \
$(MAKE) \
CFLAGS="$(HOST_CFLAGS)" \
CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
- CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
+ CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
+ GOCFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
define Host/SetToolchainInfo
$(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
diff --git a/toolchain/gcc/final/Makefile b/toolchain/gcc/final/Makefile
index 3434d89..01fec38 100644
--- a/toolchain/gcc/final/Makefile
+++ b/toolchain/gcc/final/Makefile
@@ -39,7 +39,16 @@ define Host/Configure
);
endef
+ifeq ($(CONFIG_USE_GLIBC)$(CONFIG_INSTALL_GCCGO),yy)
+define FixGogccCrt
+ # link crtX.o for gotools
+ mkdir -p $(GCC_BUILD_DIR)/gotools
+ $(foreach crt, i 1 n, ln -sf ../../glibc-dev/lib/crt$(crt).o $(GCC_BUILD_DIR)/gotools/ ; )
+endef
+endif
+
define Host/Compile
+ $(FixGogccCrt)
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all
endef
diff --git a/toolchain/gcc/patches/5.4.0/960-go_libm.patch b/toolchain/gcc/patches/5.4.0/960-go_libm.patch
new file mode 100644
index 0000000..d16b020
--- /dev/null
+++ b/toolchain/gcc/patches/5.4.0/960-go_libm.patch
@@ -0,0 +1,11 @@
+--- a/gcc/go/Make-lang.in
++++ b/gcc/go/Make-lang.in
+@@ -74,7 +74,7 @@ go_OBJS = $(GO_OBJS) go/gospec.o
+
+ go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+ +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
+- $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
++ $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) -lm
+
+ # Documentation.
+
diff --git a/toolchain/gcc/patches/5.4.0/970-warn_bug.patch b/toolchain/gcc/patches/5.4.0/970-warn_bug.patch
new file mode 100644
index 0000000..2c5cf9b
--- /dev/null
+++ b/toolchain/gcc/patches/5.4.0/970-warn_bug.patch
@@ -0,0 +1,11 @@
+--- a/libgo/runtime/mprof.goc
++++ b/libgo/runtime/mprof.goc
+@@ -403,7 +403,7 @@ func ThreadCreateProfile(p Slice) (n int
+
+ func Stack(b Slice, all bool) (n int) {
+ byte *pc, *sp;
+- bool enablegc;
++ bool enablegc = false; /* workaround GCC bug #36550 */
+
+ sp = runtime_getcallersp(&b);
+ pc = (byte*)(uintptr)runtime_getcallerpc(&b);