Skip to content
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

Cargo incorrectly uses -C linker-plugin-lto to request bitcode only crates #14575

Open
Zoxc opened this issue Sep 21, 2024 · 4 comments
Open
Labels
A-lto Area: link-time optimization C-bug Category: bug O-windows OS: Windows S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@Zoxc
Copy link
Contributor

Zoxc commented Sep 21, 2024

Problem

Cargo incorrectly uses -C linker-plugin-lto to request bitcode only crates. That's not what -C linker-plugin-lto is intended for. On Windows it has the additional effect of changing how crates a linked together, making it incorrect to mix crates not built with -C linker-plugin-lto with ones which are.

This is a contributing factor to rust-lang/rust#127979.

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

No response

@Zoxc Zoxc added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Sep 21, 2024
@weihanglo
Copy link
Member

Thanks for the report. As I understand it, -C linker-plugin-lto is not compatible with dynamic linking on Windows. Is that what you are describing?

Could you also give a minimal repro of it with the error message, and also the expected behavior?

@weihanglo weihanglo added O-windows OS: Windows S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. A-lto Area: link-time optimization and removed S-triage Status: This issue is waiting on initial triage. labels Sep 21, 2024
@Zoxc
Copy link
Contributor Author

Zoxc commented Sep 21, 2024

As I understand it, -C linker-plugin-lto is not compatible with dynamic linking on Windows. Is that what you are describing?

Yeah.

Could you also give a minimal repro of it with the error message, and also the expected behavior?

The expected behavior would be for Cargo to never pass -C linker-plugin-lto to rustc, as Cargo doesn't support linker plugin LTO. Currently rustc will just miscompile as it doesn't have proper safeguards in place, so there's no error message.

@weihanglo
Copy link
Member

Cargo incorrectly uses -C linker-plugin-lto to request bitcode only crates.

Would you mind sharing an exact setup of the Cargo package, including Cargo.toml, Cargo configuration, and the cargo invocations, so that we can reproduce it correctly?

@Zoxc
Copy link
Contributor Author

Zoxc commented Sep 22, 2024

You can use rust-lang/rust#127979 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lto Area: link-time optimization C-bug Category: bug O-windows OS: Windows S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

2 participants