-
Notifications
You must be signed in to change notification settings - Fork 13.8k
rustc: Add LLVM nounwind
with -C panic=abort
#45031
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
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
It appears that rust/src/librustc_trans/callee.rs Lines 108 to 110 in a0db04b
I'm not sure why we have 2 places of code here, but I imagine that needs to be fixed. |
Excellent point! I've updated and extended the test case for that as well. |
src/test/run-pass/no-landing-pads.rs
Outdated
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.
AFAIK this test has basically always been invalid, and -C panic=abort
is tested through many other tests
Why did you remove the r=me if you condition the |
Would you prefer I just remove the It's true that yes, |
I know |
@bors: r=arielb1 |
📌 Commit d2348dd has been approved by |
⌛ Testing commit d2348dd3d12ced0f53388e9b8899f7df58e1fea7 with merge c5cc2b0add25d809c7384c78e1915ef7156dae00... |
💔 Test failed - status-appveyor |
Two codegen tests failed on
|
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
d2348dd
to
24cc38e
Compare
@bors: r=arielb1 |
📌 Commit 24cc38e has been approved by |
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
☀️ Test successful - status-appveyor, status-travis |
TL;DR thanks to rust-lang/rust#45031 we no longer need this Now with -C panic=abort all functions are marked with the `nouwind` attribute in LLVM-IR. With this change LLVM won't generate undefined references to `__aeabi_unwind_cpp_pr0` et al. which we don't use / supply but are required by the AEABI standard in the case that a function that throw exceptions exists (semantically, we never have any of those function with panic=abort but the LLVM-IR didn't reflect this before).
TL;DR thanks to rust-lang/rust#45031 we no longer need this Now with -C panic=abort all functions are marked with the `nouwind` attribute in LLVM-IR. With this change LLVM won't generate undefined references to `__aeabi_unwind_cpp_pr0` et al. which we don't use / supply but are required by the AEABI standard in the case that a function that throw exceptions exists (semantically, we never have any of those function with panic=abort but the LLVM-IR didn't reflect this before).
TL;DR thanks to rust-lang/rust#45031 we no longer need this Now with -C panic=abort all functions are marked with the `nouwind` attribute in LLVM-IR. With this change LLVM won't generate undefined references to `__aeabi_unwind_cpp_pr0` et al. which we don't use / supply but are required by the AEABI standard in the case that a function that throw exceptions exists (semantically, we never have any of those function with panic=abort but the LLVM-IR didn't reflect this before).
Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook. Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work. Closes #81902 which is **regression-from-stable-to-stable** Closes #94815 ### History Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see #45031 and #81902 (comment)). In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see #69984). `-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces. Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact. # Release Note Entry Draft: ## Compatibility Notes * [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](#143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.
…trochenkov Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook. Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work. Closes rust-lang#81902 which is **regression-from-stable-to-stable** Closes rust-lang#94815 ### History Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see rust-lang#45031 and rust-lang#81902 (comment)). In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see rust-lang#69984). `-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces. Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact. # Release Note Entry Draft: ## Compatibility Notes * [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](rust-lang#143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.
Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook. Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work. Closes #81902 which is **regression-from-stable-to-stable** Closes #94815 ### History Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see #45031 and #81902 (comment)). In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see #69984). `-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces. Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact. # Release Note Entry Draft: ## Compatibility Notes * [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](#143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.
Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook. Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work. Closes #81902 which is **regression-from-stable-to-stable** Closes #94815 ### History Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see #45031 and #81902 (comment)). In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see #69984). `-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces. Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact. # Release Note Entry Draft: ## Compatibility Notes * [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](#143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.
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