summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.14/0007-cmd-go-make-GOROOT-precious-by-default.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-09-03 19:23:47 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-05 22:19:20 +0100
commit19e786b6fac8ecce6bb083db3dc9ff3ccc2584b2 (patch)
treeffc152bbad1291d0916d7dbe680aeb3c3e67377b /meta/recipes-devtools/go/go-1.14/0007-cmd-go-make-GOROOT-precious-by-default.patch
parentd567c995c3b3aa844e20b5117d54c71d2987d8f2 (diff)
downloadpoky-19e786b6fac8ecce6bb083db3dc9ff3ccc2584b2.tar.gz
go: Upgrade to 1.15 major release
1.15 is latest major release changelog is [1] and detailed blog is [2] Drop hardcoding ldso patch in favor of setting it using GO_LDSO variable which can be defined in terms of linuxloader defined by OE Setting GOBUILDMODE to pie is no longer needed [1] https://golang.org/doc/go1.15 [2] https://blog.golang.org/go1.15 (From OE-Core rev: aa1bfaff4adc9246a2d65592b3a8061d55829086) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go/go-1.14/0007-cmd-go-make-GOROOT-precious-by-default.patch')
-rw-r--r--meta/recipes-devtools/go/go-1.14/0007-cmd-go-make-GOROOT-precious-by-default.patch104
1 files changed, 0 insertions, 104 deletions
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.14/0007-cmd-go-make-GOROOT-precious-by-default.patch
deleted file mode 100644
index b93f83de69..0000000000
--- a/meta/recipes-devtools/go/go-1.14/0007-cmd-go-make-GOROOT-precious-by-default.patch
+++ /dev/null
@@ -1,104 +0,0 @@
1From 9ba507e076c744f4d394418e4a849e68cd426a4a Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:18:56 +0430
4Subject: [PATCH 7/9] cmd/go: make GOROOT precious by default
5
6Upstream-Status: Inappropriate [OE specific]
7
8The go build tool normally rebuilds whatever it detects is
9stale. This can be a problem when GOROOT is intended to
10be read-only and the go runtime has been built as a shared
11library, since we don't want every application to be rebuilding
12the shared runtime - particularly in cross-build/packaging
13setups, since that would lead to 'abi mismatch' runtime errors.
14
15This patch prevents the install and linkshared actions from
16installing to GOROOT unless overridden with the GOROOT_OVERRIDE
17environment variable.
18
19Adapted to Go 1.13 from patches originally submitted to
20the meta/recipes-devtools/go tree by
21Matt Madison <matt@madison.systems>.
22
23Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
24---
25 src/cmd/go/internal/work/action.go | 3 +++
26 src/cmd/go/internal/work/build.go | 6 ++++++
27 src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++
28 3 files changed, 34 insertions(+)
29
30--- a/src/cmd/go/internal/work/action.go
31+++ b/src/cmd/go/internal/work/action.go
32@@ -670,6 +670,9 @@ func (b *Builder) addTransitiveLinkDeps(
33 if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
34 continue
35 }
36+ if goRootPrecious && (p1.Standard || p1.Goroot) {
37+ continue
38+ }
39 haveShlib[filepath.Base(p1.Shlib)] = true
40 // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild,
41 // we'll end up building an overall library or executable that depends at runtime
42--- a/src/cmd/go/internal/work/build.go
43+++ b/src/cmd/go/internal/work/build.go
44@@ -167,6 +167,8 @@ See also: go install, go get, go clean.
45
46 const concurrentGCBackendCompilationEnabledByDefault = true
47
48+var goRootPrecious bool = true
49+
50 func init() {
51 // break init cycle
52 CmdBuild.Run = runBuild
53@@ -179,6 +181,10 @@ func init() {
54
55 AddBuildFlags(CmdBuild, DefaultBuildFlags)
56 AddBuildFlags(CmdInstall, DefaultBuildFlags)
57+
58+ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" {
59+ goRootPrecious = false
60+ }
61 }
62
63 // Note that flags consulted by other parts of the code
64--- a/src/cmd/go/internal/work/exec.go
65+++ b/src/cmd/go/internal/work/exec.go
66@@ -464,6 +464,23 @@ func (b *Builder) build(a *Action) (err
67 return errors.New("binary-only packages are no longer supported")
68 }
69
70+ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) {
71+ _, err := os.Stat(a.Package.Target)
72+ if err == nil {
73+ a.built = a.Package.Target
74+ a.Target = a.Package.Target
75+ a.buildID = b.fileHash(a.Package.Target)
76+ a.Package.Stale = false
77+ a.Package.StaleReason = "GOROOT-resident package"
78+ return nil
79+ }
80+ a.Package.Stale = true
81+ a.Package.StaleReason = "missing or invalid GOROOT-resident package"
82+ if b.IsCmdList {
83+ return nil
84+ }
85+ }
86+
87 if err := b.Mkdir(a.Objdir); err != nil {
88 return err
89 }
90@@ -1493,6 +1510,14 @@ func BuildInstallFunc(b *Builder, a *Act
91 return nil
92 }
93
94+ if goRootPrecious && a.Package != nil {
95+ p := a.Package
96+ if p.Standard || p.Goroot {
97+ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath)
98+ return err
99+ }
100+ }
101+
102 if err := b.Mkdir(a.Objdir); err != nil {
103 return err
104 }