[clang] [ToolChains][FreeBSD] Set default Linker to LLD for FreeBSD (PR #190596)
David Chisnall via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 13 01:31:49 PDT 2026
davidchisnall 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.
Please can you add that justification to the commit message? I think that's fine with the rationale, but someone coming to this commit in the history would simply see a change with no motivation. Ideally, we'd also have a comment on the changed lines such as:
```
// On FreeBSD, `/usr/bin/ld` is `ld.lld`, but other things may be installed in the path named `ld` or `{triple}-ld`, which may be picked by preference if we default to `ld` here.
```
And then people who see the code don't need `git blame` to understand the why.
https://github.com/llvm/llvm-project/pull/190596
More information about the cfe-commits
mailing list