Mold linker to be rewritten in Rust

Mold linker rewrite in Rust

Release context

  • Mold 2.42.1 released as a patch release; the announcement’s main news is the plan for Mold 3.0.
  • Mold typically outperforms LLVM lld, GNU ld, Wild, and other linkers.

Rust rewrite

  • Mold is being rewritten from C++ to Rust for Mold 3.0.
  • Lead developer Rui Ueyama cites Rust’s maturity, safety guarantees, and other attractive features.
  • Wild is another performance-oriented linker already written in Rust.
  • Goal: Mold 3.0 should link as well and as fast as the 2.x series.

Goal: becoming /usr/bin/ld on Linux

  • Despite fast linkers (gold, lld, mold) existing for 20 years, most distributions still ship GNU ld as the system linker, so links mold could finish in hundreds of milliseconds can take seconds to minutes.
  • Ueyama, author of both lld and mold, says he focused on speed but not enough on compatibility needed for a drop-in system linker.
  • Mold 3.x priorities:
    • Implement missing linker script features so mold can link kernels and firmware, not just user-space programs.
    • Conduct extensive compatibility testing.
    • Work with distribution developers to make adoption as /usr/bin/ld practical.

Incremental linking

  • Not supported so far; the project is open to adding it if a simple design is found.
  • It could significantly improve some workloads; designs preserving mold’s simplicity and reliability are being explored.

Further details

  • Full information is in the Mold 2.42.1 announcement.

https://www.phoronix.com/news/Mold-Linker-In-Rust-Coming


Leave a comment

Discover more from /root

Subscribe now to keep reading and get access to the full archive.

Continue reading