Stream: general

Topic: using mold linker.


view this post on Zulip yang yu (Jan 20 2023 at 08:39):

Is there anyone using https://github.com/rui314/mold as linker.
I want to use it on riscv64.
But I don't how to configure it.
linking is real slow.
My config file is clearly not ok.

[target.riscv64gc-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/home/yuyang/projects/mold/build/mold -m elf64-littleriscv"]
runner = "qemu-riscv64-static -L /usr/riscv64-linux-gnu  -E RUST_LOG=trace   -E CRANELIFT_TEST_BLESS=1   -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1"
mold: A Modern Linker 馃. Contribute to rui314/mold development by creating an account on GitHub.

view this post on Zulip yang yu (Jan 20 2023 at 08:55):

https://github.com/rui314/mold/issues/968

[target.riscv64gc-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=-fuse-ld=/home/yuyang/projects/mold/build/mold -m elf64-littleriscv"] runner = &quot...

view this post on Zulip yang yu (Jan 20 2023 at 09:22):

wasmtime is a quit large project,If we can use mold will save us a lot of time. right???

view this post on Zulip Alex Crichton (Jan 20 2023 at 17:20):

I'm not sure how to use mold myself with rustc, but the Rust zulip might have more information on that.

One way to make linking faster though would be to disable debuginfo as Rust often accumulates quite a lot of it and moving it all around can take quite some time. You can do that with CARGO_PROFILE_DEV_DEBUG=0 as an environment variable I believe

view this post on Zulip Alex Crichton (Jan 20 2023 at 17:21):

Another option, if it works, is to use lld through -Zgcc-ld=lld as a flag to the rust compiler

view this post on Zulip Jamey Sharp (Jan 20 2023 at 18:31):

Your config file looks like it follows the instructions for Rust at https://github.com/rui314/mold#how-to-use except that the spaces in the use-ld linker flag probably are not good. You might try putting /home/yuyang/projects/mold/build/mold -m elf64-littleriscv into a shell script and using the path to that shell script as the argument to -fuse-ld. But also it looks like you're getting good suggestions in the issue that you filed.

mold: A Modern Linker 馃. Contribute to rui314/mold development by creating an account on GitHub.

view this post on Zulip yang yu (Jan 21 2023 at 06:21):

Ok,thanks.


Last updated: Nov 22 2024 at 16:03 UTC