-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rustc: Continue to tweak "std internal symbols" #53640
Conversation
r? @oli-obk (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc/hir/mod.rs
Outdated
@@ -2289,6 +2289,7 @@ pub struct CodegenFnAttrs { | |||
pub flags: CodegenFnAttrFlags, | |||
pub inline: InlineAttr, | |||
pub export_name: Option<Symbol>, | |||
pub link_name: Option<Symbol>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link_name
and export_name
are kind of the same and should never occur at the same time, right? Could you add a comment on why there are two separate fields for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, docs added!
694015c
to
967c5dc
Compare
☔ The latest upstream changes (presumably #53619) made this pull request unmergeable. Please resolve the merge conflicts. |
Oh nice, that's a lot of docs |
967c5dc
to
74f1625
Compare
@bors: r=michaelwoerister |
📌 Commit 74f1625f07d55454af7aa17ebc1710065a7799e7 has been approved by |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors: r- |
In investigating [an issue][1] with `panic_implementation` defined in an executable that's optimized I once again got to rethinking a bit about the `rustc_std_internal_symbol` attribute as well as weak lang items. We've sort of been non-stop tweaking these items ever since their inception, and this continues to the trend. The crux of the bug was that in the reachability we have a [different branch][2] for non-library builds which meant that weak lang items (and std internal symbols) weren't considered reachable, causing them to get eliminiated by ThinLTO passes. The fix was to basically tweak that branch to consider these symbols to ensure that they're propagated all the way to the linker. Along the way I've attempted to erode the distinction between std internal symbols and weak lang items by having weak lang items automatically configure fields of `CodegenFnAttrs`. That way most code no longer even considers weak lang items and they're simply considered normal functions with attributes about the ABI. In the end this fixes the final comment of rust-lang#51342 [1]: rust-lang#51342 (comment) [2]: https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/librustc/middle/reachable.rs#L225-L238
74f1625
to
0a2282e
Compare
@bors: r=michaelwoerister |
📌 Commit 0a2282e has been approved by |
…ister rustc: Continue to tweak "std internal symbols" In investigating [an issue][1] with `panic_implementation` defined in an executable that's optimized I once again got to rethinking a bit about the `rustc_std_internal_symbol` attribute as well as weak lang items. We've sort of been non-stop tweaking these items ever since their inception, and this continues to the trend. The crux of the bug was that in the reachability we have a [different branch][2] for non-library builds which meant that weak lang items (and std internal symbols) weren't considered reachable, causing them to get eliminiated by ThinLTO passes. The fix was to basically tweak that branch to consider these symbols to ensure that they're propagated all the way to the linker. Along the way I've attempted to erode the distinction between std internal symbols and weak lang items by having weak lang items automatically configure fields of `CodegenFnAttrs`. That way most code no longer even considers weak lang items and they're simply considered normal functions with attributes about the ABI. In the end this fixes the final comment of #51342 [1]: #51342 (comment) [2]: https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/librustc/middle/reachable.rs#L225-L238
☀️ Test successful - status-appveyor, status-travis |
In investigating an issue with
panic_implementation
defined in anexecutable that's optimized I once again got to rethinking a bit about the
rustc_std_internal_symbol
attribute as well as weak lang items. We've sort ofbeen non-stop tweaking these items ever since their inception, and this
continues to the trend.
The crux of the bug was that in the reachability we have a different branch
for non-library builds which meant that weak lang items (and std internal
symbols) weren't considered reachable, causing them to get eliminiated by
ThinLTO passes. The fix was to basically tweak that branch to consider these
symbols to ensure that they're propagated all the way to the linker.
Along the way I've attempted to erode the distinction between std internal
symbols and weak lang items by having weak lang items automatically configure
fields of
CodegenFnAttrs
. That way most code no longer even considers weaklang items and they're simply considered normal functions with attributes about
the ABI.
In the end this fixes the final comment of #51342