From b65fe24b8cbcf8797f31d058a79f8a21985e955d Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Tue, 19 Sep 2023 22:18:03 -0700 Subject: nerdctl: fix textrel QA issue 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. Signed-off-by: Chen Qi Signed-off-by: Bruce Ashfield --- recipes-containers/nerdctl/nerdctl_git.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes-containers/nerdctl/nerdctl_git.bb b/recipes-containers/nerdctl/nerdctl_git.bb index 892629fe..4e65405e 100644 --- a/recipes-containers/nerdctl/nerdctl_git.bb +++ b/recipes-containers/nerdctl/nerdctl_git.bb @@ -49,6 +49,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 @@ -62,7 +64,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 -- cgit v1.2.3-54-g00ecf