-
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
Turn off frame pointer elimination on all Apple platforms. #85706
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This should also fix profiling rust code on the M1 in Instruments. |
r? @shepmaster I'd like to emphasize the importance of this change: Without this, profiles taken with Instruments are basically useless. And there is no workaround. The Apple docs Writing ARM64 Code for Apple Platforms has a section called "Respect the Purpose of Specific CPU Registers" which specifically calls out the frame pointer register (x29):
|
Please remove the now-unnecessary override from the specific targets (such as It would be nice, also, if you could incorporate the information from the comment above into the original PR description so that it ends up in the merge commit. r=me once these are done. r? @nagisa |
This ends up disabling frame pointer elimination on aarch64_apple_darwin which matches what clang does by default along with the aarch64_apple_ios and x86_64_apple_darwin targets. Further, the Apple docs "Writing ARM64 Code for Apple Platforms" has a section called "Respect the Purpose of Specific CPU Registers" which specifically calls out the frame pointer register (x29): The frame pointer register (x29) must always address a valid frame record. Some functions — such as leaf functions or tail calls — may opt not to create an entry in this list As a result, stack traces are always meaningful, even without debug information. Other platforms are updated to not override the default.
@bors r+ thanks! |
📌 Commit aab8545 has been approved by |
(I think there is https://doc.rust-lang.org/nightly/rustc/codegen-options/index.html#force-frame-pointers.) |
Oh, neat! (Edit for future me: One way to use it is |
Rollup of 13 pull requests Successful merges: - rust-lang#83362 (Stabilize `vecdeque_binary_search`) - rust-lang#85706 (Turn off frame pointer elimination on all Apple platforms. ) - rust-lang#85724 (Fix issue 85435 by restricting Fake Read precision) - rust-lang#85852 (Clarify meaning of MachineApplicable suggestions.) - rust-lang#85877 (Intra doc link-ify a reference to a function) - rust-lang#85880 (convert assertion on rvalue::threadlocalref to delay bug) - rust-lang#85896 (Add test for forward declared const param defaults) - rust-lang#85897 (Update I-unsound label for triagebot) - rust-lang#85900 (Use pattern matching instead of checking lengths explicitly) - rust-lang#85911 (Avoid a clone of output_filenames.) - rust-lang#85926 (Update cargo) - rust-lang#85934 (Add `Ty::is_union` predicate) - rust-lang#85935 (Validate type of locals used as indices) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This ends up disabling frame pointer elimination on aarch64_apple_darwin
which matches what clang does by default along with the
aarch64_apple_ios and x86_64_apple_darwin targets.
Further, the Apple docs "Writing ARM64 Code for Apple Platforms" has a section
called "Respect the Purpose of Specific CPU Registers" which
specifically calls out the frame pointer register (x29):
The frame pointer register (x29) must always address a valid frame
record. Some functions — such as leaf functions or tail calls — may
opt not to create an entry in this list As a result, stack traces
are always meaningful, even without debug information.
Other platforms are updated to not override the default.