Skip to contentSkip to conversation

toolchain/classes: Add lld-native dependency when using lld as system linker

PATCH In review Khem Raj 2 participants 3 messages Dec 30, 2025 – Jan 12

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 toolchain/classes: Add lld-native dependency when using lld as system linker

This was not an issue before lld split from clang, but now its an independent recipe and needs to be brought into dependency chain, otherwise clang fails to build with -flto as it does not find gold or lld plugins.

---
 meta/classes/toolchain/clang.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/toolchain/clang.bbclass +1 -1
index 9a3cd0e584..9648063f1d 100644
@@ -26,7 +26,7 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-crosssdk = "clang-crosssdk-
 PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "clang-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "clang-crosssdk-${SDK_SYS}"
 
-BASE_DEFAULT_DEPS:append = " compiler-rt libcxx"
+BASE_DEFAULT_DEPS:append = " compiler-rt libcxx ${@bb.utils.contains("DISTRO_FEATURES", "ld-is-lld", "lld-native", "", d)}"
 
 TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-prefix=/usr", "", d)}"
 
#1 lore raw
Quoted 7 lines · Khem Raj via lists.openembedded.org

This was not an issue before lld split from clang, but now its an independent recipe and needs to be brought into dependency chain, otherwise clang fails to build with -flto as it does not find gold or lld plugins.

Conditional python in a very core variable like this isn’t ideal, and the clang-cross recipe already has this dependency. Is that not sufficient, or is there some edge case where that dependency isn’t enough?

Ross

author
#2 lore raw
Quoted 6 lines · Ross Burton
Quoted 3 lines

On 30 Dec 2025, at 06:48, Khem Raj via lists.openembedded.org <raj.khem=

Quoted 2 lines · [email protected]> wrote:

This was not an issue before lld split from clang, but now its an

Quoted 8 lines

independent

Quoted 1 line

recipe and needs to be brought into dependency chain, otherwise clang

fails to

Quoted 1 line

build with -flto as it does not find gold or lld plugins.

Conditional python in a very core variable like this isn’t ideal, and the clang-cross recipe already has this dependency. Is that not sufficient, or is there some edge case where that dependency isn’t enough?

Yeah I am also troubled by this. It shows up when enabling LTO since gold linker is gone clang would work with LLD but it does not find it in rootfs I will dig recipe that shows it but generally I think clang expects lld when lto is enabled. Cross clang would pull it into its own build but not into systoots its building packages in somehow

Quoted 2 lines

Ross