-
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
Allow using -C force-unwind-tables=no
when panic=unwind
#83482
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
So, what the linked LLVM code says is that unwinding tables will be generated if a function has a personality function. A function will only have such a function associated if it has any in scope cleanups, or other unwind-interrupting mechanisms. A plain function that does not have any cleanups would still break unwinding here, i believe. Basically this needs a test that verifies a stack along the lines of can work:
and similar. The calls mustn't be inlined nor tail calls. |
@nagisa The code also checks for |
Ah, seems good to me then. Definitely can avoid generation of a fair amount of unnecessary data by default, then. |
I think some more tests could still be helpful... @rustbot label -S-waiting-on-review S-waiting-on-author |
r? @nagisa |
@rustbot label S-waiting-on-review -S-waiting-on-author |
r=me once the comments about tests are addressed and the commits squashed. |
@bors r+ Thanks! |
📌 Commit d1c591b has been approved by |
Allow using `-C force-unwind-tables=no` when `panic=unwind` It seems LLVM still generates proper unwind tables even there is no `uwtable` attribute, unless I looked at the wrong place 🤔: https://github.com/llvm/llvm-project/blob/c21016715f0ee4a36affdf7150ac135ca98b0eae/llvm/include/llvm/IR/Function.h#L666 Therefore, I *assume* it's safe to omit `uwtable` even when `panic=unwind`, and this PR removes the restriction that disallows using `-C force-unwind-tables=no` when `panic=unwind`.
Allow using `-C force-unwind-tables=no` when `panic=unwind` It seems LLVM still generates proper unwind tables even there is no `uwtable` attribute, unless I looked at the wrong place 🤔: https://github.com/llvm/llvm-project/blob/c21016715f0ee4a36affdf7150ac135ca98b0eae/llvm/include/llvm/IR/Function.h#L666 Therefore, I *assume* it's safe to omit `uwtable` even when `panic=unwind`, and this PR removes the restriction that disallows using `-C force-unwind-tables=no` when `panic=unwind`.
⌛ Testing commit 40f51bb5ecae520228b79bdd69e33dbf64468c4a with merge 4f5e9c3324a8ffce36bb8d13139b1c74e9f51c14... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
The failure was caused by But the UI test failed...
EDIT: Never mind. |
@bors r+ |
📌 Commit 2fd4dd2 has been approved by |
☀️ Test successful - checks-actions |
The documentation seems still indicating that
Created #85951 to update it. |
…eklabnik Update the documentation of `-C force-unwind-tables` for rust-lang#83482 `panic=unwind` does not require `force-unwind-tables` to be "yes" anymore. I forgot to update this in rust-lang#83482.
…eklabnik Update the documentation of `-C force-unwind-tables` for rust-lang#83482 `panic=unwind` does not require `force-unwind-tables` to be "yes" anymore. I forgot to update this in rust-lang#83482.
Rollup of 11 pull requests Successful merges: - rust-lang#85906 (Use `Iterator::find` instead of open-coding it) - rust-lang#85951 (Update the documentation of `-C force-unwind-tables` for rust-lang#83482) - rust-lang#85985 (Clarify documentation of slice sorting methods) - rust-lang#85989 (Remove rustfmt tests from top-level .gitattributes) - rust-lang#86074 (Default panic message should print Box<dyn Any>) - rust-lang#86078 (Type page font weight) - rust-lang#86090 (:arrow_up: rust-analyzer) - rust-lang#86095 (Search description codeblock) - rust-lang#86096 (Comment out unused error codes and add description for E0316) - rust-lang#86101 (Correct type signature in doc for Bound::as_mut) - rust-lang#86103 (Remove lifetime hack) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
It seems LLVM still generates proper unwind tables even there is no
uwtable
attribute, unless I looked at the wrong place 🤔:https://github.com/llvm/llvm-project/blob/c21016715f0ee4a36affdf7150ac135ca98b0eae/llvm/include/llvm/IR/Function.h#L666
Therefore, I assume it's safe to omit
uwtable
even whenpanic=unwind
, and this PR removes the restriction that disallows using-C force-unwind-tables=no
whenpanic=unwind
.