-
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
build-std panic_immediate_abort undefined reference to panic_cannot_unwind #107016
Comments
Not particularly. All I can say is this diff makes the example program link fine: diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs
index 48e90e6d794..3b7e6882107 100644
--- a/library/core/src/panicking.rs
+++ b/library/core/src/panicking.rs
@@ -164,7 +164,6 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
/// This function is called directly by the codegen backend, and must not have
/// any extra arguments (including those synthesized by track_caller).
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
-#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cfg_attr(bootstrap, lang = "panic_no_unwind")] // needed by codegen for panic in nounwind function
#[cfg_attr(not(bootstrap), lang = "panic_cannot_unwind")] // needed by codegen for panic in nounwind function
#[rustc_nounwind] But that doesn't really make any sense to me. There are a lot of other panic lang items which are fine with |
Looking inside crate/target/target/debug/deps/libpanic_abort-XXXXXXXXXXXXXXXX.rlib (it's an |
But the symbol we want is |
There is both |
I think the monomorphization collector forgot to consider rust/compiler/rustc_monomorphize/src/collector.rs Lines 843 to 851 in 21f6839
double_unwind_guard emitted for calls in cleanup blocks: rust/compiler/rustc_codegen_ssa/src/mir/block.rs Lines 173 to 186 in 21f6839
|
Using -Cpanic=abort works around the issue, and probably something one would like to do this scenario regardless? |
🤦 Yes, definitely. This is not the first time I have found odd behavior from mixing unwind with |
Might be worth retesting when #102906 lands. I think it should address this issue as well. |
#108924 proposes a static assertion that ensures that |
Can this issue be closed since the PR was merged? |
Yea, I think this is effectively solved by #108924. Thanks! |
A Cargo project with:
built with:
cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu
results in a linking failure:
This recently started with #104999. cc @saethlin do you have any insight into this?
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: