diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch')
-rw-r--r-- | meta/recipes-devtools/go/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch b/meta/recipes-devtools/go/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch new file mode 100644 index 0000000000..4e5d5021d6 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From 971b5626339ce0c4d57f9721c9a81af566c5a044 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alex Kube <alexander.j.kube@gmail.com> | ||
3 | Date: Wed, 23 Oct 2019 21:19:26 +0430 | ||
4 | Subject: [PATCH 8/9] cmd/go: Use GOBUILDMODE to set buildmode | ||
5 | |||
6 | Upstream-Status: Denied [upstream choose antoher solution: `17a256b | ||
7 | cmd/go: -buildmode=pie for android/arm'] | ||
8 | |||
9 | While building go itself, the go build system does not support | ||
10 | to set `-buildmode=pie' from environment. | ||
11 | |||
12 | Add GOBUILDMODE to support it which make PIE executables the default | ||
13 | build mode, as PIE executables are required as of Yocto | ||
14 | |||
15 | Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI | ||
16 | |||
17 | Adapted to Go 1.13 from patches originally submitted to | ||
18 | the meta/recipes-devtools/go tree by | ||
19 | Hongxu Jia <hongxu.jia@windriver.com> | ||
20 | |||
21 | Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com> | ||
22 | --- | ||
23 | src/cmd/go/internal/work/build.go | 8 +++++++- | ||
24 | 1 file changed, 7 insertions(+), 1 deletion(-) | ||
25 | |||
26 | --- a/src/cmd/go/internal/work/build.go | ||
27 | +++ b/src/cmd/go/internal/work/build.go | ||
28 | @@ -254,7 +254,13 @@ func AddBuildFlags(cmd *base.Command, ma | ||
29 | |||
30 | cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "") | ||
31 | cmd.Flag.Var(buildCompiler{}, "compiler", "") | ||
32 | - cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "") | ||
33 | + | ||
34 | + if bm := os.Getenv("GOBUILDMODE"); bm != "" { | ||
35 | + cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "") | ||
36 | + } else { | ||
37 | + cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "") | ||
38 | + } | ||
39 | + | ||
40 | cmd.Flag.Var(&load.BuildGcflags, "gcflags", "") | ||
41 | cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "") | ||
42 | if mask&OmitModFlag == 0 { | ||