On Tue, Jan 20, 2026 at 03:53 AM, mark.yang wrote:
The build reproduction steps and the intention for this patch can be found in the v1 patch at https://lists.openembedded.org/g/openembedded-core/topic/117252728.

PACKAGECONFIG:remove:class-native = "lto thin-lto"
Due to the configuration, llvm-native cannot enable lto in PACKAGECONFIG in any way.

When attempting to use clang + lto, components that cannot use the lld linker (and instead use the bfd linker) require the LLVMgold.so plugin.
To achieve this, binutils and the -DLLVM_BINUTILS_INCDIR flag in CMake are required.
(https://github.com/llvm/llvm-project/blob/main/clang/docs/ThinLTO.rst#basic)

Anyway, llvm-native cannot have LTO enabled due to the `remove`.
-DLLVM_ENABLE_LTO=Full determines whether LLVM itself will be built with LTO applied.
 
However, even if LLVM is not built using LTO, I think the environment should still be configured so that other components using the LLVM/clang toolchain can use LTO.
Hi Mark,

Thanks for the explanation. However, LTO builds are not part of the default workflow,
and adding binutils to DEPENDS would increase build time for all LLVM builds. I guess
passing -DLLVM_BINUTILS_INCDIR via a new PACKAGECONFIG is a better option without
impacting default builds.

Regards,
Deepesh