Mold Linker Being Rewritten in Rust, Aiming to Become Linux's Standard Linker
Translated by a model; the original is in Russian.
The high-performance linker Mold, which typically outpaces LLVM's lld, GNU LD, Wild and other rivals, is being rewritten in the Rust language. At the same time, the project has set itself an ambitious goal — to become the default linker in Linux systems.
On the day the Mold 2.42.1 patch shipped, the developers revealed their plans for the next major release. Mold 3.0 will be implemented entirely in Rust: according to lead developer Rui Ueyama, the language has matured enough, and its strict safety guarantees make the switch appealing. Mold is following the path of the Wild linker, which is also written in Rust. Ueyama expects the Rust version to handle fast linking just as well as the 2.xx branch.
Twenty Years with GNU ld
The second goal is especially intriguing. Ueyama notes that over the past twenty years several fast linkers have appeared — gold, lld, mold itself — yet in most distributions the system linker /usr/bin/ld is still GNU ld. As a result, linking tasks that mold completes in hundreds of milliseconds can stretch out to seconds, tens of seconds and even minutes with the standard linker. The developer calls this state of affairs a frustration for the entire Linux community.
As the author of both lld and mold, Ueyama admits part of the responsibility lies with him: he poured a great deal of effort into linker speed, but not enough into compatibility work, without which a fast linker cannot become a full-fledged replacement for the system one. With the release of Mold 3.0 they intend to fix this: one of the main aims of the 3.x branch is to make mold suitable for adoption by distributions in the role of /usr/bin/ld.
To achieve this, the missing linker-script capabilities will need to be implemented so that mold can link not only user programs but also kernels and firmware. The developers then plan to conduct large-scale compatibility testing and work closely with distribution maintainers.
Incremental Linking
Separately, the project is considering support for incremental linking — a feature mold has never had until now. Ueyama writes that if it can be added in a simple way, the developers would be glad to do so: in a number of scenarios it can noticeably speed up builds. Implementation options that would deliver such a gain while preserving mold's characteristic simplicity and reliability are currently being explored.
Source: Phoronix
Comments
Sign in, to comment.