rust-lang / rustc_codegen_cranelift

Cranelift based backend for rustc
Apache License 2.0
1.63k stars 101 forks source link

will it compatible with mold? #1498

Closed Mon-ius closed 5 months ago

Mon-ius commented 5 months ago

Can I use such config in https://github.com/benwis/customs/issues/1

bjorn3 commented 5 months ago

It works with mold. There is currently a minor issue where the combination of cg_clif + mold + valgrind doesn't work (https://github.com/rust-lang/rustc_codegen_cranelift/issues/1496), but other than that there should be no problems.

Mon-ius commented 5 months ago

Indeed, I met a similar error when introduced ffmpeg-next = { version = "7.0.2", features=["build"] } on the dependencies, says,

warning: LTO is not supported. You may get a linker error.

do I need an extra flags for make the compile work?

bjorn3 commented 5 months ago

cg_clif doesn't support LTO. You need to disable it in your Cargo.toml or wherever you enabled it.

Mon-ius commented 5 months ago

will it support LTO in future?

bjorn3 commented 5 months ago

It may support the LTO commandline option in the future, but is unlikely to see any runtime performance benefit from it. Cranelift doesn't do any inlining or other inter-procedural optimizations, which are the main reason for having LTO at all.

bjorn3 commented 5 months ago

Closing as there is no bug/feature this is tracking, but feel free to ask more questions if you have them.