When you build a program, the compiler turns each source file into an object file. Then a linker stitches all the object files and libraries into one executable.

On Linux, the default linker is usually GNU ld (also called bfd). The GNU binutils also ship gold, an alternative linker that was designed to be faster. Gold was built at Google and first made available in 2008.

The mold linker is a newer linker written by Rui Ueyama. It was first released in 2021. It is meant as a drop-in replacement for GNU ld, and its main selling point is speed. The latest release is version 3.

How much faster is it on a large project? I built Node.js from its main branch on an Intel Xeon Gold 6548N server (Emerald Rapids, two sockets, 64 cores and 128 threads) running Linux with GCC 14.3. The final node executable weighs about 160 MB.

I captured the command that links the node executable and ran it six times with each linker. I report the median.

linker time to link node
GNU ld (bfd) 2.41 2.52 s
GNU gold 2.41 1.46 s
mold 3.0.0, 1 thread 0.49 s
mold 3.0.0, 8 threads 0.13 s
mold 3.0.0, 128 threads 0.11 s

With multithreading, mold is about 24 times faster than GNU ld and about 14 times faster than gold.

Even if I restrict mold to a single thread, it links Node.js in half a second, five times faster than GNU ld. With only 8 threads, you get nearly all of the benefit.

Using mold is easy. You can pass -fuse-ld=mold to GCC or clang. Or you can wrap your whole build:

mold -run make -j128

The -run option intercepts every call to the default linker and redirects it to mold. You do not need to change the build scripts.

Of course, two seconds saved on a link does not matter much if you build Node.js once. But a developer who edits a file and rebuilds dozens of times a day pays the link cost each time. With mold, the link step becomes nearly free.

My scripts and raw results are available.