logoalt Hacker News

karavelov • yesterday at 5:11 PM • 3 replies • view on HN

Why not use LLD for linking Rust? You already must have the LLVM for Rust to be buildable, so that do not add any dependency.


Replies

lrvick • yesterday at 7:29 PM

We use the llvm linker, lld, to link mold at the earliest point we can, then use mold exclusively after that. We are an LLVM native distro so we build llvm right away as the system compiler used to build the whole tree instead of gcc.

LLD would work fine for the whole tree, and did previously, but is much much slower than mold which is why we switched to mold.

Having to build all dependencies of rust including python and openssl and everything else before being able to use mold erases most of the full-tree build speedups as the path to rust is already about 80% of the full tree build time.

We are a distro that mandates independently verified 100% deterministic builds from source for any given release commit of the tree, so we have to build the whole tree several times for every release.

➕ show 1 reply
n8henrie • yesterday at 5:28 PM

Agreed -- not my wheelhouse, but couldn't you just build rust earlier in your process using LLD, then build mold, then build everything else?

Would that meant that building rust is slower, but everything else is the same, and you don't have to maintain a fork of another complex project?

➕ show 1 reply
as-182 • yesterday at 5:16 PM

Because mold is faster. Linking is a significant bottleneck when building large projects.

➕ show 2 replies