Skip to content

Commit

Permalink
go-runtime: Use BFD linker when LLD is default system linker on aarch64
Browse files Browse the repository at this point in the history
go linker is not able to link subsequent binaries e.g. gosu with lld
produced libstd.so and crashes. This is just seen on arm64

Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
kraj committed Aug 23, 2023
1 parent 2e4dcca commit 4c124ca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions conf/nonclangable.conf
Original file line number Diff line number Diff line change
Expand Up @@ -564,4 +564,9 @@ LDFLAGS:append:pn-libffi:x86:toolchain-clang = "${@bb.utils.contains('DISTRO_FEA
LDFLAGS:append:pn-libffi:arm:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
LDFLAGS:append:pn-elfutils:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"

# Avoid's go linker crash as reported in https://github.com/golang/go/issues/61872
# it happens when libstd.so is linked with lld for aarch64
LDFLAGS:append:pn-go-runtime:toolchain-clang:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd', '', d)}"
LDFLAGS:remove:pn-go-runtime:toolchain-clang:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '-fuse-ld=lld', '', d)}"

LD:pn-gnu-efi:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '${HOST_PREFIX}ld.bfd${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', '${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', d)}"

0 comments on commit 4c124ca

Please sign in to comment.