-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsupported flags for mold during lto #119332
Comments
I have been able to build without that error using the rust alpine Docker image and extra packages to configure clang + mold. I used rust 1.75, clang 17, mold 2.4. The failure occurs with the However doing so seems to duplicate the LTO work, most notable with If I build without the For You can use
|
You need to include I have noticed that I'm not sure what the relevance of that is, but this extra arg will let you use mold, and I have noticed it doesn't seem to affect timing any differently vs with/without it and The mold process invoked still uses what cargo was configured for, so thin LTO still uses multiple threads. Additionally when delegating to clang, the parallelism is reduced to default of 1 thread per physical core, you'd need to set the jobs to |
@polarathene Thanks for your reply! |
That does not have LTO support. LTO with Mold came with the 1.1 release. You can download Mold from github and build a newer version locally, then provide an explicit path to the built binary like this: -C link-arg=-fuse-ld=/path/to/mold That should work, but you'll also need to ensure that with the Clang linker is a compatible version for the Rust toolchain you use, otherwise that'll be your next failure encountered. I've got a relevant comment for configuring this via You can try this with the official Rust Docker image. The Debian image won't work out of the box. While I think the Mold package shipped is 1.x with LTO support, the Clang and toolchain are mismatched requiring extra work for compatibility there AFAIK. |
Greetings. According to this doc, I tried to perform cross-language lto across C/C++ and Rust with mold as the linker. However, I found that existing rustc only supports lld.
The command I ran is:
However, an error was thrown:
After some investigation, I found this problem is caused by the code at here :
These flags assume users only use lld as the linker. However, mold does not support these flags, see here.
Also, this problem happened on Macos, see here.
Could we support more linkers during the linker-plugin-lto? Or we can make users override these flags?
Tasks
The text was updated successfully, but these errors were encountered: