[clang] [ToolChains][FreeBSD] Set default Linker to LLD for FreeBSD (PR #190596)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 13 01:10:24 PDT 2026
aokblast wrote:
> What is the motivation for this? We have been installing LLD as ld on FreeBSD for about ten years, setting the default to ld.lld seems like it will make it harder to move to a different linker in the future for no benefit.
It doesn’t behave as we originally expected. When the linker name is ld, the toolchain applies special handling: it prefers invoking ${triple}-${linker} over ${linker}, rather than resolving ld via the usual path lookup. As a result, if GNU ld is installed via the package system, it takes precedence—since ${triple}-ld is found first in the search path—effectively overriding ld.lld.
See: https://github.com/llvm/llvm-project/blob/82442a58c054611219385528f06a05bf1eb19215/clang/lib/Driver/ToolChain.cpp#L1111
See: https://github.com/llvm/llvm-project/blob/82442a58c054611219385528f06a05bf1eb19215/clang/lib/Driver/Driver.cpp#L6794
https://github.com/llvm/llvm-project/pull/190596
More information about the cfe-commits
mailing list