https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=caea6d9760e3f9a67d6e9205ae6c176548b19927 forced lld. But after testing, the mold linker can also be used to compile rust.
(In reply to Blacktea Hamburger from comment #0) > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > ?id=caea6d9760e3f9a67d6e9205ae6c176548b19927 forced lld. But after testing, > the mold linker can also be used to compile rust. Even when LTO is used? AFAIK and what the bug in the commit suggests that rust can't be built with LTO without lld as the linker https://bugs.gentoo.org/947697 https://bugs.gentoo.org/948027 Try with these rust flags and see if rust packages build: RUSTFLAGS="-C target-cpu=native -C linker=clang -C linker-plugin-lto -C link-arg=-fuse-ld=mold"
I build rust packages with the following flags: LDFLAGS="${LDFLAGS} -fuse-ld=mold -Wl,--lto-O3" RUSTFLAGS="-Ctarget-cpu=native -Clink-arg=-fuse-ld=mold -Clink-arg=-Wl,--lto-O3 -Clinker-plugin-lto=/usr/lib/llvm/20/lib64/LLVMgold.so -Zdylib-lto -Zlocation-detail=none" CARGO_PROFILE_RELEASE_OPT_LEVEL=3 CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO="thin" CARGO_PROFILE_RELEASE_STRIP="symbols" CARGO_PROFILE_RELEASE_PANIC="abort" CC="clang" CXX="clang++" CPP="clang-cpp" AR="llvm-ar" NM="llvm-nm" RANLIB="llvm-ranlib" These packages build successfully: rust librsvg ripgrep zram-generator gstreamer ruff
I've been using these aggressive flag for a long time and haven't had any problems (except #951740, which has now been fixed).