Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does rust use lld linker as standard

Tags:

linker

rust

lld

I have started on the "zero to performance in rust" book. This discusses using the lld linker instead of the standard rust linker to speed up compile times. However, the book is now about a year old and it mentions that there is/was work in progress to make lld the standard linker in rust wherever possible.

Does anyone know the stage of this work? Is rust using the ldd linker as standard and if not is there still a significant difference in compile time when using it.

like image 611
Pioneer_11 Avatar asked Feb 20 '26 21:02

Pioneer_11


1 Answers

As of rust 1.70, lld is the default linker for {arm,thumb}v4t-none-eabi toolchains.

If you want to use lld before 1.70 or for different toolchains where it is not the default, you can modify your .cargo/config.toml to set the linker rustc will use.

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

[target.x86_64-pc-windows-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
like image 112
pigeonhands Avatar answered Feb 27 '26 02:02

pigeonhands



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!