Skip to contentSkip to conversation

nerdctl: fix textrel QA issue

PATCH In review [email protected] 2 participants 2 messages Sep 20, 2023 – Sep 25, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nerdctl: fix textrel QA issue

From: Chen Qi <[email protected]>

Fix the following QA issue:

ERROR: QA Issue: nerdctl: ELF binary /usr/bin/nerdctl has relocations in .text [textrel]

We want to use -buildmode=pie, in order to avoid duplicating codes with go.bbclass, make use of GOBUILDFLAGS.

---
 recipes-containers/nerdctl/nerdctl_git.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
recipes-containers/nerdctl/nerdctl_git.bb +3 -1
index 62460a52..f68223df 100644
@@ -51,6 +51,8 @@ PACKAGECONFIG ?= ""
 # sets the "sites" variable.
 include relocation.inc
 
+PIEFLAG = "${@bb.utils.contains('GOBUILDFLAGS', '-buildmode=pie', '-buildmode=pie', '', d)}"
+
 do_compile() {
 
     	cd ${S}/src/import
@@ -64,7 +66,7 @@ do_compile() {
 	export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 
-	export GOFLAGS="-mod=vendor -trimpath"
+	export GOFLAGS="-mod=vendor -trimpath ${PIEFLAG}"
 
 	# our copied .go files are to be used for the build
 	ln -sf vendor.copy vendor
Signature · 1 line
2.40.0
#1 lore raw

merged.

Bruce

In message: [meta-virtualization][PATCH] nerdctl: fix textrel QA issue

Quoted 49 lines · on 19/09/2023 Chen Qi via lists.yoctoproject.org wrote:

From: Chen Qi <[email protected]>

Fix the following QA issue:

ERROR: QA Issue: nerdctl: ELF binary /usr/bin/nerdctl has relocations in .text [textrel]

We want to use -buildmode=pie, in order to avoid duplicating codes with go.bbclass, make use of GOBUILDFLAGS.

---
 recipes-containers/nerdctl/nerdctl_git.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
recipes-containers/nerdctl/nerdctl_git.bb +3 -1
index 62460a52..f68223df 100644
@@ -51,6 +51,8 @@ PACKAGECONFIG ?= ""
 # sets the "sites" variable.
 include relocation.inc
 
+PIEFLAG = "${@bb.utils.contains('GOBUILDFLAGS', '-buildmode=pie', '-buildmode=pie', '', d)}"
+
 do_compile() {
 
     	cd ${S}/src/import
@@ -64,7 +66,7 @@ do_compile() {
 	export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 
-	export GOFLAGS="-mod=vendor -trimpath"
+	export GOFLAGS="-mod=vendor -trimpath ${PIEFLAG}"
 
 	# our copied .go files are to be used for the build
 	ln -sf vendor.copy vendor
Signature · 11 lines
2.40.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8313): https://lists.yoctoproject.org/g/meta-virtualization/message/8313
Mute This Topic: https://lists.yoctoproject.org/mt/101473054/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-