summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/conf/distro/include/tcmode-default.inc2
-rw-r--r--meta/recipes-devtools/go/go-1.18.inc (renamed from meta/recipes-devtools/go/go-1.17.8.inc)11
-rw-r--r--meta/recipes-devtools/go/go-1.18/0001-allow-CC-and-CXX-to-have-multiple-words.patch33
-rw-r--r--meta/recipes-devtools/go/go-1.18/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch158
-rw-r--r--meta/recipes-devtools/go/go-1.18/0001-exec.go-do-not-write-linker-flags-into-buildids.patch9
-rw-r--r--meta/recipes-devtools/go/go-1.18/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch2
-rw-r--r--meta/recipes-devtools/go/go-1.18/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch237
-rw-r--r--meta/recipes-devtools/go/go-1.18/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch10
-rw-r--r--meta/recipes-devtools/go/go-1.18/0004-ld-add-soname-to-shareable-objects.patch6
-rw-r--r--meta/recipes-devtools/go/go-1.18/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch6
-rw-r--r--meta/recipes-devtools/go/go-1.18/0006-cmd-dist-separate-host-and-target-builds.patch38
-rw-r--r--meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch10
-rw-r--r--meta/recipes-devtools/go/go-1.18/0008-use-GOBUILDMODE-to-set-buildmode.patch2
-rw-r--r--meta/recipes-devtools/go/go-1.18/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch94
-rw-r--r--meta/recipes-devtools/go/go-binary-native_1.18.bb (renamed from meta/recipes-devtools/go/go-binary-native_1.17.8.bb)4
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian_1.18.bb (renamed from meta/recipes-devtools/go/go-cross-canadian_1.17.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-cross_1.18.bb (renamed from meta/recipes-devtools/go/go-cross_1.17.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-crosssdk_1.18.bb (renamed from meta/recipes-devtools/go/go-crosssdk_1.17.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-native_1.18.bb (renamed from meta/recipes-devtools/go/go-native_1.17.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-runtime_1.18.bb (renamed from meta/recipes-devtools/go/go-runtime_1.17.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go_1.18.bb (renamed from meta/recipes-devtools/go/go_1.17.8.bb)0
21 files changed, 197 insertions, 425 deletions
diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc
index 4a6d4da5d5..2200af5b60 100644
--- a/meta/conf/distro/include/tcmode-default.inc
+++ b/meta/conf/distro/include/tcmode-default.inc
@@ -23,7 +23,7 @@ GDBVERSION ?= "11.%"
23GLIBCVERSION ?= "2.35" 23GLIBCVERSION ?= "2.35"
24LINUXLIBCVERSION ?= "5.16%" 24LINUXLIBCVERSION ?= "5.16%"
25QEMUVERSION ?= "6.2%" 25QEMUVERSION ?= "6.2%"
26GOVERSION ?= "1.17%" 26GOVERSION ?= "1.18%"
27# This can not use wildcards like 8.0.% since it is also used in mesa to denote 27# This can not use wildcards like 8.0.% since it is also used in mesa to denote
28# llvm version being used, so always bump it with llvm recipe version bump 28# llvm version being used, so always bump it with llvm recipe version bump
29LLVMVERSION ?= "14.0.0" 29LLVMVERSION ?= "14.0.0"
diff --git a/meta/recipes-devtools/go/go-1.17.8.inc b/meta/recipes-devtools/go/go-1.18.inc
index 649c09ec1d..99ce70b346 100644
--- a/meta/recipes-devtools/go/go-1.17.8.inc
+++ b/meta/recipes-devtools/go/go-1.18.inc
@@ -5,21 +5,14 @@ FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-1.18:"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
6 6
7SRC_URI += "\ 7SRC_URI += "\
8 file://0001-allow-CC-and-CXX-to-have-multiple-words.patch \ 8 file://0001-cmd-go-make-content-based-hash-generation-less-pedan.patch \
9 file://0002-cmd-go-make-content-based-hash-generation-less-pedan.patch \
10 file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \ 9 file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \
11 file://0004-ld-add-soname-to-shareable-objects.patch \ 10 file://0004-ld-add-soname-to-shareable-objects.patch \
12 file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \ 11 file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \
13 file://0006-cmd-dist-separate-host-and-target-builds.patch \ 12 file://0006-cmd-dist-separate-host-and-target-builds.patch \
14 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ 13 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
15 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \ 14 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
16 file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \
17 file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \ 15 file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \
18 file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ 16 file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \
19" 17"
20SRC_URI[main.sha256sum] = "2effcd898140da79a061f3784ca4f8d8b13d811fb2abe9dad2404442dabbdf7a" 18SRC_URI[main.sha256sum] = "38f423db4cc834883f2b52344282fa7a39fbb93650dc62a11fdf0be6409bdad6"
21
22# Upstream don't believe it is a signifiant real world issue and will only
23# fix in 1.17 onwards where we can drop this.
24# https://github.com/golang/go/issues/30999#issuecomment-910470358
25CVE_CHECK_IGNORE += "CVE-2021-29923"
diff --git a/meta/recipes-devtools/go/go-1.18/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/meta/recipes-devtools/go/go-1.18/0001-allow-CC-and-CXX-to-have-multiple-words.patch
deleted file mode 100644
index 5f4823be22..0000000000
--- a/meta/recipes-devtools/go/go-1.18/0001-allow-CC-and-CXX-to-have-multiple-words.patch
+++ /dev/null
@@ -1,33 +0,0 @@
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
18--- a/src/cmd/go/internal/envcmd/env.go
19+++ b/src/cmd/go/internal/envcmd/env.go
20@@ -103,11 +103,11 @@ func MkEnv() []cfg.EnvVar {
21
22 cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
23 if env := strings.Fields(cfg.Getenv("CC")); len(env) > 0 {
24- cc = env[0]
25+ cc = strings.Join(env, " ")
26 }
27 cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch)
28 if env := strings.Fields(cfg.Getenv("CXX")); len(env) > 0 {
29- cxx = env[0]
30+ cxx = strings.Join(env, " ")
31 }
32 env = append(env, cfg.EnvVar{Name: "AR", Value: envOr("AR", "ar")})
33 env = append(env, cfg.EnvVar{Name: "CC", Value: cc})
diff --git a/meta/recipes-devtools/go/go-1.18/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch b/meta/recipes-devtools/go/go-1.18/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch
new file mode 100644
index 0000000000..f9db5df4eb
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.18/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch
@@ -0,0 +1,158 @@
1From 61de6067f5ad127d246543527947a357647f95e5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 28 Mar 2022 10:59:03 -0700
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
23Upstream-Status: Inappropriate [OE specific]
24
25Signed-off-by: Alex Kube <alexander.j.kube@gmail.com>
26Signed-off-by: Matt Madison <matt@madison.systems>
27Signed-off-by: Khem Raj <raj.khem@gmail.com>
28---
29 src/cmd/go/internal/envcmd/env.go | 2 +-
30 src/cmd/go/internal/work/exec.go | 42 +++++++++++++++++++++++++------
31 2 files changed, 35 insertions(+), 9 deletions(-)
32
33--- a/src/cmd/go/internal/envcmd/env.go
34+++ b/src/cmd/go/internal/envcmd/env.go
35@@ -169,7 +169,7 @@ func ExtraEnvVars() []cfg.EnvVar {
36 func ExtraEnvVarsCostly() []cfg.EnvVar {
37 var b work.Builder
38 b.Init()
39- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{})
40+ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false)
41 if err != nil {
42 // Should not happen - b.CFlags was given an empty package.
43 fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err)
44--- a/src/cmd/go/internal/work/exec.go
45+++ b/src/cmd/go/internal/work/exec.go
46@@ -213,6 +213,8 @@ func (b *Builder) Do(ctx context.Context
47 writeActionGraph()
48 }
49
50+var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != ""
51+
52 // buildActionID computes the action ID for a build action.
53 func (b *Builder) buildActionID(a *Action) cache.ActionID {
54 p := a.Package
55@@ -234,7 +236,7 @@ func (b *Builder) buildActionID(a *Actio
56 if p.Module != nil {
57 fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version)
58 }
59- } else if p.Goroot {
60+ } else if p.Goroot || omitGopath {
61 // The Go compiler always hides the exact value of $GOROOT
62 // when building things in GOROOT.
63 //
64@@ -266,9 +268,9 @@ func (b *Builder) buildActionID(a *Actio
65 }
66 if len(p.CgoFiles)+len(p.SwigFiles)+len(p.SwigCXXFiles) > 0 {
67 fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
68- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
69+ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
70
71- ccExe := b.ccExe()
72+ ccExe := filterCompilerFlags(b.ccExe())
73 fmt.Fprintf(h, "CC=%q %q %q %q\n", ccExe, cppflags, cflags, ldflags)
74 // Include the C compiler tool ID so that if the C
75 // compiler changes we rebuild the package.
76@@ -281,14 +283,14 @@ func (b *Builder) buildActionID(a *Actio
77 }
78 }
79 if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 {
80- cxxExe := b.cxxExe()
81+ cxxExe := filterCompilerFlags(b.cxxExe())
82 fmt.Fprintf(h, "CXX=%q %q\n", cxxExe, cxxflags)
83 if cxxID, err := b.gccToolID(cxxExe[0], "c++"); err == nil {
84 fmt.Fprintf(h, "CXX ID=%q\n", cxxID)
85 }
86 }
87 if len(p.FFiles) > 0 {
88- fcExe := b.fcExe()
89+ fcExe := filterCompilerFlags(b.fcExe())
90 fmt.Fprintf(h, "FC=%q %q\n", fcExe, fflags)
91 if fcID, err := b.gccToolID(fcExe[0], "f95"); err == nil {
92 fmt.Fprintf(h, "FC ID=%q\n", fcID)
93@@ -304,7 +306,7 @@ func (b *Builder) buildActionID(a *Actio
94 fmt.Fprintf(h, "fuzz %q\n", fuzzFlags)
95 }
96 }
97- fmt.Fprintf(h, "modinfo %q\n", p.Internal.BuildInfo)
98+ //fmt.Fprintf(h, "modinfo %q\n", p.Internal.BuildInfo)
99
100 // Configuration specific to compiler toolchain.
101 switch cfg.BuildToolchainName {
102@@ -2679,8 +2681,23 @@ func envList(key, def string) []string {
103 return args
104 }
105
106+var filterFlags = os.Getenv("CGO_PEDANTIC") == ""
107+
108+func filterCompilerFlags(flags []string) []string {
109+ var newflags []string
110+ if !filterFlags {
111+ return flags
112+ }
113+ for _, flag := range flags {
114+ if strings.HasPrefix(flag, "-m") {
115+ newflags = append(newflags, flag)
116+ }
117+ }
118+ return newflags
119+}
120+
121 // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
122-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
123+func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
124 defaults := "-g -O2"
125
126 if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
127@@ -2698,6 +2715,13 @@ func (b *Builder) CFlags(p *load.Package
128 if ldflags, err = buildFlags("LDFLAGS", defaults, p.CgoLDFLAGS, checkLinkerFlags); err != nil {
129 return
130 }
131+ if filtered {
132+ cppflags = filterCompilerFlags(cppflags)
133+ cflags = filterCompilerFlags(cflags)
134+ cxxflags = filterCompilerFlags(cxxflags)
135+ fflags = filterCompilerFlags(fflags)
136+ ldflags = filterCompilerFlags(ldflags)
137+ }
138
139 return
140 }
141@@ -2713,7 +2737,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`)
142
143 func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
144 p := a.Package
145- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p)
146+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false)
147 if err != nil {
148 return nil, nil, err
149 }
150@@ -3174,7 +3198,7 @@ func (b *Builder) swigIntSize(objdir str
151
152 // Run SWIG on one SWIG input file.
153 func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
154- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p)
155+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false)
156 if err != nil {
157 return "", "", err
158 }
diff --git a/meta/recipes-devtools/go/go-1.18/0001-exec.go-do-not-write-linker-flags-into-buildids.patch b/meta/recipes-devtools/go/go-1.18/0001-exec.go-do-not-write-linker-flags-into-buildids.patch
index 20b6636f65..f117152f2a 100644
--- a/meta/recipes-devtools/go/go-1.18/0001-exec.go-do-not-write-linker-flags-into-buildids.patch
+++ b/meta/recipes-devtools/go/go-1.18/0001-exec.go-do-not-write-linker-flags-into-buildids.patch
@@ -14,11 +14,9 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
14 src/cmd/go/internal/work/exec.go | 4 ++-- 14 src/cmd/go/internal/work/exec.go | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-) 15 1 file changed, 2 insertions(+), 2 deletions(-)
16 16
17diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
18index 696db23..727d40b 100644
19--- a/src/cmd/go/internal/work/exec.go 17--- a/src/cmd/go/internal/work/exec.go
20+++ b/src/cmd/go/internal/work/exec.go 18+++ b/src/cmd/go/internal/work/exec.go
21@@ -1136,7 +1136,7 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID { 19@@ -1274,7 +1274,7 @@ func (b *Builder) linkActionID(a *Action
22 } 20 }
23 21
24 // Toolchain-dependent configuration, shared with b.linkSharedActionID. 22 // Toolchain-dependent configuration, shared with b.linkSharedActionID.
@@ -27,7 +25,7 @@ index 696db23..727d40b 100644
27 25
28 // Input files. 26 // Input files.
29 for _, a1 := range a.Deps { 27 for _, a1 := range a.Deps {
30@@ -1418,7 +1418,7 @@ func (b *Builder) linkSharedActionID(a *Action) cache.ActionID { 28@@ -1568,7 +1568,7 @@ func (b *Builder) linkSharedActionID(a *
31 fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch) 29 fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
32 30
33 // Toolchain-dependent configuration, shared with b.linkActionID. 31 // Toolchain-dependent configuration, shared with b.linkActionID.
@@ -36,6 +34,3 @@ index 696db23..727d40b 100644
36 34
37 // Input files. 35 // Input files.
38 for _, a1 := range a.Deps { 36 for _, a1 := range a.Deps {
39--
402.17.1
41
diff --git a/meta/recipes-devtools/go/go-1.18/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch b/meta/recipes-devtools/go/go-1.18/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch
index 257454a67d..ef1cc6716a 100644
--- a/meta/recipes-devtools/go/go-1.18/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch
+++ b/meta/recipes-devtools/go/go-1.18/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch
@@ -13,8 +13,6 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
13 src/cmd/dist/buildgo.go | 8 ++++---- 13 src/cmd/dist/buildgo.go | 8 ++++----
14 1 file changed, 4 insertions(+), 4 deletions(-) 14 1 file changed, 4 insertions(+), 4 deletions(-)
15 15
16diff --git a/src/cmd/dist/buildgo.go b/src/cmd/dist/buildgo.go
17index caafc13..4eb1c96 100644
18--- a/src/cmd/dist/buildgo.go 16--- a/src/cmd/dist/buildgo.go
19+++ b/src/cmd/dist/buildgo.go 17+++ b/src/cmd/dist/buildgo.go
20@@ -34,8 +34,8 @@ func mkzdefaultcc(dir, file string) { 18@@ -34,8 +34,8 @@ func mkzdefaultcc(dir, file string) {
diff --git a/meta/recipes-devtools/go/go-1.18/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/meta/recipes-devtools/go/go-1.18/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
deleted file mode 100644
index 42cd568ef9..0000000000
--- a/meta/recipes-devtools/go/go-1.18/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
+++ /dev/null
@@ -1,237 +0,0 @@
1From c403b45995c5daa6747ac4d95b39bc9a6feb2cda 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] 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 20d0587..ff6f0d8 100644
55--- a/src/cmd/go/internal/envcmd/env.go
56+++ b/src/cmd/go/internal/envcmd/env.go
57@@ -160,7 +160,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 5a225fb..a37872e 100644
68--- a/src/cmd/go/internal/work/exec.go
69+++ b/src/cmd/go/internal/work/exec.go
70@@ -38,6 +38,8 @@ import (
71 "cmd/go/internal/trace"
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@@ -229,7 +231,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
80 // Assume b.WorkDir is being trimmed properly.
81 // When -trimpath is used with a package built from the module cache,
82 // use the module path and version instead of the directory.
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 } else if cfg.BuildTrimpath && p.Module != nil {
87 fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version)
88@@ -248,9 +250,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
89 }
90 if len(p.CgoFiles)+len(p.SwigFiles)+len(p.SwigCXXFiles) > 0 {
91 fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
92- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
93+ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
94
95- ccExe := b.ccExe()
96+ ccExe := b.ccExe(true)
97 fmt.Fprintf(h, "CC=%q %q %q %q\n", ccExe, cppflags, cflags, ldflags)
98 // Include the C compiler tool ID so that if the C
99 // compiler changes we rebuild the package.
100@@ -263,14 +265,14 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
101 }
102 }
103 if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 {
104- cxxExe := b.cxxExe()
105+ cxxExe := b.cxxExe(true)
106 fmt.Fprintf(h, "CXX=%q %q\n", cxxExe, cxxflags)
107 if cxxID, err := b.gccToolID(cxxExe[0], "c++"); err == nil {
108 fmt.Fprintf(h, "CXX ID=%q\n", cxxID)
109 }
110 }
111 if len(p.FFiles) > 0 {
112- fcExe := b.fcExe()
113+ fcExe := b.fcExe(true)
114 fmt.Fprintf(h, "FC=%q %q\n", fcExe, fflags)
115 if fcID, err := b.gccToolID(fcExe[0], "f95"); err == nil {
116 fmt.Fprintf(h, "FC ID=%q\n", fcID)
117@@ -2438,33 +2440,48 @@ var (
118 // gccCmd returns a gcc command line prefix
119 // defaultCC is defined in zdefaultcc.go, written by cmd/dist.
120 func (b *Builder) GccCmd(incdir, workdir string) []string {
121- return b.compilerCmd(b.ccExe(), incdir, workdir)
122+ return b.compilerCmd(b.ccExe(false), incdir, workdir)
123 }
124
125 // gxxCmd returns a g++ command line prefix
126 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
127 func (b *Builder) GxxCmd(incdir, workdir string) []string {
128- return b.compilerCmd(b.cxxExe(), incdir, workdir)
129+ return b.compilerCmd(b.cxxExe(false), incdir, workdir)
130 }
131
132 // gfortranCmd returns a gfortran command line prefix.
133 func (b *Builder) gfortranCmd(incdir, workdir string) []string {
134- return b.compilerCmd(b.fcExe(), incdir, workdir)
135+ return b.compilerCmd(b.fcExe(false), incdir, workdir)
136 }
137
138 // ccExe returns the CC compiler setting without all the extra flags we add implicitly.
139-func (b *Builder) ccExe() []string {
140- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch))
141+func (b *Builder) ccExe(filtered bool) []string {
142+ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered)
143 }
144
145 // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly.
146-func (b *Builder) cxxExe() []string {
147- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch))
148+func (b *Builder) cxxExe(filtered bool) []string {
149+ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered)
150 }
151
152 // fcExe returns the FC compiler setting without all the extra flags we add implicitly.
153-func (b *Builder) fcExe() []string {
154- return b.compilerExe(cfg.Getenv("FC"), "gfortran")
155+func (b *Builder) fcExe(filtered bool) []string {
156+ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered)
157+}
158+
159+var filterFlags = os.Getenv("CGO_PEDANTIC") == ""
160+
161+func filterCompilerFlags(flags []string) []string {
162+ var newflags []string
163+ if !filterFlags {
164+ return flags
165+ }
166+ for _, flag := range flags {
167+ if strings.HasPrefix(flag, "-m") {
168+ newflags = append(newflags, flag)
169+ }
170+ }
171+ return newflags
172 }
173
174 // compilerExe returns the compiler to use given an
175@@ -2473,11 +2490,16 @@ func (b *Builder) fcExe() []string {
176 // of the compiler but can have additional arguments if they
177 // were present in the environment value.
178 // For example if CC="gcc -DGOPHER" then the result is ["gcc", "-DGOPHER"].
179-func (b *Builder) compilerExe(envValue string, def string) []string {
180+func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string {
181 compiler := strings.Fields(envValue)
182 if len(compiler) == 0 {
183 compiler = strings.Fields(def)
184 }
185+
186+ if filtered {
187+ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...)
188+ }
189+
190 return compiler
191 }
192
193@@ -2667,7 +2689,7 @@ func envList(key, def string) []string {
194 }
195
196 // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
197-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
198+func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
199 defaults := "-g -O2"
200
201 if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
202@@ -2686,6 +2708,14 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l
203 return
204 }
205
206+ if filtered {
207+ cppflags = filterCompilerFlags(cppflags)
208+ cflags = filterCompilerFlags(cflags)
209+ cxxflags = filterCompilerFlags(cxxflags)
210+ fflags = filterCompilerFlags(fflags)
211+ ldflags = filterCompilerFlags(ldflags)
212+ }
213+
214 return
215 }
216
217@@ -2700,7 +2730,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`)
218
219 func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
220 p := a.Package
221- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p)
222+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false)
223 if err != nil {
224 return nil, nil, err
225 }
226@@ -3151,7 +3181,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) {
227
228 // Run SWIG on one SWIG input file.
229 func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
230- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p)
231+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false)
232 if err != nil {
233 return "", "", err
234 }
235--
2362.20.1
237
diff --git a/meta/recipes-devtools/go/go-1.18/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/meta/recipes-devtools/go/go-1.18/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
index 2a86bdccf3..c3ccffc3e9 100644
--- a/meta/recipes-devtools/go/go-1.18/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
+++ b/meta/recipes-devtools/go/go-1.18/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
@@ -18,11 +18,9 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
18 src/cmd/go/internal/cfg/cfg.go | 6 +++++- 18 src/cmd/go/internal/cfg/cfg.go | 6 +++++-
19 2 files changed, 8 insertions(+), 2 deletions(-) 19 2 files changed, 8 insertions(+), 2 deletions(-)
20 20
21diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
22index bec1769..d82f612 100644
23--- a/src/cmd/dist/build.go 21--- a/src/cmd/dist/build.go
24+++ b/src/cmd/dist/build.go 22+++ b/src/cmd/dist/build.go
25@@ -248,7 +248,9 @@ func xinit() { 23@@ -251,7 +251,9 @@ func xinit() {
26 } 24 }
27 xatexit(rmworkdir) 25 xatexit(rmworkdir)
28 26
@@ -33,11 +31,9 @@ index bec1769..d82f612 100644
33 } 31 }
34 32
35 // compilerEnv returns a map from "goos/goarch" to the 33 // compilerEnv returns a map from "goos/goarch" to the
36diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
37index 57a3c1f..825d8c7 100644
38--- a/src/cmd/go/internal/cfg/cfg.go 34--- a/src/cmd/go/internal/cfg/cfg.go
39+++ b/src/cmd/go/internal/cfg/cfg.go 35+++ b/src/cmd/go/internal/cfg/cfg.go
40@@ -67,7 +67,11 @@ func defaultContext() build.Context { 36@@ -76,7 +76,11 @@ func defaultContext() build.Context {
41 // variables. This matches the initialization of ToolDir in 37 // variables. This matches the initialization of ToolDir in
42 // go/build, except for using ctxt.GOROOT rather than 38 // go/build, except for using ctxt.GOROOT rather than
43 // runtime.GOROOT. 39 // runtime.GOROOT.
@@ -49,4 +45,4 @@ index 57a3c1f..825d8c7 100644
49+ } 45+ }
50 } 46 }
51 47
52 ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH) 48 ctxt.GOPATH = envOr("GOPATH", gopath(ctxt))
diff --git a/meta/recipes-devtools/go/go-1.18/0004-ld-add-soname-to-shareable-objects.patch b/meta/recipes-devtools/go/go-1.18/0004-ld-add-soname-to-shareable-objects.patch
index cd875f1164..058fa64225 100644
--- a/meta/recipes-devtools/go/go-1.18/0004-ld-add-soname-to-shareable-objects.patch
+++ b/meta/recipes-devtools/go/go-1.18/0004-ld-add-soname-to-shareable-objects.patch
@@ -19,7 +19,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
19 19
20--- a/src/cmd/link/internal/ld/lib.go 20--- a/src/cmd/link/internal/ld/lib.go
21+++ b/src/cmd/link/internal/ld/lib.go 21+++ b/src/cmd/link/internal/ld/lib.go
22@@ -1343,6 +1343,7 @@ func (ctxt *Link) hostlink() { 22@@ -1347,6 +1347,7 @@ func (ctxt *Link) hostlink() {
23 argv = append(argv, "-Wl,-z,relro") 23 argv = append(argv, "-Wl,-z,relro")
24 } 24 }
25 argv = append(argv, "-shared") 25 argv = append(argv, "-shared")
@@ -27,7 +27,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
27 if ctxt.HeadType == objabi.Hwindows { 27 if ctxt.HeadType == objabi.Hwindows {
28 if *flagAslr { 28 if *flagAslr {
29 argv = addASLRargs(argv) 29 argv = addASLRargs(argv)
30@@ -1358,6 +1359,7 @@ func (ctxt *Link) hostlink() { 30@@ -1364,6 +1365,7 @@ func (ctxt *Link) hostlink() {
31 argv = append(argv, "-Wl,-z,relro") 31 argv = append(argv, "-Wl,-z,relro")
32 } 32 }
33 argv = append(argv, "-shared") 33 argv = append(argv, "-shared")
@@ -35,7 +35,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
35 case BuildModePlugin: 35 case BuildModePlugin:
36 if ctxt.HeadType == objabi.Hdarwin { 36 if ctxt.HeadType == objabi.Hdarwin {
37 argv = append(argv, "-dynamiclib") 37 argv = append(argv, "-dynamiclib")
38@@ -1366,6 +1368,7 @@ func (ctxt *Link) hostlink() { 38@@ -1372,6 +1374,7 @@ func (ctxt *Link) hostlink() {
39 argv = append(argv, "-Wl,-z,relro") 39 argv = append(argv, "-Wl,-z,relro")
40 } 40 }
41 argv = append(argv, "-shared") 41 argv = append(argv, "-shared")
diff --git a/meta/recipes-devtools/go/go-1.18/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/meta/recipes-devtools/go/go-1.18/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
index 2845d21382..a6937672f5 100644
--- a/meta/recipes-devtools/go/go-1.18/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
+++ b/meta/recipes-devtools/go/go-1.18/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
@@ -17,11 +17,9 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
17 src/make.bash | 4 ++-- 17 src/make.bash | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-) 18 1 file changed, 2 insertions(+), 2 deletions(-)
19 19
20diff --git a/src/make.bash b/src/make.bash
21index 7986125..dd67029 100755
22--- a/src/make.bash 20--- a/src/make.bash
23+++ b/src/make.bash 21+++ b/src/make.bash
24@@ -181,7 +181,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then 22@@ -195,7 +195,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
25 exit 1 23 exit 1
26 fi 24 fi
27 rm -f cmd/dist/dist 25 rm -f cmd/dist/dist
@@ -30,7 +28,7 @@ index 7986125..dd67029 100755
30 28
31 # -e doesn't propagate out of eval, so check success by hand. 29 # -e doesn't propagate out of eval, so check success by hand.
32 eval $(./cmd/dist/dist env -p || echo FAIL=true) 30 eval $(./cmd/dist/dist env -p || echo FAIL=true)
33@@ -206,7 +206,7 @@ fi 31@@ -220,7 +220,7 @@ fi
34 # Run dist bootstrap to complete make.bash. 32 # Run dist bootstrap to complete make.bash.
35 # Bootstrap installs a proper cmd/dist, built with the new toolchain. 33 # Bootstrap installs a proper cmd/dist, built with the new toolchain.
36 # Throw ours, built with Go 1.4, away after bootstrap. 34 # Throw ours, built with Go 1.4, away after bootstrap.
diff --git a/meta/recipes-devtools/go/go-1.18/0006-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go-1.18/0006-cmd-dist-separate-host-and-target-builds.patch
index 68e8efc1d2..ee743ab990 100644
--- a/meta/recipes-devtools/go/go-1.18/0006-cmd-dist-separate-host-and-target-builds.patch
+++ b/meta/recipes-devtools/go/go-1.18/0006-cmd-dist-separate-host-and-target-builds.patch
@@ -39,11 +39,9 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
39 src/cmd/dist/build.go | 156 ++++++++++++++++++++++++++++++------------ 39 src/cmd/dist/build.go | 156 ++++++++++++++++++++++++++++++------------
40 1 file changed, 113 insertions(+), 43 deletions(-) 40 1 file changed, 113 insertions(+), 43 deletions(-)
41 41
42diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
43index d82f612..5c8459c 100644
44--- a/src/cmd/dist/build.go 42--- a/src/cmd/dist/build.go
45+++ b/src/cmd/dist/build.go 43+++ b/src/cmd/dist/build.go
46@@ -43,6 +43,7 @@ var ( 44@@ -44,6 +44,7 @@ var (
47 goexperiment string 45 goexperiment string
48 workdir string 46 workdir string
49 tooldir string 47 tooldir string
@@ -51,7 +49,7 @@ index d82f612..5c8459c 100644
51 oldgoos string 49 oldgoos string
52 oldgoarch string 50 oldgoarch string
53 exe string 51 exe string
54@@ -55,6 +56,7 @@ var ( 52@@ -54,6 +55,7 @@ var (
55 53
56 rebuildall bool 54 rebuildall bool
57 defaultclang bool 55 defaultclang bool
@@ -59,7 +57,7 @@ index d82f612..5c8459c 100644
59 57
60 vflag int // verbosity 58 vflag int // verbosity
61 ) 59 )
62@@ -251,6 +253,8 @@ func xinit() { 60@@ -254,6 +256,8 @@ func xinit() {
63 if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" { 61 if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
64 tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) 62 tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
65 } 63 }
@@ -68,7 +66,7 @@ index d82f612..5c8459c 100644
68 } 66 }
69 67
70 // compilerEnv returns a map from "goos/goarch" to the 68 // compilerEnv returns a map from "goos/goarch" to the
71@@ -496,8 +500,10 @@ func setup() { 69@@ -499,8 +503,10 @@ func setup() {
72 p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch) 70 p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch)
73 if rebuildall { 71 if rebuildall {
74 xremoveall(p) 72 xremoveall(p)
@@ -79,7 +77,7 @@ index d82f612..5c8459c 100644
79 77
80 if goos != gohostos || goarch != gohostarch { 78 if goos != gohostos || goarch != gohostarch {
81 p := pathf("%s/pkg/%s_%s", goroot, goos, goarch) 79 p := pathf("%s/pkg/%s_%s", goroot, goos, goarch)
82@@ -1267,17 +1273,35 @@ func cmdbootstrap() { 80@@ -1252,17 +1258,35 @@ func cmdbootstrap() {
83 81
84 var noBanner, noClean bool 82 var noBanner, noClean bool
85 var debug bool 83 var debug bool
@@ -116,7 +114,7 @@ index d82f612..5c8459c 100644
116 // Set GOPATH to an internal directory. We shouldn't actually 114 // Set GOPATH to an internal directory. We shouldn't actually
117 // need to store files here, since the toolchain won't 115 // need to store files here, since the toolchain won't
118 // depend on modules outside of vendor directories, but if 116 // depend on modules outside of vendor directories, but if
119@@ -1345,8 +1369,13 @@ func cmdbootstrap() { 117@@ -1330,8 +1354,13 @@ func cmdbootstrap() {
120 xprintf("\n") 118 xprintf("\n")
121 } 119 }
122 120
@@ -132,7 +130,7 @@ index d82f612..5c8459c 100644
132 goBootstrap := pathf("%s/go_bootstrap", tooldir) 130 goBootstrap := pathf("%s/go_bootstrap", tooldir)
133 cmdGo := pathf("%s/go", gobin) 131 cmdGo := pathf("%s/go", gobin)
134 if debug { 132 if debug {
135@@ -1375,7 +1404,11 @@ func cmdbootstrap() { 133@@ -1360,7 +1389,11 @@ func cmdbootstrap() {
136 xprintf("\n") 134 xprintf("\n")
137 } 135 }
138 xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") 136 xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
@@ -145,7 +143,7 @@ index d82f612..5c8459c 100644
145 // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT. 143 // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT.
146 os.Setenv("GOEXPERIMENT", goexperiment) 144 os.Setenv("GOEXPERIMENT", goexperiment)
147 goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...) 145 goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
148@@ -1414,50 +1447,84 @@ func cmdbootstrap() { 146@@ -1399,50 +1432,84 @@ func cmdbootstrap() {
149 } 147 }
150 checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) 148 checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
151 149
@@ -197,8 +195,6 @@ index d82f612..5c8459c 100644
197- timelog("build", "host toolchain") 195- timelog("build", "host toolchain")
198- if vflag > 0 { 196- if vflag > 0 {
199- xprintf("\n") 197- xprintf("\n")
200- }
201- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
202+ 198+
203+ if goos == oldgoos && goarch == oldgoarch { 199+ if goos == oldgoos && goarch == oldgoarch {
204+ // Common case - not setting up for cross-compilation. 200+ // Common case - not setting up for cross-compilation.
@@ -230,7 +226,8 @@ index d82f612..5c8459c 100644
230+ os.Setenv("GOARCH", goarch) 226+ os.Setenv("GOARCH", goarch)
231+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) 227+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
232+ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch) 228+ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
233+ } 229 }
230- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
234 goInstall(goBootstrap, "std", "cmd") 231 goInstall(goBootstrap, "std", "cmd")
235 checkNotStale(goBootstrap, "std", "cmd") 232 checkNotStale(goBootstrap, "std", "cmd")
236 checkNotStale(cmdGo, "std", "cmd") 233 checkNotStale(cmdGo, "std", "cmd")
@@ -238,12 +235,7 @@ index d82f612..5c8459c 100644
238- timelog("build", "target toolchain") 235- timelog("build", "target toolchain")
239- if vflag > 0 { 236- if vflag > 0 {
240- xprintf("\n") 237- xprintf("\n")
241+ if debug { 238- }
242+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
243+ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
244+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
245+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
246 }
247- goos = oldgoos 239- goos = oldgoos
248- goarch = oldgoarch 240- goarch = oldgoarch
249- os.Setenv("GOOS", goos) 241- os.Setenv("GOOS", goos)
@@ -264,10 +256,16 @@ index d82f612..5c8459c 100644
264- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch)) 256- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
265- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) 257- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
266- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec) 258- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
259+ if debug {
260+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
261+ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
262+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
263+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
264+ }
267 } 265 }
268 266
269 // Check that there are no new files in $GOROOT/bin other than 267 // Check that there are no new files in $GOROOT/bin other than
270@@ -1474,8 +1541,11 @@ func cmdbootstrap() { 268@@ -1459,8 +1526,11 @@ func cmdbootstrap() {
271 } 269 }
272 } 270 }
273 271
diff --git a/meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch
index 4b4d0d4f3d..534d431045 100644
--- a/meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch
+++ b/meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch
@@ -29,7 +29,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
29 29
30--- a/src/cmd/go/internal/work/action.go 30--- a/src/cmd/go/internal/work/action.go
31+++ b/src/cmd/go/internal/work/action.go 31+++ b/src/cmd/go/internal/work/action.go
32@@ -670,6 +670,9 @@ func (b *Builder) addTransitiveLinkDeps( 32@@ -673,6 +673,9 @@ func (b *Builder) addTransitiveLinkDeps(
33 if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] { 33 if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
34 continue 34 continue
35 } 35 }
@@ -41,7 +41,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
41 // we'll end up building an overall library or executable that depends at runtime 41 // we'll end up building an overall library or executable that depends at runtime
42--- a/src/cmd/go/internal/work/build.go 42--- a/src/cmd/go/internal/work/build.go
43+++ b/src/cmd/go/internal/work/build.go 43+++ b/src/cmd/go/internal/work/build.go
44@@ -167,6 +167,8 @@ See also: go install, go get, go clean. 44@@ -197,6 +197,8 @@ See also: go install, go get, go clean.
45 45
46 const concurrentGCBackendCompilationEnabledByDefault = true 46 const concurrentGCBackendCompilationEnabledByDefault = true
47 47
@@ -50,7 +50,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
50 func init() { 50 func init() {
51 // break init cycle 51 // break init cycle
52 CmdBuild.Run = runBuild 52 CmdBuild.Run = runBuild
53@@ -179,6 +181,10 @@ func init() { 53@@ -209,6 +211,10 @@ func init() {
54 54
55 AddBuildFlags(CmdBuild, DefaultBuildFlags) 55 AddBuildFlags(CmdBuild, DefaultBuildFlags)
56 AddBuildFlags(CmdInstall, DefaultBuildFlags) 56 AddBuildFlags(CmdInstall, DefaultBuildFlags)
@@ -63,7 +63,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
63 // Note that flags consulted by other parts of the code 63 // Note that flags consulted by other parts of the code
64--- a/src/cmd/go/internal/work/exec.go 64--- a/src/cmd/go/internal/work/exec.go
65+++ b/src/cmd/go/internal/work/exec.go 65+++ b/src/cmd/go/internal/work/exec.go
66@@ -468,6 +468,23 @@ func (b *Builder) build(a *Action) (err 66@@ -535,6 +535,23 @@ func (b *Builder) build(ctx context.Cont
67 return errors.New("binary-only packages are no longer supported") 67 return errors.New("binary-only packages are no longer supported")
68 } 68 }
69 69
@@ -87,7 +87,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
87 if err := b.Mkdir(a.Objdir); err != nil { 87 if err := b.Mkdir(a.Objdir); err != nil {
88 return err 88 return err
89 } 89 }
90@@ -1520,6 +1537,14 @@ func BuildInstallFunc(b *Builder, a *Act 90@@ -1585,6 +1602,14 @@ func (b *Builder) linkShared(ctx context
91 return err 91 return err
92 } 92 }
93 93
diff --git a/meta/recipes-devtools/go/go-1.18/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.18/0008-use-GOBUILDMODE-to-set-buildmode.patch
index 4e5d5021d6..0ede623af9 100644
--- a/meta/recipes-devtools/go/go-1.18/0008-use-GOBUILDMODE-to-set-buildmode.patch
+++ b/meta/recipes-devtools/go/go-1.18/0008-use-GOBUILDMODE-to-set-buildmode.patch
@@ -25,7 +25,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
25 25
26--- a/src/cmd/go/internal/work/build.go 26--- a/src/cmd/go/internal/work/build.go
27+++ b/src/cmd/go/internal/work/build.go 27+++ b/src/cmd/go/internal/work/build.go
28@@ -254,7 +254,13 @@ func AddBuildFlags(cmd *base.Command, ma 28@@ -283,7 +283,13 @@ func AddBuildFlags(cmd *base.Command, ma
29 29
30 cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "") 30 cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
31 cmd.Flag.Var(buildCompiler{}, "compiler", "") 31 cmd.Flag.Var(buildCompiler{}, "compiler", "")
diff --git a/meta/recipes-devtools/go/go-1.18/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch b/meta/recipes-devtools/go/go-1.18/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
deleted file mode 100644
index f857b72234..0000000000
--- a/meta/recipes-devtools/go/go-1.18/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
+++ /dev/null
@@ -1,94 +0,0 @@
1From 66a45dae3af140662e17ef85c2e6fe40270a2553 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 22 Feb 2021 17:54:01 -0800
4Subject: [PATCH] Revert "cmd/go: make sure CC and CXX are absolute"
5
6OE uses CC/CXX values which consists of cmpiler and options together,
7secondly, the environment is canned so this check add little value to OE
8based builds
9
10Fixes go-runtime build issues
11
12go install: CXX environment variable is relative; must be absolute path: powerpc64le-yoe-linux-musl-g++ -mlittle-endian -mhard-float -m64 -mabi=elfv2 -mcpu=power9 -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/mnt/b/yoe/master/build/tmp/work/ppc64p9le-yoe-linux-musl/go/1.16-r0/recipe-sysroot
13
14This reverts commit aa161e799df7e1eba99d2be10271e76b6f758142.
15
16Upstream-Status: Inappropriate [OE-Specific]
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 src/cmd/go/internal/envcmd/env.go | 5 -----
20 src/cmd/go/internal/work/init.go | 6 ------
21 src/cmd/go/testdata/script/env_write.txt | 24 ------------------------
22 3 files changed, 35 deletions(-)
23
24diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
25index ff6f0d8..43b94e7 100644
26--- a/src/cmd/go/internal/envcmd/env.go
27+++ b/src/cmd/go/internal/envcmd/env.go
28@@ -457,11 +457,6 @@ func checkEnvWrite(key, val string) error {
29 if !filepath.IsAbs(val) && val != "" {
30 return fmt.Errorf("GOPATH entry is relative; must be absolute path: %q", val)
31 }
32- // Make sure CC and CXX are absolute paths
33- case "CC", "CXX", "GOMODCACHE":
34- if !filepath.IsAbs(val) && val != "" && val != filepath.Base(val) {
35- return fmt.Errorf("%s entry is relative; must be absolute path: %q", key, val)
36- }
37 }
38
39 if !utf8.ValidString(val) {
40diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
41index 37a3e2d..316b0cf 100644
42--- a/src/cmd/go/internal/work/init.go
43+++ b/src/cmd/go/internal/work/init.go
44@@ -39,12 +39,6 @@ func BuildInit() {
45 cfg.BuildPkgdir = p
46 }
47
48- // Make sure CC and CXX are absolute paths
49- for _, key := range []string{"CC", "CXX"} {
50- if path := cfg.Getenv(key); !filepath.IsAbs(path) && path != "" && path != filepath.Base(path) {
51- base.Fatalf("go %s: %s environment variable is relative; must be absolute path: %s\n", flag.Args()[0], key, path)
52- }
53- }
54 }
55
56 func instrumentInit() {
57diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt
58index b5e9739..566c876 100644
59--- a/src/cmd/go/testdata/script/env_write.txt
60+++ b/src/cmd/go/testdata/script/env_write.txt
61@@ -129,30 +129,6 @@ go env -w GOTMPDIR=
62 go env GOTMPDIR
63 stdout ^$
64
65-# go env -w rejects relative CC values
66-[!windows] go env -w CC=/usr/bin/clang
67-go env -w CC=clang
68-[!windows] ! go env -w CC=./clang
69-[!windows] ! go env -w CC=bin/clang
70-[!windows] stderr 'go env -w: CC entry is relative; must be absolute path'
71-
72-[windows] go env -w CC=$WORK\bin\clang
73-[windows] ! go env -w CC=.\clang
74-[windows] ! go env -w CC=bin\clang
75-[windows] stderr 'go env -w: CC entry is relative; must be absolute path'
76-
77-# go env -w rejects relative CXX values
78-[!windows] go env -w CC=/usr/bin/cpp
79-go env -w CXX=cpp
80-[!windows] ! go env -w CXX=./cpp
81-[!windows] ! go env -w CXX=bin/cpp
82-[!windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
83-
84-[windows] go env -w CXX=$WORK\bin\cpp
85-[windows] ! go env -w CXX=.\cpp
86-[windows] ! go env -w CXX=bin\cpp
87-[windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
88-
89 # go env -w/-u checks validity of GOOS/ARCH combinations
90 env GOOS=
91 env GOARCH=
92--
932.20.1
94
diff --git a/meta/recipes-devtools/go/go-binary-native_1.17.8.bb b/meta/recipes-devtools/go/go-binary-native_1.18.bb
index 1b85cd50d6..500bb4ddcc 100644
--- a/meta/recipes-devtools/go/go-binary-native_1.17.8.bb
+++ b/meta/recipes-devtools/go/go-binary-native_1.18.bb
@@ -8,8 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
8PROVIDES = "go-native" 8PROVIDES = "go-native"
9 9
10SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}" 10SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
11SRC_URI[go_linux_amd64.sha256sum] = "980e65a863377e69fd9b67df9d8395fd8e93858e7a24c9f55803421e453f4f99" 11SRC_URI[go_linux_amd64.sha256sum] = "e85278e98f57cdb150fe8409e6e5df5343ecb13cebf03a5d5ff12bd55a80264f"
12SRC_URI[go_linux_arm64.sha256sum] = "57a9171682e297df1a5bd287be056ed0280195ad079af90af16dcad4f64710cb" 12SRC_URI[go_linux_arm64.sha256sum] = "7ac7b396a691e588c5fb57687759e6c4db84a2a3bbebb0765f4b38e5b1c5b00e"
13 13
14UPSTREAM_CHECK_URI = "https://golang.org/dl/" 14UPSTREAM_CHECK_URI = "https://golang.org/dl/"
15UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux" 15UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"
diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.17.8.bb b/meta/recipes-devtools/go/go-cross-canadian_1.18.bb
index 7ac9449e47..7ac9449e47 100644
--- a/meta/recipes-devtools/go/go-cross-canadian_1.17.8.bb
+++ b/meta/recipes-devtools/go/go-cross-canadian_1.18.bb
diff --git a/meta/recipes-devtools/go/go-cross_1.17.8.bb b/meta/recipes-devtools/go/go-cross_1.18.bb
index 80b5a03f6c..80b5a03f6c 100644
--- a/meta/recipes-devtools/go/go-cross_1.17.8.bb
+++ b/meta/recipes-devtools/go/go-cross_1.18.bb
diff --git a/meta/recipes-devtools/go/go-crosssdk_1.17.8.bb b/meta/recipes-devtools/go/go-crosssdk_1.18.bb
index 1857c8a577..1857c8a577 100644
--- a/meta/recipes-devtools/go/go-crosssdk_1.17.8.bb
+++ b/meta/recipes-devtools/go/go-crosssdk_1.18.bb
diff --git a/meta/recipes-devtools/go/go-native_1.17.8.bb b/meta/recipes-devtools/go/go-native_1.18.bb
index 76c0ab73a6..76c0ab73a6 100644
--- a/meta/recipes-devtools/go/go-native_1.17.8.bb
+++ b/meta/recipes-devtools/go/go-native_1.18.bb
diff --git a/meta/recipes-devtools/go/go-runtime_1.17.8.bb b/meta/recipes-devtools/go/go-runtime_1.18.bb
index 63464a1501..63464a1501 100644
--- a/meta/recipes-devtools/go/go-runtime_1.17.8.bb
+++ b/meta/recipes-devtools/go/go-runtime_1.18.bb
diff --git a/meta/recipes-devtools/go/go_1.17.8.bb b/meta/recipes-devtools/go/go_1.18.bb
index 34dc89bb0c..34dc89bb0c 100644
--- a/meta/recipes-devtools/go/go_1.17.8.bb
+++ b/meta/recipes-devtools/go/go_1.18.bb