Mold Linker Version 3.0.0 Release – Rewritten in Rust
Mold 3.0.0, a high-speed linker, has been released in a major update. This version is rewritten from C++ to Rust, as previously announced in the 2.42.1 release notes. The 2.42.1 release is the last one for the C++ version. The primary goals of this 3.x release are to close compatibility gaps with GNU ld, particularly in linker script support, and to make mold a potential default linker in Linux distributions.
Mold 3.0 aims to be a drop-in replacement for 2.42.1, maintaining the same command-line options, target architectures, and output, except for bug fixes. No performance degradation was observed during the release process. Compatibility was ensured by running the test suite on every supported target, comparing linker output across various real-world workloads and option combinations, and building all Gentoo packages without finding any regressions.
The transition to Rust enhances mold's safety when dealing with corrupted input files, as it now checks for out-of-bounds memory reads and crashes with a panic instead of a segmentation fault. When building mold yourself, note the changes to the build system, as it has moved from CMake to Cargo. Mold now requires Rust 1.95 or later and a C compiler, with installation using cargo build --release and ./install-mold.sh.
Several bug fixes have been implemented, including crashes when creating statically-linked executables with version scripts or --default-symver, crashes when output and input files are the same, and nondeterministic output in various scenarios. Additionally, mold now correctly handles GOT-relative relocations, versioned references, errors for PC-relative relocations, and other issues, ensuring a smoother linking experience.
Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.