Merge commit 93a67259cf23 from llvm git (by ShengYi Hung):

[ToolChains][FreeBSD] Set default Linker to LLD for FreeBSD (#190596)

  When the linker is specified as ld, toolchain applies special handling
  by invoking (triple)-ld instead of resolving ld via standard PATH
  lookup. This causes GNU ld installed via the system package manager to
  take the precedence (since (triple)-ld appears earlier in the search
  path), effectively overriding ld.lld.

  As a result, we set the default Linker on FreeBSD to ld.lld to indicate
  we want to use lld by default.

PR:		292067
MFC after:	3 days
This commit is contained in:
Dimitry Andric
2026-06-13 12:03:11 +02:00
parent 4179f1d9de
commit 2b619b7c7b
@@ -91,6 +91,10 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
// Until dtrace (via CTF) and LLDB can deal with distributed debug info,
// FreeBSD defaults to standalone/full debug info.
bool GetDefaultStandaloneDebug() const override { return true; }
// 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.
const char *getDefaultLinker() const override { return "ld.lld"; }
protected:
Tool *buildAssembler() const override;