mirror of
https://git.yoctoproject.org/poky
synced 2026-03-06 23:39:40 +01:00
go 1.9/1.11: fix textrel qa warning for non mips arch
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 But mips doesn't support -buildmode=pie, so skip the QA checking for mips and its variants (From OE-Core rev: 7a8c5d29f70574043d695bc60da16c823d12a83e) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
3fc361f5f0
commit
a8bccfa9a5
@@ -15,6 +15,7 @@ SRC_URI += "\
|
||||
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_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From 0e0c247f0caec23528889ff09d98348cba9028f1 Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Fri, 26 Oct 2018 15:02:32 +0800
|
||||
Subject: [PATCH] use GOBUILDMODE to set buildmode
|
||||
|
||||
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
|
||||
Upstream-Status: Denied [upstream choose antoher solution: `17a256b
|
||||
cmd/go: -buildmode=pie for android/arm']
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
src/cmd/go/internal/work/build.go | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
|
||||
index 145b875..595d703 100644
|
||||
--- a/src/cmd/go/internal/work/build.go
|
||||
+++ b/src/cmd/go/internal/work/build.go
|
||||
@@ -218,7 +218,11 @@ func AddBuildFlags(cmd *base.Command) {
|
||||
|
||||
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", "")
|
||||
cmd.Flag.StringVar(&cfg.BuildMod, "mod", "", "")
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -19,6 +19,7 @@ SRC_URI += "\
|
||||
file://0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch \
|
||||
file://0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch \
|
||||
file://0010-make.bash-override-CC-when-building-dist-and-go_boot.patch \
|
||||
file://0011-use-GOBUILDMODE-to-set-buildmode.patch \
|
||||
"
|
||||
SRC_URI_append_libc-musl = " file://set-external-linker.patch"
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From b928fafab1d9425aae9341806bd2f6178ba1da1f Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Fri, 26 Oct 2018 16:32:50 +0800
|
||||
Subject: [PATCH] use GOBUILDMODE to set buildmode
|
||||
|
||||
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
|
||||
Upstream-Status: Denied [upstream choose antoher solution: `17a256b
|
||||
cmd/go: -buildmode=pie for android/arm']
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
src/cmd/go/internal/work/build.go | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
|
||||
index b276de5..1683e7e 100644
|
||||
--- a/src/cmd/go/internal/work/build.go
|
||||
+++ b/src/cmd/go/internal/work/build.go
|
||||
@@ -211,7 +211,11 @@ func AddBuildFlags(cmd *base.Command) {
|
||||
|
||||
cmd.Flag.Var((*base.StringsFlag)(&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((*base.StringsFlag)(&buildGcflags), "gcflags", "")
|
||||
cmd.Flag.Var((*base.StringsFlag)(&buildGccgoflags), "gccgoflags", "")
|
||||
cmd.Flag.StringVar(&cfg.BuildContext.InstallSuffix, "installsuffix", "", "")
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
require go-${PV}.inc
|
||||
require go-target.inc
|
||||
|
||||
export GOBUILDMODE=""
|
||||
|
||||
# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips
|
||||
# doesn't support -buildmode=pie, so skip the QA checking for mips and its
|
||||
# variants.
|
||||
python() {
|
||||
if 'mips' in d.getVar('TARGET_ARCH'):
|
||||
d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
|
||||
else:
|
||||
d.setVar('GOBUILDMODE', 'pie')
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ export GO_TARGET_INSTALL = "cmd"
|
||||
export GO_FLAGS = "-a"
|
||||
export CC_FOR_TARGET = "${CC}"
|
||||
export CXX_FOR_TARGET = "${CXX}"
|
||||
export GOBUILDMODE=""
|
||||
|
||||
do_compile() {
|
||||
export GOBIN="${B}/bin"
|
||||
@@ -16,9 +17,12 @@ do_compile() {
|
||||
cd ${B}
|
||||
}
|
||||
|
||||
# for aarch64 ends with textrel in ${PN}
|
||||
# http://errors.yoctoproject.org/Errors/Details/185634/
|
||||
# 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
|
||||
# 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
|
||||
# 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]
|
||||
INSANE_SKIP_${PN} += "textrel"
|
||||
# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips
|
||||
# doesn't support -buildmode=pie, so skip the QA checking for mips and its
|
||||
# variants.
|
||||
python() {
|
||||
if 'mips' in d.getVar('TARGET_ARCH'):
|
||||
d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
|
||||
else:
|
||||
d.setVar('GOBUILDMODE', 'pie')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user