Repository navigation
Add Option to Force Unwind Tables - #69984
Conversation
There was a problem hiding this comment.
As implemented, this allows users to turn off unwinding tables even if the target strictly requires them. That seems like a footgun.
There was a problem hiding this comment.
should we just error in case of such a conflict?
There was a problem hiding this comment.
Emitting an error has prior art in rustc so, yes.
There was a problem hiding this comment.
Ok, Will do when I get back to my work computer.
There was a problem hiding this comment.
I believe that I've done this in the right place: validate_commandline_args_with_session_available. This check only takes into account the target definition, not the no_landing_pads that is checked at attribute insertion time.
commented
Mar 13, 2020
|
I'm obviously in favor of having this option in some way, but since |
commented
Mar 14, 2020
|
@rfcbot fcp merge This introduces an insta-stable argument to control a fairly well understood behaviour of the compilers (not just rustc, but also clang/gcc ( |
|
Team member @nagisa has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
commented
Mar 16, 2020
|
As I commented in #69890:
|
ef00e5c to
18f4afb
Compare
commented
Mar 16, 2020
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
commented
Mar 16, 2020
|
@Amanieu Can you elaborate why you think a new
|
commented
Mar 16, 2020
|
@bors retry |
commented
Mar 16, 2020
|
@lenary: 🔑 Insufficient privileges: not in try users |
18f4afb to
74e911c
Compare
commented
Mar 16, 2020
|
One advantage of
AFAIK that's not true, when compiling with |
commented
Mar 18, 2020
Cargo has its own validation of this Cargo.toml entry, so some Cargo changes are required to enable this. And if Cargo changes are required anyway, I don't think it would be significantly harder to add a new
Ah, right, this is indeed mostly the current behavior. But it is not true for allocator shims, and I don't think the current behavior for other functions is intended or can be expected to last forever. For historic reasons, certain code paths in the compiler currently decide some unwinding-related things based on the global |
commented
Mar 18, 2020
|
Fair enough, I'll withdraw my objection to making this a |
commented
Apr 2, 2020
|
@rfcbot reviewed |
commented
Apr 5, 2020
|
Should we avoid emitting unwind tables by default on Windows (and let people opt-in with this flag)? If not, we probably want an option to turn off unwind tables which this doesn't enable. |
commented
Apr 5, 2020
|
Given the many different mechanisms and tools that rely on SEH, and Windows gurus stating that pretty much all functions should have unwinding information on x64 Windows, it does not seem very wise to ever omit unwinding tables. Even an opt-out seems dubious to me, and as far as I can tell it's not a feature anyone has ever requested. In fact, after poking at it for a little bit, I can't find any such opt out in MSVC, even when compiling plain C code. In any case, should we ever change our mind about this, we can still change |
commented
Apr 5, 2020
|
My understanding is that the I don't know if i should include that check in the error reporting here: https://github.com/rust-lang/rust/pull/69984/files#diff-eadaa1c9e135801995ae29eaec608049R1173 - happy to update the patch to do so if needed, not sure how it will affect testing. |
commented
Apr 6, 2020
I'm pretty sure this is wrong. However, your conclusion (that users can't remove unwinding information on Windows targets) is correct as far as I can tell. |
commented
May 5, 2020
|
⌛ Testing commit cda9946 with merge ac9bfbf737b9450ab6f6e632406e3a403b4e958a... |
commented
May 5, 2020
|
@bors retry |
When panic != unwind,
nounwindis added to all functions for a target.This can cause issues when a panic happens with RUST_BACKTRACE=1, as
there needs to be a way to reconstruct the backtrace. There are three
possible sources of this information: forcing frame pointers (for which
an option exists already), debug info (for which an option exists), or
unwind tables.
Especially for embedded devices, forcing frame pointers can have code
size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads).
In production code, it can be the case that debug info is not kept, so it is useful
to provide this third option, unwind tables, that users can use to
reconstruct the call stack. Reconstructing this stack is harder than
with frame pointers, but it is still possible.
This came up in discussion on #69890, and turned out to be a fairly simple addition.
r? @hanna-kruppe