summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go')
-rw-r--r--meta/recipes-devtools/go/go-1.14/0009-ld-replace-glibc-dynamic-linker-with-musl.patch115
-rw-r--r--meta/recipes-devtools/go/go-1.17.8.inc (renamed from meta/recipes-devtools/go/go-1.14.inc)16
-rw-r--r--meta/recipes-devtools/go/go-1.18/0001-allow-CC-and-CXX-to-have-multiple-words.patch (renamed from meta/recipes-devtools/go/go-1.14/0001-allow-CC-and-CXX-to-have-multiple-words.patch)2
-rw-r--r--meta/recipes-devtools/go/go-1.18/0001-exec.go-do-not-write-linker-flags-into-buildids.patch41
-rw-r--r--meta/recipes-devtools/go/go-1.18/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch41
-rw-r--r--meta/recipes-devtools/go/go-1.18/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch (renamed from meta/recipes-devtools/go/go-1.14/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch)68
-rw-r--r--meta/recipes-devtools/go/go-1.18/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch (renamed from meta/recipes-devtools/go/go-1.14/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch)15
-rw-r--r--meta/recipes-devtools/go/go-1.18/0004-ld-add-soname-to-shareable-objects.patch (renamed from meta/recipes-devtools/go/go-1.14/0004-ld-add-soname-to-shareable-objects.patch)12
-rw-r--r--meta/recipes-devtools/go/go-1.18/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch (renamed from meta/recipes-devtools/go/go-1.14/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch)16
-rw-r--r--meta/recipes-devtools/go/go-1.18/0006-cmd-dist-separate-host-and-target-builds.patch (renamed from meta/recipes-devtools/go/go-1.14/0006-cmd-dist-separate-host-and-target-builds.patch)61
-rw-r--r--meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch (renamed from meta/recipes-devtools/go/go-1.14/0007-cmd-go-make-GOROOT-precious-by-default.patch)6
-rw-r--r--meta/recipes-devtools/go/go-1.18/0008-use-GOBUILDMODE-to-set-buildmode.patch (renamed from meta/recipes-devtools/go/go-1.14/0008-use-GOBUILDMODE-to-set-buildmode.patch)2
-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.17.8.bb (renamed from meta/recipes-devtools/go/go-binary-native_1.14.4.bb)4
-rw-r--r--meta/recipes-devtools/go/go-common.inc8
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian.inc1
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian_1.17.8.bb (renamed from meta/recipes-devtools/go/go-cross-canadian_1.14.bb)0
-rw-r--r--meta/recipes-devtools/go/go-cross.inc1
-rw-r--r--meta/recipes-devtools/go/go-cross_1.17.8.bb (renamed from meta/recipes-devtools/go/go-cross_1.14.bb)0
-rw-r--r--meta/recipes-devtools/go/go-crosssdk.inc1
-rw-r--r--meta/recipes-devtools/go/go-crosssdk_1.17.8.bb (renamed from meta/recipes-devtools/go/go-crosssdk_1.14.bb)0
-rw-r--r--meta/recipes-devtools/go/go-dep/0001-Add-support-for-mips-mips64.patch54
-rw-r--r--meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch33
-rw-r--r--meta/recipes-devtools/go/go-dep_0.5.4.bb29
-rw-r--r--meta/recipes-devtools/go/go-native_1.17.8.bb (renamed from meta/recipes-devtools/go/go-native_1.14.bb)4
-rw-r--r--meta/recipes-devtools/go/go-runtime.inc23
-rw-r--r--meta/recipes-devtools/go/go-runtime_1.17.8.bb (renamed from meta/recipes-devtools/go/go-runtime_1.14.bb)1
-rw-r--r--meta/recipes-devtools/go/go-target.inc24
-rw-r--r--meta/recipes-devtools/go/go_1.14.bb14
-rw-r--r--meta/recipes-devtools/go/go_1.17.8.bb17
30 files changed, 351 insertions, 352 deletions
diff --git a/meta/recipes-devtools/go/go-1.14/0009-ld-replace-glibc-dynamic-linker-with-musl.patch b/meta/recipes-devtools/go/go-1.14/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
deleted file mode 100644
index 427cfb0dd2..0000000000
--- a/meta/recipes-devtools/go/go-1.14/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From 973251ae0c69a35721f6115345d3f57b2847979f Mon Sep 17 00:00:00 2001
-From: Alex Kube <alexander.j.kube@gmail.com>
-Date: Wed, 23 Oct 2019 21:20:13 +0430
-Subject: [PATCH 9/9] ld: replace glibc dynamic linker with musl
-
-Rework of patch by Khem Raj <raj.khem@gmail.com>
-for go 1.10. Should be applied conditionally on
-musl being the system C library.
-
-Adapted to Go 1.13 from patches originally submitted to
-the meta/recipes-devtools/go tree by
-Matt Madison <matt@madison.systems>.
-
-Upstream-Status: Inappropriate [Real fix should be portable across libcs]
-
-Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
----
- src/cmd/link/internal/amd64/obj.go | 2 +-
- src/cmd/link/internal/arm/obj.go | 2 +-
- src/cmd/link/internal/arm64/obj.go | 2 +-
- src/cmd/link/internal/mips/obj.go | 2 +-
- src/cmd/link/internal/mips64/obj.go | 2 +-
- src/cmd/link/internal/ppc64/obj.go | 2 +-
- src/cmd/link/internal/s390x/obj.go | 2 +-
- src/cmd/link/internal/x86/obj.go | 2 +-
- 8 files changed, 8 insertions(+), 8 deletions(-)
-
---- a/src/cmd/link/internal/amd64/obj.go
-+++ b/src/cmd/link/internal/amd64/obj.go
-@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
- PEreloc1: pereloc1,
- TLSIEtoLE: tlsIEtoLE,
-
-- Linuxdynld: "/lib64/ld-linux-x86-64.so.2",
-+ Linuxdynld: "/lib64/ld-musl-x86-64.so.1",
- Freebsddynld: "/libexec/ld-elf.so.1",
- Openbsddynld: "/usr/libexec/ld.so",
- Netbsddynld: "/libexec/ld.elf_so",
---- a/src/cmd/link/internal/arm/obj.go
-+++ b/src/cmd/link/internal/arm/obj.go
-@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
- Machoreloc1: machoreloc1,
- PEreloc1: pereloc1,
-
-- Linuxdynld: "/lib/ld-linux.so.3", // 2 for OABI, 3 for EABI
-+ Linuxdynld: "/lib/ld-musl-armhf.so.1",
- Freebsddynld: "/usr/libexec/ld-elf.so.1",
- Openbsddynld: "/usr/libexec/ld.so",
- Netbsddynld: "/libexec/ld.elf_so",
---- a/src/cmd/link/internal/arm64/obj.go
-+++ b/src/cmd/link/internal/arm64/obj.go
-@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
- Gentext: gentext,
- Machoreloc1: machoreloc1,
-
-- Linuxdynld: "/lib/ld-linux-aarch64.so.1",
-+ Linuxdynld: "/lib/ld-musl-aarch64.so.1",
-
- Freebsddynld: "/usr/libexec/ld-elf.so.1",
- Openbsddynld: "/usr/libexec/ld.so",
---- a/src/cmd/link/internal/mips/obj.go
-+++ b/src/cmd/link/internal/mips/obj.go
-@@ -60,7 +60,7 @@ func Init() (*sys.Arch, ld.Arch) {
- Gentext: gentext,
- Machoreloc1: machoreloc1,
-
-- Linuxdynld: "/lib/ld.so.1",
-+ Linuxdynld: "/lib/ld-musl-mipsle.so.1",
-
- Freebsddynld: "XXX",
- Openbsddynld: "XXX",
---- a/src/cmd/link/internal/mips64/obj.go
-+++ b/src/cmd/link/internal/mips64/obj.go
-@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
- Gentext: gentext,
- Machoreloc1: machoreloc1,
-
-- Linuxdynld: "/lib64/ld64.so.1",
-+ Linuxdynld: "/lib64/ld-musl-mips64le.so.1",
- Freebsddynld: "XXX",
- Openbsddynld: "XXX",
- Netbsddynld: "XXX",
---- a/src/cmd/link/internal/ppc64/obj.go
-+++ b/src/cmd/link/internal/ppc64/obj.go
-@@ -63,7 +63,7 @@ func Init() (*sys.Arch, ld.Arch) {
- Xcoffreloc1: xcoffreloc1,
-
- // TODO(austin): ABI v1 uses /usr/lib/ld.so.1,
-- Linuxdynld: "/lib64/ld64.so.1",
-+ Linuxdynld: "/lib64/ld-musl-powerpc64le.so.1",
-
- Freebsddynld: "XXX",
- Openbsddynld: "XXX",
---- a/src/cmd/link/internal/s390x/obj.go
-+++ b/src/cmd/link/internal/s390x/obj.go
-@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
- Gentext: gentext,
- Machoreloc1: machoreloc1,
-
-- Linuxdynld: "/lib64/ld64.so.1",
-+ Linuxdynld: "/lib64/ld-musl-s390x.so.1",
-
- // not relevant for s390x
- Freebsddynld: "XXX",
---- a/src/cmd/link/internal/x86/obj.go
-+++ b/src/cmd/link/internal/x86/obj.go
-@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
- Machoreloc1: machoreloc1,
- PEreloc1: pereloc1,
-
-- Linuxdynld: "/lib/ld-linux.so.2",
-+ Linuxdynld: "/lib/ld-musl-i386.so.1",
- Freebsddynld: "/usr/libexec/ld-elf.so.1",
- Openbsddynld: "/usr/libexec/ld.so",
- Netbsddynld: "/usr/libexec/ld.elf_so",
diff --git a/meta/recipes-devtools/go/go-1.14.inc b/meta/recipes-devtools/go/go-1.17.8.inc
index 1050116950..649c09ec1d 100644
--- a/meta/recipes-devtools/go/go-1.14.inc
+++ b/meta/recipes-devtools/go/go-1.17.8.inc
@@ -1,9 +1,6 @@
require go-common.inc
-GO_BASEVERSION = "1.14"
-GO_MINOR = ".4"
-PV .= "${GO_MINOR}"
-FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
+FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-1.18:"
LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
@@ -16,6 +13,13 @@ SRC_URI += "\
file://0006-cmd-dist-separate-host-and-target-builds.patch \
file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
+ file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \
+ file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \
+ file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \
"
-SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
-SRC_URI[main.sha256sum] = "7011af3bbc2ac108d1b82ea8abb87b2e63f78844f0259be20cde4d42c5c40584"
+SRC_URI[main.sha256sum] = "2effcd898140da79a061f3784ca4f8d8b13d811fb2abe9dad2404442dabbdf7a"
+
+# Upstream don't believe it is a signifiant real world issue and will only
+# fix in 1.17 onwards where we can drop this.
+# https://github.com/golang/go/issues/30999#issuecomment-910470358
+CVE_CHECK_IGNORE += "CVE-2021-29923"
diff --git a/meta/recipes-devtools/go/go-1.14/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
index d47664d8e2..5f4823be22 100644
--- a/meta/recipes-devtools/go/go-1.14/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
@@ -17,7 +17,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
--- a/src/cmd/go/internal/envcmd/env.go
+++ b/src/cmd/go/internal/envcmd/env.go
-@@ -102,11 +102,11 @@ func MkEnv() []cfg.EnvVar {
+@@ -103,11 +103,11 @@ func MkEnv() []cfg.EnvVar {
cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
if env := strings.Fields(cfg.Getenv("CC")); len(env) > 0 {
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
new file mode 100644
index 0000000000..20b6636f65
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.18/0001-exec.go-do-not-write-linker-flags-into-buildids.patch
@@ -0,0 +1,41 @@
+From bdd69b55387f80c8df18d0af5008bf5e1a66be6a Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Mon, 23 Nov 2020 19:22:04 +0000
+Subject: [PATCH] exec.go: do not write linker flags into buildids
+
+The flags can contain build-specific paths, breaking reproducibility.
+
+To make this acceptable to upstream, we probably need to trim the flags,
+removing those known to be buildhost-specific.
+
+Upstream-Status: Inappropriate [needs upstream discussion]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ src/cmd/go/internal/work/exec.go | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
+index 696db23..727d40b 100644
+--- a/src/cmd/go/internal/work/exec.go
++++ b/src/cmd/go/internal/work/exec.go
+@@ -1136,7 +1136,7 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID {
+ }
+
+ // Toolchain-dependent configuration, shared with b.linkSharedActionID.
+- b.printLinkerConfig(h, p)
++ //b.printLinkerConfig(h, p)
+
+ // Input files.
+ for _, a1 := range a.Deps {
+@@ -1418,7 +1418,7 @@ func (b *Builder) linkSharedActionID(a *Action) cache.ActionID {
+ fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
+
+ // Toolchain-dependent configuration, shared with b.linkActionID.
+- b.printLinkerConfig(h, nil)
++ //b.printLinkerConfig(h, nil)
+
+ // Input files.
+ for _, a1 := range a.Deps {
+--
+2.17.1
+
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
new file mode 100644
index 0000000000..257454a67d
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.18/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch
@@ -0,0 +1,41 @@
+From 2055a46b396e272616c0b2273903e02c3b49a2ff Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Tue, 10 Nov 2020 16:33:27 +0000
+Subject: [PATCH] src/cmd/dist/buildgo.go: do not hardcode host compilers into
+ target binaries
+
+These come from $CC/$CXX on the build host and are not useful on targets;
+additionally as they contain host specific paths, this helps reproducibility.
+
+Upstream-Status: Inappropriate [needs upstream discussion]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ src/cmd/dist/buildgo.go | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/cmd/dist/buildgo.go b/src/cmd/dist/buildgo.go
+index caafc13..4eb1c96 100644
+--- a/src/cmd/dist/buildgo.go
++++ b/src/cmd/dist/buildgo.go
+@@ -34,8 +34,8 @@ func mkzdefaultcc(dir, file string) {
+ fmt.Fprintf(&buf, "package cfg\n")
+ fmt.Fprintln(&buf)
+ fmt.Fprintf(&buf, "const DefaultPkgConfig = `%s`\n", defaultpkgconfig)
+- buf.WriteString(defaultCCFunc("DefaultCC", defaultcc))
+- buf.WriteString(defaultCCFunc("DefaultCXX", defaultcxx))
++ buf.WriteString(defaultCCFunc("DefaultCC", map[string]string{"":"gcc"}))
++ buf.WriteString(defaultCCFunc("DefaultCXX", map[string]string{"":"g++"}))
+ writefile(buf.String(), file, writeSkipSame)
+ return
+ }
+@@ -46,8 +46,8 @@ func mkzdefaultcc(dir, file string) {
+ fmt.Fprintf(&buf, "package main\n")
+ fmt.Fprintln(&buf)
+ fmt.Fprintf(&buf, "const defaultPkgConfig = `%s`\n", defaultpkgconfig)
+- buf.WriteString(defaultCCFunc("defaultCC", defaultcc))
+- buf.WriteString(defaultCCFunc("defaultCXX", defaultcxx))
++ buf.WriteString(defaultCCFunc("defaultCC", map[string]string{"":"gcc"}))
++ buf.WriteString(defaultCCFunc("defaultCXX", map[string]string{"":"g++"}))
+ writefile(buf.String(), file, writeSkipSame)
+ }
+
diff --git a/meta/recipes-devtools/go/go-1.14/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
index 9e88567ebd..42cd568ef9 100644
--- a/meta/recipes-devtools/go/go-1.14/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
@@ -1,7 +1,7 @@
-From a13ae484e41139094505d2834437e9262a5315f7 Mon Sep 17 00:00:00 2001
+From c403b45995c5daa6747ac4d95b39bc9a6feb2cda Mon Sep 17 00:00:00 2001
From: Alex Kube <alexander.j.kube@gmail.com>
Date: Wed, 23 Oct 2019 21:14:22 +0430
-Subject: [PATCH 2/9] cmd/go: make content-based hash generation less pedantic
+Subject: [PATCH] cmd/go: make content-based hash generation less pedantic
Upstream-Status: Inappropriate [OE specific]
@@ -50,9 +50,11 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
src/cmd/go/internal/work/exec.go | 66 ++++++++++++++++++++++---------
2 files changed, 49 insertions(+), 19 deletions(-)
+diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
+index 20d0587..ff6f0d8 100644
--- a/src/cmd/go/internal/envcmd/env.go
+++ b/src/cmd/go/internal/envcmd/env.go
-@@ -156,7 +156,7 @@ func ExtraEnvVars() []cfg.EnvVar {
+@@ -160,7 +160,7 @@ func ExtraEnvVars() []cfg.EnvVar {
func ExtraEnvVarsCostly() []cfg.EnvVar {
var b work.Builder
b.Init()
@@ -61,10 +63,12 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
if err != nil {
// Should not happen - b.CFlags was given an empty package.
fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err)
+diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
+index 5a225fb..a37872e 100644
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
-@@ -32,6 +32,8 @@ import (
- "time"
+@@ -38,6 +38,8 @@ import (
+ "cmd/go/internal/trace"
)
+var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != ""
@@ -72,7 +76,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
// actionList returns the list of actions in the dag rooted at root
// as visited in a depth-first post-order traversal.
func actionList(root *Action) []*Action {
-@@ -208,7 +210,7 @@ func (b *Builder) buildActionID(a *Actio
+@@ -229,7 +231,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
// Assume b.WorkDir is being trimmed properly.
// When -trimpath is used with a package built from the module cache,
// use the module path and version instead of the directory.
@@ -81,25 +85,36 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
fmt.Fprintf(h, "dir %s\n", p.Dir)
} else if cfg.BuildTrimpath && p.Module != nil {
fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version)
-@@ -224,13 +226,13 @@ func (b *Builder) buildActionID(a *Actio
+@@ -248,9 +250,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
}
- if len(p.CgoFiles)+len(p.SwigFiles) > 0 {
+ if len(p.CgoFiles)+len(p.SwigFiles)+len(p.SwigCXXFiles) > 0 {
fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
-- fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(), cppflags, cflags, ldflags)
+ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
-+ fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(true), cppflags, cflags, ldflags)
- if len(p.CXXFiles)+len(p.SwigFiles) > 0 {
-- fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(), cxxflags)
-+ fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(true), cxxflags)
+
+- ccExe := b.ccExe()
++ ccExe := b.ccExe(true)
+ fmt.Fprintf(h, "CC=%q %q %q %q\n", ccExe, cppflags, cflags, ldflags)
+ // Include the C compiler tool ID so that if the C
+ // compiler changes we rebuild the package.
+@@ -263,14 +265,14 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
+ }
}
- if len(p.FFiles) > 0 {
-- fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(), fflags)
-+ fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(true), fflags)
+ if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 {
+- cxxExe := b.cxxExe()
++ cxxExe := b.cxxExe(true)
+ fmt.Fprintf(h, "CXX=%q %q\n", cxxExe, cxxflags)
+ if cxxID, err := b.gccToolID(cxxExe[0], "c++"); err == nil {
+ fmt.Fprintf(h, "CXX ID=%q\n", cxxID)
+ }
}
- // TODO(rsc): Should we include the SWIG version or Fortran/GCC/G++/Objective-C compiler versions?
- }
-@@ -2228,33 +2230,48 @@ var (
+ if len(p.FFiles) > 0 {
+- fcExe := b.fcExe()
++ fcExe := b.fcExe(true)
+ fmt.Fprintf(h, "FC=%q %q\n", fcExe, fflags)
+ if fcID, err := b.gccToolID(fcExe[0], "f95"); err == nil {
+ fmt.Fprintf(h, "FC ID=%q\n", fcID)
+@@ -2438,33 +2440,48 @@ var (
// gccCmd returns a gcc command line prefix
// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
func (b *Builder) GccCmd(incdir, workdir string) []string {
@@ -157,7 +172,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
}
// compilerExe returns the compiler to use given an
-@@ -2263,11 +2280,16 @@ func (b *Builder) fcExe() []string {
+@@ -2473,11 +2490,16 @@ func (b *Builder) fcExe() []string {
// of the compiler but can have additional arguments if they
// were present in the environment value.
// For example if CC="gcc -DGOPHER" then the result is ["gcc", "-DGOPHER"].
@@ -165,7 +180,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string {
compiler := strings.Fields(envValue)
if len(compiler) == 0 {
- compiler = []string{def}
+ compiler = strings.Fields(def)
}
+
+ if filtered {
@@ -175,7 +190,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
return compiler
}
-@@ -2428,7 +2450,7 @@ func envList(key, def string) []string {
+@@ -2667,7 +2689,7 @@ func envList(key, def string) []string {
}
// CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
@@ -184,7 +199,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
defaults := "-g -O2"
if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
-@@ -2447,6 +2469,14 @@ func (b *Builder) CFlags(p *load.Package
+@@ -2686,6 +2708,14 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l
return
}
@@ -199,7 +214,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
return
}
-@@ -2461,7 +2491,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`)
+@@ -2700,7 +2730,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`)
func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
p := a.Package
@@ -208,7 +223,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
if err != nil {
return nil, nil, err
}
-@@ -2820,7 +2850,7 @@ func (b *Builder) swigIntSize(objdir str
+@@ -3151,7 +3181,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) {
// Run SWIG on one SWIG input file.
func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
@@ -217,3 +232,6 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
if err != nil {
return "", "", err
}
+--
+2.20.1
+
diff --git a/meta/recipes-devtools/go/go-1.14/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 662c705471..2a86bdccf3 100644
--- a/meta/recipes-devtools/go/go-1.14/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
@@ -1,7 +1,7 @@
-From 28ada8896b76d620240bafc22aa395071d601482 Mon Sep 17 00:00:00 2001
+From 8512964c0bfdfc3c9c3805743ea7de551a1d476a Mon Sep 17 00:00:00 2001
From: Alex Kube <alexander.j.kube@gmail.com>
Date: Wed, 23 Oct 2019 21:15:37 +0430
-Subject: [PATCH 3/9] cmd/go: Allow GOTOOLDIR to be overridden in the environment
+Subject: [PATCH] cmd/go: Allow GOTOOLDIR to be overridden in the environment
to allow for split host/target build roots
@@ -12,15 +12,18 @@ Matt Madison <matt@madison.systems>.
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+
---
src/cmd/dist/build.go | 4 +++-
src/cmd/go/internal/cfg/cfg.go | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
+diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
+index bec1769..d82f612 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
-@@ -246,7 +246,9 @@ func xinit() {
- workdir = xworkdir()
+@@ -248,7 +248,9 @@ func xinit() {
+ }
xatexit(rmworkdir)
- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
@@ -30,9 +33,11 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
}
// compilerEnv returns a map from "goos/goarch" to the
+diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
+index 57a3c1f..825d8c7 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
-@@ -64,7 +64,11 @@ func defaultContext() build.Context {
+@@ -67,7 +67,11 @@ func defaultContext() build.Context {
// variables. This matches the initialization of ToolDir in
// go/build, except for using ctxt.GOROOT rather than
// runtime.GOROOT.
diff --git a/meta/recipes-devtools/go/go-1.14/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 75c9c75211..cd875f1164 100644
--- a/meta/recipes-devtools/go/go-1.14/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,15 +19,15 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
-@@ -1280,6 +1280,7 @@ func (ctxt *Link) hostlink() {
+@@ -1343,6 +1343,7 @@ func (ctxt *Link) hostlink() {
argv = append(argv, "-Wl,-z,relro")
}
argv = append(argv, "-shared")
+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
- if ctxt.HeadType != objabi.Hwindows {
- // Pass -z nodelete to mark the shared library as
- // non-closeable: a dlclose will do nothing.
-@@ -1291,6 +1292,7 @@ func (ctxt *Link) hostlink() {
+ if ctxt.HeadType == objabi.Hwindows {
+ if *flagAslr {
+ argv = addASLRargs(argv)
+@@ -1358,6 +1359,7 @@ func (ctxt *Link) hostlink() {
argv = append(argv, "-Wl,-z,relro")
}
argv = append(argv, "-shared")
@@ -35,7 +35,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
case BuildModePlugin:
if ctxt.HeadType == objabi.Hdarwin {
argv = append(argv, "-dynamiclib")
-@@ -1299,6 +1301,7 @@ func (ctxt *Link) hostlink() {
+@@ -1366,6 +1368,7 @@ func (ctxt *Link) hostlink() {
argv = append(argv, "-Wl,-z,relro")
}
argv = append(argv, "-shared")
diff --git a/meta/recipes-devtools/go/go-1.14/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 59c12d9546..2845d21382 100644
--- a/meta/recipes-devtools/go/go-1.14/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
@@ -1,8 +1,7 @@
-From f05ef3ded52b98537c10efd0b15cd9612471524d Mon Sep 17 00:00:00 2001
+From 153e2dda6103fd9dd871be4bb495a8da5328301e Mon Sep 17 00:00:00 2001
From: Alex Kube <alexander.j.kube@gmail.com>
Date: Wed, 23 Oct 2019 21:17:16 +0430
-Subject: [PATCH 5/9] make.bash: override CC when building dist and
- go_bootstrap
+Subject: [PATCH] make.bash: override CC when building dist and go_bootstrap
for handling OE cross-canadian builds.
@@ -13,13 +12,16 @@ Matt Madison <matt@madison.systems>.
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+
---
src/make.bash | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
+diff --git a/src/make.bash b/src/make.bash
+index 7986125..dd67029 100755
--- a/src/make.bash
+++ b/src/make.bash
-@@ -178,7 +178,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
+@@ -181,7 +181,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
exit 1
fi
rm -f cmd/dist/dist
@@ -28,12 +30,12 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
# -e doesn't propagate out of eval, so check success by hand.
eval $(./cmd/dist/dist env -p || echo FAIL=true)
-@@ -209,7 +209,7 @@ fi
+@@ -206,7 +206,7 @@ fi
# Run dist bootstrap to complete make.bash.
# Bootstrap installs a proper cmd/dist, built with the new toolchain.
# Throw ours, built with Go 1.4, away after bootstrap.
--./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
-+CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
+-./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@"
++CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@"
rm -f ./cmd/dist/dist
# DO NOT ADD ANY NEW CODE HERE.
diff --git a/meta/recipes-devtools/go/go-1.14/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 7aee0bac43..68e8efc1d2 100644
--- a/meta/recipes-devtools/go/go-1.14/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
@@ -1,7 +1,7 @@
-From 10735bb84df17ba657f76835f483cd8543a879c1 Mon Sep 17 00:00:00 2001
+From 7bc891e00be4263311d75aa2b2ee6a3b7b75355f Mon Sep 17 00:00:00 2001
From: Alex Kube <alexander.j.kube@gmail.com>
Date: Wed, 23 Oct 2019 21:18:12 +0430
-Subject: [PATCH 6/9] cmd/dist: separate host and target builds
+Subject: [PATCH] cmd/dist: separate host and target builds
Upstream-Status: Inappropriate [OE specific]
@@ -34,21 +34,24 @@ the meta/recipes-devtools/go tree by
Matt Madison <matt@madison.systems>.
Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+
---
- src/cmd/dist/build.go | 155 ++++++++++++++++++++++++++++++------------
- 1 file changed, 112 insertions(+), 43 deletions(-)
+ src/cmd/dist/build.go | 156 ++++++++++++++++++++++++++++++------------
+ 1 file changed, 113 insertions(+), 43 deletions(-)
+diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
+index d82f612..5c8459c 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
-@@ -41,6 +41,7 @@ var (
- goldflags string
+@@ -43,6 +43,7 @@ var (
+ goexperiment string
workdir string
tooldir string
+ build_tooldir string
oldgoos string
oldgoarch string
exe string
-@@ -53,6 +54,7 @@ var (
+@@ -55,6 +56,7 @@ var (
rebuildall bool
defaultclang bool
@@ -56,7 +59,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
vflag int // verbosity
)
-@@ -249,6 +251,8 @@ func xinit() {
+@@ -251,6 +253,8 @@ func xinit() {
if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
}
@@ -65,7 +68,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
}
// compilerEnv returns a map from "goos/goarch" to the
-@@ -480,8 +484,10 @@ func setup() {
+@@ -496,8 +500,10 @@ func setup() {
p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch)
if rebuildall {
xremoveall(p)
@@ -76,9 +79,9 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
if goos != gohostos || goarch != gohostarch {
p := pathf("%s/pkg/%s_%s", goroot, goos, goarch)
-@@ -1244,12 +1250,29 @@ func cmdbootstrap() {
+@@ -1267,17 +1273,35 @@ func cmdbootstrap() {
- var noBanner bool
+ var noBanner, noClean bool
var debug bool
+ var hostOnly bool
+ var targetOnly bool
@@ -87,12 +90,17 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
+ flag.BoolVar(&noClean, "no-clean", noClean, "print deprecation warning")
+ flag.BoolVar(&hostOnly, "host-only", hostOnly, "build only host binaries, not target")
+ flag.BoolVar(&targetOnly, "target-only", targetOnly, "build only target binaries, not host")
- xflagparse(0)
+ xflagparse(-1)
+ if noClean {
+ xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n")
+ }
+
+ if hostOnly && targetOnly {
+ fatalf("specify only one of --host-only or --target-only\n")
+ }
@@ -104,10 +112,11 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+ fatalf("package names not permitted without --host-only or --target-only\n")
+ }
+ }
++
// Set GOPATH to an internal directory. We shouldn't actually
// need to store files here, since the toolchain won't
// depend on modules outside of vendor directories, but if
-@@ -1303,8 +1326,13 @@ func cmdbootstrap() {
+@@ -1345,8 +1369,13 @@ func cmdbootstrap() {
xprintf("\n")
}
@@ -123,7 +132,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
goBootstrap := pathf("%s/go_bootstrap", tooldir)
cmdGo := pathf("%s/go", gobin)
if debug {
-@@ -1333,7 +1361,11 @@ func cmdbootstrap() {
+@@ -1375,7 +1404,11 @@ func cmdbootstrap() {
xprintf("\n")
}
xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
@@ -133,10 +142,10 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+ } else {
+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
+ }
+ // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT.
+ os.Setenv("GOEXPERIMENT", goexperiment)
goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
- if debug {
- run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
-@@ -1370,50 +1402,84 @@ func cmdbootstrap() {
+@@ -1414,50 +1447,84 @@ func cmdbootstrap() {
}
checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
@@ -188,6 +197,8 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
- timelog("build", "host toolchain")
- if vflag > 0 {
- xprintf("\n")
+- }
+- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
+
+ if goos == oldgoos && goarch == oldgoarch {
+ // Common case - not setting up for cross-compilation.
@@ -219,8 +230,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+ os.Setenv("GOARCH", goarch)
+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
+ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
- }
-- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
++ }
goInstall(goBootstrap, "std", "cmd")
checkNotStale(goBootstrap, "std", "cmd")
checkNotStale(cmdGo, "std", "cmd")
@@ -228,7 +238,12 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
- timelog("build", "target toolchain")
- if vflag > 0 {
- xprintf("\n")
-- }
++ if debug {
++ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
++ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
++ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
++ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
+ }
- goos = oldgoos
- goarch = oldgoarch
- os.Setenv("GOOS", goos)
@@ -249,16 +264,10 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
-+ if debug {
-+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
-+ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
-+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
-+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
-+ }
}
// Check that there are no new files in $GOROOT/bin other than
-@@ -1430,8 +1496,11 @@ func cmdbootstrap() {
+@@ -1474,8 +1541,11 @@ func cmdbootstrap() {
}
}
diff --git a/meta/recipes-devtools/go/go-1.14/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 b93f83de69..4b4d0d4f3d 100644
--- a/meta/recipes-devtools/go/go-1.14/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
@@ -63,7 +63,7 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
// Note that flags consulted by other parts of the code
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
-@@ -464,6 +464,23 @@ func (b *Builder) build(a *Action) (err
+@@ -468,6 +468,23 @@ func (b *Builder) build(a *Action) (err
return errors.New("binary-only packages are no longer supported")
}
@@ -87,8 +87,8 @@ Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
if err := b.Mkdir(a.Objdir); err != nil {
return err
}
-@@ -1493,6 +1510,14 @@ func BuildInstallFunc(b *Builder, a *Act
- return nil
+@@ -1520,6 +1537,14 @@ func BuildInstallFunc(b *Builder, a *Act
+ return err
}
+ if goRootPrecious && a.Package != nil {
diff --git a/meta/recipes-devtools/go/go-1.14/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.18/0008-use-GOBUILDMODE-to-set-buildmode.patch
index b15d9812aa..4e5d5021d6 100644
--- a/meta/recipes-devtools/go/go-1.14/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>
--- a/src/cmd/go/internal/work/build.go
+++ b/src/cmd/go/internal/work/build.go
-@@ -251,7 +251,13 @@ func AddBuildFlags(cmd *base.Command, ma
+@@ -254,7 +254,13 @@ func AddBuildFlags(cmd *base.Command, ma
cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
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
new file mode 100644
index 0000000000..f857b72234
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.18/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
@@ -0,0 +1,94 @@
+From 66a45dae3af140662e17ef85c2e6fe40270a2553 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 22 Feb 2021 17:54:01 -0800
+Subject: [PATCH] Revert "cmd/go: make sure CC and CXX are absolute"
+
+OE uses CC/CXX values which consists of cmpiler and options together,
+secondly, the environment is canned so this check add little value to OE
+based builds
+
+Fixes go-runtime build issues
+
+go 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
+
+This reverts commit aa161e799df7e1eba99d2be10271e76b6f758142.
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/cmd/go/internal/envcmd/env.go | 5 -----
+ src/cmd/go/internal/work/init.go | 6 ------
+ src/cmd/go/testdata/script/env_write.txt | 24 ------------------------
+ 3 files changed, 35 deletions(-)
+
+diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
+index ff6f0d8..43b94e7 100644
+--- a/src/cmd/go/internal/envcmd/env.go
++++ b/src/cmd/go/internal/envcmd/env.go
+@@ -457,11 +457,6 @@ func checkEnvWrite(key, val string) error {
+ if !filepath.IsAbs(val) && val != "" {
+ return fmt.Errorf("GOPATH entry is relative; must be absolute path: %q", val)
+ }
+- // Make sure CC and CXX are absolute paths
+- case "CC", "CXX", "GOMODCACHE":
+- if !filepath.IsAbs(val) && val != "" && val != filepath.Base(val) {
+- return fmt.Errorf("%s entry is relative; must be absolute path: %q", key, val)
+- }
+ }
+
+ if !utf8.ValidString(val) {
+diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
+index 37a3e2d..316b0cf 100644
+--- a/src/cmd/go/internal/work/init.go
++++ b/src/cmd/go/internal/work/init.go
+@@ -39,12 +39,6 @@ func BuildInit() {
+ cfg.BuildPkgdir = p
+ }
+
+- // Make sure CC and CXX are absolute paths
+- for _, key := range []string{"CC", "CXX"} {
+- if path := cfg.Getenv(key); !filepath.IsAbs(path) && path != "" && path != filepath.Base(path) {
+- base.Fatalf("go %s: %s environment variable is relative; must be absolute path: %s\n", flag.Args()[0], key, path)
+- }
+- }
+ }
+
+ func instrumentInit() {
+diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt
+index b5e9739..566c876 100644
+--- a/src/cmd/go/testdata/script/env_write.txt
++++ b/src/cmd/go/testdata/script/env_write.txt
+@@ -129,30 +129,6 @@ go env -w GOTMPDIR=
+ go env GOTMPDIR
+ stdout ^$
+
+-# go env -w rejects relative CC values
+-[!windows] go env -w CC=/usr/bin/clang
+-go env -w CC=clang
+-[!windows] ! go env -w CC=./clang
+-[!windows] ! go env -w CC=bin/clang
+-[!windows] stderr 'go env -w: CC entry is relative; must be absolute path'
+-
+-[windows] go env -w CC=$WORK\bin\clang
+-[windows] ! go env -w CC=.\clang
+-[windows] ! go env -w CC=bin\clang
+-[windows] stderr 'go env -w: CC entry is relative; must be absolute path'
+-
+-# go env -w rejects relative CXX values
+-[!windows] go env -w CC=/usr/bin/cpp
+-go env -w CXX=cpp
+-[!windows] ! go env -w CXX=./cpp
+-[!windows] ! go env -w CXX=bin/cpp
+-[!windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
+-
+-[windows] go env -w CXX=$WORK\bin\cpp
+-[windows] ! go env -w CXX=.\cpp
+-[windows] ! go env -w CXX=bin\cpp
+-[windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
+-
+ # go env -w/-u checks validity of GOOS/ARCH combinations
+ env GOOS=
+ env GOARCH=
+--
+2.20.1
+
diff --git a/meta/recipes-devtools/go/go-binary-native_1.14.4.bb b/meta/recipes-devtools/go/go-binary-native_1.17.8.bb
index 72c988944f..1b85cd50d6 100644
--- a/meta/recipes-devtools/go/go-binary-native_1.14.4.bb
+++ b/meta/recipes-devtools/go/go-binary-native_1.17.8.bb
@@ -8,8 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
PROVIDES = "go-native"
SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
-SRC_URI[go_linux_amd64.sha256sum] = "aed845e4185a0b2a3c3d5e1d0a35491702c55889192bb9c30e67a3de6849c067"
-SRC_URI[go_linux_arm64.sha256sum] = "05dc46ada4e23a1f58e72349f7c366aae2e9c7a7f1e7653095538bc5bba5e077"
+SRC_URI[go_linux_amd64.sha256sum] = "980e65a863377e69fd9b67df9d8395fd8e93858e7a24c9f55803421e453f4f99"
+SRC_URI[go_linux_arm64.sha256sum] = "57a9171682e297df1a5bd287be056ed0280195ad079af90af16dcad4f64710cb"
UPSTREAM_CHECK_URI = "https://golang.org/dl/"
UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"
diff --git a/meta/recipes-devtools/go/go-common.inc b/meta/recipes-devtools/go/go-common.inc
index f18d928c70..83f8db7b39 100644
--- a/meta/recipes-devtools/go/go-common.inc
+++ b/meta/recipes-devtools/go/go-common.inc
@@ -14,7 +14,7 @@ LICENSE = "BSD-3-Clause"
inherit goarch
-SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz;name=main"
+SRC_URI = "https://golang.org/dl/go${PV}.src.tar.gz;name=main"
S = "${WORKDIR}/go"
B = "${S}"
UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.src\.tar"
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
SSTATE_SCAN_CMD = "true"
export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
GOTMPDIR[vardepvalue] = ""
export CGO_ENABLED = "1"
@@ -37,6 +37,8 @@ export GO386 ?= "${TARGET_GO386}"
export GOMIPS ?= "${TARGET_GOMIPS}"
export GOROOT_FINAL ?= "${libdir}/go"
-do_compile_prepend() {
+export GODEBUG = "gocachehash=1"
+
+do_compile:prepend() {
BUILD_CC=${BUILD_CC}
}
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc
index d49250a8e2..c1aa987427 100644
--- a/meta/recipes-devtools/go/go-cross-canadian.inc
+++ b/meta/recipes-devtools/go/go-cross-canadian.inc
@@ -27,7 +27,6 @@ do_compile() {
./make.bash --host-only --no-banner
cd ${B}
}
-do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.14.bb b/meta/recipes-devtools/go/go-cross-canadian_1.17.8.bb
index 7ac9449e47..7ac9449e47 100644
--- a/meta/recipes-devtools/go/go-cross-canadian_1.14.bb
+++ b/meta/recipes-devtools/go/go-cross-canadian_1.17.8.bb
diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc
index 3d5803bf07..a0fbdbe3b9 100644
--- a/meta/recipes-devtools/go/go-cross.inc
+++ b/meta/recipes-devtools/go/go-cross.inc
@@ -17,7 +17,6 @@ do_compile() {
./make.bash --host-only --no-banner
cd ${B}
}
-do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
make_wrapper() {
diff --git a/meta/recipes-devtools/go/go-cross_1.14.bb b/meta/recipes-devtools/go/go-cross_1.17.8.bb
index 80b5a03f6c..80b5a03f6c 100644
--- a/meta/recipes-devtools/go/go-cross_1.14.bb
+++ b/meta/recipes-devtools/go/go-cross_1.17.8.bb
diff --git a/meta/recipes-devtools/go/go-crosssdk.inc b/meta/recipes-devtools/go/go-crosssdk.inc
index f0bec79719..cd23cca2fe 100644
--- a/meta/recipes-devtools/go/go-crosssdk.inc
+++ b/meta/recipes-devtools/go/go-crosssdk.inc
@@ -13,7 +13,6 @@ do_compile() {
./make.bash --host-only --no-banner
cd ${B}
}
-do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
make_wrapper() {
diff --git a/meta/recipes-devtools/go/go-crosssdk_1.14.bb b/meta/recipes-devtools/go/go-crosssdk_1.17.8.bb
index 1857c8a577..1857c8a577 100644
--- a/meta/recipes-devtools/go/go-crosssdk_1.14.bb
+++ b/meta/recipes-devtools/go/go-crosssdk_1.17.8.bb
diff --git a/meta/recipes-devtools/go/go-dep/0001-Add-support-for-mips-mips64.patch b/meta/recipes-devtools/go/go-dep/0001-Add-support-for-mips-mips64.patch
deleted file mode 100644
index 34ec9876f8..0000000000
--- a/meta/recipes-devtools/go/go-dep/0001-Add-support-for-mips-mips64.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From f0fb80604385ae3266a472601ef685896b4cc0af Mon Sep 17 00:00:00 2001
-From: Vladimir Stefanovic <vladimir.stefanovic@imgtec.com>
-Date: Fri, 17 Feb 2017 20:44:43 +0100
-Subject: [PATCH] Add support for mips, mips64
-
----
-Upstream-Status: Submitted
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
- vendor/github.com/boltdb/bolt/bolt_mips64x.go | 12 ++++++++++++
- vendor/github.com/boltdb/bolt/bolt_mipsx.go | 12 ++++++++++++
- 2 files changed, 24 insertions(+)
- create mode 100644 vendor/github.com/boltdb/bolt/bolt_mips64x.go
- create mode 100644 vendor/github.com/boltdb/bolt/bolt_mipsx.go
-
-diff --git a/vendor/github.com/boltdb/bolt/bolt_mips64x.go b/vendor/github.com/boltdb/bolt/bolt_mips64x.go
-new file mode 100644
-index 00000000..134b578b
---- /dev/null
-+++ b/vendor/github.com/boltdb/bolt/bolt_mips64x.go
-@@ -0,0 +1,12 @@
-+// +build mips64 mips64le
-+
-+package bolt
-+
-+// maxMapSize represents the largest mmap size supported by Bolt.
-+const maxMapSize = 0x8000000000 // 512GB
-+
-+// maxAllocSize is the size used when creating array pointers.
-+const maxAllocSize = 0x7FFFFFFF
-+
-+// Are unaligned load/stores broken on this arch?
-+var brokenUnaligned = false
-diff --git a/vendor/github.com/boltdb/bolt/bolt_mipsx.go b/vendor/github.com/boltdb/bolt/bolt_mipsx.go
-new file mode 100644
-index 00000000..d5ecb059
---- /dev/null
-+++ b/vendor/github.com/boltdb/bolt/bolt_mipsx.go
-@@ -0,0 +1,12 @@
-+// +build mips mipsle
-+
-+package bolt
-+
-+// maxMapSize represents the largest mmap size supported by Bolt.
-+const maxMapSize = 0x40000000 // 1GB
-+
-+// maxAllocSize is the size used when creating array pointers.
-+const maxAllocSize = 0xFFFFFFF
-+
-+// Are unaligned load/stores broken on this arch?
-+var brokenUnaligned = false
---
-2.14.1
-
diff --git a/meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch b/meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch
deleted file mode 100644
index 4d97d48243..0000000000
--- a/meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 5e051669d117d7cd9b24cea3494959eec396ec1e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 25 Jan 2020 22:37:25 -0800
-Subject: [PATCH] /bolt_riscv64: Add support for riscv64
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- vendor/github.com/boltdb/bolt/bolt_riscv64.go | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
- create mode 100644 vendor/github.com/boltdb/bolt/bolt_riscv64.go
-
-diff --git a/vendor/github.com/boltdb/bolt/bolt_riscv64.go b/vendor/github.com/boltdb/bolt/bolt_riscv64.go
-new file mode 100644
-index 00000000..3d6b88d4
---- /dev/null
-+++ b/vendor/github.com/boltdb/bolt/bolt_riscv64.go
-@@ -0,0 +1,12 @@
-+// +build riscv64
-+
-+package bolt
-+
-+// maxMapSize represents the largest mmap size supported by Bolt.
-+const maxMapSize = 0xFFFFFFFFFFFF // 256TB
-+
-+// maxAllocSize is the size used when creating array pointers.
-+const maxAllocSize = 0x7FFFFFFF
-+
-+// Are unaligned load/stores broken on this arch?
-+var brokenUnaligned = false
---
-2.25.0
-
diff --git a/meta/recipes-devtools/go/go-dep_0.5.4.bb b/meta/recipes-devtools/go/go-dep_0.5.4.bb
deleted file mode 100644
index 496224a5cf..0000000000
--- a/meta/recipes-devtools/go/go-dep_0.5.4.bb
+++ /dev/null
@@ -1,29 +0,0 @@
-SUMMARY = "Dependency management tool for Golang"
-HOMEPAGE = "https://github.com/golang/dep"
-LICENSE = "BSD-3-Clause"
-LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=1bad315647751fab0007812f70d42c0d"
-
-GO_IMPORT = "github.com/golang/dep"
-SRC_URI = "git://${GO_IMPORT} \
- file://0001-Add-support-for-mips-mips64.patch;patchdir=src/github.com/golang/dep \
- file://0001-bolt_riscv64-Add-support-for-riscv64.patch;patchdir=src/github.com/golang/dep \
- "
-
-SRCREV = "1f7c19e5f52f49ffb9f956f64c010be14683468b"
-
-inherit go
-
-# New Go versions has Go modules support enabled by default and cause the Glide
-# tool build to fail.
-export GO111MODULE = "off"
-
-GO_INSTALL = "${GO_IMPORT}/cmd/dep"
-
-RDEPENDS_${PN}-dev += "bash"
-
-BBCLASSEXTEND = "native nativesdk"
-
-# For compiling ptest on mips and mips64, the current go-dep version fails with the go 1.11 toolchain.
-# error message: vet config not found
-PTEST_ENABLED_mips = "0"
-PTEST_ENABLED_mips64 = "0"
diff --git a/meta/recipes-devtools/go/go-native_1.14.bb b/meta/recipes-devtools/go/go-native_1.17.8.bb
index c5cb97e73e..76c0ab73a6 100644
--- a/meta/recipes-devtools/go/go-native_1.14.bb
+++ b/meta/recipes-devtools/go/go-native_1.17.8.bb
@@ -5,8 +5,7 @@ require go-${PV}.inc
inherit native
-SRC_URI_append = " https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4"
-SRC_URI[bootstrap.md5sum] = "dbf727a4b0e365bf88d97cbfde590016"
+SRC_URI:append = " https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4"
SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52"
export GOOS = "${BUILD_GOOS}"
@@ -28,7 +27,6 @@ do_compile() {
./make.bash ${GOMAKEARGS}
cd ${B}
}
-do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin"
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin"
make_wrapper() {
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
index 21179a83a0..e18339cddb 100644
--- a/meta/recipes-devtools/go/go-runtime.inc
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -1,11 +1,17 @@
DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
-DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
+DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
+DEBUG_PREFIX_MAP = "\
+ -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+ -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
export CGO_CFLAGS = "${CFLAGS}"
export CGO_CPPFLAGS = "${CPPFLAGS}"
export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+# Filter out -fdebug-prefix-map options as they clash with the GO's build system
+export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f: not f.startswith('-fdebug-prefix-map'), d.getVar('LDFLAGS').split())) }"
export GOCACHE = "${B}/.cache"
GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
@@ -15,7 +21,7 @@ do_configure() {
:
}
-do_configure_libc-musl() {
+do_configure:libc-musl() {
rm -f ${S}/src/runtime/race/*.syso
}
@@ -32,7 +38,6 @@ do_compile() {
fi
cd ${B}
}
-do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
do_install() {
@@ -55,9 +60,9 @@ do_install() {
}
-ALLOW_EMPTY_${PN} = "1"
-FILES_${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}"
-FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
+ALLOW_EMPTY:${PN} = "1"
+FILES:${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}"
+FILES:${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.shlibname \
${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.shlibname \
${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.shlibname \
@@ -73,12 +78,12 @@ FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \
${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \
"
-FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}"
+FILES:${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}"
# Go sources include some scripts and pre-built binaries for
# multiple architectures. The static .a files for dynamically-linked
# runtime are also required in -dev.
-INSANE_SKIP_${PN}-dev = "staticdev file-rdeps arch"
+INSANE_SKIP:${PN}-dev = "staticdev file-rdeps arch"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta/recipes-devtools/go/go-runtime_1.14.bb b/meta/recipes-devtools/go/go-runtime_1.17.8.bb
index 43b68b4e46..63464a1501 100644
--- a/meta/recipes-devtools/go/go-runtime_1.14.bb
+++ b/meta/recipes-devtools/go/go-runtime_1.17.8.bb
@@ -1,2 +1,3 @@
require go-${PV}.inc
require go-runtime.inc
+
diff --git a/meta/recipes-devtools/go/go-target.inc b/meta/recipes-devtools/go/go-target.inc
index 8e44247031..d085643036 100644
--- a/meta/recipes-devtools/go/go-target.inc
+++ b/meta/recipes-devtools/go/go-target.inc
@@ -1,12 +1,23 @@
DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
-DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
+DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
+
+DEBUG_PREFIX_MAP = "\
+ -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+ -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+# Filter out -fdebug-prefix-map options as they clash with the GO's build system
+export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f: not f.startswith('-fdebug-prefix-map'), d.getVar('LDFLAGS').split())) }"
export GOCACHE = "${B}/.cache"
GO_LDFLAGS = ""
-GO_LDFLAGS_class-nativesdk = "-linkmode external"
+GO_LDFLAGS:class-nativesdk = "-linkmode external"
export GO_LDFLAGS
-CC_append_class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}"
+CC:append:class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}"
do_configure[noexec] = "1"
@@ -18,7 +29,6 @@ do_compile() {
./make.bash --target-only --no-banner
cd ${B}
}
-do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
do_install() {
@@ -38,8 +48,8 @@ do_install() {
}
PACKAGES = "${PN} ${PN}-dev"
-FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
-RDEPENDS_${PN} = "go-runtime"
-INSANE_SKIP_${PN} = "ldflags"
+FILES:${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
+RDEPENDS:${PN} = "go-runtime"
+INSANE_SKIP:${PN} = "ldflags"
BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-devtools/go/go_1.14.bb b/meta/recipes-devtools/go/go_1.14.bb
deleted file mode 100644
index 5d40cf9d04..0000000000
--- a/meta/recipes-devtools/go/go_1.14.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-require go-${PV}.inc
-require go-target.inc
-
-export GOBUILDMODE=""
-
-# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips/riscv
-# doesn't support -buildmode=pie, so skip the QA checking for mips/riscv and its
-# variants.
-python() {
- if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True):
- d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel")
- else:
- d.setVar('GOBUILDMODE', 'pie')
-}
diff --git a/meta/recipes-devtools/go/go_1.17.8.bb b/meta/recipes-devtools/go/go_1.17.8.bb
new file mode 100644
index 0000000000..34dc89bb0c
--- /dev/null
+++ b/meta/recipes-devtools/go/go_1.17.8.bb
@@ -0,0 +1,17 @@
+require go-${PV}.inc
+require go-target.inc
+
+inherit linuxloader
+
+export GOBUILDMODE=""
+export GO_LDSO = "${@get_linuxloader(d)}"
+export CC_FOR_TARGET = "gcc"
+export CXX_FOR_TARGET = "g++"
+
+# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv32 and its
+# variants.
+python() {
+ if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv32' in d.getVar('TARGET_ARCH',True):
+ d.appendVar('INSANE_SKIP:%s' % d.getVar('PN',True), " textrel")
+}
+