summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/go/go-1.11.inc1
-rw-r--r--meta/recipes-devtools/go/go-1.11/0008-use-GOBUILDMODE-to-set-buildmode.patch40
-rw-r--r--meta/recipes-devtools/go/go-1.9.inc1
-rw-r--r--meta/recipes-devtools/go/go-1.9/0011-use-GOBUILDMODE-to-set-buildmode.patch40
-rw-r--r--meta/recipes-devtools/go/go_1.11.bb12
-rw-r--r--meta/recipes-devtools/go/go_1.9.bb16
6 files changed, 104 insertions, 6 deletions
diff --git a/meta/recipes-devtools/go/go-1.11.inc b/meta/recipes-devtools/go/go-1.11.inc
index c02e4683b3..d626514ae6 100644
--- a/meta/recipes-devtools/go/go-1.11.inc
+++ b/meta/recipes-devtools/go/go-1.11.inc
@@ -15,6 +15,7 @@ SRC_URI += "\
15 file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \ 15 file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \
16 file://0006-cmd-dist-separate-host-and-target-builds.patch \ 16 file://0006-cmd-dist-separate-host-and-target-builds.patch \
17 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ 17 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
18 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
18" 19"
19 20
20SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch" 21SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
diff --git a/meta/recipes-devtools/go/go-1.11/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.11/0008-use-GOBUILDMODE-to-set-buildmode.patch
new file mode 100644
index 0000000000..b6ab504335
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.11/0008-use-GOBUILDMODE-to-set-buildmode.patch
@@ -0,0 +1,40 @@
1From 0e0c247f0caec23528889ff09d98348cba9028f1 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 26 Oct 2018 15:02:32 +0800
4Subject: [PATCH] use GOBUILDMODE to set buildmode
5
6While building go itself, the go build system does not support
7to set `-buildmode=pie' from environment.
8
9Add GOBUILDMODE to support it which make PIE executables the default
10build mode, as PIE executables are required as of Yocto
11
12Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI
13Upstream-Status: Denied [upstream choose antoher solution: `17a256b
14cmd/go: -buildmode=pie for android/arm']
15
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17---
18 src/cmd/go/internal/work/build.go | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
22index 145b875..595d703 100644
23--- a/src/cmd/go/internal/work/build.go
24+++ b/src/cmd/go/internal/work/build.go
25@@ -218,7 +218,11 @@ func AddBuildFlags(cmd *base.Command) {
26
27 cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
28 cmd.Flag.Var(buildCompiler{}, "compiler", "")
29- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
30+ if bm := os.Getenv("GOBUILDMODE"); bm != "" {
31+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "")
32+ } else {
33+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
34+ }
35 cmd.Flag.Var(&load.BuildGcflags, "gcflags", "")
36 cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "")
37 cmd.Flag.StringVar(&cfg.BuildMod, "mod", "", "")
38--
392.7.4
40
diff --git a/meta/recipes-devtools/go/go-1.9.inc b/meta/recipes-devtools/go/go-1.9.inc
index 329cee061c..ba1eaa051a 100644
--- a/meta/recipes-devtools/go/go-1.9.inc
+++ b/meta/recipes-devtools/go/go-1.9.inc
@@ -19,6 +19,7 @@ SRC_URI += "\
19 file://0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch \ 19 file://0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch \
20 file://0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch \ 20 file://0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch \
21 file://0010-make.bash-override-CC-when-building-dist-and-go_boot.patch \ 21 file://0010-make.bash-override-CC-when-building-dist-and-go_boot.patch \
22 file://0011-use-GOBUILDMODE-to-set-buildmode.patch \
22" 23"
23SRC_URI_append_libc-musl = " file://set-external-linker.patch" 24SRC_URI_append_libc-musl = " file://set-external-linker.patch"
24 25
diff --git a/meta/recipes-devtools/go/go-1.9/0011-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.9/0011-use-GOBUILDMODE-to-set-buildmode.patch
new file mode 100644
index 0000000000..da93dc5c14
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0011-use-GOBUILDMODE-to-set-buildmode.patch
@@ -0,0 +1,40 @@
1From b928fafab1d9425aae9341806bd2f6178ba1da1f Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 26 Oct 2018 16:32:50 +0800
4Subject: [PATCH] use GOBUILDMODE to set buildmode
5
6While building go itself, the go build system does not support
7to set `-buildmode=pie' from environment.
8
9Add GOBUILDMODE to support it which make PIE executables the default
10build mode, as PIE executables are required as of Yocto
11
12Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI
13Upstream-Status: Denied [upstream choose antoher solution: `17a256b
14cmd/go: -buildmode=pie for android/arm']
15
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17---
18 src/cmd/go/internal/work/build.go | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
22index b276de5..1683e7e 100644
23--- a/src/cmd/go/internal/work/build.go
24+++ b/src/cmd/go/internal/work/build.go
25@@ -211,7 +211,11 @@ func AddBuildFlags(cmd *base.Command) {
26
27 cmd.Flag.Var((*base.StringsFlag)(&buildAsmflags), "asmflags", "")
28 cmd.Flag.Var(buildCompiler{}, "compiler", "")
29- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
30+ if bm := os.Getenv("GOBUILDMODE"); bm != "" {
31+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "")
32+ } else {
33+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
34+ }
35 cmd.Flag.Var((*base.StringsFlag)(&buildGcflags), "gcflags", "")
36 cmd.Flag.Var((*base.StringsFlag)(&buildGccgoflags), "gccgoflags", "")
37 cmd.Flag.StringVar(&cfg.BuildContext.InstallSuffix, "installsuffix", "", "")
38--
392.7.4
40
diff --git a/meta/recipes-devtools/go/go_1.11.bb b/meta/recipes-devtools/go/go_1.11.bb
index c67e2cb050..42cdb0430a 100644
--- a/meta/recipes-devtools/go/go_1.11.bb
+++ b/meta/recipes-devtools/go/go_1.11.bb
@@ -1,2 +1,14 @@
1require go-${PV}.inc 1require go-${PV}.inc
2require go-target.inc 2require go-target.inc
3
4export GOBUILDMODE=""
5
6# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips
7# doesn't support -buildmode=pie, so skip the QA checking for mips and its
8# variants.
9python() {
10 if 'mips' in d.getVar('TARGET_ARCH'):
11 d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
12 else:
13 d.setVar('GOBUILDMODE', 'pie')
14}
diff --git a/meta/recipes-devtools/go/go_1.9.bb b/meta/recipes-devtools/go/go_1.9.bb
index 7da7897cf5..c23ea0c1ae 100644
--- a/meta/recipes-devtools/go/go_1.9.bb
+++ b/meta/recipes-devtools/go/go_1.9.bb
@@ -5,6 +5,7 @@ export GO_TARGET_INSTALL = "cmd"
5export GO_FLAGS = "-a" 5export GO_FLAGS = "-a"
6export CC_FOR_TARGET = "${CC}" 6export CC_FOR_TARGET = "${CC}"
7export CXX_FOR_TARGET = "${CXX}" 7export CXX_FOR_TARGET = "${CXX}"
8export GOBUILDMODE=""
8 9
9do_compile() { 10do_compile() {
10 export GOBIN="${B}/bin" 11 export GOBIN="${B}/bin"
@@ -16,9 +17,12 @@ do_compile() {
16 cd ${B} 17 cd ${B}
17} 18}
18 19
19# for aarch64 ends with textrel in ${PN} 20# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips
20# http://errors.yoctoproject.org/Errors/Details/185634/ 21# doesn't support -buildmode=pie, so skip the QA checking for mips and its
21# ERROR: QA Issue: ELF binary '/work/aarch64-oe-linux/go/1.9.7-r0/packages-split/go/usr/lib/go/bin/go' has relocations in .text 22# variants.
22# ELF binary '/work/aarch64-oe-linux/go/1.9.7-r0/packages-split/go/usr/lib/go/pkg/tool/linux_arm64/trace' has relocations in .text 23python() {
23# ELF binary '/work/aarch64-oe-linux/go/1.9.7-r0/packages-split/go/usr/lib/go/pkg/tool/linux_arm64/pprof' has relocations in .text [textrel] 24 if 'mips' in d.getVar('TARGET_ARCH'):
24INSANE_SKIP_${PN} += "textrel" 25 d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
26 else:
27 d.setVar('GOBUILDMODE', 'pie')
28}