-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
linking issue on x86_64-pc-windows-gnu target + thinLTO related to static function pointers #98302
Comments
It's an issue I found in the wild: gl |
This specific example seems to succeed in 1.46 but fail in 1.47. I've not done a bisect though. The most significant thing in the release notes for 1.47 was the upgrade to LLVM 11 but this could be caused by something else. |
Oh, and it doesn't seem to be a problem with |
Workaround for xiph#2960, because of rust-lang/rust#98302
Workaround for xiph#2960, because of rust-lang/rust#98302
Workaround for #2960, because of rust-lang/rust#98302
I believe it works with LLD because it can fixup missing dllimport symbols if it finds regular ones: https://github.com/llvm/llvm-project/blob/16e5d6d7f98f1119aab3d10ec4f9e59b5aacd359/lld/COFF/SymbolTable.cpp#L488
For now sticking with LLD is probably the best option, this issue needs more investigation what happened with dllimports/dllexports. |
914: 0.8: Prepare for the next release r=taiki-e a=taiki-e Backports #913 and CI-related patches. Changes: - crossbeam-epoch 0.8.11 -> 0.8.12 - Removes the dependency on the `once_cell` crate to restore the MSRV. (#913) - Work around [rust-lang#98302](rust-lang/rust#98302), which causes compile error on windows-gnu when LTO is enabled. (#913) - crossbeam-utils 0.8.11 -> 0.8.12 - Removes the dependency on the `once_cell` crate to restore the MSRV. (#913) - Work around [rust-lang#98302](rust-lang/rust#98302), which causes compile error on windows-gnu when LTO is enabled. (#913) Co-authored-by: Taiki Endo <[email protected]>
Well, good to see some investigation! It seems to mostly affect crossbeam seeing all the links related to it. |
Before 1.47.0 these symbols were created without dllimport/dllexport:
Which makes me believe it's actually my fault in #72049 |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Possibly the cause of this problem. See taike-e's comment above. It's happening in a situation where thinLTO has real benefits - locking primitives in a high-performance graphics crate. |
In my program, changing
to
Fixed the problem. So, I seem to be hitting this bug too. "Fat" is the right term here. The linking step fills up memory on the 8GB machine, and then Linux kills the process. I have to use a 32GB machine to link my program. Linking now takes 1-2 minutes, so compile times for a one-character change went from about 15 seconds to 90 seconds on the big machine (32GB, 12 cores.) |
Fixed in the nightly, likely by #129079 |
Closing., since the issue seems fixed |
errors on link with
and it only occurs:
• on x86_64-pc-windows-gnu
• With thin LTO
• With #[inline]
• With a static mut or UnsafeCell
• With a function pointer
Meta
rustc --version --verbose
:Closest I could find: #71720
The text was updated successfully, but these errors were encountered: