summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2022-01-13 22:22:49 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-14 09:25:31 +0000
commitf9f3e1bd3e1144f237598c6e20874bc621de6190 (patch)
treeae3392a276dced62375b774d44f5f07650789f46
parent58aa9f81554a76b877a267ab98e0fae4fb9ed73c (diff)
downloadpoky-f9f3e1bd3e1144f237598c6e20874bc621de6190.tar.gz
go: fix building without SECURITY_LDFLAGS
Commit 9985b17a30bb ("go: correctly set debug-prefix-map and build directory") has changed CGO_LDFLAGS to the manually crafted version of LDFLAGS to strip out DEBUG_PREFIX_MAP contents. However this manually crafted version includes ${SECURITY_LDFLAGS}. If security_flags.inc is not included, the variable is not defined, thus CGO_LDFLAGS will include the '${SECURITY_LDFLAGS}' literally. When building the recipe, the build would break with the follwing message: aarch64-linaro-linux-gcc: error: ${SECURITY_LDFLAGS}: No such file or directory So, instead of manually specifying variable contents, perform the expected action: filter offending arguments out of LDFLAGS. Cc: Alexander Kanavin <alex.kanavin@gmail.com> (From OE-Core rev: e7d2d68679c1980d9e889d96c3eab49589f5b832) Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/go/go-runtime.inc3
-rw-r--r--meta/recipes-devtools/go/go-target.inc3
2 files changed, 4 insertions, 2 deletions
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
index a08d44dd3a..ccb86d4fe9 100644
--- a/meta/recipes-devtools/go/go-runtime.inc
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -10,7 +10,8 @@ DEBUG_PREFIX_MAP = "\
10export CGO_CFLAGS = "${CFLAGS}" 10export CGO_CFLAGS = "${CFLAGS}"
11export CGO_CPPFLAGS = "${CPPFLAGS}" 11export CGO_CPPFLAGS = "${CPPFLAGS}"
12export CGO_CXXFLAGS = "${CXXFLAGS}" 12export CGO_CXXFLAGS = "${CXXFLAGS}"
13export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}" 13# Filter out -fdebug-prefix-map options as they clash with the GO's build system
14export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f: not f.startswith('-fdebug-prefix-map'), d.getVar('LDFLAGS').split())) }"
14export GOCACHE = "${B}/.cache" 15export GOCACHE = "${B}/.cache"
15 16
16GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}" 17GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
diff --git a/meta/recipes-devtools/go/go-target.inc b/meta/recipes-devtools/go/go-target.inc
index 51f1b79cc3..b0d487ae1c 100644
--- a/meta/recipes-devtools/go/go-target.inc
+++ b/meta/recipes-devtools/go/go-target.inc
@@ -9,7 +9,8 @@ DEBUG_PREFIX_MAP = "\
9export CGO_CFLAGS = "${CFLAGS}" 9export CGO_CFLAGS = "${CFLAGS}"
10export CGO_CPPFLAGS = "${CPPFLAGS}" 10export CGO_CPPFLAGS = "${CPPFLAGS}"
11export CGO_CXXFLAGS = "${CXXFLAGS}" 11export CGO_CXXFLAGS = "${CXXFLAGS}"
12export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}" 12# Filter out -fdebug-prefix-map options as they clash with the GO's build system
13export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f: not f.startswith('-fdebug-prefix-map'), d.getVar('LDFLAGS').split())) }"
13 14
14export GOCACHE = "${B}/.cache" 15export GOCACHE = "${B}/.cache"
15GO_LDFLAGS = "" 16GO_LDFLAGS = ""