recipes: Drop ld-is-gold support

Gold hasn't seen development in some time and is being dropped from binutils
releases. Drop the small number of special cases for it we were carrying.

This patch also turns off gold in the binutils recipe.

(From OE-Core rev: a4addb9ab63011e7c604fc5daff95559e7d214e7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2025-02-06 14:48:07 +00:00
parent 6d0cf6477c
commit 89ce67d8e4
8 changed files with 10 additions and 50 deletions

View File

@ -10,7 +10,7 @@ inherit uboot-config uboot-extlinux-config uboot-sign deploy python3native kerne
DEPENDS += "swig-native"
EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} V=1'
EXTRA_OEMAKE += 'CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)} ${DEBUG_PREFIX_MAP}"'
EXTRA_OEMAKE += 'CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${DEBUG_PREFIX_MAP}"'
EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"'
EXTRA_OEMAKE += 'STAGING_INCDIR=${STAGING_INCDIR_NATIVE} STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}'
@ -35,10 +35,6 @@ require u-boot-configure.inc
UBOOT_ARCH_DIR = "${@'arm' if d.getVar('UBOOT_ARCH').startswith('arm') else d.getVar('UBOOT_ARCH')}"
do_compile () {
if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
fi
unset LDFLAGS
unset CFLAGS
unset CPPFLAGS

View File

@ -56,12 +56,6 @@ GPROFNG_ALTS:x86 = "${GPROFNGS}"
GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
LDGOLD_ALTS ?= "ld.gold dwp"
LDGOLD_ALTS:riscv64 = ""
LDGOLD_ALTS:riscv32 = ""
LDGOLD_ALTS:loongarch64 = ""
LDGOLD_ALTS:libc-glibc:mipsarch = ""
USE_ALTERNATIVES_FOR = " \
addr2line \
ar \
@ -72,7 +66,6 @@ USE_ALTERNATIVES_FOR = " \
${GPROFNG_ALTS} \
ld \
ld.bfd \
${LDGOLD_ALTS} \
nm \
objcopy \
objdump \
@ -104,7 +97,7 @@ EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
--disable-libdecnumber \
--disable-readline \
--disable-sim \
${LDGOLD} \
--disable-gold \
${EXTRA_TARGETS} \
${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
@ -112,12 +105,6 @@ EXTRA_TARGETS = ""
EXTRA_TARGETS:x86-64 = " --enable-targets=x86_64-pe,x86_64-pep "
EXTRA_TARGETS:class-native = ""
LDGOLD:class-native = ""
LDGOLD:class-crosssdk = ""
LDGOLD:libc-glibc:mipsarch = ""
LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}"
# This is necessary due to a bug in the binutils Makefiles
# EXTRA_OEMAKE = "configure-build-libiberty all"
@ -204,8 +191,3 @@ inherit update-alternatives
ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE:${PN}:class-target = "${USE_ALTERNATIVES_FOR}"
python () {
if bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', True, False, d) and bb.utils.contains_any('TARGET_ARCH', 'riscv32 riscv64 loongarch64', True, False, d):
bb.fatal("Gold linker does not _yet_ support RISC-V and LoongArch architecture please remove ld-is-gold from DISTRO_FEATURES")
}

View File

@ -48,8 +48,3 @@ do_install () {
}
BBCLASSEXTEND = "nativesdk"
# Since 1.70.0 upgrade this fails to build with gold:
# http://errors.yoctoproject.org/Errors/Details/708194/
# ld: error: version script assignment of to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined
LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '-fuse-ld=bfd', '', d)}"

View File

@ -377,8 +377,3 @@ RUSTLIB_DEP:class-nativesdk = ""
INSANE_SKIP:${PN} = "staticdev"
BBCLASSEXTEND = "native nativesdk"
# Since 1.70.0 upgrade this fails to build with gold:
# http://errors.yoctoproject.org/Errors/Details/708196/
# ld: error: version script assignment of to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined
LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '-fuse-ld=bfd', '', d)}"

View File

@ -36,19 +36,18 @@ S = "${WORKDIR}/git"
inherit autotools-brokensep pkgconfig
# Version 20220527 added KVM test infrastructure which currently fails to build with gold due to
# Version 20220527 added KVM test infrastructure which currently fails to build with lld due to
# SORT_NONE in linker script which isn't supported by gold:
# https://sourceware.org/bugzilla/show_bug.cgi?id=18097
# https://github.com/linux-test-project/ltp/commit/3fce2064b54843218d085aae326c8f7ecf3a8c41#diff-39268f0855c634ca48c8993fcd2c95b12a65b79e8d9fa5ccd6b0f5a8785c0dd6R36
LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '-fuse-ld=bfd', '', d)}"
LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '-fuse-ld=bfd', '', d)}"
# After 0002-kvm-use-LD-instead-of-hardcoding-ld.patch
# https://github.com/linux-test-project/ltp/commit/f94e0ef3b7280f886384703ef9019aaf2f2dfebb
# it fails with gold also a bit later when trying to use *-payload.bin
# it fails with lld also a bit later when trying to use *-payload.bin
# http://errors.yoctoproject.org/Errors/Details/663094/
# work around this by forcing .bfd linked in LD when ld-is-gold is in DISTRO_FEATURES
KVM_LD = "${@bb.utils.contains_any('DISTRO_FEATURES', 'ld-is-gold ld-is-lld', '${HOST_PREFIX}ld.bfd${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', '${LD}', d)}"
# work around this by forcing .bfd linked in LD when ld-is-lld is in DISTRO_FEATURES
KVM_LD = "${@bb.utils.contains_any('DISTRO_FEATURES', 'ld-is-lld', '${HOST_PREFIX}ld.bfd${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', '${LD}', d)}"
TARGET_CC_ARCH += "${LDFLAGS}"

View File

@ -142,10 +142,6 @@ EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic"
EXTRA_OECONF:append:armv7a = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}"
EXTRA_OECONF:append:armv7ve = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}"
# gold crashes on x86, another solution is to --disable-asm but thats more hacky
# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd ', '', d)}"
EXTRA_OEMAKE = "V=1"

View File

@ -118,12 +118,9 @@ EXTRA_OECMAKE:append:armv4 = " -DENABLE_JIT=OFF "
EXTRA_OECMAKE:append:armv5 = " -DENABLE_JIT=OFF "
EXTRA_OECMAKE:append:armv6 = " -DENABLE_JIT=OFF "
EXTRA_OECMAKE:append:mipsarch = " -DUSE_LD_GOLD=OFF "
EXTRA_OECMAKE:append:powerpc = " -DUSE_LD_GOLD=OFF "
# JIT and gold linker does not work on RISCV
EXTRA_OECMAKE:append:riscv32 = " -DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF"
EXTRA_OECMAKE:append:riscv64 = " -DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF"
# JIT does not work on RISCV
EXTRA_OECMAKE:append:riscv32 = " -DENABLE_JIT=OFF"
EXTRA_OECMAKE:append:riscv64 = " -DENABLE_JIT=OFF"
# JIT not supported on MIPS either
EXTRA_OECMAKE:append:mipsarch = " -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON "

View File

@ -30,7 +30,7 @@ EXTRA_OECONF = "--enable-static"
ARM_INSTRUCTION_SET:armv4 = "arm"
ARM_INSTRUCTION_SET:armv5 = "arm"
LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
LDFLAGS += "-Wl,-z,relro,-z,now"
SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared"
CACHED_CONFIGUREVARS:append:libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'"