-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Should -Cforce-frame-pointers
favor the target or CLI?
#140774
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
base: master
Are you sure you want to change the base?
Should -Cforce-frame-pointers
favor the target or CLI?
#140774
Conversation
This test only makes sense if you send it back in time and run it with a now-old Rust commit, e.g. 50e0cc5 However, if you do go back that far in time, you will see it pass.
Update this time-traveler on the changes in compiletest and target specs that they missed over the pass ~3 years by being caught in a time rift. The aarch64-apple rev splits into itself and aarch64-apple-on, because rustc obtained support for non-leaf frame-pointers ever since 9b67cba implemented them and used them in aarch64-apple-darwin's spec. Note that the aarch64-apple-off revision fails, despite modernization. This is because 9b67cba also changed the behavior of rustc to defer to the spec over the command-line interface.
The job Click to see the possible cause of the failure (guessed by this bot)
|
The current behavior of being a ratchet makes most sense to me. Enabling force-frame-pointers forces frame pointers to be used, disabling it is equivalent to not passing it at all and causes the default to be used. This matches the behavior of force-unwind-tables (for which the current behavior is required. disabling unwind tables when they are enabled by default is unsound and picking the target default even when force-unwind-tables is enabled makes the cli option useless) |
I agree and think the naming conveys this as well. The absence of force should not force the opposite, it just leaves it up to the compiler to choose. In fact, this is already clearly documented: https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=force-frame#force-frame-pointers
And this documentation has been there basically forever: #65136 |
Yes. This is essentially me looking for a clarification that yes, we intended to head in this direction, to make sure I have something authoritative to point to if it comes up again and help inform any near-future decisions about frame-pointer-related things. |
This PR exists to essentially document that we (that is, the compiler reviewer) implicitly made a decision in #86652 that defies the expectations of some programmers. Some programmers believe
-Cforce-frame-pointers=false
should obey the programmer in all cases, removing all frame pointers in the current session. I am forced to note that "remove frame pointers" is actually an optimization in terms of register allocation and the like, thus one that depends on the compiler to implement, but that's part of the problem:All of this is further complicated by the simple fact that accurate backtraces and profiling can require these to get correct addresses. The included test includes some commentary where I try to enumerate all of the various problems I could find. A common bug seems to be our backtrace implementations stumbling into infinite loops due to a system API or unwinding info no longer behaving as expected.
Obviously, I personally believe the decision was correct, but it was a choice that some people can be surprised or even upset about. As it changed a highly user-facing behavior in ways that might break with user expectations, it perhaps should have a team decision behind it with an FCP and all that. Thus I submit this for review and discussion by T-compiler so we can figure out what we actually want, here, as it will become particularly relevant to have a decision about if rust-lang/compiler-team#872 is accepted.
The code itself has a TODO and thus is not fit for merging yet, indeed it really includes no changes at all, though it is precisely this TODO that one might wish to read.
r? @ghost