
mold
A faster drop-in replacement for Unix linkers, written in Rust, to shorten build times.
- Stars
- 17.7k
- Forks
- 585
- Licence
- MIT
- Language
- Rust
- Last update
- 15 days ago
- Type
- Dev tool
What it is
mold is a linker, the final build step that combines compiled object files into one executable or shared library. It is a drop-in replacement for existing Unix linkers, so it can be used without changing your source code. Its stated goal is to make the linking step, which can take a long time on large programs, much faster.
- Speed up incremental debug builds of a large C++ or Rust project by switching the linker
- Link programs for other CPU architectures such as ARM64 or RISC-V using the supported targets
- Compare link times against lld or wild using the benchmark suite the author published
Great for
- Developers working on large C, C++, or Rust programs with slow link times
- Teams doing frequent debug-edit-rebuild cycles
- Linux users on the supported architectures who want to try a faster linker
- Projects whose build system already lets them pass a compiler flag like -fuse-ld=mold
Not ideal for
- Developers on macOS or Windows, since the README only describes Unix-style linking and lists Windows only as a release zip without detail (reason: unclear platform support from the README)
- Small projects where link time is already negligible (reason: the benefit only matters when linking is a bottleneck)
- People who need a linker feature set the README does not describe (reason: the README does not document full compatibility details)
How to get it
- 1
Clone and build from source
You'll need: Rust 1.95 or later (or install via rustup) · Git · A C compiler such as GCC or Clang
Clone the repository
git clone https://github.com/rui314/mold.gitBuild the release binary
cd mold && cargo build --releaseInstall under /usr/local
sudo ./install-mold.sh - 2
Run it
- Build mold with cargo build --release, or install it with the script.
- Find the binary at target/release/mold, or use the installed copy.
- Add -fuse-ld=mold to your Clang or GCC 12.1.0+ linker flags.
- Rebuild your project and compare the link time.
- 3
Get the most out of it
- Use the -B option with /usr/local/libexec/mold if you have an older GCC that does not accept -fuse-ld=mold
- Install with PREFIX set (for example sudo PREFIX=/usr ./install-mold.sh) to match your system layout
- Read the author's paper on the design for details on how the speed is achieved
Downloads
Strengths
- The README reports large speedups over lld and wild in its own benchmarks, with the full inputs published on Zenodo
- It is a drop-in replacement, so it works through existing compiler flags such as -fuse-ld=mold
- It supports many CPU architectures and is MIT-licensed
Trade-offs
- Benchmark results come from the author and were run on two specific machines, so your gains may differ
- Some competitors cannot link certain programs (marked N/A), which makes direct comparison incomplete
- Older GCC versions need a less convenient -B option to use it
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.