The linker from the LLVM project lld
is currently developed with new features added week by week. Its developers promise that lld
is faster than ld
. How does it compete compared to gold
?
Is lld a drop-in replacement for ld
? With gold there are some hoops to jump through .
One of the LLD developers, Rui Ueyama, looks back at the progress LLD did in 2016, see http://lists.llvm.org/pipermail/llvm-dev/2016-December/107981.html .
And, as a bonus:
Update spring 2017 According to one of the developers "LLD/ELF is now ready for production use at least for x86-64 (and probably for AArch64 and MIPS).", seehttp://lists.llvm.org/pipermail/llvm-dev/2017-March/111083.html It also contains a brief description on how to make use of LLD.
The program itself claims compatibility goal, and seems to work fine on simple tests
Eg on Ubuntu 20.04 I install :
sudo apt install lld
lld --version
says:
LLD 10.0.0 (compatible with GNU linkers)
and I'm able to compile a C hello world with -fuse-ld=lld
:
gcc -fuse-ld=lld -ggdb3 -O0 -std=c11 -Wall -Wextra -pedantic -o hello.out hello.c
Performance benchmark vs gold
I'll document results soon at: Replacing ld with gold - any experience?
FreeBSD / OpenBSD use lld as the system linker. FreeBSD does across all supported archs, for OpenBSD we do for all minus mips64 at the moment (amd64 arm i386 powerpc -- aarch64 powerpc64 riscv64 ports were from scratch and never used the BFD linker, but do use lld). We're building the whole OS and 99.9999% of the ports tree. I can count on one hand how many are left that do not.
It's definitely much faster for larger projects especially larger C++ projects like Chrome, Firefox, Thunderbird, KDE, etc. Also lower memory utilization which can be problematic on 32-bit archs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.