[llvm] [CMake] Set LLVM_USE_LINKER for external projects when using lld (PR #170401)
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 00:53:07 PST 2025
petrhosek wrote:
> @petrhosek I understand your concern about llvm_ExternalProject_Add being a generic utility.
>
> However, the existing code at line 244 already sets CMAKE_LINKER to ld.lld when lld is in TOOLCHAIN_TOOLS - so the utility already attempts to configure lld usage for external projects. The problem is that clang ignores CMAKE_LINKER on Linux and requires -fuse-ld=lld instead. My fix just makes this existing intent actually work.
The difference is that `CMAKE_LINKER` is a generic CMake flag while `LLVM_USE_LINKER` is specific to the LLVM build and it may not be supported by every subproject that's used with `llvm_ExternalProject_Add` such as the runtimes build.
> That said, if you'd prefer not to add LLVM_USE_LINKER in the generic utility, I'm happy to move the fix to llvm/runtimes/CMakeLists.txt where llvm_ExternalProject_Add is called. Let me know which approach you'd prefer.
Moving the fix to `llvm/runtimes/CMakeLists.txt` would be my preference.
https://github.com/llvm/llvm-project/pull/170401
More information about the llvm-commits
mailing list