summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-03-07 16:10:55 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-03-09 14:43:11 +0000
commite53aa46f435d68706d042af17bf629a16f18556c (patch)
tree57aced42db7e12c5cc90a385231c7b42272adda8 /meta
parentd5cfad0848d51191ff2555c4fe07554aec146f18 (diff)
downloadpoky-e53aa46f435d68706d042af17bf629a16f18556c.tar.gz
go: Add recipes for 1.12 release and make it default
- Refresh patches - Enable GOCACHE required as of Go 1.12 (From OE-Core rev: f559fd6df2978f9093672794420eada2b7452987) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/go.bbclass1
-rw-r--r--meta/conf/distro/include/tcmode-default.inc2
-rw-r--r--meta/recipes-devtools/go/go-1.12.inc23
-rw-r--r--meta/recipes-devtools/go/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch31
-rw-r--r--meta/recipes-devtools/go/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch218
-rw-r--r--meta/recipes-devtools/go/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch48
-rw-r--r--meta/recipes-devtools/go/go-1.12/0004-ld-add-soname-to-shareable-objects.patch45
-rw-r--r--meta/recipes-devtools/go/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch37
-rw-r--r--meta/recipes-devtools/go/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch282
-rw-r--r--meta/recipes-devtools/go/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch106
-rw-r--r--meta/recipes-devtools/go/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch37
-rw-r--r--meta/recipes-devtools/go/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch112
-rw-r--r--meta/recipes-devtools/go/go-common.inc1
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian_1.12.bb2
-rw-r--r--meta/recipes-devtools/go/go-cross.inc1
-rw-r--r--meta/recipes-devtools/go/go-cross_1.12.bb2
-rw-r--r--meta/recipes-devtools/go/go-crosssdk_1.12.bb2
-rw-r--r--meta/recipes-devtools/go/go-native_1.12.bb2
-rw-r--r--meta/recipes-devtools/go/go-runtime_1.12.bb2
-rw-r--r--meta/recipes-devtools/go/go_1.12.bb14
20 files changed, 964 insertions, 4 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index af331f8018..7069c5fec0 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -45,7 +45,6 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
45 45
46B = "${WORKDIR}/build" 46B = "${WORKDIR}/build"
47export GOPATH = "${B}" 47export GOPATH = "${B}"
48export GOCACHE = "off"
49export GOTMPDIR ?= "${WORKDIR}/go-tmp" 48export GOTMPDIR ?= "${WORKDIR}/go-tmp"
50GOTMPDIR[vardepvalue] = "" 49GOTMPDIR[vardepvalue] = ""
51 50
diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc
index 12d3901ee1..04373cc0aa 100644
--- a/meta/conf/distro/include/tcmode-default.inc
+++ b/meta/conf/distro/include/tcmode-default.inc
@@ -25,7 +25,7 @@ GDBVERSION ?= "8.2%"
25GLIBCVERSION ?= "2.29%" 25GLIBCVERSION ?= "2.29%"
26LINUXLIBCVERSION ?= "5.0%" 26LINUXLIBCVERSION ?= "5.0%"
27QEMUVERSION ?= "3.1%" 27QEMUVERSION ?= "3.1%"
28GOVERSION ?= "1.11%" 28GOVERSION ?= "1.12%"
29 29
30PREFERRED_VERSION_gcc ?= "${GCCVERSION}" 30PREFERRED_VERSION_gcc ?= "${GCCVERSION}"
31PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}" 31PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}"
diff --git a/meta/recipes-devtools/go/go-1.12.inc b/meta/recipes-devtools/go/go-1.12.inc
new file mode 100644
index 0000000000..4f6c341fc3
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12.inc
@@ -0,0 +1,23 @@
1require go-common.inc
2
3GO_BASEVERSION = "1.12"
4GO_MINOR = ""
5PV .= "${GO_MINOR}"
6FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
7
8LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
9
10SRC_URI += "\
11 file://0001-allow-CC-and-CXX-to-have-multiple-words.patch \
12 file://0002-cmd-go-make-content-based-hash-generation-less-pedan.patch \
13 file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \
14 file://0004-ld-add-soname-to-shareable-objects.patch \
15 file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \
16 file://0006-cmd-dist-separate-host-and-target-builds.patch \
17 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
18 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
19"
20SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
21
22SRC_URI[main.md5sum] = "b3332feba8a945a193b47a52d9981bb9"
23SRC_URI[main.sha256sum] = "09c43d3336743866f2985f566db0520b36f4992aea2b4b2fd9f52f17049e88f2"
diff --git a/meta/recipes-devtools/go/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/meta/recipes-devtools/go/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch
new file mode 100644
index 0000000000..4442858c83
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch
@@ -0,0 +1,31 @@
1From 7cc519aa5f84cf8fc7ac8c10fc69aa8040330ea0 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Mon, 19 Feb 2018 08:49:33 -0800
4Subject: [PATCH] allow CC and CXX to have multiple words
5
6Upstream-Status: Inappropriate [OE specific]
7
8Signed-off-by: Matt Madison <matt@madison.systems>
9
10---
11 src/cmd/go/internal/envcmd/env.go | 4 ++--
12 1 file changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
15index afadbad..cedbfbf 100644
16--- a/src/cmd/go/internal/envcmd/env.go
17+++ b/src/cmd/go/internal/envcmd/env.go
18@@ -85,11 +85,11 @@ func MkEnv() []cfg.EnvVar {
19
20 cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
21 if env := strings.Fields(os.Getenv("CC")); len(env) > 0 {
22- cc = env[0]
23+ cc = strings.Join(env, " ")
24 }
25 cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch)
26 if env := strings.Fields(os.Getenv("CXX")); len(env) > 0 {
27- cxx = env[0]
28+ cxx = strings.Join(env, " ")
29 }
30 env = append(env, cfg.EnvVar{Name: "CC", Value: cc})
31 env = append(env, cfg.EnvVar{Name: "CXX", Value: cxx})
diff --git a/meta/recipes-devtools/go/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/meta/recipes-devtools/go/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
new file mode 100644
index 0000000000..66b8561874
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
@@ -0,0 +1,218 @@
1From 47db69e20ed66fb62b01affd83d829654b829893 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Mon, 19 Feb 2018 08:50:59 -0800
4Subject: [PATCH] cmd/go: make content-based hash generation less pedantic
5
6Go 1.10's build tool now uses content-based hashes to
7determine when something should be built or re-built.
8This same mechanism is used to maintain a built-artifact
9cache for speeding up builds.
10
11However, the hashes it generates include information that
12doesn't work well with OE, nor with using a shared runtime
13library.
14
15First, it embeds path names to source files, unless
16building within GOROOT. This prevents the building
17of a package in GOPATH for later staging into GOROOT.
18
19This patch adds support for the environment variable
20GOPATH_OMIT_IN_ACTIONID. If present, path name
21embedding is disabled.
22
23Second, if cgo is enabled, the build ID for cgo-related
24packages will include the current value of the environment
25variables for invoking the compiler (CC, CXX, FC) and
26any CGO_xxFLAGS variables. Only if the settings used
27during a compilation exactly match, character for character,
28the values used for compiling runtime/cgo or any other
29cgo-enabled package being imported, will the tool
30decide that the imported package is up-to-date.
31
32This is done to help ensure correctness, but is overly
33simplistic and effectively prevents the reuse of built
34artifacts that use cgo (or shared runtime, which includes
35runtime/cgo).
36
37This patch filters out all compiler flags except those
38beginning with '-m'. The default behavior can be restored
39by setting the CGO_PEDANTIC environment variable.
40
41Upstream-Status: Inappropriate [OE specific]
42
43Signed-off-by: Matt Madison <matt@madison.systems>
44
45---
46 src/cmd/go/internal/envcmd/env.go | 2 +-
47 src/cmd/go/internal/work/exec.go | 63 ++++++++++++++++++++++---------
48 2 files changed, 46 insertions(+), 19 deletions(-)
49
50diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
51index cedbfbf..5763a0d 100644
52--- a/src/cmd/go/internal/envcmd/env.go
53+++ b/src/cmd/go/internal/envcmd/env.go
54@@ -128,7 +128,7 @@ func ExtraEnvVars() []cfg.EnvVar {
55 func ExtraEnvVarsCostly() []cfg.EnvVar {
56 var b work.Builder
57 b.Init()
58- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{})
59+ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false)
60 if err != nil {
61 // Should not happen - b.CFlags was given an empty package.
62 fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err)
63diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
64index 12e1527..e41bfac 100644
65--- a/src/cmd/go/internal/work/exec.go
66+++ b/src/cmd/go/internal/work/exec.go
67@@ -174,6 +174,8 @@ func (b *Builder) Do(root *Action) {
68 wg.Wait()
69 }
70
71+var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != ""
72+
73 // buildActionID computes the action ID for a build action.
74 func (b *Builder) buildActionID(a *Action) cache.ActionID {
75 p := a.Package
76@@ -190,7 +192,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
77 // but it does not hide the exact value of $GOPATH.
78 // Include the full dir in that case.
79 // Assume b.WorkDir is being trimmed properly.
80- if !p.Goroot && !strings.HasPrefix(p.Dir, b.WorkDir) {
81+ if !p.Goroot && !omitGopath && !strings.HasPrefix(p.Dir, b.WorkDir) {
82 fmt.Fprintf(h, "dir %s\n", p.Dir)
83 }
84 fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
85@@ -201,13 +203,13 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
86 }
87 if len(p.CgoFiles)+len(p.SwigFiles) > 0 {
88 fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
89- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
90- fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(), cppflags, cflags, ldflags)
91+ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
92+ fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(true), cppflags, cflags, ldflags)
93 if len(p.CXXFiles)+len(p.SwigFiles) > 0 {
94- fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(), cxxflags)
95+ fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(true), cxxflags)
96 }
97 if len(p.FFiles) > 0 {
98- fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(), fflags)
99+ fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(true), fflags)
100 }
101 // TODO(rsc): Should we include the SWIG version or Fortran/GCC/G++/Objective-C compiler versions?
102 }
103@@ -2096,33 +2098,33 @@ var (
104 // gccCmd returns a gcc command line prefix
105 // defaultCC is defined in zdefaultcc.go, written by cmd/dist.
106 func (b *Builder) GccCmd(incdir, workdir string) []string {
107- return b.compilerCmd(b.ccExe(), incdir, workdir)
108+ return b.compilerCmd(b.ccExe(false), incdir, workdir)
109 }
110
111 // gxxCmd returns a g++ command line prefix
112 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
113 func (b *Builder) GxxCmd(incdir, workdir string) []string {
114- return b.compilerCmd(b.cxxExe(), incdir, workdir)
115+ return b.compilerCmd(b.cxxExe(false), incdir, workdir)
116 }
117
118 // gfortranCmd returns a gfortran command line prefix.
119 func (b *Builder) gfortranCmd(incdir, workdir string) []string {
120- return b.compilerCmd(b.fcExe(), incdir, workdir)
121+ return b.compilerCmd(b.fcExe(false), incdir, workdir)
122 }
123
124 // ccExe returns the CC compiler setting without all the extra flags we add implicitly.
125-func (b *Builder) ccExe() []string {
126- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch))
127+func (b *Builder) ccExe(filtered bool) []string {
128+ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered)
129 }
130
131 // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly.
132-func (b *Builder) cxxExe() []string {
133- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch))
134+func (b *Builder) cxxExe(filtered bool) []string {
135+ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered)
136 }
137
138 // fcExe returns the FC compiler setting without all the extra flags we add implicitly.
139-func (b *Builder) fcExe() []string {
140- return b.compilerExe(os.Getenv("FC"), "gfortran")
141+func (b *Builder) fcExe(filtered bool) []string {
142+ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered)
143 }
144
145 // compilerExe returns the compiler to use given an
146@@ -2131,11 +2133,14 @@ func (b *Builder) fcExe() []string {
147 // of the compiler but can have additional arguments if they
148 // were present in the environment value.
149 // For example if CC="gcc -DGOPHER" then the result is ["gcc", "-DGOPHER"].
150-func (b *Builder) compilerExe(envValue string, def string) []string {
151+func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string {
152 compiler := strings.Fields(envValue)
153 if len(compiler) == 0 {
154 compiler = []string{def}
155 }
156+ if filtered {
157+ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...)
158+ }
159 return compiler
160 }
161
162@@ -2285,8 +2290,23 @@ func envList(key, def string) []string {
163 return strings.Fields(v)
164 }
165
166+var filterFlags = os.Getenv("CGO_PEDANTIC") == ""
167+
168+func filterCompilerFlags(flags []string) []string {
169+ var newflags []string
170+ if !filterFlags {
171+ return flags
172+ }
173+ for _, flag := range flags {
174+ if strings.HasPrefix(flag, "-m") {
175+ newflags = append(newflags, flag)
176+ }
177+ }
178+ return newflags
179+}
180+
181 // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
182-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
183+func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
184 defaults := "-g -O2"
185
186 if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
187@@ -2304,6 +2324,13 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l
188 if ldflags, err = buildFlags("LDFLAGS", defaults, p.CgoLDFLAGS, checkLinkerFlags); err != nil {
189 return
190 }
191+ if filtered {
192+ cppflags = filterCompilerFlags(cppflags)
193+ cflags = filterCompilerFlags(cflags)
194+ cxxflags = filterCompilerFlags(cxxflags)
195+ fflags = filterCompilerFlags(fflags)
196+ ldflags = filterCompilerFlags(ldflags)
197+ }
198
199 return
200 }
201@@ -2319,7 +2346,7 @@ var cgoRe = regexp.MustCompile(`[/\\:]`)
202
203 func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
204 p := a.Package
205- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p)
206+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false)
207 if err != nil {
208 return nil, nil, err
209 }
210@@ -2679,7 +2706,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) {
211
212 // Run SWIG on one SWIG input file.
213 func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
214- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p)
215+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false)
216 if err != nil {
217 return "", "", err
218 }
diff --git a/meta/recipes-devtools/go/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/meta/recipes-devtools/go/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
new file mode 100644
index 0000000000..b6ca40edee
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
@@ -0,0 +1,48 @@
1From 5c32c38bf19b24f0aadd78012d17ff5caa82151e Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 05:24:20 -0800
4Subject: [PATCH] allow GOTOOLDIR to be overridden in the environment
5
6to allow for split host/target build roots
7
8Upstream-Status: Inappropriate [OE specific]
9
10Signed-off-by: Matt Madison <matt@madison.systems>
11
12---
13 src/cmd/dist/build.go | 4 +++-
14 src/cmd/go/internal/cfg/cfg.go | 7 +++++--
15 2 files changed, 8 insertions(+), 3 deletions(-)
16
17Index: go/src/cmd/dist/build.go
18===================================================================
19--- go.orig/src/cmd/dist/build.go
20+++ go/src/cmd/dist/build.go
21@@ -228,7 +228,9 @@ func xinit() {
22 workdir = xworkdir()
23 xatexit(rmworkdir)
24
25- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
26+ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
27+ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
28+ }
29 }
30
31 // compilerEnv returns a map from "goos/goarch" to the
32Index: go/src/cmd/go/internal/cfg/cfg.go
33===================================================================
34--- go.orig/src/cmd/go/internal/cfg/cfg.go
35+++ go/src/cmd/go/internal/cfg/cfg.go
36@@ -116,7 +116,11 @@ func init() {
37 // variables. This matches the initialization of ToolDir in
38 // go/build, except for using GOROOT rather than
39 // runtime.GOROOT.
40- build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
41+ if s := os.Getenv("GOTOOLDIR"); s != "" {
42+ build.ToolDir = filepath.Clean(s)
43+ } else {
44+ build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
45+ }
46 }
47 }
48
diff --git a/meta/recipes-devtools/go/go-1.12/0004-ld-add-soname-to-shareable-objects.patch b/meta/recipes-devtools/go/go-1.12/0004-ld-add-soname-to-shareable-objects.patch
new file mode 100644
index 0000000000..004a33a023
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0004-ld-add-soname-to-shareable-objects.patch
@@ -0,0 +1,45 @@
1From 55eb8c95a89f32aec16b7764e78e8cf75169dc81 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 06:26:10 -0800
4Subject: [PATCH] ld: add soname to shareable objects
5
6so that OE's shared library dependency handling
7can find them.
8
9Upstream-Status: Inappropriate [OE specific]
10
11Signed-off-by: Matt Madison <matt@madison.systems>
12
13---
14 src/cmd/link/internal/ld/lib.go | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
18index 220aab3..703925f 100644
19--- a/src/cmd/link/internal/ld/lib.go
20+++ b/src/cmd/link/internal/ld/lib.go
21@@ -1135,6 +1135,7 @@ func (ctxt *Link) hostlink() {
22 argv = append(argv, "-Wl,-z,relro")
23 }
24 argv = append(argv, "-shared")
25+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
26 if ctxt.HeadType != objabi.Hwindows {
27 // Pass -z nodelete to mark the shared library as
28 // non-closeable: a dlclose will do nothing.
29@@ -1146,6 +1147,8 @@ func (ctxt *Link) hostlink() {
30 argv = append(argv, "-Wl,-z,relro")
31 }
32 argv = append(argv, "-shared")
33+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
34+
35 case BuildModePlugin:
36 if ctxt.HeadType == objabi.Hdarwin {
37 argv = append(argv, "-dynamiclib")
38@@ -1154,6 +1157,7 @@ func (ctxt *Link) hostlink() {
39 argv = append(argv, "-Wl,-z,relro")
40 }
41 argv = append(argv, "-shared")
42+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
43 }
44 }
45
diff --git a/meta/recipes-devtools/go/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/meta/recipes-devtools/go/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
new file mode 100644
index 0000000000..ace8de9eae
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
@@ -0,0 +1,37 @@
1From 1bf15aa8fb773604b2524cfdab493fa4d8fa9285 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 06:32:45 -0800
4Subject: [PATCH] make.bash: override CC when building dist and go_bootstrap
5
6for handling OE cross-canadian builds.
7
8Upstream-Status: Inappropriate [OE specific]
9
10Signed-off-by: Matt Madison <matt@madison.systems>
11
12---
13 src/make.bash | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/src/make.bash b/src/make.bash
17index 78882d9..25943d0 100755
18--- a/src/make.bash
19+++ b/src/make.bash
20@@ -163,7 +163,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
21 exit 1
22 fi
23 rm -f cmd/dist/dist
24-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
25+CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
26
27 # -e doesn't propagate out of eval, so check success by hand.
28 eval $(./cmd/dist/dist env -p || echo FAIL=true)
29@@ -194,7 +194,7 @@ fi
30 # Run dist bootstrap to complete make.bash.
31 # Bootstrap installs a proper cmd/dist, built with the new toolchain.
32 # Throw ours, built with Go 1.4, away after bootstrap.
33-./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
34+CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
35 rm -f ./cmd/dist/dist
36
37 # DO NOT ADD ANY NEW CODE HERE.
diff --git a/meta/recipes-devtools/go/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch
new file mode 100644
index 0000000000..0c0d5da80a
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch
@@ -0,0 +1,282 @@
1From fe0fcaf43ef3aab81541dad2a71b46254dc4cf6a Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 10:03:48 -0800
4Subject: [PATCH] cmd/dist: separate host and target builds
5
6Change the dist tool to allow for OE-style cross-
7and cross-canadian builds:
8
9 - command flags --host-only and --target only are added;
10 if one is present, the other changes mentioned below
11 take effect, and arguments may also be specified on
12 the command line to enumerate the package(s) to be
13 built.
14
15 - for OE cross builds, go_bootstrap is always built for
16 the current build host, and is moved, along with the supporting
17 toolchain (asm, compile, etc.) to a separate 'native_native'
18 directory under GOROOT/pkg/tool.
19
20 - go_bootstrap is not automatically removed after the build,
21 so it can be reused later (e.g., building both static and
22 shared runtime).
23
24Note that for --host-only builds, it would be nice to specify
25just the "cmd" package to build only the go commands/tools,
26the staleness checks in the dist tool will fail if the "std"
27library has not also been built. So host-only builds have to
28build everything anyway.
29
30Upstream-Status: Inappropriate [OE specific]
31
32Signed-off-by: Matt Madison <matt@madison.systems>
33
34more dist cleanup
35
36---
37 src/cmd/dist/build.go | 153 ++++++++++++++++++++++++++++++------------
38 1 file changed, 111 insertions(+), 42 deletions(-)
39
40Index: go/src/cmd/dist/build.go
41===================================================================
42--- go.orig/src/cmd/dist/build.go
43+++ go/src/cmd/dist/build.go
44@@ -39,6 +39,7 @@ var (
45 goldflags string
46 workdir string
47 tooldir string
48+ build_tooldir string
49 oldgoos string
50 oldgoarch string
51 exe string
52@@ -50,6 +51,7 @@ var (
53
54 rebuildall bool
55 defaultclang bool
56+ crossBuild bool
57
58 vflag int // verbosity
59 )
60@@ -231,6 +233,8 @@ func xinit() {
61 if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
62 tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
63 }
64+ build_tooldir = pathf("%s/pkg/tool/native_native", goroot)
65+
66 }
67
68 // compilerEnv returns a map from "goos/goarch" to the
69@@ -260,7 +264,6 @@ func compilerEnv(envName, def string) ma
70 if gohostos != goos || gohostarch != goarch {
71 m[gohostos+"/"+gohostarch] = m[""]
72 }
73- m[""] = env
74 }
75
76 for _, goos := range okgoos {
77@@ -487,8 +490,10 @@ func setup() {
78 // We keep it in pkg/, just like the object directory above.
79 if rebuildall {
80 xremoveall(tooldir)
81+ xremoveall(build_tooldir)
82 }
83 xmkdirall(tooldir)
84+ xmkdirall(build_tooldir)
85
86 // Remove tool binaries from before the tool/gohostos_gohostarch
87 xremoveall(pathf("%s/bin/tool", goroot))
88@@ -1155,11 +1160,29 @@ func cmdbootstrap() {
89
90 var noBanner bool
91 var debug bool
92+ var hostOnly bool
93+ var targetOnly bool
94+ var toBuild = []string { "std", "cmd" }
95+
96 flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
97 flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
98 flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
99+ flag.BoolVar(&hostOnly, "host-only", hostOnly, "build only host binaries, not target")
100+ flag.BoolVar(&targetOnly, "target-only", targetOnly, "build only target binaries, not host")
101
102- xflagparse(0)
103+ xflagparse(-1)
104+
105+ if (hostOnly && targetOnly) {
106+ fatalf("specify only one of --host-only or --target-only\n")
107+ }
108+ crossBuild = hostOnly || targetOnly
109+ if flag.NArg() > 0 {
110+ if crossBuild {
111+ toBuild = flag.Args()
112+ } else {
113+ fatalf("package names not permitted without --host-only or --target-only\n")
114+ }
115+ }
116
117 if debug {
118 // cmd/buildid is used in debug mode.
119@@ -1207,8 +1230,13 @@ func cmdbootstrap() {
120 xprintf("\n")
121 }
122
123- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
124- goldflags = os.Getenv("GO_LDFLAGS")
125+ // For split host/target cross/cross-canadian builds, we don't
126+ // want to be setting these flags until after we have compiled
127+ // the toolchain that runs on the build host.
128+ if ! crossBuild {
129+ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
130+ goldflags = os.Getenv("GO_LDFLAGS")
131+ }
132 goBootstrap := pathf("%s/go_bootstrap", tooldir)
133 cmdGo := pathf("%s/go", gobin)
134 if debug {
135@@ -1237,7 +1265,11 @@ func cmdbootstrap() {
136 xprintf("\n")
137 }
138 xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
139- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
140+ if crossBuild {
141+ os.Setenv("CC", defaultcc[""])
142+ } else {
143+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
144+ }
145 goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
146 if debug {
147 run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
148@@ -1274,50 +1306,84 @@ func cmdbootstrap() {
149 }
150 checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
151
152- if goos == oldgoos && goarch == oldgoarch {
153- // Common case - not setting up for cross-compilation.
154- timelog("build", "toolchain")
155- if vflag > 0 {
156- xprintf("\n")
157+ if crossBuild {
158+ gogcflags = os.Getenv("GO_GCFLAGS")
159+ goldflags = os.Getenv("GO_LDFLAGS")
160+ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir))
161+ for _, f := range tool_files {
162+ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec)
163+ xremove(f)
164+ }
165+ os.Setenv("GOTOOLDIR", build_tooldir)
166+ goBootstrap = pathf("%s/go_bootstrap", build_tooldir)
167+ if hostOnly {
168+ timelog("build", "host toolchain")
169+ if vflag > 0 {
170+ xprintf("\n")
171+ }
172+ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
173+ goInstall(goBootstrap, toBuild...)
174+ checkNotStale(goBootstrap, toBuild...)
175+ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary
176+
177+ timelog("build", "target toolchain")
178+ if vflag > 0 {
179+ xprintf("\n")
180+ }
181+ } else if targetOnly {
182+ goos = oldgoos
183+ goarch = oldgoarch
184+ os.Setenv("GOOS", goos)
185+ os.Setenv("GOARCH", goarch)
186+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
187+ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
188+ goInstall(goBootstrap, toBuild...)
189+ checkNotStale(goBootstrap, toBuild...)
190+ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary
191 }
192- xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
193 } else {
194- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
195- // Finish GOHOSTOS/GOHOSTARCH installation and then
196- // run GOOS/GOARCH installation.
197- timelog("build", "host toolchain")
198- if vflag > 0 {
199- xprintf("\n")
200+
201+ if goos == oldgoos && goarch == oldgoarch {
202+ // Common case - not setting up for cross-compilation.
203+ timelog("build", "toolchain")
204+ if vflag > 0 {
205+ xprintf("\n")
206+ }
207+ xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
208+ } else {
209+ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
210+ // Finish GOHOSTOS/GOHOSTARCH installation and then
211+ // run GOOS/GOARCH installation.
212+ timelog("build", "host toolchain")
213+ if vflag > 0 {
214+ xprintf("\n")
215+ }
216+ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
217+ goInstall(goBootstrap, "std", "cmd")
218+ checkNotStale(goBootstrap, "std", "cmd")
219+ checkNotStale(cmdGo, "std", "cmd")
220+
221+ timelog("build", "target toolchain")
222+ if vflag > 0 {
223+ xprintf("\n")
224+ }
225+ goos = oldgoos
226+ goarch = oldgoarch
227+ os.Setenv("GOOS", goos)
228+ os.Setenv("GOARCH", goarch)
229+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
230+ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
231 }
232- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
233 goInstall(goBootstrap, "std", "cmd")
234 checkNotStale(goBootstrap, "std", "cmd")
235 checkNotStale(cmdGo, "std", "cmd")
236
237- timelog("build", "target toolchain")
238- if vflag > 0 {
239- xprintf("\n")
240- }
241- goos = oldgoos
242- goarch = oldgoarch
243- os.Setenv("GOOS", goos)
244- os.Setenv("GOARCH", goarch)
245- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
246- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
247- }
248- targets := []string{"std", "cmd"}
249- if goos == "js" && goarch == "wasm" {
250- // Skip the cmd tools for js/wasm. They're not usable.
251- targets = targets[:1]
252- }
253- goInstall(goBootstrap, targets...)
254- checkNotStale(goBootstrap, targets...)
255- checkNotStale(cmdGo, targets...)
256- if debug {
257- run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
258- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
259- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
260- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
261+ if debug {
262+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
263+ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
264+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
265+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
266+ }
267 }
268
269 // Check that there are no new files in $GOROOT/bin other than
270@@ -1335,7 +1401,11 @@ func cmdbootstrap() {
271 }
272
273 // Remove go_bootstrap now that we're done.
274- xremove(pathf("%s/go_bootstrap", tooldir))
275+ // Except that for split host/target cross-builds, we need to
276+ // keep it.
277+ if ! crossBuild {
278+ xremove(pathf("%s/go_bootstrap", tooldir))
279+ }
280
281 // Print trailing banner unless instructed otherwise.
282 if !noBanner {
diff --git a/meta/recipes-devtools/go/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
new file mode 100644
index 0000000000..29ef947abd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
@@ -0,0 +1,106 @@
1From 7cc60b3887be2d5674b9f5d422d022976cf205e5 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Fri, 2 Mar 2018 06:00:20 -0800
4Subject: [PATCH] cmd/go: make GOROOT precious by default
5
6The go build tool normally rebuilds whatever it detects is
7stale. This can be a problem when GOROOT is intended to
8be read-only and the go runtime has been built as a shared
9library, since we don't want every application to be rebuilding
10the shared runtime - particularly in cross-build/packaging
11setups, since that would lead to 'abi mismatch' runtime errors.
12
13This patch prevents the install and linkshared actions from
14installing to GOROOT unless overridden with the GOROOT_OVERRIDE
15environment variable.
16
17Upstream-Status: Inappropriate [OE specific]
18
19Signed-off-by: Matt Madison <matt@madison.systems>
20
21---
22 src/cmd/go/internal/work/action.go | 3 +++
23 src/cmd/go/internal/work/build.go | 5 +++++
24 src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++
25 3 files changed, 33 insertions(+)
26
27Index: go/src/cmd/go/internal/work/action.go
28===================================================================
29--- go.orig/src/cmd/go/internal/work/action.go
30+++ go/src/cmd/go/internal/work/action.go
31@@ -600,6 +600,9 @@ func (b *Builder) addTransitiveLinkDeps(
32 if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
33 continue
34 }
35+ if goRootPrecious && (p1.Standard || p1.Goroot) {
36+ continue
37+ }
38 haveShlib[filepath.Base(p1.Shlib)] = true
39 // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild,
40 // we'll end up building an overall library or executable that depends at runtime
41Index: go/src/cmd/go/internal/work/build.go
42===================================================================
43--- go.orig/src/cmd/go/internal/work/build.go
44+++ go/src/cmd/go/internal/work/build.go
45@@ -147,6 +147,7 @@ See also: go install, go get, go clean.
46 }
47
48 const concurrentGCBackendCompilationEnabledByDefault = true
49+var goRootPrecious bool = true
50
51 func init() {
52 // break init cycle
53@@ -160,6 +161,10 @@ func init() {
54
55 AddBuildFlags(CmdBuild)
56 AddBuildFlags(CmdInstall)
57+
58+ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" {
59+ goRootPrecious = false
60+ }
61 }
62
63 // Note that flags consulted by other parts of the code
64Index: go/src/cmd/go/internal/work/exec.go
65===================================================================
66--- go.orig/src/cmd/go/internal/work/exec.go
67+++ go/src/cmd/go/internal/work/exec.go
68@@ -436,6 +436,23 @@ func (b *Builder) build(a *Action) (err
69 return fmt.Errorf("missing or invalid binary-only package; expected file %q", a.Package.Target)
70 }
71
72+ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) {
73+ _, err := os.Stat(a.Package.Target)
74+ if err == nil {
75+ a.built = a.Package.Target
76+ a.Target = a.Package.Target
77+ a.buildID = b.fileHash(a.Package.Target)
78+ a.Package.Stale = false
79+ a.Package.StaleReason = "GOROOT-resident package"
80+ return nil
81+ }
82+ a.Package.Stale = true
83+ a.Package.StaleReason = "missing or invalid GOROOT-resident package"
84+ if b.IsCmdList {
85+ return nil
86+ }
87+ }
88+
89 if err := b.Mkdir(a.Objdir); err != nil {
90 return err
91 }
92@@ -1438,6 +1455,14 @@ func BuildInstallFunc(b *Builder, a *Act
93 return nil
94 }
95
96+ if goRootPrecious && a.Package != nil {
97+ p := a.Package
98+ if p.Standard || p.Goroot {
99+ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath)
100+ return err
101+ }
102+ }
103+
104 if err := b.Mkdir(a.Objdir); err != nil {
105 return err
106 }
diff --git a/meta/recipes-devtools/go/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch
new file mode 100644
index 0000000000..225cf439c5
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch
@@ -0,0 +1,37 @@
1From 0e0c247f0caec23528889ff09d98348cba9028f1 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 26 Oct 2018 15:02:32 +0800
4Subject: [PATCH] use GOBUILDMODE to set buildmode
5
6While building go itself, the go build system does not support
7to set `-buildmode=pie' from environment.
8
9Add GOBUILDMODE to support it which make PIE executables the default
10build mode, as PIE executables are required as of Yocto
11
12Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI
13Upstream-Status: Denied [upstream choose antoher solution: `17a256b
14cmd/go: -buildmode=pie for android/arm']
15
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17---
18 src/cmd/go/internal/work/build.go | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21Index: go/src/cmd/go/internal/work/build.go
22===================================================================
23--- go.orig/src/cmd/go/internal/work/build.go
24+++ go/src/cmd/go/internal/work/build.go
25@@ -223,7 +223,11 @@ func AddBuildFlags(cmd *base.Command) {
26
27 cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
28 cmd.Flag.Var(buildCompiler{}, "compiler", "")
29- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
30+ if bm := os.Getenv("GOBUILDMODE"); bm != "" {
31+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "")
32+ } else {
33+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
34+ }
35 cmd.Flag.Var(&load.BuildGcflags, "gcflags", "")
36 cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "")
37 cmd.Flag.StringVar(&cfg.BuildMod, "mod", "", "")
diff --git a/meta/recipes-devtools/go/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch b/meta/recipes-devtools/go/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
new file mode 100644
index 0000000000..840cf4bbd7
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
@@ -0,0 +1,112 @@
1From 35ea4be34e94912b00837e0f7c7385f2e98fe769 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sun, 18 Feb 2018 08:24:05 -0800
4Subject: [PATCH] ld: replace glibc dynamic linker with musl
5
6Rework of patch by Khem Raj <raj.khem@gmail.com>
7for go 1.10. Should be applied conditionally on
8musl being the system C library.
9
10Upstream-Status: Inappropriate [Real fix should be portable across libcs]
11
12Signed-off-by: Matt Madison <matt@madison.systems>
13
14---
15 src/cmd/link/internal/amd64/obj.go | 2 +-
16 src/cmd/link/internal/arm/obj.go | 2 +-
17 src/cmd/link/internal/arm64/obj.go | 2 +-
18 src/cmd/link/internal/mips/obj.go | 2 +-
19 src/cmd/link/internal/mips64/obj.go | 2 +-
20 src/cmd/link/internal/ppc64/obj.go | 2 +-
21 src/cmd/link/internal/s390x/obj.go | 2 +-
22 src/cmd/link/internal/x86/obj.go | 2 +-
23 8 files changed, 8 insertions(+), 8 deletions(-)
24
25--- a/src/cmd/link/internal/amd64/obj.go
26+++ b/src/cmd/link/internal/amd64/obj.go
27@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
28 PEreloc1: pereloc1,
29 TLSIEtoLE: tlsIEtoLE,
30
31- Linuxdynld: "/lib64/ld-linux-x86-64.so.2",
32+ Linuxdynld: "/lib64/ld-musl-x86-64.so.1",
33 Freebsddynld: "/libexec/ld-elf.so.1",
34 Openbsddynld: "/usr/libexec/ld.so",
35 Netbsddynld: "/libexec/ld.elf_so",
36--- a/src/cmd/link/internal/arm/obj.go
37+++ b/src/cmd/link/internal/arm/obj.go
38@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
39 Machoreloc1: machoreloc1,
40 PEreloc1: pereloc1,
41
42- Linuxdynld: "/lib/ld-linux.so.3", // 2 for OABI, 3 for EABI
43+ Linuxdynld: "/lib/ld-musl-armhf.so.1",
44 Freebsddynld: "/usr/libexec/ld-elf.so.1",
45 Openbsddynld: "/usr/libexec/ld.so",
46 Netbsddynld: "/libexec/ld.elf_so",
47--- a/src/cmd/link/internal/arm64/obj.go
48+++ b/src/cmd/link/internal/arm64/obj.go
49@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
50 Gentext: gentext,
51 Machoreloc1: machoreloc1,
52
53- Linuxdynld: "/lib/ld-linux-aarch64.so.1",
54+ Linuxdynld: "/lib/ld-musl-aarch64.so.1",
55
56 Freebsddynld: "XXX",
57 Openbsddynld: "XXX",
58--- a/src/cmd/link/internal/mips/obj.go
59+++ b/src/cmd/link/internal/mips/obj.go
60@@ -60,7 +60,7 @@ func Init() (*sys.Arch, ld.Arch) {
61 Gentext: gentext,
62 Machoreloc1: machoreloc1,
63
64- Linuxdynld: "/lib/ld.so.1",
65+ Linuxdynld: "/lib/ld-musl-mipsle.so.1",
66
67 Freebsddynld: "XXX",
68 Openbsddynld: "XXX",
69--- a/src/cmd/link/internal/mips64/obj.go
70+++ b/src/cmd/link/internal/mips64/obj.go
71@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
72 Gentext: gentext,
73 Machoreloc1: machoreloc1,
74
75- Linuxdynld: "/lib64/ld64.so.1",
76+ Linuxdynld: "/lib64/ld-musl-mips64le.so.1",
77 Freebsddynld: "XXX",
78 Openbsddynld: "XXX",
79 Netbsddynld: "XXX",
80--- a/src/cmd/link/internal/ppc64/obj.go
81+++ b/src/cmd/link/internal/ppc64/obj.go
82@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
83 Machoreloc1: machoreloc1,
84
85 // TODO(austin): ABI v1 uses /usr/lib/ld.so.1,
86- Linuxdynld: "/lib64/ld64.so.1",
87+ Linuxdynld: "/lib64/ld-musl-powerpc64le.so.1",
88
89 Freebsddynld: "XXX",
90 Openbsddynld: "XXX",
91--- a/src/cmd/link/internal/s390x/obj.go
92+++ b/src/cmd/link/internal/s390x/obj.go
93@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
94 Gentext: gentext,
95 Machoreloc1: machoreloc1,
96
97- Linuxdynld: "/lib64/ld64.so.1",
98+ Linuxdynld: "/lib64/ld-musl-s390x.so.1",
99
100 // not relevant for s390x
101 Freebsddynld: "XXX",
102--- a/src/cmd/link/internal/x86/obj.go
103+++ b/src/cmd/link/internal/x86/obj.go
104@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
105 Machoreloc1: machoreloc1,
106 PEreloc1: pereloc1,
107
108- Linuxdynld: "/lib/ld-linux.so.2",
109+ Linuxdynld: "/lib/ld-musl-i386.so.1",
110 Freebsddynld: "/usr/libexec/ld-elf.so.1",
111 Openbsddynld: "/usr/libexec/ld.so",
112 Netbsddynld: "/usr/libexec/ld.elf_so",
diff --git a/meta/recipes-devtools/go/go-common.inc b/meta/recipes-devtools/go/go-common.inc
index 11d55c4d36..93a3d3b5fb 100644
--- a/meta/recipes-devtools/go/go-common.inc
+++ b/meta/recipes-devtools/go/go-common.inc
@@ -25,7 +25,6 @@ SSTATE_SCAN_CMD = "true"
25export GOROOT_OVERRIDE = "1" 25export GOROOT_OVERRIDE = "1"
26export GOTMPDIR ?= "${WORKDIR}/go-tmp" 26export GOTMPDIR ?= "${WORKDIR}/go-tmp"
27GOTMPDIR[vardepvalue] = "" 27GOTMPDIR[vardepvalue] = ""
28export GOCACHE = "off"
29export CGO_ENABLED = "1" 28export CGO_ENABLED = "1"
30 29
31do_compile_prepend() { 30do_compile_prepend() {
diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.12.bb b/meta/recipes-devtools/go/go-cross-canadian_1.12.bb
new file mode 100644
index 0000000000..7ac9449e47
--- /dev/null
+++ b/meta/recipes-devtools/go/go-cross-canadian_1.12.bb
@@ -0,0 +1,2 @@
1require go-cross-canadian.inc
2require go-${PV}.inc
diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc
index 6d9aa5c2dd..29ce7f6e84 100644
--- a/meta/recipes-devtools/go/go-cross.inc
+++ b/meta/recipes-devtools/go/go-cross.inc
@@ -14,7 +14,6 @@ export GO386 = "${TARGET_GO386}"
14export GOMIPS = "${TARGET_GOMIPS}" 14export GOMIPS = "${TARGET_GOMIPS}"
15export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" 15export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
16export GOROOT_FINAL = "${libdir}/go" 16export GOROOT_FINAL = "${libdir}/go"
17export GOCACHE = "off"
18CC = "${@d.getVar('BUILD_CC').strip()}" 17CC = "${@d.getVar('BUILD_CC').strip()}"
19 18
20do_configure[noexec] = "1" 19do_configure[noexec] = "1"
diff --git a/meta/recipes-devtools/go/go-cross_1.12.bb b/meta/recipes-devtools/go/go-cross_1.12.bb
new file mode 100644
index 0000000000..80b5a03f6c
--- /dev/null
+++ b/meta/recipes-devtools/go/go-cross_1.12.bb
@@ -0,0 +1,2 @@
1require go-cross.inc
2require go-${PV}.inc
diff --git a/meta/recipes-devtools/go/go-crosssdk_1.12.bb b/meta/recipes-devtools/go/go-crosssdk_1.12.bb
new file mode 100644
index 0000000000..1857c8a577
--- /dev/null
+++ b/meta/recipes-devtools/go/go-crosssdk_1.12.bb
@@ -0,0 +1,2 @@
1require go-crosssdk.inc
2require go-${PV}.inc
diff --git a/meta/recipes-devtools/go/go-native_1.12.bb b/meta/recipes-devtools/go/go-native_1.12.bb
new file mode 100644
index 0000000000..bbf3c0dd73
--- /dev/null
+++ b/meta/recipes-devtools/go/go-native_1.12.bb
@@ -0,0 +1,2 @@
1require ${PN}.inc
2require go-${PV}.inc
diff --git a/meta/recipes-devtools/go/go-runtime_1.12.bb b/meta/recipes-devtools/go/go-runtime_1.12.bb
new file mode 100644
index 0000000000..43b68b4e46
--- /dev/null
+++ b/meta/recipes-devtools/go/go-runtime_1.12.bb
@@ -0,0 +1,2 @@
1require go-${PV}.inc
2require go-runtime.inc
diff --git a/meta/recipes-devtools/go/go_1.12.bb b/meta/recipes-devtools/go/go_1.12.bb
new file mode 100644
index 0000000000..42cdb0430a
--- /dev/null
+++ b/meta/recipes-devtools/go/go_1.12.bb
@@ -0,0 +1,14 @@
1require go-${PV}.inc
2require go-target.inc
3
4export GOBUILDMODE=""
5
6# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips
7# doesn't support -buildmode=pie, so skip the QA checking for mips and its
8# variants.
9python() {
10 if 'mips' in d.getVar('TARGET_ARCH'):
11 d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
12 else:
13 d.setVar('GOBUILDMODE', 'pie')
14}