From: Joerg Vehlow <lkml@jv-coder.de>
To: openembedded-core@lists.openembedded.org, raj.khem@gmail.com
Cc: Joerg Vehlow <joerg.vehlow@aox.de>
Subject: [PATCH] go: Always pass interpreter to linker
Date: Mon, 11 Apr 2022 14:35:20 +0200 [thread overview]
Message-ID: <20220411123520.95107-1-lkml@jv-coder.de> (raw)
From: Joerg Vehlow <joerg.vehlow@aox.de>
When gos internal linker is used, it uses hardcoded paths to the
interpreter (dynamic linker). For x86_64 this hardcoded path is
/lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path
is /lib64/ld-linux-x86-64.so.2.
Most of the time, the internal linker is not used and binutils linker
sets the correct path, but sometimes the internal linker is used and
the resulting binary will not work on x86_64.
To ensure the path is always correct, pass it to the linker.
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox.de>
---
meta/classes/go.bbclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 9c4c92bffd..df8d4db26d 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -1,4 +1,5 @@
inherit goarch
+inherit linuxloader
GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
@@ -44,7 +45,7 @@ GO_LINKMODE ?= ""
GO_LINKMODE:class-nativesdk = "--linkmode=external"
GO_LINKMODE:class-native = "--linkmode=external"
GO_EXTRA_LDFLAGS ?= ""
-GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
+GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -I ${@get_linuxloader(d)} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
export GOPATH_OMIT_IN_ACTIONID ?= "1"
export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
--
2.25.1
next reply other threads:[~2022-04-11 17:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 12:35 Joerg Vehlow [this message]
2022-04-11 13:30 ` [OE-core] [PATCH] go: Always pass interpreter to linker Jose Quaresma
2022-04-11 13:32 ` Joerg Vehlow
2022-04-11 16:04 ` Khem Raj
2022-04-14 5:24 ` Joerg Vehlow
2022-04-29 12:45 ` Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220411123520.95107-1-lkml@jv-coder.de \
--to=lkml@jv-coder.de \
--cc=joerg.vehlow@aox.de \
--cc=openembedded-core@lists.openembedded.org \
--cc=raj.khem@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox