mold is a high-performance linker built to replace the default Unix linker (ld, lld, gold) without changing your build setup. It's aimed at developers working with large C, C++, or Rust codebases where the link step of a build (combining compiled object files into an executable or shared library) eats up noticeable time during edit-compile-rebuild cycles. The project is written by the original author of LLVM lld, and it's been used in production since 2021.
Linking is often the slowest, least parallel part of a build. mold was designed from scratch around pervasive parallelism and efficient data structures to cut that time down, especially for debug builds of large projects where build output can run into gigabytes.
mold fits projects with large object file output where the link step is a measurable fraction of build time: big C++ codebases, browser engines, compilers, game engines, and Rust projects with many crates. It's particularly useful in debug-edit-rebuild loops, where developers relink repeatedly and every second matters, and in CI pipelines where link time adds up across many jobs.
It's less useful for small projects where linking already takes a fraction of a second; the overhead of switching linkers isn't worth it if your total link time is negligible. It also won't help with compile time itself, only the link phase, so projects bottlenecked on compilation rather than linking won't see much benefit. Some linker feature gaps exist in comparison to lld for edge cases (for example, identical code folding behavior differs from the wild linker), so projects relying on specific linker flags should check compatibility first.
Prebuilt binary packages are available for many Linux distributions (see the Repology badge in the repo), and prebuilt binaries for Linux on x86-64, ARM64, ARM32, RISC-V, PPC64LE, s390x, and LoongArch are attached to each GitHub release.
To build from source, you need Rust 1.95 or later (install via rustup if your system's Rust is older), Git, and a C compiler like GCC or Clang:
git clone https://github.com/rui314/mold.git
cd mold
cargo build --release
The resulting executable is at target/release/mold. To install it system-wide:
sudo ./install-mold.sh
Use sudo PREFIX=/usr ./install-mold.sh to install under a different prefix, or just run target/release/mold directly without installing.
To actually use mold, point your compiler driver at it. For Clang or GCC 12.1.0+, pass -fuse-ld=mold. For older GCC, use -B/usr/local/libexec/mold (or your custom prefix) since -fuse-ld doesn't accept mold as an argument on those versions. For Rust projects, add a rustflags entry in .cargo/config.toml pointing at mold via -C link-arg=-fuse-ld=mold. If you can't easily change compiler flags, run your build through mold -run make (or another build command) to intercept linker calls automatically on Linux and FreeBSD.