cmake: zephyr: Define LLVM_USE_LLD for the llvm variant - #1162
Open
tpambor wants to merge 1 commit into
Open
Conversation
1 task
The llvm toolchain description hardcodes 'set(LINKER lld)' in cmake/zephyr/llvm/generic.cmake, but nothing ever told Kconfig about it. Zephyr's linker scripts wrap the output section descriptions for .symtab, .strtab and .shstrtab in '#if defined(CONFIG_LLVM_USE_LLD)', because lld models these as synthetic input sections that have to be placed by the linker script, while GNU ld creates them internally after script processing. That symbol is declared only in Zephyr's cmake/toolchain/host/llvm/Kconfig, which is not sourced for the 'zephyr' variant. CONFIG_LLVM_USE_LLD was therefore never set with ZEPHYR_TOOLCHAIN_VARIANT set to zephyr/llvm, and every link reported the sections as orphans: ld.lld: warning: <internal>:(.symtab) is being placed in '.symtab' ld.lld: warning: <internal>:(.shstrtab) is being placed in '.shstrtab' ld.lld: warning: <internal>:(.strtab) is being placed in '.strtab' Define the symbol in the SDK's Kconfig. No choice is needed, as lld is the only linker this variant can use. Assisted-by: Claude:opus-5 Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
tpambor
force-pushed
the
llvm-use-lld-kconfig
branch
from
September 13, 2026 09:38
44893a0 to
349f64a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The llvm toolchain description hardcodes
set(LINKER lld)incmake/zephyr/llvm/generic.cmake, but nothing ever told Kconfig about it.Zephyr's linker scripts wrap the output section descriptions for
.symtab,.strtaband.shstrtabin#if defined(CONFIG_LLVM_USE_LLD), because lld models these as synthetic input sections that have to be placed by the linker script, while GNU ld creates them internally after script processing. That symbol is declared only in Zephyr'scmake/toolchain/host/llvm/Kconfig, which is not sourced for thezephyr/llvmvariant.CONFIG_LLVM_USE_LLDwas therefore never set withZEPHYR_TOOLCHAIN_VARIANTset tozephyr/llvm, and every link reported the sections as orphans:Define the symbol in the SDK's Kconfig. No choice is needed, as lld is the only linker this variant can use.
Fixes zephyrproject-rtos/zephyr#96389