-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Emit nounwind
LLVM attribute with -C panic=abort
#44992
Comments
Just for the record: in #45029 @sunfishcode brought up the possibility of other languages unwinding through Rust code. IIUC this could theoretically work if the Rust code contains no landing pads, though I believe that it is and should be UB instead. Still, I find it interesting that if we wanted to support that, the change proposed here would break that (b/c any unwinding would now be UB, rather than passing through the landing-pad-free code harmlessly). |
@rkruppe that seems like support for that would be opt-in, if ever? |
Mayyyyybe? I don't think this is likely to happen regardless of the details. I mostly wanted to record the thought somewhere. |
There are currently platforms where Rust and C++ can unwind through each other and landing pads will function correctly (such as windows msvc). I don't understand why anyone would want to support unwinding between Rust and other languages when |
This informs LLVM that functions can't unwind, which while it should typically have already been inferred when necessary or otherwise not impact codegen is apparently needed on targets like ARM to avoid references to unnecessary symbols. Closes rust-lang#44992
rustc: Add LLVM `nounwind` with `-C panic=abort` This informs LLVM that functions can't unwind, which while it should typically have already been inferred when necessary or otherwise not impact codegen is apparently needed on targets like ARM to avoid references to unnecessary symbols. Closes #44992
Currently whenever you compile with
-C panic=abort
we will omitinvoke
instructions and theuwtable
LLVM function attribute, but we should also set thenounwind
attribute. It looks like on ARM this forces the object file to not reference functions that otherwise a function missing thenounwind
attribute will not have.This should help out remove some weird hacks for embedded work!
cc @japaric
The text was updated successfully, but these errors were encountered: