summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-09-22 18:05:29 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-26 11:05:00 +0100
commitc1dce31ced7dda38730555a6adf6b81446281a11 (patch)
treec7b1082723c4e20c2d59066873c0c5e8162225d5
parent58551a0b5398938c896c99adee2b33e0c4b72ff9 (diff)
downloadpoky-c1dce31ced7dda38730555a6adf6b81446281a11.tar.gz
go: Fix build with -buildmode=pie
(From OE-Core rev: f080dafbbba31686fddb0867cadb8dfe273632f3) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/go/go-1.9.inc1
-rw-r--r--meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch47
2 files changed, 48 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.9.inc b/meta/recipes-devtools/go/go-1.9.inc
index 0b0aca3fbe..65adaa8d72 100644
--- a/meta/recipes-devtools/go/go-1.9.inc
+++ b/meta/recipes-devtools/go/go-1.9.inc
@@ -14,6 +14,7 @@ SRC_URI += "\
14 file://0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch \ 14 file://0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch \
15 file://0007-ld-add-soname-to-shareable-objects.patch \ 15 file://0007-ld-add-soname-to-shareable-objects.patch \
16 file://0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch \ 16 file://0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch \
17 file://0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch \
17" 18"
18SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2" 19SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2"
19SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463605264e44868362ca8e7accc8be057e993" 20SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463605264e44868362ca8e7accc8be057e993"
diff --git a/meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch b/meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch
new file mode 100644
index 0000000000..aa5fcfdd23
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch
@@ -0,0 +1,47 @@
1From aae44527c8065d54f6acaf87c82cba1ac96fae59 Mon Sep 17 00:00:00 2001
2From: Ian Lance Taylor <iant@golang.org>
3Date: Fri, 18 Aug 2017 17:46:03 -0700
4Subject: [PATCH] cmd/go: -buildmode=pie forces external linking mode on all
5 systems
6
7The go tool assumed that -buildmode=pie implied internal linking on
8linux-amd64. However, that was changed by CL 36417 for issue #18968.
9
10Fixes #21452
11
12Change-Id: I8ed13aea52959cc5c53223f4c41ba35329445545
13Reviewed-on: https://go-review.googlesource.com/57231
14Run-TryBot: Ian Lance Taylor <iant@golang.org>
15TryBot-Result: Gobot Gobot <gobot@golang.org>
16Reviewed-by: Avelino <t@avelino.xxx>
17Reviewed-by: Rob Pike <r@golang.org>
18---
19Upstream-Status: Backport
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21
22 src/cmd/go/internal/load/pkg.go | 7 ++++---
23 1 file changed, 4 insertions(+), 3 deletions(-)
24
25diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
26index 2660d3f..d40773b 100644
27--- a/src/cmd/go/internal/load/pkg.go
28+++ b/src/cmd/go/internal/load/pkg.go
29@@ -954,11 +954,12 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) *Package
30
31 if cfg.BuildContext.CgoEnabled && p.Name == "main" && !p.Goroot {
32 // Currently build modes c-shared, pie (on systems that do not
33- // support PIE with internal linking mode), plugin, and
34- // -linkshared force external linking mode, as of course does
35+ // support PIE with internal linking mode (currently all
36+ // systems: issue #18968)), plugin, and -linkshared force
37+ // external linking mode, as of course does
38 // -ldflags=-linkmode=external. External linking mode forces
39 // an import of runtime/cgo.
40- pieCgo := cfg.BuildBuildmode == "pie" && (cfg.BuildContext.GOOS != "linux" || cfg.BuildContext.GOARCH != "amd64")
41+ pieCgo := cfg.BuildBuildmode == "pie"
42 linkmodeExternal := false
43 for i, a := range cfg.BuildLdflags {
44 if a == "-linkmode=external" {
45--
462.14.1
47