kernel: netfilter: chain filters merged into nf_tables.ko
[openwrt/openwrt.git] / toolchain / gcc / patches / 7.3.0 / 960-gotools-fix-compilation-when-making-cross-compiler.patch
1 From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
2 From: Yousong Zhou <yszhou4tech@gmail.com>
3 Date: Fri, 4 May 2018 18:20:53 +0800
4 Subject: [PATCH] gotools: fix compilation when making cross compiler
5
6 libgo is "the runtime support library for the Go programming language.
7 This library is intended for use with the Go frontend."
8
9 gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
10 the linker will complain that it cannot find it. That's because shared libgcc
11 is not present in the install directory yet. libgo.so was made without problem
12 because gcc will emit -lgcc_s when compiled with -shared option. When gotools
13 were being made, it was supplied with -static-libgcc thus no link option was
14 provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
15 for linking with libgo.so
16
17 - GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
18 - Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
19
20 When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
21 available after gcc pass2 completed and will meet the gotools link requirement
22 at gcc pass3
23 ---
24 gotools/Makefile.am | 4 +++-
25 gotools/Makefile.in | 4 +++-
26 2 files changed, 6 insertions(+), 2 deletions(-)
27
28 diff --git a/gotools/Makefile.am b/gotools/Makefile.am
29 index 5f3940a278b..9c22f5df103 100644
30 --- a/gotools/Makefile.am
31 +++ b/gotools/Makefile.am
32 @@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
33 STAMP = echo timestamp >
34
35 libgodir = ../$(target_noncanonical)/libgo
36 +libgccdir = ../$(target_noncanonical)/libgcc
37 LIBGODEP = $(libgodir)/libgo.la
38
39 if NATIVE
40 @@ -38,7 +39,8 @@ endif
41 GOCFLAGS = $(CFLAGS_FOR_TARGET)
42 GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
43
44 -AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
45 +AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
46 + -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
47 GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
48
49 cmdsrcdir = $(srcdir)/../libgo/go/cmd
50 diff --git a/gotools/Makefile.in b/gotools/Makefile.in
51 index 4386576b011..0bdd9290e01 100644
52 --- a/gotools/Makefile.in
53 +++ b/gotools/Makefile.in
54 @@ -252,13 +252,15 @@ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
55 PWD_COMMAND = $${PWDCMD-pwd}
56 STAMP = echo timestamp >
57 libgodir = ../$(target_noncanonical)/libgo
58 +libgccdir = ../$(target_noncanonical)/libgcc
59 LIBGODEP = $(libgodir)/libgo.la
60 @NATIVE_FALSE@GOCOMPILER = $(GOC)
61
62 # Use the compiler we just built.
63 @NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
64 GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
65 -AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
66 +AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
67 + -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
68 GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
69 cmdsrcdir = $(srcdir)/../libgo/go/cmd
70 go_cmd_go_files = \
71 --
72 2.16.3
73