3 ms·
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.
by brokencode 6y 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.
- rui314 6y agoI 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.
- k_bx 6y agoYes, put this in your ~/.cargo/config.toml: [target.x86_64-unknown-linux] linker = "ld.lld"
- zamalek 6y agoAnd it does help compilation times quite a bit.
- lankalanka 6y agoSure 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 https://github.com/michaeleisel/zld#if-using-rust