Comment by brokencode
5 years ago
Is it possible to use alternate linkers with Rust? Anything that helps Rust compile faster is pretty cool, especially if it allows better multithreaded scaling.
5 years ago
Is it possible to use alternate linkers with Rust? Anything that helps Rust compile faster is pretty cool, especially if it allows better multithreaded scaling.
I believe the Rust compiler can use an alternative linker, but I'm pretty sure that mold can't link Rust programs because it lacks lots of features. It's so experimental that I didn't even think about trying to link a Rust program with it.
Sure you can. Please refer to the doc of zld on how to use zld as an alternative linker for Rust as an example:
https://github.com/michaeleisel/zld#if-using-rust
Yes, put this in your ~/.cargo/config.toml:
[target.x86_64-unknown-linux]
linker = "ld.lld"
And it does help compilation times quite a bit.