summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2017-10-04 18:21:52 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-10-07 23:20:39 +0100
commit39da5f3e13afe13fe7585949d4f4b41bcb410b09 (patch)
treeab56f3602538f9c8315d41af8366c17c5c1f45f3 /meta/recipes-devtools
parentb2646b5cf7850716e24ad18da1f6c27f369cb16d (diff)
downloadpoky-39da5f3e13afe13fe7585949d4f4b41bcb410b09.tar.gz
go-runtime: prevent host leakage into target objects
When building for a target whose architecture matches the build host's, the second pass through make.bash to build the shareable runtime would also overwrite the target's static cgo library with host-compatibile binaries. Fix this by running the host-side build once and target-only passes of make.bash twice, for static and shareable. This ensures that what gets installed is target-compatible. Also fix an issue with x86-64 targets running MUSL by removing the pre-built (for glibc) objects for the race detector runtime before building. [YOCTO #12136] (From OE-Core rev: 070f4af529c84a3c8c0b1ffc7b138bdd9e8439b7) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/go/go-runtime.inc19
1 files changed, 15 insertions, 4 deletions
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
index 934d1aaeb9..f181dc7a29 100644
--- a/meta/recipes-devtools/go/go-runtime.inc
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -15,7 +15,13 @@ export CC_FOR_TARGET="${CC}"
15export CXX_FOR_TARGET="${CXX}" 15export CXX_FOR_TARGET="${CXX}"
16export GOROOT_OVERRIDE = "1" 16export GOROOT_OVERRIDE = "1"
17 17
18do_configure[noexec] = "1" 18do_configure() {
19 :
20}
21
22do_configure_libc-musl() {
23 rm -f ${S}/src/runtime/race/*.syso
24}
19 25
20do_compile() { 26do_compile() {
21 export GOBIN="${B}/bin" 27 export GOBIN="${B}/bin"
@@ -23,9 +29,13 @@ do_compile() {
23 rm -rf ${GOBIN} ${B}/pkg 29 rm -rf ${GOBIN} ${B}/pkg
24 mkdir ${GOBIN} 30 mkdir ${GOBIN}
25 cd src 31 cd src
26 GO_FLAGS="" ./make.bash 32 ./make.bash --host-only
33 cp ${B}/pkg/tool/${BUILD_GOTUPLE}/go_bootstrap ${B}
34 rm -rf ${B}/pkg/${TARGET_GOTUPLE}
35 ./make.bash --target-only
27 if [ -n "${GO_DYNLINK}" ]; then 36 if [ -n "${GO_DYNLINK}" ]; then
28 GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags \"${LDFLAGS}\"" ./make.bash 37 cp ${B}/go_bootstrap ${B}/pkg/tool/${BUILD_GOTUPLE}
38 GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags \"${LDFLAGS}\"" ./make.bash --target-only
29 fi 39 fi
30 cd ${B} 40 cd ${B}
31} 41}
@@ -41,8 +51,9 @@ do_install() {
41 rm -rf ${D}${libdir}/go/pkg/obj 51 rm -rf ${D}${libdir}/go/pkg/obj
42 rm -rf ${D}${libdir}/go/pkg/bootstrap 52 rm -rf ${D}${libdir}/go/pkg/bootstrap
43 find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do 53 find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
44 [ "$srcdir" = "./cmd" ] || cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/ 54 cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
45 done 55 done
56 rm -f ${D}${libdir}/go/src/cmd/dist/dist
46} 57}
47 58
48# Remove test binaries that cannot be relocated 59# Remove test binaries that cannot be relocated