hn.today

Mold Linker Version 3.0.0 Release – Rewritten in Rust

github.com212 points124 comments
Screenshot of Mold Linker Version 3.0.0 Release – Rewritten in Rust

mold 3.0.0 is a major release that rewrites the high-speed linker in Rust, replacing the C++ codebase (2.42.1 is the last C++ release). It is intended as a drop-in replacement: same command-line options, supported architectures, and comparable linking performance. The rewrite aims to close remaining compatibility gaps with GNU ld (especially linker script support) and to make mold suitable as a default linker in Linux distributions. The release reports extensive verification - test suites across targets, cross-checking outputs on real workloads, and building all Gentoo packages - with no regressions. The Rust port improves safety by bounds-checking reads from corrupted input files, preventing segfaults. Build and packaging have changed: mold now uses Cargo (Rust 1.95+) instead of CMake, MOLD_LIBDIR and Cargo features replace previous CMake variables, oneTBB is removed, mimalloc remains statically linked by default (with an option to use the system allocator), and zlib/zstd/BLAKE3 handling is updated. Tests run with cargo test and install-test-deps replaces the old script.

The release bundles numerous bug fixes and compatibility improvements: many crash fixes (version scripts, output-as-input, noinhibit-exec), corrected -r handling (C++ exceptions, relocations, COMDATs), gc-sections behavior, and alignment/size rules for common symbols to match GNU ld. GOT- and PC-relative relocation handling was fixed or now emits clear errors; option parsing now follows GNU ld behavior; mold no longer reserves 8 GiB of virtual address space; separate-debug-file and repro/chroot relative-path bugs are fixed; and version-script precedence was aligned with GNU ld. It also adds or fixes relocation and PLT handling across architectures (AArch64, ARM32, RISC-V, LoongArch, PPC, SPARC64, SH4, m68k), tightens error reporting for invalid constructs, and eliminates several sources of nondeterministic output.

Read on github.com124 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Other

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.