HeadlinesBriefing HeadlinesBriefing.com

Mold Linker 3.0.0 Released – Rewritten in Rust

Hacker News •
×

mold 3.0.0 is a new major release of the high-speed linker, rewritten from C++ to Rust. This is the first Rust version, with 2.42.1 being the last C++ release. The goal of mold 3.x is to close compatibility gaps with GNU ld, particularly in linker script support, and to pave the way for adoption as the default linker in Linux distributions.

mold 3.0 is a drop-in replacement for 2.42.1, accepting the same command-line options and supporting the same targets. Linking performance remains on par. The move to Rust makes mold safer with corrupted input files; the C++ version could read memory out of bounds, while mold 3.0 bounds-checks and panics instead.

Build changes include using Cargo instead of CMake, requiring Rust 1.95 or later. Run `cargo build --release` and `./install-mold.sh`. mold no longer depends on TBB and statically links mimalloc 3.5.3. The test suite runs with `cargo test`.

Bug fixes include fixing crashes with version scripts, `--gc-sections` no longer removing functions from `--init` and `--fini`, and fixing nondeterministic output in several areas. Errors for PC-relative relocations against symbols in shared libraries are now handled correctly.

Source: Hacker News · Summarized by HeadlinesBriefing