[llvm] [CMake] Set LLVM_USE_LINKER for external projects when using lld (PR #170401)

Zachary Fogg via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 2 23:38:52 PST 2025


zfogg 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.

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.

https://github.com/llvm/llvm-project/pull/170401


More information about the llvm-commits mailing list