From cedb3aa8173a9443fec5adee8419d2f505bc304c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 23 Feb 2021 20:13:18 -0800 Subject: go: Upgrade compiler to 1.16 major release Revert a CC/CXX check [1] which wont work with OE settings Forward port needed patches forward Details releaase notes are here [2] [1] https://go-review.googlesource.com/c/go/+/228517/ [2] https://golang.org/doc/go1.16 (From OE-Core rev: 5c41c6ed4e2e70d18b32c460b8c8e1aadd54584f) Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- meta/conf/distro/include/tcmode-default.inc | 2 +- meta/recipes-devtools/go/go-1.15.inc | 19 -- ...1-allow-CC-and-CXX-to-have-multiple-words.patch | 33 --- ...-content-based-hash-generation-less-pedan.patch | 219 ---------------- ...OLDIR-to-be-overridden-in-the-environment.patch | 47 ---- .../0004-ld-add-soname-to-shareable-objects.patch | 45 ---- ...verride-CC-when-building-dist-and-go_boot.patch | 39 --- ...-cmd-dist-separate-host-and-target-builds.patch | 274 --------------------- ...07-cmd-go-make-GOROOT-precious-by-default.patch | 104 -------- .../0008-use-GOBUILDMODE-to-set-buildmode.patch | 42 ---- meta/recipes-devtools/go/go-1.16.inc | 20 ++ ...1-allow-CC-and-CXX-to-have-multiple-words.patch | 33 +++ ...-content-based-hash-generation-less-pedan.patch | 219 ++++++++++++++++ ...OLDIR-to-be-overridden-in-the-environment.patch | 47 ++++ .../0004-ld-add-soname-to-shareable-objects.patch | 45 ++++ ...verride-CC-when-building-dist-and-go_boot.patch | 39 +++ ...-cmd-dist-separate-host-and-target-builds.patch | 274 +++++++++++++++++++++ ...07-cmd-go-make-GOROOT-precious-by-default.patch | 104 ++++++++ .../0008-use-GOBUILDMODE-to-set-buildmode.patch | 42 ++++ ...-cmd-go-make-sure-CC-and-CXX-are-absolute.patch | 95 +++++++ .../recipes-devtools/go/go-binary-native_1.15.8.bb | 46 ---- meta/recipes-devtools/go/go-binary-native_1.16.bb | 46 ++++ meta/recipes-devtools/go/go-cross-canadian_1.15.bb | 2 - meta/recipes-devtools/go/go-cross-canadian_1.16.bb | 2 + meta/recipes-devtools/go/go-cross_1.15.bb | 2 - meta/recipes-devtools/go/go-cross_1.16.bb | 2 + meta/recipes-devtools/go/go-crosssdk_1.15.bb | 2 - meta/recipes-devtools/go/go-crosssdk_1.16.bb | 2 + meta/recipes-devtools/go/go-native_1.15.bb | 59 ----- meta/recipes-devtools/go/go-native_1.16.bb | 59 +++++ meta/recipes-devtools/go/go-runtime_1.15.bb | 4 - meta/recipes-devtools/go/go-runtime_1.16.bb | 4 + meta/recipes-devtools/go/go_1.15.bb | 18 -- meta/recipes-devtools/go/go_1.16.bb | 18 ++ 34 files changed, 1052 insertions(+), 956 deletions(-) delete mode 100644 meta/recipes-devtools/go/go-1.15.inc delete mode 100644 meta/recipes-devtools/go/go-1.15/0001-allow-CC-and-CXX-to-have-multiple-words.patch delete mode 100644 meta/recipes-devtools/go/go-1.15/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch delete mode 100644 meta/recipes-devtools/go/go-1.15/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch delete mode 100644 meta/recipes-devtools/go/go-1.15/0004-ld-add-soname-to-shareable-objects.patch delete mode 100644 meta/recipes-devtools/go/go-1.15/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch delete mode 100644 meta/recipes-devtools/go/go-1.15/0006-cmd-dist-separate-host-and-target-builds.patch delete mode 100644 meta/recipes-devtools/go/go-1.15/0007-cmd-go-make-GOROOT-precious-by-default.patch delete mode 100644 meta/recipes-devtools/go/go-1.15/0008-use-GOBUILDMODE-to-set-buildmode.patch create mode 100644 meta/recipes-devtools/go/go-1.16.inc create mode 100644 meta/recipes-devtools/go/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0004-ld-add-soname-to-shareable-objects.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch create mode 100644 meta/recipes-devtools/go/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch delete mode 100644 meta/recipes-devtools/go/go-binary-native_1.15.8.bb create mode 100644 meta/recipes-devtools/go/go-binary-native_1.16.bb delete mode 100644 meta/recipes-devtools/go/go-cross-canadian_1.15.bb create mode 100644 meta/recipes-devtools/go/go-cross-canadian_1.16.bb delete mode 100644 meta/recipes-devtools/go/go-cross_1.15.bb create mode 100644 meta/recipes-devtools/go/go-cross_1.16.bb delete mode 100644 meta/recipes-devtools/go/go-crosssdk_1.15.bb create mode 100644 meta/recipes-devtools/go/go-crosssdk_1.16.bb delete mode 100644 meta/recipes-devtools/go/go-native_1.15.bb create mode 100644 meta/recipes-devtools/go/go-native_1.16.bb delete mode 100644 meta/recipes-devtools/go/go-runtime_1.15.bb create mode 100644 meta/recipes-devtools/go/go-runtime_1.16.bb delete mode 100644 meta/recipes-devtools/go/go_1.15.bb create mode 100644 meta/recipes-devtools/go/go_1.16.bb (limited to 'meta') diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc index 8df328dc0d..8e454f74a5 100644 --- a/meta/conf/distro/include/tcmode-default.inc +++ b/meta/conf/distro/include/tcmode-default.inc @@ -23,7 +23,7 @@ GDBVERSION ?= "10.%" GLIBCVERSION ?= "2.33" LINUXLIBCVERSION ?= "5.10%" QEMUVERSION ?= "5.2%" -GOVERSION ?= "1.15%" +GOVERSION ?= "1.16%" # This can not use wildcards like 8.0.% since it is also used in mesa to denote # llvm version being used, so always bump it with llvm recipe version bump LLVMVERSION ?= "10.0.1" diff --git a/meta/recipes-devtools/go/go-1.15.inc b/meta/recipes-devtools/go/go-1.15.inc deleted file mode 100644 index 7c8190f68c..0000000000 --- a/meta/recipes-devtools/go/go-1.15.inc +++ /dev/null @@ -1,19 +0,0 @@ -require go-common.inc - -GO_BASEVERSION = "1.15" -PV = "1.15.8" -FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" - -SRC_URI += "\ - file://0001-allow-CC-and-CXX-to-have-multiple-words.patch \ - file://0002-cmd-go-make-content-based-hash-generation-less-pedan.patch \ - file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \ - file://0004-ld-add-soname-to-shareable-objects.patch \ - file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \ - 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 \ -" -SRC_URI[main.sha256sum] = "540c0ab7781084d124991321ed1458e479982de94454a98afab6acadf38497c2" diff --git a/meta/recipes-devtools/go/go-1.15/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/meta/recipes-devtools/go/go-1.15/0001-allow-CC-and-CXX-to-have-multiple-words.patch deleted file mode 100644 index 5f4823be22..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0001-allow-CC-and-CXX-to-have-multiple-words.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9e3dc44cdfa58d96504d0a789dc82617dd5bef55 Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:01:13 +0430 -Subject: [PATCH 1/9] cmd/go: Allow CC and CXX to have multiple words - -Upstream-Status: Inappropriate [OE specific] - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Matt Madison . - -Signed-off-by: Alexander J Kube - ---- - src/cmd/go/internal/envcmd/env.go | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/src/cmd/go/internal/envcmd/env.go -+++ b/src/cmd/go/internal/envcmd/env.go -@@ -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 { -- cc = env[0] -+ cc = strings.Join(env, " ") - } - cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch) - if env := strings.Fields(cfg.Getenv("CXX")); len(env) > 0 { -- cxx = env[0] -+ cxx = strings.Join(env, " ") - } - env = append(env, cfg.EnvVar{Name: "AR", Value: envOr("AR", "ar")}) - env = append(env, cfg.EnvVar{Name: "CC", Value: cc}) diff --git a/meta/recipes-devtools/go/go-1.15/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/meta/recipes-devtools/go/go-1.15/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch deleted file mode 100644 index d0511c0c40..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch +++ /dev/null @@ -1,219 +0,0 @@ -From a13ae484e41139094505d2834437e9262a5315f7 Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:14:22 +0430 -Subject: [PATCH 2/9] cmd/go: make content-based hash generation less pedantic - -Upstream-Status: Inappropriate [OE specific] - -Go 1.10's build tool now uses content-based hashes to -determine when something should be built or re-built. -This same mechanism is used to maintain a built-artifact -cache for speeding up builds. - -However, the hashes it generates include information that -doesn't work well with OE, nor with using a shared runtime -library. - -First, it embeds path names to source files, unless -building within GOROOT. This prevents the building -of a package in GOPATH for later staging into GOROOT. - -This patch adds support for the environment variable -GOPATH_OMIT_IN_ACTIONID. If present, path name -embedding is disabled. - -Second, if cgo is enabled, the build ID for cgo-related -packages will include the current value of the environment -variables for invoking the compiler (CC, CXX, FC) and -any CGO_xxFLAGS variables. Only if the settings used -during a compilation exactly match, character for character, -the values used for compiling runtime/cgo or any other -cgo-enabled package being imported, will the tool -decide that the imported package is up-to-date. - -This is done to help ensure correctness, but is overly -simplistic and effectively prevents the reuse of built -artifacts that use cgo (or shared runtime, which includes -runtime/cgo). - -This patch filters out all compiler flags except those -beginning with '-m'. The default behavior can be restored -by setting the CGO_PEDANTIC environment variable. - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Matt Madison . - -Signed-off-by: Alexander J Kube ---- - src/cmd/go/internal/envcmd/env.go | 2 +- - src/cmd/go/internal/work/exec.go | 66 ++++++++++++++++++++++--------- - 2 files changed, 49 insertions(+), 19 deletions(-) - ---- a/src/cmd/go/internal/envcmd/env.go -+++ b/src/cmd/go/internal/envcmd/env.go -@@ -157,7 +157,7 @@ func ExtraEnvVars() []cfg.EnvVar { - func ExtraEnvVarsCostly() []cfg.EnvVar { - var b work.Builder - b.Init() -- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}) -+ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false) - if err != nil { - // Should not happen - b.CFlags was given an empty package. - fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err) ---- a/src/cmd/go/internal/work/exec.go -+++ b/src/cmd/go/internal/work/exec.go -@@ -33,6 +33,8 @@ import ( - "cmd/go/internal/str" - ) - -+var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != "" -+ - // 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 { -@@ -209,7 +211,7 @@ func (b *Builder) buildActionID(a *Actio - // 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. -- if !p.Goroot && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) { -+ if !p.Goroot && !omitGopath && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) { - 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) -@@ -228,13 +230,13 @@ func (b *Builder) buildActionID(a *Actio - } - if len(p.CgoFiles)+len(p.SwigFiles) > 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) - } - 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) - } - // TODO(rsc): Should we include the SWIG version or Fortran/GCC/G++/Objective-C compiler versions? - } -@@ -2298,33 +2300,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 { -- return b.compilerCmd(b.ccExe(), incdir, workdir) -+ return b.compilerCmd(b.ccExe(false), incdir, workdir) - } - - // gxxCmd returns a g++ command line prefix - // defaultCXX is defined in zdefaultcc.go, written by cmd/dist. - func (b *Builder) GxxCmd(incdir, workdir string) []string { -- return b.compilerCmd(b.cxxExe(), incdir, workdir) -+ return b.compilerCmd(b.cxxExe(false), incdir, workdir) - } - - // gfortranCmd returns a gfortran command line prefix. - func (b *Builder) gfortranCmd(incdir, workdir string) []string { -- return b.compilerCmd(b.fcExe(), incdir, workdir) -+ return b.compilerCmd(b.fcExe(false), incdir, workdir) - } - - // ccExe returns the CC compiler setting without all the extra flags we add implicitly. --func (b *Builder) ccExe() []string { -- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch)) -+func (b *Builder) ccExe(filtered bool) []string { -+ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered) - } - - // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly. --func (b *Builder) cxxExe() []string { -- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch)) -+func (b *Builder) cxxExe(filtered bool) []string { -+ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered) - } - - // fcExe returns the FC compiler setting without all the extra flags we add implicitly. --func (b *Builder) fcExe() []string { -- return b.compilerExe(cfg.Getenv("FC"), "gfortran") -+func (b *Builder) fcExe(filtered bool) []string { -+ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered) -+} -+ -+var filterFlags = os.Getenv("CGO_PEDANTIC") == "" -+ -+func filterCompilerFlags(flags []string) []string { -+ var newflags []string -+ if !filterFlags { -+ return flags -+ } -+ for _, flag := range flags { -+ if strings.HasPrefix(flag, "-m") { -+ newflags = append(newflags, flag) -+ } -+ } -+ return newflags - } - - // compilerExe returns the compiler to use given an -@@ -2333,11 +2350,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"]. --func (b *Builder) compilerExe(envValue string, def string) []string { -+func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string { - compiler := strings.Fields(envValue) - if len(compiler) == 0 { - compiler = []string{def} - } -+ -+ if filtered { -+ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...) -+ } -+ - return compiler - } - -@@ -2510,7 +2532,7 @@ func envList(key, def string) []string { - } - - // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo. --func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) { -+func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) { - defaults := "-g -O2" - - if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil { -@@ -2529,6 +2551,14 @@ func (b *Builder) CFlags(p *load.Package - return - } - -+ if filtered { -+ cppflags = filterCompilerFlags(cppflags) -+ cflags = filterCompilerFlags(cflags) -+ cxxflags = filterCompilerFlags(cxxflags) -+ fflags = filterCompilerFlags(fflags) -+ ldflags = filterCompilerFlags(ldflags) -+ } -+ - return - } - -@@ -2543,7 +2573,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 -- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p) -+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false) - if err != nil { - return nil, nil, err - } -@@ -2902,7 +2932,7 @@ func (b *Builder) swigIntSize(objdir str - - // 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) { -- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p) -+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false) - if err != nil { - return "", "", err - } diff --git a/meta/recipes-devtools/go/go-1.15/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/meta/recipes-devtools/go/go-1.15/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch deleted file mode 100644 index 662c705471..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 28ada8896b76d620240bafc22aa395071d601482 Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:15:37 +0430 -Subject: [PATCH 3/9] cmd/go: Allow GOTOOLDIR to be overridden in the environment - -to allow for split host/target build roots - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Matt Madison . - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Alexander J Kube ---- - src/cmd/dist/build.go | 4 +++- - src/cmd/go/internal/cfg/cfg.go | 6 +++++- - 2 files changed, 8 insertions(+), 2 deletions(-) - ---- a/src/cmd/dist/build.go -+++ b/src/cmd/dist/build.go -@@ -246,7 +246,9 @@ func xinit() { - workdir = xworkdir() - xatexit(rmworkdir) - -- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) -+ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" { -+ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) -+ } - } - - // compilerEnv returns a map from "goos/goarch" to the ---- a/src/cmd/go/internal/cfg/cfg.go -+++ b/src/cmd/go/internal/cfg/cfg.go -@@ -64,7 +64,11 @@ func defaultContext() build.Context { - // variables. This matches the initialization of ToolDir in - // go/build, except for using ctxt.GOROOT rather than - // runtime.GOROOT. -- build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) -+ if s := os.Getenv("GOTOOLDIR"); s != "" { -+ build.ToolDir = filepath.Clean(s) -+ } else { -+ build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) -+ } - } - - ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH) diff --git a/meta/recipes-devtools/go/go-1.15/0004-ld-add-soname-to-shareable-objects.patch b/meta/recipes-devtools/go/go-1.15/0004-ld-add-soname-to-shareable-objects.patch deleted file mode 100644 index da29923920..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0004-ld-add-soname-to-shareable-objects.patch +++ /dev/null @@ -1,45 +0,0 @@ -From bf5cf5301ae5914498454c87293d1df2e1d8489f Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:16:32 +0430 -Subject: [PATCH 4/9] ld: add soname to shareable objects - -so that OE's shared library dependency handling -can find them. - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Matt Madison . - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Alexander J Kube ---- - src/cmd/link/internal/ld/lib.go | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/src/cmd/link/internal/ld/lib.go -+++ b/src/cmd/link/internal/ld/lib.go -@@ -1446,6 +1446,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. -@@ -1457,6 +1458,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))) - case BuildModePlugin: - if ctxt.HeadType == objabi.Hdarwin { - argv = append(argv, "-dynamiclib") -@@ -1465,6 +1467,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))) - } - } - diff --git a/meta/recipes-devtools/go/go-1.15/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/meta/recipes-devtools/go/go-1.15/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch deleted file mode 100644 index 59c12d9546..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch +++ /dev/null @@ -1,39 +0,0 @@ -From f05ef3ded52b98537c10efd0b15cd9612471524d Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:17:16 +0430 -Subject: [PATCH 5/9] make.bash: override CC when building dist and - go_bootstrap - -for handling OE cross-canadian builds. - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Matt Madison . - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Alexander J Kube ---- - src/make.bash | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/src/make.bash -+++ b/src/make.bash -@@ -178,7 +178,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; - exit 1 - fi - rm -f cmd/dist/dist --GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist -+CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist - - # -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 - # 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 "$@" - rm -f ./cmd/dist/dist - - # DO NOT ADD ANY NEW CODE HERE. diff --git a/meta/recipes-devtools/go/go-1.15/0006-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go-1.15/0006-cmd-dist-separate-host-and-target-builds.patch deleted file mode 100644 index 7aee0bac43..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0006-cmd-dist-separate-host-and-target-builds.patch +++ /dev/null @@ -1,274 +0,0 @@ -From 10735bb84df17ba657f76835f483cd8543a879c1 Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:18:12 +0430 -Subject: [PATCH 6/9] cmd/dist: separate host and target builds - -Upstream-Status: Inappropriate [OE specific] - -Change the dist tool to allow for OE-style cross- -and cross-canadian builds: - - - command flags --host-only and --target only are added; - if one is present, the other changes mentioned below - take effect, and arguments may also be specified on - the command line to enumerate the package(s) to be - built. - - - for OE cross builds, go_bootstrap is always built for - the current build host, and is moved, along with the supporting - toolchain (asm, compile, etc.) to a separate 'native_native' - directory under GOROOT/pkg/tool. - - - go_bootstrap is not automatically removed after the build, - so it can be reused later (e.g., building both static and - shared runtime). - -Note that for --host-only builds, it would be nice to specify -just the "cmd" package to build only the go commands/tools, -the staleness checks in the dist tool will fail if the "std" -library has not also been built. So host-only builds have to -build everything anyway. - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Matt Madison . - -Signed-off-by: Alexander J Kube ---- - src/cmd/dist/build.go | 155 ++++++++++++++++++++++++++++++------------ - 1 file changed, 112 insertions(+), 43 deletions(-) - ---- a/src/cmd/dist/build.go -+++ b/src/cmd/dist/build.go -@@ -41,6 +41,7 @@ var ( - goldflags string - workdir string - tooldir string -+ build_tooldir string - oldgoos string - oldgoarch string - exe string -@@ -53,6 +54,7 @@ var ( - - rebuildall bool - defaultclang bool -+ crossBuild bool - - vflag int // verbosity - ) -@@ -249,6 +251,8 @@ func xinit() { - if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" { - tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) - } -+ -+ build_tooldir = pathf("%s/pkg/tool/native_native", goroot) - } - - // compilerEnv returns a map from "goos/goarch" to the -@@ -480,8 +484,10 @@ func setup() { - p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch) - if rebuildall { - xremoveall(p) -+ xremoveall(build_tooldir) - } - xmkdirall(p) -+ xmkdirall(build_tooldir) - - if goos != gohostos || goarch != gohostarch { - p := pathf("%s/pkg/%s_%s", goroot, goos, goarch) -@@ -1244,12 +1250,29 @@ func cmdbootstrap() { - - var noBanner bool - var debug bool -+ var hostOnly bool -+ var targetOnly bool -+ var toBuild = []string{"std", "cmd"} -+ - 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(&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 hostOnly && targetOnly { -+ fatalf("specify only one of --host-only or --target-only\n") -+ } -+ crossBuild = hostOnly || targetOnly -+ if flag.NArg() > 0 { -+ if crossBuild { -+ toBuild = flag.Args() -+ } else { -+ 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() { - xprintf("\n") - } - -- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now -- goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now -+ // For split host/target cross/cross-canadian builds, we don't -+ // want to be setting these flags until after we have compiled -+ // the toolchain that runs on the build host. -+ if !crossBuild { -+ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now -+ goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now -+ } - goBootstrap := pathf("%s/go_bootstrap", tooldir) - cmdGo := pathf("%s/go", gobin) - if debug { -@@ -1333,7 +1361,11 @@ func cmdbootstrap() { - xprintf("\n") - } - xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") -- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) -+ if crossBuild { -+ os.Setenv("CC", defaultcc[""]) -+ } else { -+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) -+ } - goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...) - if debug { - run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") -@@ -1370,50 +1402,84 @@ func cmdbootstrap() { - } - checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) - -- if goos == oldgoos && goarch == oldgoarch { -- // Common case - not setting up for cross-compilation. -- timelog("build", "toolchain") -- if vflag > 0 { -- xprintf("\n") -+ if crossBuild { -+ gogcflags = os.Getenv("GO_GCFLAGS") -+ goldflags = os.Getenv("GO_LDFLAGS") -+ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir)) -+ for _, f := range tool_files { -+ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec) -+ xremove(f) -+ } -+ os.Setenv("GOTOOLDIR", build_tooldir) -+ goBootstrap = pathf("%s/go_bootstrap", build_tooldir) -+ if hostOnly { -+ timelog("build", "host toolchain") -+ if vflag > 0 { -+ xprintf("\n") -+ } -+ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch) -+ goInstall(goBootstrap, toBuild...) -+ checkNotStale(goBootstrap, toBuild...) -+ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary -+ -+ timelog("build", "target toolchain") -+ if vflag > 0 { -+ xprintf("\n") -+ } -+ } else if targetOnly { -+ goos = oldgoos -+ goarch = oldgoarch -+ os.Setenv("GOOS", goos) -+ os.Setenv("GOARCH", goarch) -+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) -+ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch) -+ goInstall(goBootstrap, toBuild...) -+ checkNotStale(goBootstrap, toBuild...) -+ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary - } -- xprintf("Building packages and commands for %s/%s.\n", goos, goarch) - } else { -- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH. -- // Finish GOHOSTOS/GOHOSTARCH installation and then -- // run GOOS/GOARCH installation. -- timelog("build", "host toolchain") -- if vflag > 0 { -- xprintf("\n") -+ -+ if goos == oldgoos && goarch == oldgoarch { -+ // Common case - not setting up for cross-compilation. -+ timelog("build", "toolchain") -+ if vflag > 0 { -+ xprintf("\n") -+ } -+ xprintf("Building packages and commands for %s/%s.\n", goos, goarch) -+ } else { -+ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH. -+ // Finish GOHOSTOS/GOHOSTARCH installation and then -+ // run GOOS/GOARCH installation. -+ timelog("build", "host toolchain") -+ if vflag > 0 { -+ xprintf("\n") -+ } -+ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch) -+ goInstall(goBootstrap, "std", "cmd") -+ checkNotStale(goBootstrap, "std", "cmd") -+ checkNotStale(cmdGo, "std", "cmd") -+ -+ timelog("build", "target toolchain") -+ if vflag > 0 { -+ xprintf("\n") -+ } -+ goos = oldgoos -+ goarch = oldgoarch -+ os.Setenv("GOOS", goos) -+ 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") - -- timelog("build", "target toolchain") -- if vflag > 0 { -- xprintf("\n") -- } -- goos = oldgoos -- goarch = oldgoarch -- os.Setenv("GOOS", goos) -- os.Setenv("GOARCH", goarch) -- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) -- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch) -- } -- targets := []string{"std", "cmd"} -- if goos == "js" && goarch == "wasm" { -- // Skip the cmd tools for js/wasm. They're not usable. -- targets = targets[:1] -- } -- goInstall(goBootstrap, targets...) -- checkNotStale(goBootstrap, targets...) -- checkNotStale(cmdGo, targets...) -- 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) -+ 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() { - } - } - -- // Remove go_bootstrap now that we're done. -- xremove(pathf("%s/go_bootstrap", tooldir)) -+ // Except that for split host/target cross-builds, we need to -+ // keep it. -+ if !crossBuild { -+ xremove(pathf("%s/go_bootstrap", tooldir)) -+ } - - if goos == "android" { - // Make sure the exec wrapper will sync a fresh $GOROOT to the device. diff --git a/meta/recipes-devtools/go/go-1.15/0007-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go-1.15/0007-cmd-go-make-GOROOT-precious-by-default.patch deleted file mode 100644 index 4b4d0d4f3d..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0007-cmd-go-make-GOROOT-precious-by-default.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 9ba507e076c744f4d394418e4a849e68cd426a4a Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:18:56 +0430 -Subject: [PATCH 7/9] cmd/go: make GOROOT precious by default - -Upstream-Status: Inappropriate [OE specific] - -The go build tool normally rebuilds whatever it detects is -stale. This can be a problem when GOROOT is intended to -be read-only and the go runtime has been built as a shared -library, since we don't want every application to be rebuilding -the shared runtime - particularly in cross-build/packaging -setups, since that would lead to 'abi mismatch' runtime errors. - -This patch prevents the install and linkshared actions from -installing to GOROOT unless overridden with the GOROOT_OVERRIDE -environment variable. - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Matt Madison . - -Signed-off-by: Alexander J Kube ---- - src/cmd/go/internal/work/action.go | 3 +++ - src/cmd/go/internal/work/build.go | 6 ++++++ - src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++ - 3 files changed, 34 insertions(+) - ---- a/src/cmd/go/internal/work/action.go -+++ b/src/cmd/go/internal/work/action.go -@@ -670,6 +670,9 @@ func (b *Builder) addTransitiveLinkDeps( - if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] { - continue - } -+ if goRootPrecious && (p1.Standard || p1.Goroot) { -+ continue -+ } - haveShlib[filepath.Base(p1.Shlib)] = true - // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild, - // we'll end up building an overall library or executable that depends at runtime ---- a/src/cmd/go/internal/work/build.go -+++ b/src/cmd/go/internal/work/build.go -@@ -167,6 +167,8 @@ See also: go install, go get, go clean. - - const concurrentGCBackendCompilationEnabledByDefault = true - -+var goRootPrecious bool = true -+ - func init() { - // break init cycle - CmdBuild.Run = runBuild -@@ -179,6 +181,10 @@ func init() { - - AddBuildFlags(CmdBuild, DefaultBuildFlags) - AddBuildFlags(CmdInstall, DefaultBuildFlags) -+ -+ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" { -+ goRootPrecious = false -+ } - } - - // 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 -@@ -468,6 +468,23 @@ func (b *Builder) build(a *Action) (err - return errors.New("binary-only packages are no longer supported") - } - -+ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) { -+ _, err := os.Stat(a.Package.Target) -+ if err == nil { -+ a.built = a.Package.Target -+ a.Target = a.Package.Target -+ a.buildID = b.fileHash(a.Package.Target) -+ a.Package.Stale = false -+ a.Package.StaleReason = "GOROOT-resident package" -+ return nil -+ } -+ a.Package.Stale = true -+ a.Package.StaleReason = "missing or invalid GOROOT-resident package" -+ if b.IsCmdList { -+ return nil -+ } -+ } -+ - if err := b.Mkdir(a.Objdir); err != nil { - return err - } -@@ -1520,6 +1537,14 @@ func BuildInstallFunc(b *Builder, a *Act - return err - } - -+ if goRootPrecious && a.Package != nil { -+ p := a.Package -+ if p.Standard || p.Goroot { -+ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath) -+ return err -+ } -+ } -+ - if err := b.Mkdir(a.Objdir); err != nil { - return err - } diff --git a/meta/recipes-devtools/go/go-1.15/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.15/0008-use-GOBUILDMODE-to-set-buildmode.patch deleted file mode 100644 index 4e5d5021d6..0000000000 --- a/meta/recipes-devtools/go/go-1.15/0008-use-GOBUILDMODE-to-set-buildmode.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 971b5626339ce0c4d57f9721c9a81af566c5a044 Mon Sep 17 00:00:00 2001 -From: Alex Kube -Date: Wed, 23 Oct 2019 21:19:26 +0430 -Subject: [PATCH 8/9] cmd/go: Use GOBUILDMODE to set buildmode - -Upstream-Status: Denied [upstream choose antoher solution: `17a256b -cmd/go: -buildmode=pie for android/arm'] - -While building go itself, the go build system does not support -to set `-buildmode=pie' from environment. - -Add GOBUILDMODE to support it which make PIE executables the default -build mode, as PIE executables are required as of Yocto - -Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI - -Adapted to Go 1.13 from patches originally submitted to -the meta/recipes-devtools/go tree by -Hongxu Jia - -Signed-off-by: Alexander J Kube ---- - src/cmd/go/internal/work/build.go | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - ---- a/src/cmd/go/internal/work/build.go -+++ b/src/cmd/go/internal/work/build.go -@@ -254,7 +254,13 @@ func AddBuildFlags(cmd *base.Command, ma - - cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "") - cmd.Flag.Var(buildCompiler{}, "compiler", "") -- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "") -+ -+ if bm := os.Getenv("GOBUILDMODE"); bm != "" { -+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "") -+ } else { -+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "") -+ } -+ - cmd.Flag.Var(&load.BuildGcflags, "gcflags", "") - cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "") - if mask&OmitModFlag == 0 { diff --git a/meta/recipes-devtools/go/go-1.16.inc b/meta/recipes-devtools/go/go-1.16.inc new file mode 100644 index 0000000000..1ebbbef833 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16.inc @@ -0,0 +1,20 @@ +require go-common.inc + +GO_BASEVERSION = "1.16" +PV = "1.16" +FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" + +SRC_URI += "\ + file://0001-allow-CC-and-CXX-to-have-multiple-words.patch \ + file://0002-cmd-go-make-content-based-hash-generation-less-pedan.patch \ + file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \ + file://0004-ld-add-soname-to-shareable-objects.patch \ + file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \ + 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 \ +" +SRC_URI[main.sha256sum] = "7688063d55656105898f323d90a79a39c378d86fe89ae192eb3b7fc46347c95a" diff --git a/meta/recipes-devtools/go/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/meta/recipes-devtools/go/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch new file mode 100644 index 0000000000..5f4823be22 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch @@ -0,0 +1,33 @@ +From 9e3dc44cdfa58d96504d0a789dc82617dd5bef55 Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:01:13 +0430 +Subject: [PATCH 1/9] cmd/go: Allow CC and CXX to have multiple words + +Upstream-Status: Inappropriate [OE specific] + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Signed-off-by: Alexander J Kube + +--- + src/cmd/go/internal/envcmd/env.go | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/cmd/go/internal/envcmd/env.go ++++ b/src/cmd/go/internal/envcmd/env.go +@@ -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 { +- cc = env[0] ++ cc = strings.Join(env, " ") + } + cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch) + if env := strings.Fields(cfg.Getenv("CXX")); len(env) > 0 { +- cxx = env[0] ++ cxx = strings.Join(env, " ") + } + env = append(env, cfg.EnvVar{Name: "AR", Value: envOr("AR", "ar")}) + env = append(env, cfg.EnvVar{Name: "CC", Value: cc}) diff --git a/meta/recipes-devtools/go/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/meta/recipes-devtools/go/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch new file mode 100644 index 0000000000..04d0e496c0 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch @@ -0,0 +1,219 @@ +From a13ae484e41139094505d2834437e9262a5315f7 Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:14:22 +0430 +Subject: [PATCH 2/9] cmd/go: make content-based hash generation less pedantic + +Upstream-Status: Inappropriate [OE specific] + +Go 1.10's build tool now uses content-based hashes to +determine when something should be built or re-built. +This same mechanism is used to maintain a built-artifact +cache for speeding up builds. + +However, the hashes it generates include information that +doesn't work well with OE, nor with using a shared runtime +library. + +First, it embeds path names to source files, unless +building within GOROOT. This prevents the building +of a package in GOPATH for later staging into GOROOT. + +This patch adds support for the environment variable +GOPATH_OMIT_IN_ACTIONID. If present, path name +embedding is disabled. + +Second, if cgo is enabled, the build ID for cgo-related +packages will include the current value of the environment +variables for invoking the compiler (CC, CXX, FC) and +any CGO_xxFLAGS variables. Only if the settings used +during a compilation exactly match, character for character, +the values used for compiling runtime/cgo or any other +cgo-enabled package being imported, will the tool +decide that the imported package is up-to-date. + +This is done to help ensure correctness, but is overly +simplistic and effectively prevents the reuse of built +artifacts that use cgo (or shared runtime, which includes +runtime/cgo). + +This patch filters out all compiler flags except those +beginning with '-m'. The default behavior can be restored +by setting the CGO_PEDANTIC environment variable. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Signed-off-by: Alexander J Kube +--- + src/cmd/go/internal/envcmd/env.go | 2 +- + src/cmd/go/internal/work/exec.go | 66 ++++++++++++++++++++++--------- + 2 files changed, 49 insertions(+), 19 deletions(-) + +--- a/src/cmd/go/internal/envcmd/env.go ++++ b/src/cmd/go/internal/envcmd/env.go +@@ -157,7 +157,7 @@ func ExtraEnvVars() []cfg.EnvVar { + func ExtraEnvVarsCostly() []cfg.EnvVar { + var b work.Builder + b.Init() +- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}) ++ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false) + if err != nil { + // Should not happen - b.CFlags was given an empty package. + fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err) +--- a/src/cmd/go/internal/work/exec.go ++++ b/src/cmd/go/internal/work/exec.go +@@ -37,6 +37,8 @@ import ( + "cmd/go/internal/trace" + ) + ++var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != "" ++ + // 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 { +@@ -228,7 +230,7 @@ func (b *Builder) buildActionID(a *Actio + // 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. +- if !p.Goroot && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) { ++ if !p.Goroot && !omitGopath && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) { + 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) +@@ -247,13 +249,13 @@ func (b *Builder) buildActionID(a *Actio + } + if len(p.CgoFiles)+len(p.SwigFiles) > 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) + } + 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) + } + // TODO(rsc): Should we include the SWIG version or Fortran/GCC/G++/Objective-C compiler versions? + } +@@ -2401,33 +2403,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 { +- return b.compilerCmd(b.ccExe(), incdir, workdir) ++ return b.compilerCmd(b.ccExe(false), incdir, workdir) + } + + // gxxCmd returns a g++ command line prefix + // defaultCXX is defined in zdefaultcc.go, written by cmd/dist. + func (b *Builder) GxxCmd(incdir, workdir string) []string { +- return b.compilerCmd(b.cxxExe(), incdir, workdir) ++ return b.compilerCmd(b.cxxExe(false), incdir, workdir) + } + + // gfortranCmd returns a gfortran command line prefix. + func (b *Builder) gfortranCmd(incdir, workdir string) []string { +- return b.compilerCmd(b.fcExe(), incdir, workdir) ++ return b.compilerCmd(b.fcExe(false), incdir, workdir) + } + + // ccExe returns the CC compiler setting without all the extra flags we add implicitly. +-func (b *Builder) ccExe() []string { +- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch)) ++func (b *Builder) ccExe(filtered bool) []string { ++ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered) + } + + // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly. +-func (b *Builder) cxxExe() []string { +- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch)) ++func (b *Builder) cxxExe(filtered bool) []string { ++ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered) + } + + // fcExe returns the FC compiler setting without all the extra flags we add implicitly. +-func (b *Builder) fcExe() []string { +- return b.compilerExe(cfg.Getenv("FC"), "gfortran") ++func (b *Builder) fcExe(filtered bool) []string { ++ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered) ++} ++ ++var filterFlags = os.Getenv("CGO_PEDANTIC") == "" ++ ++func filterCompilerFlags(flags []string) []string { ++ var newflags []string ++ if !filterFlags { ++ return flags ++ } ++ for _, flag := range flags { ++ if strings.HasPrefix(flag, "-m") { ++ newflags = append(newflags, flag) ++ } ++ } ++ return newflags + } + + // compilerExe returns the compiler to use given an +@@ -2436,11 +2453,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"]. +-func (b *Builder) compilerExe(envValue string, def string) []string { ++func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string { + compiler := strings.Fields(envValue) + if len(compiler) == 0 { + compiler = strings.Fields(def) + } ++ ++ if filtered { ++ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...) ++ } ++ + return compiler + } + +@@ -2620,7 +2642,7 @@ func envList(key, def string) []string { + } + + // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo. +-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) { ++func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) { + defaults := "-g -O2" + + if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil { +@@ -2639,6 +2661,14 @@ func (b *Builder) CFlags(p *load.Package + return + } + ++ if filtered { ++ cppflags = filterCompilerFlags(cppflags) ++ cflags = filterCompilerFlags(cflags) ++ cxxflags = filterCompilerFlags(cxxflags) ++ fflags = filterCompilerFlags(fflags) ++ ldflags = filterCompilerFlags(ldflags) ++ } ++ + return + } + +@@ -2653,7 +2683,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 +- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p) ++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false) + if err != nil { + return nil, nil, err + } +@@ -3104,7 +3134,7 @@ func (b *Builder) swigIntSize(objdir str + + // 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) { +- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p) ++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false) + if err != nil { + return "", "", err + } diff --git a/meta/recipes-devtools/go/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/meta/recipes-devtools/go/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch new file mode 100644 index 0000000000..662c705471 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch @@ -0,0 +1,47 @@ +From 28ada8896b76d620240bafc22aa395071d601482 Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:15:37 +0430 +Subject: [PATCH 3/9] cmd/go: Allow GOTOOLDIR to be overridden in the environment + +to allow for split host/target build roots + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Alexander J Kube +--- + src/cmd/dist/build.go | 4 +++- + src/cmd/go/internal/cfg/cfg.go | 6 +++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +--- a/src/cmd/dist/build.go ++++ b/src/cmd/dist/build.go +@@ -246,7 +246,9 @@ func xinit() { + workdir = xworkdir() + xatexit(rmworkdir) + +- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) ++ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" { ++ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) ++ } + } + + // compilerEnv returns a map from "goos/goarch" to the +--- a/src/cmd/go/internal/cfg/cfg.go ++++ b/src/cmd/go/internal/cfg/cfg.go +@@ -64,7 +64,11 @@ func defaultContext() build.Context { + // variables. This matches the initialization of ToolDir in + // go/build, except for using ctxt.GOROOT rather than + // runtime.GOROOT. +- build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) ++ if s := os.Getenv("GOTOOLDIR"); s != "" { ++ build.ToolDir = filepath.Clean(s) ++ } else { ++ build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) ++ } + } + + ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH) diff --git a/meta/recipes-devtools/go/go-1.16/0004-ld-add-soname-to-shareable-objects.patch b/meta/recipes-devtools/go/go-1.16/0004-ld-add-soname-to-shareable-objects.patch new file mode 100644 index 0000000000..cd875f1164 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0004-ld-add-soname-to-shareable-objects.patch @@ -0,0 +1,45 @@ +From bf5cf5301ae5914498454c87293d1df2e1d8489f Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:16:32 +0430 +Subject: [PATCH 4/9] ld: add soname to shareable objects + +so that OE's shared library dependency handling +can find them. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Alexander J Kube +--- + src/cmd/link/internal/ld/lib.go | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -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 { + if *flagAslr { + argv = addASLRargs(argv) +@@ -1358,6 +1359,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))) + case BuildModePlugin: + if ctxt.HeadType == objabi.Hdarwin { + argv = append(argv, "-dynamiclib") +@@ -1366,6 +1368,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))) + } + } + diff --git a/meta/recipes-devtools/go/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/meta/recipes-devtools/go/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch new file mode 100644 index 0000000000..59c12d9546 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch @@ -0,0 +1,39 @@ +From f05ef3ded52b98537c10efd0b15cd9612471524d Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:17:16 +0430 +Subject: [PATCH 5/9] make.bash: override CC when building dist and + go_bootstrap + +for handling OE cross-canadian builds. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Alexander J Kube +--- + src/make.bash | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/make.bash ++++ b/src/make.bash +@@ -178,7 +178,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; + exit 1 + fi + rm -f cmd/dist/dist +-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist ++CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist + + # -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 + # 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 "$@" + rm -f ./cmd/dist/dist + + # DO NOT ADD ANY NEW CODE HERE. diff --git a/meta/recipes-devtools/go/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch new file mode 100644 index 0000000000..7aee0bac43 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch @@ -0,0 +1,274 @@ +From 10735bb84df17ba657f76835f483cd8543a879c1 Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:18:12 +0430 +Subject: [PATCH 6/9] cmd/dist: separate host and target builds + +Upstream-Status: Inappropriate [OE specific] + +Change the dist tool to allow for OE-style cross- +and cross-canadian builds: + + - command flags --host-only and --target only are added; + if one is present, the other changes mentioned below + take effect, and arguments may also be specified on + the command line to enumerate the package(s) to be + built. + + - for OE cross builds, go_bootstrap is always built for + the current build host, and is moved, along with the supporting + toolchain (asm, compile, etc.) to a separate 'native_native' + directory under GOROOT/pkg/tool. + + - go_bootstrap is not automatically removed after the build, + so it can be reused later (e.g., building both static and + shared runtime). + +Note that for --host-only builds, it would be nice to specify +just the "cmd" package to build only the go commands/tools, +the staleness checks in the dist tool will fail if the "std" +library has not also been built. So host-only builds have to +build everything anyway. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Signed-off-by: Alexander J Kube +--- + src/cmd/dist/build.go | 155 ++++++++++++++++++++++++++++++------------ + 1 file changed, 112 insertions(+), 43 deletions(-) + +--- a/src/cmd/dist/build.go ++++ b/src/cmd/dist/build.go +@@ -41,6 +41,7 @@ var ( + goldflags string + workdir string + tooldir string ++ build_tooldir string + oldgoos string + oldgoarch string + exe string +@@ -53,6 +54,7 @@ var ( + + rebuildall bool + defaultclang bool ++ crossBuild bool + + vflag int // verbosity + ) +@@ -249,6 +251,8 @@ func xinit() { + if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" { + tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) + } ++ ++ build_tooldir = pathf("%s/pkg/tool/native_native", goroot) + } + + // compilerEnv returns a map from "goos/goarch" to the +@@ -480,8 +484,10 @@ func setup() { + p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch) + if rebuildall { + xremoveall(p) ++ xremoveall(build_tooldir) + } + xmkdirall(p) ++ xmkdirall(build_tooldir) + + if goos != gohostos || goarch != gohostarch { + p := pathf("%s/pkg/%s_%s", goroot, goos, goarch) +@@ -1244,12 +1250,29 @@ func cmdbootstrap() { + + var noBanner bool + var debug bool ++ var hostOnly bool ++ var targetOnly bool ++ var toBuild = []string{"std", "cmd"} ++ + 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(&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 hostOnly && targetOnly { ++ fatalf("specify only one of --host-only or --target-only\n") ++ } ++ crossBuild = hostOnly || targetOnly ++ if flag.NArg() > 0 { ++ if crossBuild { ++ toBuild = flag.Args() ++ } else { ++ 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() { + xprintf("\n") + } + +- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now +- goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now ++ // For split host/target cross/cross-canadian builds, we don't ++ // want to be setting these flags until after we have compiled ++ // the toolchain that runs on the build host. ++ if !crossBuild { ++ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now ++ goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now ++ } + goBootstrap := pathf("%s/go_bootstrap", tooldir) + cmdGo := pathf("%s/go", gobin) + if debug { +@@ -1333,7 +1361,11 @@ func cmdbootstrap() { + xprintf("\n") + } + xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") +- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) ++ if crossBuild { ++ os.Setenv("CC", defaultcc[""]) ++ } else { ++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) ++ } + goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...) + if debug { + run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") +@@ -1370,50 +1402,84 @@ func cmdbootstrap() { + } + checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) + +- if goos == oldgoos && goarch == oldgoarch { +- // Common case - not setting up for cross-compilation. +- timelog("build", "toolchain") +- if vflag > 0 { +- xprintf("\n") ++ if crossBuild { ++ gogcflags = os.Getenv("GO_GCFLAGS") ++ goldflags = os.Getenv("GO_LDFLAGS") ++ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir)) ++ for _, f := range tool_files { ++ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec) ++ xremove(f) ++ } ++ os.Setenv("GOTOOLDIR", build_tooldir) ++ goBootstrap = pathf("%s/go_bootstrap", build_tooldir) ++ if hostOnly { ++ timelog("build", "host toolchain") ++ if vflag > 0 { ++ xprintf("\n") ++ } ++ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch) ++ goInstall(goBootstrap, toBuild...) ++ checkNotStale(goBootstrap, toBuild...) ++ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary ++ ++ timelog("build", "target toolchain") ++ if vflag > 0 { ++ xprintf("\n") ++ } ++ } else if targetOnly { ++ goos = oldgoos ++ goarch = oldgoarch ++ os.Setenv("GOOS", goos) ++ os.Setenv("GOARCH", goarch) ++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) ++ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch) ++ goInstall(goBootstrap, toBuild...) ++ checkNotStale(goBootstrap, toBuild...) ++ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary + } +- xprintf("Building packages and commands for %s/%s.\n", goos, goarch) + } else { +- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH. +- // Finish GOHOSTOS/GOHOSTARCH installation and then +- // run GOOS/GOARCH installation. +- timelog("build", "host toolchain") +- if vflag > 0 { +- xprintf("\n") ++ ++ if goos == oldgoos && goarch == oldgoarch { ++ // Common case - not setting up for cross-compilation. ++ timelog("build", "toolchain") ++ if vflag > 0 { ++ xprintf("\n") ++ } ++ xprintf("Building packages and commands for %s/%s.\n", goos, goarch) ++ } else { ++ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH. ++ // Finish GOHOSTOS/GOHOSTARCH installation and then ++ // run GOOS/GOARCH installation. ++ timelog("build", "host toolchain") ++ if vflag > 0 { ++ xprintf("\n") ++ } ++ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch) ++ goInstall(goBootstrap, "std", "cmd") ++ checkNotStale(goBootstrap, "std", "cmd") ++ checkNotStale(cmdGo, "std", "cmd") ++ ++ timelog("build", "target toolchain") ++ if vflag > 0 { ++ xprintf("\n") ++ } ++ goos = oldgoos ++ goarch = oldgoarch ++ os.Setenv("GOOS", goos) ++ 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") + +- timelog("build", "target toolchain") +- if vflag > 0 { +- xprintf("\n") +- } +- goos = oldgoos +- goarch = oldgoarch +- os.Setenv("GOOS", goos) +- os.Setenv("GOARCH", goarch) +- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) +- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch) +- } +- targets := []string{"std", "cmd"} +- if goos == "js" && goarch == "wasm" { +- // Skip the cmd tools for js/wasm. They're not usable. +- targets = targets[:1] +- } +- goInstall(goBootstrap, targets...) +- checkNotStale(goBootstrap, targets...) +- checkNotStale(cmdGo, targets...) +- 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) ++ 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() { + } + } + +- // Remove go_bootstrap now that we're done. +- xremove(pathf("%s/go_bootstrap", tooldir)) ++ // Except that for split host/target cross-builds, we need to ++ // keep it. ++ if !crossBuild { ++ xremove(pathf("%s/go_bootstrap", tooldir)) ++ } + + if goos == "android" { + // Make sure the exec wrapper will sync a fresh $GOROOT to the device. diff --git a/meta/recipes-devtools/go/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch new file mode 100644 index 0000000000..4b4d0d4f3d --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch @@ -0,0 +1,104 @@ +From 9ba507e076c744f4d394418e4a849e68cd426a4a Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:18:56 +0430 +Subject: [PATCH 7/9] cmd/go: make GOROOT precious by default + +Upstream-Status: Inappropriate [OE specific] + +The go build tool normally rebuilds whatever it detects is +stale. This can be a problem when GOROOT is intended to +be read-only and the go runtime has been built as a shared +library, since we don't want every application to be rebuilding +the shared runtime - particularly in cross-build/packaging +setups, since that would lead to 'abi mismatch' runtime errors. + +This patch prevents the install and linkshared actions from +installing to GOROOT unless overridden with the GOROOT_OVERRIDE +environment variable. + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Matt Madison . + +Signed-off-by: Alexander J Kube +--- + src/cmd/go/internal/work/action.go | 3 +++ + src/cmd/go/internal/work/build.go | 6 ++++++ + src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++ + 3 files changed, 34 insertions(+) + +--- a/src/cmd/go/internal/work/action.go ++++ b/src/cmd/go/internal/work/action.go +@@ -670,6 +670,9 @@ func (b *Builder) addTransitiveLinkDeps( + if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] { + continue + } ++ if goRootPrecious && (p1.Standard || p1.Goroot) { ++ continue ++ } + haveShlib[filepath.Base(p1.Shlib)] = true + // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild, + // we'll end up building an overall library or executable that depends at runtime +--- a/src/cmd/go/internal/work/build.go ++++ b/src/cmd/go/internal/work/build.go +@@ -167,6 +167,8 @@ See also: go install, go get, go clean. + + const concurrentGCBackendCompilationEnabledByDefault = true + ++var goRootPrecious bool = true ++ + func init() { + // break init cycle + CmdBuild.Run = runBuild +@@ -179,6 +181,10 @@ func init() { + + AddBuildFlags(CmdBuild, DefaultBuildFlags) + AddBuildFlags(CmdInstall, DefaultBuildFlags) ++ ++ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" { ++ goRootPrecious = false ++ } + } + + // 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 +@@ -468,6 +468,23 @@ func (b *Builder) build(a *Action) (err + return errors.New("binary-only packages are no longer supported") + } + ++ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) { ++ _, err := os.Stat(a.Package.Target) ++ if err == nil { ++ a.built = a.Package.Target ++ a.Target = a.Package.Target ++ a.buildID = b.fileHash(a.Package.Target) ++ a.Package.Stale = false ++ a.Package.StaleReason = "GOROOT-resident package" ++ return nil ++ } ++ a.Package.Stale = true ++ a.Package.StaleReason = "missing or invalid GOROOT-resident package" ++ if b.IsCmdList { ++ return nil ++ } ++ } ++ + if err := b.Mkdir(a.Objdir); err != nil { + return err + } +@@ -1520,6 +1537,14 @@ func BuildInstallFunc(b *Builder, a *Act + return err + } + ++ if goRootPrecious && a.Package != nil { ++ p := a.Package ++ if p.Standard || p.Goroot { ++ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath) ++ return err ++ } ++ } ++ + if err := b.Mkdir(a.Objdir); err != nil { + return err + } diff --git a/meta/recipes-devtools/go/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch new file mode 100644 index 0000000000..4e5d5021d6 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch @@ -0,0 +1,42 @@ +From 971b5626339ce0c4d57f9721c9a81af566c5a044 Mon Sep 17 00:00:00 2001 +From: Alex Kube +Date: Wed, 23 Oct 2019 21:19:26 +0430 +Subject: [PATCH 8/9] cmd/go: Use GOBUILDMODE to set buildmode + +Upstream-Status: Denied [upstream choose antoher solution: `17a256b +cmd/go: -buildmode=pie for android/arm'] + +While building go itself, the go build system does not support +to set `-buildmode=pie' from environment. + +Add GOBUILDMODE to support it which make PIE executables the default +build mode, as PIE executables are required as of Yocto + +Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI + +Adapted to Go 1.13 from patches originally submitted to +the meta/recipes-devtools/go tree by +Hongxu Jia + +Signed-off-by: Alexander J Kube +--- + src/cmd/go/internal/work/build.go | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/src/cmd/go/internal/work/build.go ++++ b/src/cmd/go/internal/work/build.go +@@ -254,7 +254,13 @@ func AddBuildFlags(cmd *base.Command, ma + + cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "") + cmd.Flag.Var(buildCompiler{}, "compiler", "") +- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "") ++ ++ if bm := os.Getenv("GOBUILDMODE"); bm != "" { ++ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "") ++ } else { ++ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "") ++ } ++ + cmd.Flag.Var(&load.BuildGcflags, "gcflags", "") + cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "") + if mask&OmitModFlag == 0 { diff --git a/meta/recipes-devtools/go/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch b/meta/recipes-devtools/go/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch new file mode 100644 index 0000000000..dcbdf58752 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch @@ -0,0 +1,95 @@ +From a983bc6cd48fb0da939e3329cac18d7a3b29ecf8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +--- + src/cmd/go/internal/envcmd/env.go | 5 ----- + src/cmd/go/internal/work/init.go | 7 ------- + src/cmd/go/testdata/script/env_write.txt | 24 ------------------------ + 3 files changed, 36 deletions(-) + +diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go +index 6937187522..29f9057c3f 100644 +--- a/src/cmd/go/internal/envcmd/env.go ++++ b/src/cmd/go/internal/envcmd/env.go +@@ -427,11 +427,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": +- 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 ba7c7c2fbb..3a6df5f758 100644 +--- a/src/cmd/go/internal/work/init.go ++++ b/src/cmd/go/internal/work/init.go +@@ -41,13 +41,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) +- } +- } +- + // For each experiment that has been enabled in the toolchain, define a + // build tag with the same name but prefixed by "goexperiment." which can be + // used for compiling alternative files for the experiment. This allows +diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt +index bda1e57826..c99aadb7f2 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.30.1 + diff --git a/meta/recipes-devtools/go/go-binary-native_1.15.8.bb b/meta/recipes-devtools/go/go-binary-native_1.15.8.bb deleted file mode 100644 index df697e2781..0000000000 --- a/meta/recipes-devtools/go/go-binary-native_1.15.8.bb +++ /dev/null @@ -1,46 +0,0 @@ -# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org. - -SUMMARY = "Go programming language compiler (upstream binary for bootstrap)" -HOMEPAGE = " http://golang.org/" -LICENSE = "BSD-3-Clause" -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] = "d3379c32a90fdf9382166f8f48034c459a8cc433730bc9476d39d9082c94583b" -SRC_URI[go_linux_arm64.sha256sum] = "0e31ea4bf53496b0f0809730520dee98c0ae5c530f3701a19df0ba0a327bf3d2" - -UPSTREAM_CHECK_URI = "https://golang.org/dl/" -UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux" - -S = "${WORKDIR}/go" - -inherit goarch native - -do_compile() { - : -} - -make_wrapper() { - rm -f ${D}${bindir}/$1 - cat <${D}${bindir}/$1 -#!/bin/bash -here=\`dirname \$0\` -export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" -\$here/../lib/go/bin/$1 "\$@" -END - chmod +x ${D}${bindir}/$1 -} - -do_install() { - find ${S} -depth -type d -name testdata -exec rm -rf {} + - - install -d ${D}${bindir} ${D}${libdir}/go - cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/ - - for f in ${S}/bin/* - do - make_wrapper `basename $f` - done -} diff --git a/meta/recipes-devtools/go/go-binary-native_1.16.bb b/meta/recipes-devtools/go/go-binary-native_1.16.bb new file mode 100644 index 0000000000..155a475c95 --- /dev/null +++ b/meta/recipes-devtools/go/go-binary-native_1.16.bb @@ -0,0 +1,46 @@ +# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org. + +SUMMARY = "Go programming language compiler (upstream binary for bootstrap)" +HOMEPAGE = " http://golang.org/" +LICENSE = "BSD-3-Clause" +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] = "013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2" +SRC_URI[go_linux_arm64.sha256sum] = "3770f7eb22d05e25fbee8fb53c2a4e897da043eb83c69b9a14f8d98562cd8098" + +UPSTREAM_CHECK_URI = "https://golang.org/dl/" +UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux" + +S = "${WORKDIR}/go" + +inherit goarch native + +do_compile() { + : +} + +make_wrapper() { + rm -f ${D}${bindir}/$1 + cat <${D}${bindir}/$1 +#!/bin/bash +here=\`dirname \$0\` +export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" +\$here/../lib/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$1 +} + +do_install() { + find ${S} -depth -type d -name testdata -exec rm -rf {} + + + install -d ${D}${bindir} ${D}${libdir}/go + cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/ + + for f in ${S}/bin/* + do + make_wrapper `basename $f` + done +} diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.15.bb b/meta/recipes-devtools/go/go-cross-canadian_1.15.bb deleted file mode 100644 index 7ac9449e47..0000000000 --- a/meta/recipes-devtools/go/go-cross-canadian_1.15.bb +++ /dev/null @@ -1,2 +0,0 @@ -require go-cross-canadian.inc -require go-${PV}.inc diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.16.bb b/meta/recipes-devtools/go/go-cross-canadian_1.16.bb new file mode 100644 index 0000000000..7ac9449e47 --- /dev/null +++ b/meta/recipes-devtools/go/go-cross-canadian_1.16.bb @@ -0,0 +1,2 @@ +require go-cross-canadian.inc +require go-${PV}.inc diff --git a/meta/recipes-devtools/go/go-cross_1.15.bb b/meta/recipes-devtools/go/go-cross_1.15.bb deleted file mode 100644 index 80b5a03f6c..0000000000 --- a/meta/recipes-devtools/go/go-cross_1.15.bb +++ /dev/null @@ -1,2 +0,0 @@ -require go-cross.inc -require go-${PV}.inc diff --git a/meta/recipes-devtools/go/go-cross_1.16.bb b/meta/recipes-devtools/go/go-cross_1.16.bb new file mode 100644 index 0000000000..80b5a03f6c --- /dev/null +++ b/meta/recipes-devtools/go/go-cross_1.16.bb @@ -0,0 +1,2 @@ +require go-cross.inc +require go-${PV}.inc diff --git a/meta/recipes-devtools/go/go-crosssdk_1.15.bb b/meta/recipes-devtools/go/go-crosssdk_1.15.bb deleted file mode 100644 index 1857c8a577..0000000000 --- a/meta/recipes-devtools/go/go-crosssdk_1.15.bb +++ /dev/null @@ -1,2 +0,0 @@ -require go-crosssdk.inc -require go-${PV}.inc diff --git a/meta/recipes-devtools/go/go-crosssdk_1.16.bb b/meta/recipes-devtools/go/go-crosssdk_1.16.bb new file mode 100644 index 0000000000..1857c8a577 --- /dev/null +++ b/meta/recipes-devtools/go/go-crosssdk_1.16.bb @@ -0,0 +1,2 @@ +require go-crosssdk.inc +require go-${PV}.inc diff --git a/meta/recipes-devtools/go/go-native_1.15.bb b/meta/recipes-devtools/go/go-native_1.15.bb deleted file mode 100644 index f14892cdb0..0000000000 --- a/meta/recipes-devtools/go/go-native_1.15.bb +++ /dev/null @@ -1,59 +0,0 @@ -# This recipe builds a native Go (written in Go) by first building an old Go 1.4 -# (written in C). However this old Go does not support all hosts platforms. - -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.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52" - -export GOOS = "${BUILD_GOOS}" -export GOARCH = "${BUILD_GOARCH}" -CC = "${@d.getVar('BUILD_CC').strip()}" - -GOMAKEARGS ?= "--no-banner" - -do_configure() { - cd ${WORKDIR}/go1.4/go/src - CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash -} - -do_compile() { - export GOROOT_FINAL="${libdir_native}/go" - export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go" - - cd src - ./make.bash ${GOMAKEARGS} - cd ${B} -} -do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin" -do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin" - -make_wrapper() { - rm -f ${D}${bindir}/$2$3 - cat <${D}${bindir}/$2$3 -#!/bin/bash -here=\`dirname \$0\` -export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" -\$here/../lib/go/bin/$1 "\$@" -END - chmod +x ${D}${bindir}/$2 -} - -do_install() { - install -d ${D}${libdir}/go - cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ - install -d ${D}${libdir}/go/src - (cd ${S}/src; for d in *; do \ - [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ - done) - find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; - install -d ${D}${bindir} ${D}${libdir}/go/bin - for f in ${B}/bin/* - do - base=`basename $f` - install -m755 $f ${D}${libdir}/go/bin - make_wrapper $base $base - done -} diff --git a/meta/recipes-devtools/go/go-native_1.16.bb b/meta/recipes-devtools/go/go-native_1.16.bb new file mode 100644 index 0000000000..f14892cdb0 --- /dev/null +++ b/meta/recipes-devtools/go/go-native_1.16.bb @@ -0,0 +1,59 @@ +# This recipe builds a native Go (written in Go) by first building an old Go 1.4 +# (written in C). However this old Go does not support all hosts platforms. + +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.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52" + +export GOOS = "${BUILD_GOOS}" +export GOARCH = "${BUILD_GOARCH}" +CC = "${@d.getVar('BUILD_CC').strip()}" + +GOMAKEARGS ?= "--no-banner" + +do_configure() { + cd ${WORKDIR}/go1.4/go/src + CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash +} + +do_compile() { + export GOROOT_FINAL="${libdir_native}/go" + export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go" + + cd src + ./make.bash ${GOMAKEARGS} + cd ${B} +} +do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin" +do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin" + +make_wrapper() { + rm -f ${D}${bindir}/$2$3 + cat <${D}${bindir}/$2$3 +#!/bin/bash +here=\`dirname \$0\` +export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" +\$here/../lib/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$2 +} + +do_install() { + install -d ${D}${libdir}/go + cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ + install -d ${D}${libdir}/go/src + (cd ${S}/src; for d in *; do \ + [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ + done) + find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; + install -d ${D}${bindir} ${D}${libdir}/go/bin + for f in ${B}/bin/* + do + base=`basename $f` + install -m755 $f ${D}${libdir}/go/bin + make_wrapper $base $base + done +} diff --git a/meta/recipes-devtools/go/go-runtime_1.15.bb b/meta/recipes-devtools/go/go-runtime_1.15.bb deleted file mode 100644 index d6ddb31ed4..0000000000 --- a/meta/recipes-devtools/go/go-runtime_1.15.bb +++ /dev/null @@ -1,4 +0,0 @@ -export CGO_ENABLED_riscv64 = "" -require go-${PV}.inc -require go-runtime.inc - diff --git a/meta/recipes-devtools/go/go-runtime_1.16.bb b/meta/recipes-devtools/go/go-runtime_1.16.bb new file mode 100644 index 0000000000..d6ddb31ed4 --- /dev/null +++ b/meta/recipes-devtools/go/go-runtime_1.16.bb @@ -0,0 +1,4 @@ +export CGO_ENABLED_riscv64 = "" +require go-${PV}.inc +require go-runtime.inc + diff --git a/meta/recipes-devtools/go/go_1.15.bb b/meta/recipes-devtools/go/go_1.15.bb deleted file mode 100644 index d4812c0f0a..0000000000 --- a/meta/recipes-devtools/go/go_1.15.bb +++ /dev/null @@ -1,18 +0,0 @@ -require go-${PV}.inc -require go-target.inc - -inherit linuxloader - -export GOBUILDMODE="" -export CGO_ENABLED_riscv64 = "" -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/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") -} - diff --git a/meta/recipes-devtools/go/go_1.16.bb b/meta/recipes-devtools/go/go_1.16.bb new file mode 100644 index 0000000000..d4812c0f0a --- /dev/null +++ b/meta/recipes-devtools/go/go_1.16.bb @@ -0,0 +1,18 @@ +require go-${PV}.inc +require go-target.inc + +inherit linuxloader + +export GOBUILDMODE="" +export CGO_ENABLED_riscv64 = "" +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/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") +} + -- cgit v1.2.3-54-g00ecf