Vibeleaderboard
Index / tool

mold 3.0.0 Release

github.com/rui314/mold
Visit github.com
Category
Developer Tools
Rank

Previous survey · No. 796 ·

Type
TOOL
Use case
Coding
Interfaces
CLI
Latest release
v3.0.0
Date

About

mold 3.0.0 is the first release of the high-speed linker rewritten from C++ to Rust. It is meant as a drop-in replacement for 2.42.1 with the same command-line options, target architectures and output apart from listed bug fixes. The goal is to close remaining compatibility gaps with GNU ld, especially linker script support, so distributions can adopt mold as their default linker.

What it does

A linker is the last step of a C, C++ or Rust build: it stitches compiled object files into one executable or shared library. This one spreads that work across every available core, using parallel passes and lock-free hash tables, so a large debug build links in a second or two instead of tens of seconds. You select it with one compiler flag, or wrap the whole build command so it intercepts calls to the system linker. It writes ELF output, the binary format of Linux and most Unix systems, for a long list of CPU families.

Why it's ranked here

Link time is the part of the edit-rebuild loop that compilers cannot cache away, and this project goes straight at it. Its own benchmarks on a 64-core Threadripper put a Chromium debug link at 1.65 seconds against 16.64 for LLVM lld, and the full input suite is posted publicly so anyone can rerun it. The author originally wrote lld, the code is MIT licensed, and output is guaranteed bit-for-bit deterministic. The numbers are self-reported, but the method and inputs are stated.

What's good

Determinism is a stated guarantee: the same inputs, options and version produce identical bytes, and no host-specific defaults are baked in, which suits reproducible builds and build caches. Archive order on the command line stops mattering, because it remembers which archives can satisfy which symbols. Identical code folding hashes call chains in parallel; its own notes put Chromium under one second where lld takes five. Debug info can go to a separate file written in the background, and a repro flag packs every input into a tarball for bug reports.

Tradeoffs

Linker script support is minimal by design. The manual shipped in this release says it handles just enough to read the glibc stub script and that there is no plan to add more, so builds that depend on custom scripts, such as firmware or kernels, are out. On the Apple M1 Ultra runs the lead over the wild linker narrows, and wild is faster on two of the programs tested. GCC older than 12.1 needs a directory-override flag instead of the usual switch, and building from source needs Rust 1.95 plus a C compiler.

How to use it well

Best fit: anyone linking large C, C++ or Rust programs on Linux during tight debug-edit-rebuild cycles, where a multi-second link repeats dozens of times a day. Clang and GCC 12.1 or newer take a single linker-selection flag, and Rust projects set it once in their Cargo config, per project or globally. When a build system will not pass flags, run the build as a subcommand and it redirects linker calls through a preloaded library, on Linux and FreeBSD. There is a GitHub Action for CI. It does nothing for compile time.

Technical notes+

The workspace in Cargo.toml separates the generic ELF linker (elf/) from twenty per-architecture crates under arch/, because instantiating every target in one crate kept the compiler on a single core for minutes (arch/README.md); each crate pins the others to the exact workspace version, and the release profile sets codegen-units = 1 and panic = abort. Parallelism is rayon throughout (elf/Cargo.toml). elf/passes.rs marks live files by spawning one rayon scope task per newly reached file so the pool never drains between frontier rounds. common/parallel.rs adds a block-wise stable_partition and a Background job whose join yields to the pool rather than blocking, which would deadlock a one-worker pool. elf/icf.rs folds identical sections by hashing call trees one level deeper per iteration with 128-bit SipHash-1-3 digests, stored in a lock-free open-addressing DigestMap stamped by round number, and stops when the unique-digest count stops growing. common/concurrent_map.rs is a 64-shard lock-free map that panics when a probe passes 256 slots, so callers must size it upfront.

Observed

License
MIT
Language
Rust, built with Cargo; requires Rust 1.95 or later
Interface
Command-line linker selected through the compiler driver
Target architectures
x86-64, i386, ARM 32/64, RISC-V 32/64, PowerPC 32/64, s390x, LoongArch 32/64, SPARC64, m68k, SH-4
Install surface
Distribution packages, prebuilt Linux binaries on GitHub releases, or build from source
Linker script support
Very limited, with no plan to extend it
Output determinism
Bit-for-bit identical output for identical inputs, options and version
Build interception
Wraps a build command to redirect linker calls; Linux and FreeBSD only
Tests
Workspace has a tests crate; unit tests sit inline in common/parallel.rs

Read from README.md, Cargo.toml, LICENSE, docs/mold.md, elf/Cargo.toml, elf/passes.rs, elf/icf.rs, common/parallel.rs, common/concurrent_map.rs, arch/README.md, rust-toolchain.toml.

Tags

linkermoldrustreleasegnu-ldbuild-tools

Tech Stack

Rust

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.