summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlex Kube <alexander.j.kube@gmail.com>2019-10-25 18:28:26 +0430
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-14 13:20:59 +0000
commit2fca8ce3a8c241293ba5df8fe4f6c2bbafa67eea (patch)
treed615a6a70cb21636370ed281861aadc2af98b040 /meta
parentd71fb563c182f241511fe968405375fdac93611f (diff)
downloadpoky-2fca8ce3a8c241293ba5df8fe4f6c2bbafa67eea.tar.gz
go: Refactor patches for 1.13.3
(From OE-Core rev: 607adb5490456d4d3457b54f1cf2a38824f1b8b7) Signed-off-by: Alex Kube <alexander.j.kube@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/go/go-1.13/0001-allow-CC-and-CXX-to-have-multiple-words.patch38
-rw-r--r--meta/recipes-devtools/go/go-1.13/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch226
-rw-r--r--meta/recipes-devtools/go/go-1.13/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch54
-rw-r--r--meta/recipes-devtools/go/go-1.13/0004-ld-add-soname-to-shareable-objects.patch50
-rw-r--r--meta/recipes-devtools/go/go-1.13/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch44
-rw-r--r--meta/recipes-devtools/go/go-1.13/0006-cmd-dist-separate-host-and-target-builds.patch279
-rw-r--r--meta/recipes-devtools/go/go-1.13/0007-cmd-go-make-GOROOT-precious-by-default.patch113
-rw-r--r--meta/recipes-devtools/go/go-1.13/0008-use-GOBUILDMODE-to-set-buildmode.patch47
-rw-r--r--meta/recipes-devtools/go/go-1.13/0009-ld-replace-glibc-dynamic-linker-with-musl.patch134
9 files changed, 985 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.13/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/meta/recipes-devtools/go/go-1.13/0001-allow-CC-and-CXX-to-have-multiple-words.patch
new file mode 100644
index 0000000000..ddfd5e41d1
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0001-allow-CC-and-CXX-to-have-multiple-words.patch
@@ -0,0 +1,38 @@
1From 9e3dc44cdfa58d96504d0a789dc82617dd5bef55 Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:01:13 +0430
4Subject: [PATCH 1/9] cmd/go: Allow CC and CXX to have multiple words
5
6Upstream-Status: Inappropriate [OE specific]
7
8Adapted to Go 1.13 from patches originally submitted to
9the meta/recipes-devtools/go tree by
10Matt Madison <matt@madison.systems>.
11
12Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
13
14---
15 src/cmd/go/internal/envcmd/env.go | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
19index 17852de..7b5ec5e 100644
20--- a/src/cmd/go/internal/envcmd/env.go
21+++ b/src/cmd/go/internal/envcmd/env.go
22@@ -100,11 +100,11 @@ func MkEnv() []cfg.EnvVar {
23
24 cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
25 if env := strings.Fields(cfg.Getenv("CC")); len(env) > 0 {
26- cc = env[0]
27+ cc = strings.Join(env, " ")
28 }
29 cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch)
30 if env := strings.Fields(cfg.Getenv("CXX")); len(env) > 0 {
31- cxx = env[0]
32+ cxx = strings.Join(env, " ")
33 }
34 env = append(env, cfg.EnvVar{Name: "AR", Value: envOr("AR", "ar")})
35 env = append(env, cfg.EnvVar{Name: "CC", Value: cc})
36--
372.17.1 (Apple Git-112)
38
diff --git a/meta/recipes-devtools/go/go-1.13/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/meta/recipes-devtools/go/go-1.13/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
new file mode 100644
index 0000000000..4eddd39809
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
@@ -0,0 +1,226 @@
1From a13ae484e41139094505d2834437e9262a5315f7 Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:14:22 +0430
4Subject: [PATCH 2/9] cmd/go: make content-based hash generation less pedantic
5
6Upstream-Status: Inappropriate [OE specific]
7
8Go 1.10's build tool now uses content-based hashes to
9determine when something should be built or re-built.
10This same mechanism is used to maintain a built-artifact
11cache for speeding up builds.
12
13However, the hashes it generates include information that
14doesn't work well with OE, nor with using a shared runtime
15library.
16
17First, it embeds path names to source files, unless
18building within GOROOT. This prevents the building
19of a package in GOPATH for later staging into GOROOT.
20
21This patch adds support for the environment variable
22GOPATH_OMIT_IN_ACTIONID. If present, path name
23embedding is disabled.
24
25Second, if cgo is enabled, the build ID for cgo-related
26packages will include the current value of the environment
27variables for invoking the compiler (CC, CXX, FC) and
28any CGO_xxFLAGS variables. Only if the settings used
29during a compilation exactly match, character for character,
30the values used for compiling runtime/cgo or any other
31cgo-enabled package being imported, will the tool
32decide that the imported package is up-to-date.
33
34This is done to help ensure correctness, but is overly
35simplistic and effectively prevents the reuse of built
36artifacts that use cgo (or shared runtime, which includes
37runtime/cgo).
38
39This patch filters out all compiler flags except those
40beginning with '-m'. The default behavior can be restored
41by setting the CGO_PEDANTIC environment variable.
42
43Adapted to Go 1.13 from patches originally submitted to
44the meta/recipes-devtools/go tree by
45Matt Madison <matt@madison.systems>.
46
47Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
48---
49 src/cmd/go/internal/envcmd/env.go | 2 +-
50 src/cmd/go/internal/work/exec.go | 66 ++++++++++++++++++++++---------
51 2 files changed, 49 insertions(+), 19 deletions(-)
52
53diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
54index 7b5ec5e..292f117 100644
55--- a/src/cmd/go/internal/envcmd/env.go
56+++ b/src/cmd/go/internal/envcmd/env.go
57@@ -154,7 +154,7 @@ func ExtraEnvVars() []cfg.EnvVar {
58 func ExtraEnvVarsCostly() []cfg.EnvVar {
59 var b work.Builder
60 b.Init()
61- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{})
62+ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false)
63 if err != nil {
64 // Should not happen - b.CFlags was given an empty package.
65 fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err)
66diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
67index 7dd9a90..ccebaf8 100644
68--- a/src/cmd/go/internal/work/exec.go
69+++ b/src/cmd/go/internal/work/exec.go
70@@ -32,6 +32,8 @@ import (
71 "time"
72 )
73
74+var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != ""
75+
76 // actionList returns the list of actions in the dag rooted at root
77 // as visited in a depth-first post-order traversal.
78 func actionList(root *Action) []*Action {
79@@ -205,7 +207,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
80 // The compiler hides the exact value of $GOROOT
81 // when building things in GOROOT.
82 // Assume b.WorkDir is being trimmed properly.
83- if !p.Goroot && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) {
84+ if !p.Goroot && !omitGopath && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) {
85 fmt.Fprintf(h, "dir %s\n", p.Dir)
86 }
87 fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
88@@ -219,13 +221,13 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
89 }
90 if len(p.CgoFiles)+len(p.SwigFiles) > 0 {
91 fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
92- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
93- fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(), cppflags, cflags, ldflags)
94+ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
95+ fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(true), cppflags, cflags, ldflags)
96 if len(p.CXXFiles)+len(p.SwigFiles) > 0 {
97- fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(), cxxflags)
98+ fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(true), cxxflags)
99 }
100 if len(p.FFiles) > 0 {
101- fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(), fflags)
102+ fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(true), fflags)
103 }
104 // TODO(rsc): Should we include the SWIG version or Fortran/GCC/G++/Objective-C compiler versions?
105 }
106@@ -2229,33 +2231,48 @@ var (
107 // gccCmd returns a gcc command line prefix
108 // defaultCC is defined in zdefaultcc.go, written by cmd/dist.
109 func (b *Builder) GccCmd(incdir, workdir string) []string {
110- return b.compilerCmd(b.ccExe(), incdir, workdir)
111+ return b.compilerCmd(b.ccExe(false), incdir, workdir)
112 }
113
114 // gxxCmd returns a g++ command line prefix
115 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
116 func (b *Builder) GxxCmd(incdir, workdir string) []string {
117- return b.compilerCmd(b.cxxExe(), incdir, workdir)
118+ return b.compilerCmd(b.cxxExe(false), incdir, workdir)
119 }
120
121 // gfortranCmd returns a gfortran command line prefix.
122 func (b *Builder) gfortranCmd(incdir, workdir string) []string {
123- return b.compilerCmd(b.fcExe(), incdir, workdir)
124+ return b.compilerCmd(b.fcExe(false), incdir, workdir)
125 }
126
127 // ccExe returns the CC compiler setting without all the extra flags we add implicitly.
128-func (b *Builder) ccExe() []string {
129- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch))
130+func (b *Builder) ccExe(filtered bool) []string {
131+ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered)
132 }
133
134 // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly.
135-func (b *Builder) cxxExe() []string {
136- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch))
137+func (b *Builder) cxxExe(filtered bool) []string {
138+ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered)
139 }
140
141 // fcExe returns the FC compiler setting without all the extra flags we add implicitly.
142-func (b *Builder) fcExe() []string {
143- return b.compilerExe(cfg.Getenv("FC"), "gfortran")
144+func (b *Builder) fcExe(filtered bool) []string {
145+ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered)
146+}
147+
148+var filterFlags = os.Getenv("CGO_PEDANTIC") == ""
149+
150+func filterCompilerFlags(flags []string) []string {
151+ var newflags []string
152+ if !filterFlags {
153+ return flags
154+ }
155+ for _, flag := range flags {
156+ if strings.HasPrefix(flag, "-m") {
157+ newflags = append(newflags, flag)
158+ }
159+ }
160+ return newflags
161 }
162
163 // compilerExe returns the compiler to use given an
164@@ -2264,11 +2281,16 @@ func (b *Builder) fcExe() []string {
165 // of the compiler but can have additional arguments if they
166 // were present in the environment value.
167 // For example if CC="gcc -DGOPHER" then the result is ["gcc", "-DGOPHER"].
168-func (b *Builder) compilerExe(envValue string, def string) []string {
169+func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string {
170 compiler := strings.Fields(envValue)
171 if len(compiler) == 0 {
172 compiler = []string{def}
173 }
174+
175+ if filtered {
176+ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...)
177+ }
178+
179 return compiler
180 }
181
182@@ -2429,7 +2451,7 @@ func envList(key, def string) []string {
183 }
184
185 // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
186-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
187+func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
188 defaults := "-g -O2"
189
190 if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
191@@ -2448,6 +2470,14 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l
192 return
193 }
194
195+ if filtered {
196+ cppflags = filterCompilerFlags(cppflags)
197+ cflags = filterCompilerFlags(cflags)
198+ cxxflags = filterCompilerFlags(cxxflags)
199+ fflags = filterCompilerFlags(fflags)
200+ ldflags = filterCompilerFlags(ldflags)
201+ }
202+
203 return
204 }
205
206@@ -2462,7 +2492,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`)
207
208 func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
209 p := a.Package
210- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p)
211+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false)
212 if err != nil {
213 return nil, nil, err
214 }
215@@ -2821,7 +2851,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) {
216
217 // Run SWIG on one SWIG input file.
218 func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
219- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p)
220+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false)
221 if err != nil {
222 return "", "", err
223 }
224--
2252.17.1 (Apple Git-112)
226
diff --git a/meta/recipes-devtools/go/go-1.13/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/meta/recipes-devtools/go/go-1.13/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
new file mode 100644
index 0000000000..9aa0119ae9
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
@@ -0,0 +1,54 @@
1From 28ada8896b76d620240bafc22aa395071d601482 Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:15:37 +0430
4Subject: [PATCH 3/9] cmd/go: Allow GOTOOLDIR to be overridden in the environment
5
6to allow for split host/target build roots
7
8Adapted to Go 1.13 from patches originally submitted to
9the meta/recipes-devtools/go tree by
10Matt Madison <matt@madison.systems>.
11
12Upstream-Status: Inappropriate [OE specific]
13
14Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
15---
16 src/cmd/dist/build.go | 4 +++-
17 src/cmd/go/internal/cfg/cfg.go | 6 +++++-
18 2 files changed, 8 insertions(+), 2 deletions(-)
19
20diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
21index 9e50311..683ca6f 100644
22--- a/src/cmd/dist/build.go
23+++ b/src/cmd/dist/build.go
24@@ -244,7 +244,9 @@ func xinit() {
25 workdir = xworkdir()
26 xatexit(rmworkdir)
27
28- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
29+ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
30+ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
31+ }
32 }
33
34 // compilerEnv returns a map from "goos/goarch" to the
35diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
36index a3277a6..db96350 100644
37--- a/src/cmd/go/internal/cfg/cfg.go
38+++ b/src/cmd/go/internal/cfg/cfg.go
39@@ -60,7 +60,11 @@ func defaultContext() build.Context {
40 // variables. This matches the initialization of ToolDir in
41 // go/build, except for using ctxt.GOROOT rather than
42 // runtime.GOROOT.
43- build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
44+ if s := os.Getenv("GOTOOLDIR"); s != "" {
45+ build.ToolDir = filepath.Clean(s)
46+ } else {
47+ build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
48+ }
49 }
50
51 ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH)
52--
532.17.1 (Apple Git-112)
54
diff --git a/meta/recipes-devtools/go/go-1.13/0004-ld-add-soname-to-shareable-objects.patch b/meta/recipes-devtools/go/go-1.13/0004-ld-add-soname-to-shareable-objects.patch
new file mode 100644
index 0000000000..40763ad5b1
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0004-ld-add-soname-to-shareable-objects.patch
@@ -0,0 +1,50 @@
1From bf5cf5301ae5914498454c87293d1df2e1d8489f Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:16:32 +0430
4Subject: [PATCH 4/9] ld: add soname to shareable objects
5
6so that OE's shared library dependency handling
7can find them.
8
9Adapted to Go 1.13 from patches originally submitted to
10the meta/recipes-devtools/go tree by
11Matt Madison <matt@madison.systems>.
12
13Upstream-Status: Inappropriate [OE specific]
14
15Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
16---
17 src/cmd/link/internal/ld/lib.go | 3 +++
18 1 file changed, 3 insertions(+)
19
20diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
21index 3fa258d..f96fb02 100644
22--- a/src/cmd/link/internal/ld/lib.go
23+++ b/src/cmd/link/internal/ld/lib.go
24@@ -1215,6 +1215,7 @@ func (ctxt *Link) hostlink() {
25 argv = append(argv, "-Wl,-z,relro")
26 }
27 argv = append(argv, "-shared")
28+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
29 if ctxt.HeadType != objabi.Hwindows {
30 // Pass -z nodelete to mark the shared library as
31 // non-closeable: a dlclose will do nothing.
32@@ -1226,6 +1227,7 @@ func (ctxt *Link) hostlink() {
33 argv = append(argv, "-Wl,-z,relro")
34 }
35 argv = append(argv, "-shared")
36+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
37 case BuildModePlugin:
38 if ctxt.HeadType == objabi.Hdarwin {
39 argv = append(argv, "-dynamiclib")
40@@ -1234,6 +1236,7 @@ func (ctxt *Link) hostlink() {
41 argv = append(argv, "-Wl,-z,relro")
42 }
43 argv = append(argv, "-shared")
44+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
45 }
46 }
47
48--
492.17.1 (Apple Git-112)
50
diff --git a/meta/recipes-devtools/go/go-1.13/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/meta/recipes-devtools/go/go-1.13/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
new file mode 100644
index 0000000000..4f2a46c6ce
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
@@ -0,0 +1,44 @@
1From f05ef3ded52b98537c10efd0b15cd9612471524d Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:17:16 +0430
4Subject: [PATCH 5/9] make.bash: override CC when building dist and
5 go_bootstrap
6
7for handling OE cross-canadian builds.
8
9Adapted to Go 1.13 from patches originally submitted to
10the meta/recipes-devtools/go tree by
11Matt Madison <matt@madison.systems>.
12
13Upstream-Status: Inappropriate [OE specific]
14
15Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
16---
17 src/make.bash | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/src/make.bash b/src/make.bash
21index 92d1481..0c2822f 100755
22--- a/src/make.bash
23+++ b/src/make.bash
24@@ -177,7 +177,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
25 exit 1
26 fi
27 rm -f cmd/dist/dist
28-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
29+CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
30
31 # -e doesn't propagate out of eval, so check success by hand.
32 eval $(./cmd/dist/dist env -p || echo FAIL=true)
33@@ -208,7 +208,7 @@ fi
34 # Run dist bootstrap to complete make.bash.
35 # Bootstrap installs a proper cmd/dist, built with the new toolchain.
36 # Throw ours, built with Go 1.4, away after bootstrap.
37-./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
38+CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
39 rm -f ./cmd/dist/dist
40
41 # DO NOT ADD ANY NEW CODE HERE.
42--
432.17.1 (Apple Git-112)
44
diff --git a/meta/recipes-devtools/go/go-1.13/0006-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go-1.13/0006-cmd-dist-separate-host-and-target-builds.patch
new file mode 100644
index 0000000000..354aaca3a1
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0006-cmd-dist-separate-host-and-target-builds.patch
@@ -0,0 +1,279 @@
1From 10735bb84df17ba657f76835f483cd8543a879c1 Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:18:12 +0430
4Subject: [PATCH 6/9] cmd/dist: separate host and target builds
5
6Upstream-Status: Inappropriate [OE specific]
7
8Change the dist tool to allow for OE-style cross-
9and cross-canadian builds:
10
11 - command flags --host-only and --target only are added;
12 if one is present, the other changes mentioned below
13 take effect, and arguments may also be specified on
14 the command line to enumerate the package(s) to be
15 built.
16
17 - for OE cross builds, go_bootstrap is always built for
18 the current build host, and is moved, along with the supporting
19 toolchain (asm, compile, etc.) to a separate 'native_native'
20 directory under GOROOT/pkg/tool.
21
22 - go_bootstrap is not automatically removed after the build,
23 so it can be reused later (e.g., building both static and
24 shared runtime).
25
26Note that for --host-only builds, it would be nice to specify
27just the "cmd" package to build only the go commands/tools,
28the staleness checks in the dist tool will fail if the "std"
29library has not also been built. So host-only builds have to
30build everything anyway.
31
32Adapted to Go 1.13 from patches originally submitted to
33the meta/recipes-devtools/go tree by
34Matt Madison <matt@madison.systems>.
35
36Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
37---
38 src/cmd/dist/build.go | 155 ++++++++++++++++++++++++++++++------------
39 1 file changed, 112 insertions(+), 43 deletions(-)
40
41diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
42index 683ca6f..0ad082b 100644
43--- a/src/cmd/dist/build.go
44+++ b/src/cmd/dist/build.go
45@@ -41,6 +41,7 @@ var (
46 goldflags string
47 workdir string
48 tooldir string
49+ build_tooldir string
50 oldgoos string
51 oldgoarch string
52 exe string
53@@ -53,6 +54,7 @@ var (
54
55 rebuildall bool
56 defaultclang bool
57+ crossBuild bool
58
59 vflag int // verbosity
60 )
61@@ -247,6 +249,8 @@ func xinit() {
62 if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
63 tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
64 }
65+
66+ build_tooldir = pathf("%s/pkg/tool/native_native", goroot)
67 }
68
69 // compilerEnv returns a map from "goos/goarch" to the
70@@ -478,8 +482,10 @@ func setup() {
71 p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch)
72 if rebuildall {
73 xremoveall(p)
74+ xremoveall(build_tooldir)
75 }
76 xmkdirall(p)
77+ xmkdirall(build_tooldir)
78
79 if goos != gohostos || goarch != gohostarch {
80 p := pathf("%s/pkg/%s_%s", goroot, goos, goarch)
81@@ -1207,12 +1213,29 @@ func cmdbootstrap() {
82
83 var noBanner bool
84 var debug bool
85+ var hostOnly bool
86+ var targetOnly bool
87+ var toBuild = []string{"std", "cmd"}
88+
89 flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
90 flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
91 flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
92+ flag.BoolVar(&hostOnly, "host-only", hostOnly, "build only host binaries, not target")
93+ flag.BoolVar(&targetOnly, "target-only", targetOnly, "build only target binaries, not host")
94
95- xflagparse(0)
96+ xflagparse(-1)
97
98+ if hostOnly && targetOnly {
99+ fatalf("specify only one of --host-only or --target-only\n")
100+ }
101+ crossBuild = hostOnly || targetOnly
102+ if flag.NArg() > 0 {
103+ if crossBuild {
104+ toBuild = flag.Args()
105+ } else {
106+ fatalf("package names not permitted without --host-only or --target-only\n")
107+ }
108+ }
109 // Set GOPATH to an internal directory. We shouldn't actually
110 // need to store files here, since the toolchain won't
111 // depend on modules outside of vendor directories, but if
112@@ -1266,8 +1289,13 @@ func cmdbootstrap() {
113 xprintf("\n")
114 }
115
116- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
117- goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
118+ // For split host/target cross/cross-canadian builds, we don't
119+ // want to be setting these flags until after we have compiled
120+ // the toolchain that runs on the build host.
121+ if !crossBuild {
122+ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
123+ goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
124+ }
125 goBootstrap := pathf("%s/go_bootstrap", tooldir)
126 cmdGo := pathf("%s/go", gobin)
127 if debug {
128@@ -1296,7 +1324,11 @@ func cmdbootstrap() {
129 xprintf("\n")
130 }
131 xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
132- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
133+ if crossBuild {
134+ os.Setenv("CC", defaultcc[""])
135+ } else {
136+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
137+ }
138 goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
139 if debug {
140 run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
141@@ -1333,50 +1365,84 @@ func cmdbootstrap() {
142 }
143 checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
144
145- if goos == oldgoos && goarch == oldgoarch {
146- // Common case - not setting up for cross-compilation.
147- timelog("build", "toolchain")
148- if vflag > 0 {
149- xprintf("\n")
150+ if crossBuild {
151+ gogcflags = os.Getenv("GO_GCFLAGS")
152+ goldflags = os.Getenv("GO_LDFLAGS")
153+ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir))
154+ for _, f := range tool_files {
155+ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec)
156+ xremove(f)
157+ }
158+ os.Setenv("GOTOOLDIR", build_tooldir)
159+ goBootstrap = pathf("%s/go_bootstrap", build_tooldir)
160+ if hostOnly {
161+ timelog("build", "host toolchain")
162+ if vflag > 0 {
163+ xprintf("\n")
164+ }
165+ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
166+ goInstall(goBootstrap, toBuild...)
167+ checkNotStale(goBootstrap, toBuild...)
168+ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary
169+
170+ timelog("build", "target toolchain")
171+ if vflag > 0 {
172+ xprintf("\n")
173+ }
174+ } else if targetOnly {
175+ goos = oldgoos
176+ goarch = oldgoarch
177+ os.Setenv("GOOS", goos)
178+ os.Setenv("GOARCH", goarch)
179+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
180+ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
181+ goInstall(goBootstrap, toBuild...)
182+ checkNotStale(goBootstrap, toBuild...)
183+ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary
184 }
185- xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
186 } else {
187- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
188- // Finish GOHOSTOS/GOHOSTARCH installation and then
189- // run GOOS/GOARCH installation.
190- timelog("build", "host toolchain")
191- if vflag > 0 {
192- xprintf("\n")
193- }
194- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
195+
196+ if goos == oldgoos && goarch == oldgoarch {
197+ // Common case - not setting up for cross-compilation.
198+ timelog("build", "toolchain")
199+ if vflag > 0 {
200+ xprintf("\n")
201+ }
202+ xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
203+ } else {
204+ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
205+ // Finish GOHOSTOS/GOHOSTARCH installation and then
206+ // run GOOS/GOARCH installation.
207+ timelog("build", "host toolchain")
208+ if vflag > 0 {
209+ xprintf("\n")
210+ }
211+ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
212+ goInstall(goBootstrap, "std", "cmd")
213+ checkNotStale(goBootstrap, "std", "cmd")
214+ checkNotStale(cmdGo, "std", "cmd")
215+
216+ timelog("build", "target toolchain")
217+ if vflag > 0 {
218+ xprintf("\n")
219+ }
220+ goos = oldgoos
221+ goarch = oldgoarch
222+ os.Setenv("GOOS", goos)
223+ os.Setenv("GOARCH", goarch)
224+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
225+ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
226+ }
227 goInstall(goBootstrap, "std", "cmd")
228 checkNotStale(goBootstrap, "std", "cmd")
229 checkNotStale(cmdGo, "std", "cmd")
230
231- timelog("build", "target toolchain")
232- if vflag > 0 {
233- xprintf("\n")
234+ if debug {
235+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
236+ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
237+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
238+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
239 }
240- goos = oldgoos
241- goarch = oldgoarch
242- os.Setenv("GOOS", goos)
243- os.Setenv("GOARCH", goarch)
244- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
245- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
246- }
247- targets := []string{"std", "cmd"}
248- if goos == "js" && goarch == "wasm" {
249- // Skip the cmd tools for js/wasm. They're not usable.
250- targets = targets[:1]
251- }
252- goInstall(goBootstrap, targets...)
253- checkNotStale(goBootstrap, targets...)
254- checkNotStale(cmdGo, targets...)
255- if debug {
256- run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
257- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
258- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
259- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
260 }
261
262 // Check that there are no new files in $GOROOT/bin other than
263@@ -1393,8 +1459,11 @@ func cmdbootstrap() {
264 }
265 }
266
267- // Remove go_bootstrap now that we're done.
268- xremove(pathf("%s/go_bootstrap", tooldir))
269+ // Except that for split host/target cross-builds, we need to
270+ // keep it.
271+ if !crossBuild {
272+ xremove(pathf("%s/go_bootstrap", tooldir))
273+ }
274
275 if goos == "android" {
276 // Make sure the exec wrapper will sync a fresh $GOROOT to the device.
277--
2782.17.1 (Apple Git-112)
279
diff --git a/meta/recipes-devtools/go/go-1.13/0007-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go-1.13/0007-cmd-go-make-GOROOT-precious-by-default.patch
new file mode 100644
index 0000000000..e232c79199
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0007-cmd-go-make-GOROOT-precious-by-default.patch
@@ -0,0 +1,113 @@
1From 9ba507e076c744f4d394418e4a849e68cd426a4a Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:18:56 +0430
4Subject: [PATCH 7/9] cmd/go: make GOROOT precious by default
5
6Upstream-Status: Inappropriate [OE specific]
7
8The go build tool normally rebuilds whatever it detects is
9stale. This can be a problem when GOROOT is intended to
10be read-only and the go runtime has been built as a shared
11library, since we don't want every application to be rebuilding
12the shared runtime - particularly in cross-build/packaging
13setups, since that would lead to 'abi mismatch' runtime errors.
14
15This patch prevents the install and linkshared actions from
16installing to GOROOT unless overridden with the GOROOT_OVERRIDE
17environment variable.
18
19Adapted to Go 1.13 from patches originally submitted to
20the meta/recipes-devtools/go tree by
21Matt Madison <matt@madison.systems>.
22
23Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
24---
25 src/cmd/go/internal/work/action.go | 3 +++
26 src/cmd/go/internal/work/build.go | 6 ++++++
27 src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++
28 3 files changed, 34 insertions(+)
29
30diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go
31index 33b7818..7617b4c 100644
32--- a/src/cmd/go/internal/work/action.go
33+++ b/src/cmd/go/internal/work/action.go
34@@ -662,6 +662,9 @@ func (b *Builder) addTransitiveLinkDeps(a, a1 *Action, shlib string) {
35 if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
36 continue
37 }
38+ if goRootPrecious && (p1.Standard || p1.Goroot) {
39+ continue
40+ }
41 haveShlib[filepath.Base(p1.Shlib)] = true
42 // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild,
43 // we'll end up building an overall library or executable that depends at runtime
44diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
45index 9305b2d..6560317 100644
46--- a/src/cmd/go/internal/work/build.go
47+++ b/src/cmd/go/internal/work/build.go
48@@ -155,6 +155,8 @@ See also: go install, go get, go clean.
49
50 const concurrentGCBackendCompilationEnabledByDefault = true
51
52+var goRootPrecious bool = true
53+
54 func init() {
55 // break init cycle
56 CmdBuild.Run = runBuild
57@@ -167,6 +169,10 @@ func init() {
58
59 AddBuildFlags(CmdBuild)
60 AddBuildFlags(CmdInstall)
61+
62+ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" {
63+ goRootPrecious = false
64+ }
65 }
66
67 // Note that flags consulted by other parts of the code
68diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
69index ccebaf8..59450d7 100644
70--- a/src/cmd/go/internal/work/exec.go
71+++ b/src/cmd/go/internal/work/exec.go
72@@ -455,6 +455,23 @@ func (b *Builder) build(a *Action) (err error) {
73 return errors.New("binary-only packages are no longer supported")
74 }
75
76+ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) {
77+ _, err := os.Stat(a.Package.Target)
78+ if err == nil {
79+ a.built = a.Package.Target
80+ a.Target = a.Package.Target
81+ a.buildID = b.fileHash(a.Package.Target)
82+ a.Package.Stale = false
83+ a.Package.StaleReason = "GOROOT-resident package"
84+ return nil
85+ }
86+ a.Package.Stale = true
87+ a.Package.StaleReason = "missing or invalid GOROOT-resident package"
88+ if b.IsCmdList {
89+ return nil
90+ }
91+ }
92+
93 if err := b.Mkdir(a.Objdir); err != nil {
94 return err
95 }
96@@ -1499,6 +1516,14 @@ func BuildInstallFunc(b *Builder, a *Action) (err error) {
97 return nil
98 }
99
100+ if goRootPrecious && a.Package != nil {
101+ p := a.Package
102+ if p.Standard || p.Goroot {
103+ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath)
104+ return err
105+ }
106+ }
107+
108 if err := b.Mkdir(a.Objdir); err != nil {
109 return err
110 }
111--
1122.17.1 (Apple Git-112)
113
diff --git a/meta/recipes-devtools/go/go-1.13/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.13/0008-use-GOBUILDMODE-to-set-buildmode.patch
new file mode 100644
index 0000000000..68e132f30a
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0008-use-GOBUILDMODE-to-set-buildmode.patch
@@ -0,0 +1,47 @@
1From 971b5626339ce0c4d57f9721c9a81af566c5a044 Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:19:26 +0430
4Subject: [PATCH 8/9] cmd/go: Use GOBUILDMODE to set buildmode
5
6Upstream-Status: Denied [upstream choose antoher solution: `17a256b
7cmd/go: -buildmode=pie for android/arm']
8
9While building go itself, the go build system does not support
10to set `-buildmode=pie' from environment.
11
12Add GOBUILDMODE to support it which make PIE executables the default
13build mode, as PIE executables are required as of Yocto
14
15Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI
16
17Adapted to Go 1.13 from patches originally submitted to
18the meta/recipes-devtools/go tree by
19Hongxu Jia <hongxu.jia@windriver.com>
20
21Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
22---
23 src/cmd/go/internal/work/build.go | 8 +++++++-
24 1 file changed, 7 insertions(+), 1 deletion(-)
25
26diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
27index 6560317..5f3a988 100644
28--- a/src/cmd/go/internal/work/build.go
29+++ b/src/cmd/go/internal/work/build.go
30@@ -231,7 +231,13 @@ func AddBuildFlags(cmd *base.Command) {
31
32 cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
33 cmd.Flag.Var(buildCompiler{}, "compiler", "")
34- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
35+
36+ if bm := os.Getenv("GOBUILDMODE"); bm != "" {
37+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "")
38+ } else {
39+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
40+ }
41+
42 cmd.Flag.Var(&load.BuildGcflags, "gcflags", "")
43 cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "")
44 cmd.Flag.StringVar(&cfg.BuildMod, "mod", "", "")
45--
462.17.1 (Apple Git-112)
47
diff --git a/meta/recipes-devtools/go/go-1.13/0009-ld-replace-glibc-dynamic-linker-with-musl.patch b/meta/recipes-devtools/go/go-1.13/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
new file mode 100644
index 0000000000..4bb1106f09
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.13/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
@@ -0,0 +1,134 @@
1From 973251ae0c69a35721f6115345d3f57b2847979f Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:20:13 +0430
4Subject: [PATCH 9/9] 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
10Adapted to Go 1.13 from patches originally submitted to
11the meta/recipes-devtools/go tree by
12Matt Madison <matt@madison.systems>.
13
14Upstream-Status: Inappropriate [Real fix should be portable across libcs]
15
16Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
17---
18 src/cmd/link/internal/amd64/obj.go | 2 +-
19 src/cmd/link/internal/arm/obj.go | 2 +-
20 src/cmd/link/internal/arm64/obj.go | 2 +-
21 src/cmd/link/internal/mips/obj.go | 2 +-
22 src/cmd/link/internal/mips64/obj.go | 2 +-
23 src/cmd/link/internal/ppc64/obj.go | 2 +-
24 src/cmd/link/internal/s390x/obj.go | 2 +-
25 src/cmd/link/internal/x86/obj.go | 2 +-
26 8 files changed, 8 insertions(+), 8 deletions(-)
27
28diff --git a/src/cmd/link/internal/amd64/obj.go b/src/cmd/link/internal/amd64/obj.go
29index 23741eb..8e74576 100644
30--- a/src/cmd/link/internal/amd64/obj.go
31+++ b/src/cmd/link/internal/amd64/obj.go
32@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
33 PEreloc1: pereloc1,
34 TLSIEtoLE: tlsIEtoLE,
35
36- Linuxdynld: "/lib64/ld-linux-x86-64.so.2",
37+ Linuxdynld: "/lib64/ld-musl-x86-64.so.1",
38 Freebsddynld: "/libexec/ld-elf.so.1",
39 Openbsddynld: "/usr/libexec/ld.so",
40 Netbsddynld: "/libexec/ld.elf_so",
41diff --git a/src/cmd/link/internal/arm/obj.go b/src/cmd/link/internal/arm/obj.go
42index 45a406e..724d3e3 100644
43--- a/src/cmd/link/internal/arm/obj.go
44+++ b/src/cmd/link/internal/arm/obj.go
45@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
46 Machoreloc1: machoreloc1,
47 PEreloc1: pereloc1,
48
49- Linuxdynld: "/lib/ld-linux.so.3", // 2 for OABI, 3 for EABI
50+ Linuxdynld: "/lib/ld-musl-armhf.so.1",
51 Freebsddynld: "/usr/libexec/ld-elf.so.1",
52 Openbsddynld: "/usr/libexec/ld.so",
53 Netbsddynld: "/libexec/ld.elf_so",
54diff --git a/src/cmd/link/internal/arm64/obj.go b/src/cmd/link/internal/arm64/obj.go
55index 7c66623..d8b1db1 100644
56--- a/src/cmd/link/internal/arm64/obj.go
57+++ b/src/cmd/link/internal/arm64/obj.go
58@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
59 Gentext: gentext,
60 Machoreloc1: machoreloc1,
61
62- Linuxdynld: "/lib/ld-linux-aarch64.so.1",
63+ Linuxdynld: "/lib/ld-musl-aarch64.so.1",
64
65 Freebsddynld: "XXX",
66 Openbsddynld: "/usr/libexec/ld.so",
67diff --git a/src/cmd/link/internal/mips/obj.go b/src/cmd/link/internal/mips/obj.go
68index 231e1ff..631dd7a 100644
69--- a/src/cmd/link/internal/mips/obj.go
70+++ b/src/cmd/link/internal/mips/obj.go
71@@ -60,7 +60,7 @@ func Init() (*sys.Arch, ld.Arch) {
72 Gentext: gentext,
73 Machoreloc1: machoreloc1,
74
75- Linuxdynld: "/lib/ld.so.1",
76+ Linuxdynld: "/lib/ld-musl-mipsle.so.1",
77
78 Freebsddynld: "XXX",
79 Openbsddynld: "XXX",
80diff --git a/src/cmd/link/internal/mips64/obj.go b/src/cmd/link/internal/mips64/obj.go
81index 9604208..5ef3ffc 100644
82--- a/src/cmd/link/internal/mips64/obj.go
83+++ b/src/cmd/link/internal/mips64/obj.go
84@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
85 Gentext: gentext,
86 Machoreloc1: machoreloc1,
87
88- Linuxdynld: "/lib64/ld64.so.1",
89+ Linuxdynld: "/lib64/ld-musl-mips64le.so.1",
90 Freebsddynld: "XXX",
91 Openbsddynld: "XXX",
92 Netbsddynld: "XXX",
93diff --git a/src/cmd/link/internal/ppc64/obj.go b/src/cmd/link/internal/ppc64/obj.go
94index 51d1791..b15da85 100644
95--- a/src/cmd/link/internal/ppc64/obj.go
96+++ b/src/cmd/link/internal/ppc64/obj.go
97@@ -63,7 +63,7 @@ func Init() (*sys.Arch, ld.Arch) {
98 Xcoffreloc1: xcoffreloc1,
99
100 // TODO(austin): ABI v1 uses /usr/lib/ld.so.1,
101- Linuxdynld: "/lib64/ld64.so.1",
102+ Linuxdynld: "/lib64/ld-musl-powerpc64le.so.1",
103
104 Freebsddynld: "XXX",
105 Openbsddynld: "XXX",
106diff --git a/src/cmd/link/internal/s390x/obj.go b/src/cmd/link/internal/s390x/obj.go
107index 3454476..42cc346 100644
108--- a/src/cmd/link/internal/s390x/obj.go
109+++ b/src/cmd/link/internal/s390x/obj.go
110@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
111 Gentext: gentext,
112 Machoreloc1: machoreloc1,
113
114- Linuxdynld: "/lib64/ld64.so.1",
115+ Linuxdynld: "/lib64/ld-musl-s390x.so.1",
116
117 // not relevant for s390x
118 Freebsddynld: "XXX",
119diff --git a/src/cmd/link/internal/x86/obj.go b/src/cmd/link/internal/x86/obj.go
120index f1fad20..d2ca10c 100644
121--- a/src/cmd/link/internal/x86/obj.go
122+++ b/src/cmd/link/internal/x86/obj.go
123@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
124 Machoreloc1: machoreloc1,
125 PEreloc1: pereloc1,
126
127- Linuxdynld: "/lib/ld-linux.so.2",
128+ Linuxdynld: "/lib/ld-musl-i386.so.1",
129 Freebsddynld: "/usr/libexec/ld-elf.so.1",
130 Openbsddynld: "/usr/libexec/ld.so",
131 Netbsddynld: "/usr/libexec/ld.elf_so",
132--
1332.17.1 (Apple Git-112)
134