[PATCH] go: Always pass interpreter to linker


J?rg Vehlow
 

From: Joerg Vehlow <joerg.vehlow@...>

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@...>
---
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
=20
GO_PARALLEL_BUILD ?=3D "${@oe.utils.parallel_make_argument(d, '-p %d')}"
=20
@@ -44,7 +45,7 @@ GO_LINKMODE ?=3D ""
GO_LINKMODE:class-nativesdk =3D "--linkmode=3Dexternal"
GO_LINKMODE:class-native =3D "--linkmode=3Dexternal"
GO_EXTRA_LDFLAGS ?=3D ""
-GO_LDFLAGS ?=3D '-ldflags=3D"${GO_RPATH} ${GO_LINKMODE} ${GO_EXTRA_LDFLA=
GS} -extldflags '${GO_EXTLDFLAGS}'"'
+GO_LDFLAGS ?=3D '-ldflags=3D"${GO_RPATH} ${GO_LINKMODE} -I ${@get_linuxl=
oader(d)} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
export GOBUILDFLAGS ?=3D "-v ${GO_LDFLAGS} -trimpath"
export GOPATH_OMIT_IN_ACTIONID ?=3D "1"
export GOPTESTBUILDFLAGS ?=3D "${GOBUILDFLAGS} -c"
--=20
2.25.1

Join openembedded-core@lists.openembedded.org to automatically receive all group messages.