Skip to contentSkip to conversation

classes/toolchain/clang: Add placeholder for dynamic linker in cross-canadian packages

PATCH New Khem Raj 1 participant 2 messages Oct 27, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/2 classes/toolchain/clang: Add placeholder for dynamic linker in cross-canadian packages

clang-cross-canadian is just symlinking into nativesdk-clang unlike gcc which has separate binaries and they have inbuilt dynamic linker specs. To help clang built cross-canadian binaries add it via cmdline option here, cross-canadian binaries are only usable on installed SDKs, and these paths get re-written with correct SDK specific linker during SDK install relocation process.

This helps clang built cross-canadian tools e.g. from binutils-cross-canadian be relocated correctly on SDK install.

---
v2: Use a placeholder that is not confusing with real ldso

 meta/classes/toolchain/clang.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/toolchain/clang.bbclass +1 -0
index b4a1c180f6a..9a3cd0e5849 100644
@@ -32,6 +32,7 @@ TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre
 
 LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2"
 LDFLAGS:append:class-nativesdk:aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1"
+LDFLAGS:append:class-cross-canadian = " -Wl,-dynamic-linker,${base_libdir}/placeholder/to/be/rewritten/by/sdk/installer"
 
 # do_populate_sysroot needs STRIP, do_package_qa needs OBJDUMP
 POPULATESYSROOTDEPS:append:class-target = " llvm-native:do_populate_sysroot"
author
#1 lore raw

PATCH 2/2 binutils-cross-canadian: Do not install bdf-plugins

for SDK they are provided via nativesdk-binutils latest binutils have started to build libdep plugin as static library libdep.a which is then reported via build QA

ERROR: QA Issue: non -staticdev package contains static .a library: binutils-cross-canadian-aarch64 path '/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/lib/aarch64-oe-linux/bfd-plugins/libdep.a' [staticdev]

---
 meta/recipes-devtools/binutils/binutils-cross-canadian.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/binutils/binutils-cross-canadian.inc +2 -1
index 7d7ffe92ce1..d28dcaf4022 100644
@@ -21,9 +21,10 @@ LDFLAGS:append:toolchain-clang = " -fuse-ld=bfd"
 do_install () {
 	autotools_do_install
 
-	# We're not interested in the libs or headers, these would come from the 
+	# We're not interested in the plugins, libs, or headers, these would come from the
 	# nativesdk or target version of the binutils recipe
 	rm -rf ${D}${prefix}/${TARGET_SYS}
+	rm -rf ${D}${libdir}/bfd-plugins
 	rm -f ${D}${libdir}/libbfd*
 	rm -f ${D}${libdir}/libiberty*
 	rm -f ${D}${libdir}/libopcodes*