Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the lld linker a drop-in replacement for ld and gold?

Tags:

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.

like image 264
usr1234567 Avatar asked Mar 31 '15 06:03

usr1234567


People also ask

Is LD faster than gold?

gold was about 3x/4x faster than LD.

Why is LLD faster?

Among the reasons why LLD is so much faster comes down to its threading model, continuously evaluating its performance with code changes, a custom memory allocator, more efficient data structures, and other design choices.

What is LLD in Linux?

LLD is a linker from the LLVM project that is a drop-in replacement for system linkers and runs much faster than them. It also provides features that are useful for toolchain developers. The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS) and WebAssembly in descending order of completeness.

Does clang have a linker?

Clang can be configured to use one of several different linkers: GNU ld. GNU gold. LLVM's lld.


1 Answers

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.

  • "Now I'm pretty sure that that [LLD] is going to be a serious (and better, in my opinion) alternative to the existing GNU linkers [..]."
  • "LLD is now able to link most x86-64 userland programs."
  • "The FreeBSD project and we are trying to make LLD the system default linker of the operating system, and except a few tricky programs such as the kernel or a bootloader, the linker works mostly fine." Already achieved!
  • "LLD supports x86, x86-64, x32, AArch64, AMDGPU, ARM, PPC64 and MIPS32/64, though completeness varies."
  • "[T]here are already a few systems that are using LLD as system linkers, such as CloudABI or Fuchsia. Chromium and Clang/LLVM itself has build options to use LLD to build them."

And, as a bonus:

  • "LLD got faster [..] At the beginning of this year, LLD took about 16 seconds to produce a 1.5 GB clang (debug build) executable. Now, it takes about 14.5 seconds on single core and 8.5 seconds on 20 cores. ld.gold takes about 25 seconds and 20 seconds, respectively. [..] If you have a problem of too long link time, I'd recommend to try LLD."

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).", see http://lists.llvm.org/pipermail/llvm-dev/2017-March/111083.html It also contains a brief description on how to make use of LLD.

like image 127
usr1234567 Avatar answered Sep 21 '22 10:09

usr1234567