-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Make __rust_alloc_error_handler_should_panic a function #143387
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
Conversation
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in compiler/rustc_codegen_gcc |
This comment has been minimized.
This comment has been minimized.
That won't have any effect. It is part of the allocator shim object file, which doesn't participate in LTO unless you use |
The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
r=me with CI passing |
@bors r+ |
Since this is changing to a new |
IIUC that's very hard to do correctly on arm64ec, and because one fairly niche platform makes this (needlessly?) complicated, we have to use a less optimal solution on all platforms... (I guess we could switch between function and data variable depending on the target, but that'd mean even more hacks in rustc.) |
Ah, that's the |
Rollup of 7 pull requests Successful merges: - #140643 (Refactor StableMIR) - #143286 (Make -Ztrack-diagnostics emit like a note) - #143308 (Remove `PointerLike` trait) - #143387 (Make __rust_alloc_error_handler_should_panic a function) - #143400 (Port `#[rustc_pass_by_value]` to the new attribute system) - #143417 (bump termize dep) - #143420 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143387 - dpaoliello:shouldpanicfn, r=bjorn3 Make __rust_alloc_error_handler_should_panic a function Fixes #143253 `__rust_alloc_error_handler_should_panic` is a static but was being exported as a function. For most targets this doesn't matter, but Arm64EC Windows uses different decorations for exported variables vs functions, hence it fails to link when `-Z oom=abort` is enabled. We've had issues in the past with statics like this (see #141061) but the tldr; is that Arm64EC needs symbols correctly exported as either a function or data, and data MUST and MUST ONLY be marked `dllimport` when the symbol is being imported from another binary, which is non-trivial to calculate for these compiler-generated statics. So, instead, the easiest thing to do is to make `__rust_alloc_error_handler_should_panic` a function instead. Since `__rust_alloc_error_handler_should_panic` isn't involved in any linking shenanigans, I've marked it as `AlwaysInline` with the hopes that the various backends will see that it is just returning a constant and perform the same optimizations as the previous implementation. r? `@bjorn3`
Rollup of 7 pull requests Successful merges: - rust-lang/rust#140643 (Refactor StableMIR) - rust-lang/rust#143286 (Make -Ztrack-diagnostics emit like a note) - rust-lang/rust#143308 (Remove `PointerLike` trait) - rust-lang/rust#143387 (Make __rust_alloc_error_handler_should_panic a function) - rust-lang/rust#143400 (Port `#[rustc_pass_by_value]` to the new attribute system) - rust-lang/rust#143417 (bump termize dep) - rust-lang/rust#143420 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #143253
__rust_alloc_error_handler_should_panic
is a static but was being exported as a function.For most targets this doesn't matter, but Arm64EC Windows uses different decorations for exported variables vs functions, hence it fails to link when
-Z oom=abort
is enabled.We've had issues in the past with statics like this (see #141061) but the tldr; is that Arm64EC needs symbols correctly exported as either a function or data, and data MUST and MUST ONLY be marked
dllimport
when the symbol is being imported from another binary, which is non-trivial to calculate for these compiler-generated statics.So, instead, the easiest thing to do is to make
__rust_alloc_error_handler_should_panic
a function instead.Since
__rust_alloc_error_handler_should_panic
isn't involved in any linking shenanigans, I've marked it asAlwaysInline
with the hopes that the various backends will see that it is just returning a constant and perform the same optimizations as the previous implementation.r? @bjorn3