lld, part of the LLVM family of projects, is a high-performance linker for the ELF, COFF, and Mach-O object formats. This page describes the now-completed project to use lld as FreeBSD's base system linker.
As of 13, lld is now the default system linker on all supported architectures.
Prior to this, lld was in use on i386, amd64, arm*, aarch64, and riscv64*, with other architectures still using GNU BFD ld. For more information, see arch(7) in the manual for your particular FreeBSD version.
To forcibly build world and kernel with LLD and install LLD as /usr/bin/ld in pre-13 versions, add to /etc/src.conf:
WITH_LLD_IS_LD=yes WITH_LLD_BOOTSTRAP=yes
WITH_LLD_BOOTSTRAP=yes uses lld as the linker for building the FreeBSD world, and has no effect on the linker installed in /usr/bin/ld. WITH_LLD_IS_LD=yes installes lld as /usr/bin/ld, and has no effect on the linker used for building world.
MIPS
ARM
A FreeBSD ports exp-run is tracked in PR214864.
Common issues in ports:
-fPIC, to the linker./lib, /usr/lib). Normally the linker is invoked from the compiler driver, which adds the library search paths. If lld is invoked directly then library search paths must be explicitly specified, with -L/lib -L/usr/lib.