-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
LTO behavior depends on root targets #8337
Comments
I agree that we should probably fix this since it's otherwise a bit surprising that your "main" library is so different from other libraries. I also agree that it's due to that root issue you pointed out. I think it may be a possible solution to specify all roots as OnlyBitcode? That way we'd guarantee that root libraries are at least compiled. |
Hm. Starting with Do you have a preference on how |
Double hmm... Building a project with a dylib dependency with LTO is currently broken. It builds the dylib with Also, would you mind too much if we rename the
|
Just an update, I've been fiddling with this for a while, and I think I have something that should work better. I'll try to work on some more tests tomorrow and see if I can post a PR soon. |
Hm for dylib dependencies I think it needs to be |
I'm still experiencing this on 1.46. I had a repo that reproduced the issue on 1.45, and I was just about to file the issue when 1.46 was released. #8349 fixed my test case, however I have since noticed that it does not fix my actual project:
If I disable
The repository is available at https://github.com/betrusted-io/xous-core and the above commands can be used to demonstrate the issue. One interesting thing to note is that both |
@xobs, can you file a new issue? It doesn't seem directly related to this. Also, briefly tried your repro steps, but it didn't cause any rebuilds. You can run cargo with the |
Comparing these two commands building Cargo itself with
lto='thin'
:cargo build --release
cargo build --release --bin cargo
The first command does not engage the LTO codegen optimization added in #8192. On my system, the total build time goes from 187s to 150s.
It is a bit surprising, since the two commands generally produce the same output, so I would not expect them to use different settings.
Would it make sense to be a little smarter about how the root units are chosen? I think the crux of the issue is this line where it starts the lib at
Lto::None
in the first case. In the second case, it is computed as a dependency withLto::OnlyBitcode
.The text was updated successfully, but these errors were encountered: