-
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
Disable all unwinding on -Z no-landing-pads LTO #10916
Conversation
I think there's a few things that should be reviewed about this:
|
How will this interact with |
@alexcrichton: I'm not quite sure it should close it, because it would be nice to be able to omit them without optimizations enabled or without link-time optimization. This should also probably not work if unwinding is used because it's going to be undefined behaviour. One way to do that would be having an |
I don't think that we should encourage distribution of libraries with I agree that the only way to truly safely do this is to statically ensure that The best way that I can think of doing something like this:
If we did something like this, then we would have a static guarantee that code compiled with As another consequence of possibly going down this route, if we start making |
I like this approach because it handles the kernel case quite nicely (as kernels definitely want LTO and probably don't want unwinding). Although if your kernel supports loadable kernel modules then, well, we'll have to come up with something. |
When performing LTO, the rust compiler has an opportunity to completely strip all landing pads in all dependent libraries. I've modified the LTO pass to recognize the -Z no-landing-pads option when also running an LTO pass to flag everything in LLVM as nothrow. I've verified that this prevents any and all invoke instructions from being emitted. I believe that this is one of our best options for moving forward with accomodating use-cases where unwinding doesn't really make sense. This will allow libraries to be built with landing pads by default but allow usage of them in contexts where landing pads aren't necessary. cc rust-lang#10780
(I force pushed to remove the 'Closes' part of the commit message) |
When performing LTO, the rust compiler has an opportunity to completely strip all landing pads in all dependent libraries. I've modified the LTO pass to recognize the -Z no-landing-pads option when also running an LTO pass to flag everything in LLVM as nothrow. I've verified that this prevents any and all invoke instructions from being emitted. I believe that this is one of our best options for moving forward with accomodating use-cases where unwinding doesn't really make sense. This will allow libraries to be built with landing pads by default but allow usage of them in contexts where landing pads aren't necessary.
This was originally introduced in rust-lang#10916 as a way to remove all landing pads when performing LTO. However this is no longer necessary today since rustc properly marks all functions and call-sites as nounwind where appropriate. In fact this is incorrect in the presence of `extern "C-unwind"` which must create a landing pad when compiled with `-C panic=abort` so that foreign exceptions are caught and properly turned into aborts.
…k-Simulacrum Remove LLVMRustMarkAllFunctionsNounwind This was originally introduced in rust-lang#10916 as a way to remove all landing pads when performing LTO. However this is no longer necessary today since rustc properly marks all functions and call-sites as nounwind where appropriate. In fact this is incorrect in the presence of `extern "C-unwind"` which must create a landing pad when compiled with `-C panic=abort` so that foreign exceptions are caught and properly turned into aborts.
…as,xFrednet New lint [`min_ident_chars`] Closes rust-lang#10915 This also implements `WithSearchPat` for `Ident`, as I was going to rewrite this as a late lint to optionally ignore fields and/or generics but this was more complex than anticipated changelog: New lint [`min_ident_chars`] [rust-lang#10916](rust-lang/rust-clippy#10916)
When performing LTO, the rust compiler has an opportunity to completely strip
all landing pads in all dependent libraries. I've modified the LTO pass to
recognize the -Z no-landing-pads option when also running an LTO pass to flag
everything in LLVM as nothrow. I've verified that this prevents any and all
invoke instructions from being emitted.
I believe that this is one of our best options for moving forward with
accomodating use-cases where unwinding doesn't really make sense. This will
allow libraries to be built with landing pads by default but allow usage of them
in contexts where landing pads aren't necessary.