mold 3.0: the fast linker is now written in Rust
Summary
On 5 October 2026 Rui Ueyama released mold 3.0, the first version of the fast linker after its complete rewrite from C++ to Rust. The new version is meant to be a drop-in replacement for mold 2.42.1, with the same options, target architectures and speed. The goal of the 3.x series is to close the remaining gaps to GNU ld so that Linux distributions can use mold as their default linker.
What is a linker and why mold?
A linker combines the object files produced by the compiler and the libraries into an executable program. For large projects such as browsers or the kernel, this step alone can take many seconds to minutes, with every rebuild. mold was developed to cut this waiting time drastically through consistent parallelisation and is considerably faster than the classic linkers GNU ld and gold.
For developers, a fast linker means shorter paths between change and test; for distributions, faster package builds.
What the switch to Rust brings
The C++ version could read beyond memory bounds on corrupted input files and crash with a segmentation fault. In Rust these accesses are checked; mold then stops in a controlled way with an error message. It is now built with Cargo instead of CMake, and the dependency on oneTBB is gone.
The rewrite was checked with the test suite on all target architectures, by comparing linker output across many real projects and by building all Gentoo packages. The project found no regressions. Along the way, the release fixes numerous bugs, such as nondeterministic output and wrong addresses for certain relocations.
Why it is interesting beyond mold
A complete rewrite of an established tool is usually considered risky. mold shows how it can work: clearly defined as a replacement without functional changes, tested against the behaviour of its predecessor and backed by a large real-world test case such as Gentoo. This fits the broader trend of gradually moving security-critical system software to memory-safe languages.
Ideas
- A linker combines object files and libraries into a program.
- Consistent parallelisation considerably shortens linking of large projects.
- Memory-safe languages turn memory errors into controlled aborts.
- A rewrite is tested against the behaviour of its predecessor.
Insights
- A rewrite is more likely to succeed if it is defined and tested as a functionally identical replacement.
- Building an entire distribution is a strict real-world test for system tools.
Facts
- mold 2.42.1 is the last version in C++.
- Building mold 3.0 requires Rust 1.95 or later and a C compiler.
- mold no longer reserves 8 GiB of virtual address space at startup and therefore also runs under ulimit -v.
References
Remarks
- mold comes from Rui Ueyama, who previously also played a major part in developing the LLVM linker lld.
Recommendations
- Test mold in your own projects with -fuse-ld=mold or mold -run and compare build times.
- For package builds, check whether your own build scripts still use mold 2.x CMake options.
Links to the original source and the Web Archive open in a new tab.