[oe-commits] [openembedded-core] 21/24: go: fix linking issues for nativesdk builds

git at git.openembedded.org git at git.openembedded.org
Thu Sep 21 08:06:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit f76779f7ef6636355a5aa5741a736f5234a67fdb
Author: Matt Madison <matt at madison.systems>
AuthorDate: Thu Sep 14 16:22:28 2017 -0300

    go: fix linking issues for nativesdk builds
    
    Switch to using an external linker for nativesdk
    go, go-runtime, and go package builds, which works
    more reliably when building 32-bit SDKs.
    
    Signed-off-by: Matt Madison <matt at madison.systems>
    Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/go.bbclass                 | 4 +++-
 meta/recipes-devtools/go/go-runtime.inc | 5 +++++
 meta/recipes-devtools/go/go-target.inc  | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 33502bf..863b578 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -37,7 +37,9 @@ GO_RPATH = "${@'-r ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_D
 GO_RPATH_class-native = "${@'-r ${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
 GO_RPATH_LINK_class-native = "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}"
-GO_LDFLAGS ?= '-ldflags="${GO_RPATH} -extldflags '${GO_EXTLDFLAGS}'"'
+GO_LINKMODE ?= ""
+GO_LINKMODE_class-nativesdk = "--linkmode=external"
+GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"'
 export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS}"
 export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
 export GOPTESTFLAGS ?= "-test.v"
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
index a074238..934d1aa 100644
--- a/meta/recipes-devtools/go/go-runtime.inc
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -45,6 +45,11 @@ do_install() {
 	done
 }
 
+# Remove test binaries that cannot be relocated
+do_install_append_class-nativesdk() {
+	rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata
+}
+
 # These testdata directories aren't needed for builds and contain binaries
 # that can cause errors in sysroot_strip(), so just remove them.
 sysroot_stage_all_append() {
diff --git a/meta/recipes-devtools/go/go-target.inc b/meta/recipes-devtools/go/go-target.inc
index 0d80bf0..b88d016 100644
--- a/meta/recipes-devtools/go/go-target.inc
+++ b/meta/recipes-devtools/go/go-target.inc
@@ -14,6 +14,9 @@ export CC_FOR_TARGET = "${CC}"
 export CXX_FOR_TARGET = "${CXX}"
 export GO_TARGET_INSTALL = "cmd"
 export GO_FLAGS = "-a"
+GO_LDFLAGS = ""
+GO_LDFLAGS_class-nativesdk = "-linkmode external"
+export GO_LDFLAGS
 
 do_configure[noexec] = "1"
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list