Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enable non-leaf Frame Pointers for Arm64 Windows #140828

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

dpaoliello
Copy link
Contributor

Microsoft recommends enabling frame pointers for Arm64 Windows as it enables fast stack walking, from https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers:

The frame pointer (x29) is required for compatibility with fast stack walking used by ETW and other services. It must point to the previous {x29, x30} pair on the stack.

I'm setting this to "non-leaf" as leaf functions shouldn't be spilling registers and so won't touch the frame pointer.

@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@workingjubilee
Copy link
Member

needs rebase

@dpaoliello
Copy link
Contributor Author

needs rebase

"Ugh, who else has been messing with this target?"
> git log
Author: Daniel Paoliello
"Oh, right, me..."

@workingjubilee
Copy link
Member

Thanks!

This is consistent with other decisions we've made for other AArch64 targets that recommend/require using frame pointers, see:

...and it obviously is what the docs want. There is an open question about how this interacts with CLI options that those PRs accidentally raised, but it will remain an open question regardless of what is done here. So, I'm just going to r+ this.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 8, 2025

📌 Commit d951c41 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 8, 2025
@workingjubilee workingjubilee assigned workingjubilee and unassigned lcnr May 8, 2025
@workingjubilee workingjubilee added O-windows Operating system: Windows O-AArch64 Armv8-A or later processors in AArch64 mode labels May 8, 2025
@dpaoliello
Copy link
Contributor Author

Also see https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer

Would it be worth enabling this for Arm64 by default? Guessing that would need an MCP to discuss...

@workingjubilee
Copy link
Member

Probably? Less clear to me that we need an MCP, but maybe.

We don't really have "architectural defaults" in our current structure for the code.

I've opened #140832 to address this for Linux platforms at least.

jhpratt added a commit to jhpratt/rust that referenced this pull request May 9, 2025
Enable non-leaf Frame Pointers for Arm64 Windows

Microsoft recommends enabling frame pointers for Arm64 Windows as it enables fast stack walking, from <https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers>:

> The frame pointer (x29) is required for compatibility with fast stack walking used by ETW and other services. It must point to the previous {x29, x30} pair on the stack.

I'm setting this to "non-leaf" as leaf functions shouldn't be spilling registers and so won't touch the frame pointer.
jhpratt added a commit to jhpratt/rust that referenced this pull request May 9, 2025
Enable non-leaf Frame Pointers for Arm64 Windows

Microsoft recommends enabling frame pointers for Arm64 Windows as it enables fast stack walking, from <https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers>:

> The frame pointer (x29) is required for compatibility with fast stack walking used by ETW and other services. It must point to the previous {x29, x30} pair on the stack.

I'm setting this to "non-leaf" as leaf functions shouldn't be spilling registers and so won't touch the frame pointer.
bors added a commit to rust-lang-ci/rust that referenced this pull request May 9, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#140801 (Use span before macro expansion in lint for-loops-over-falibles)
 - rust-lang#140804 (add signed ints to unn- transmutes to ensure feature parity)
 - rust-lang#140812 (Fix `tests/rustdoc-json` triagebot message path)
 - rust-lang#140817 (bootstrap: more consistent use of `...` when citing configuration snippets)
 - rust-lang#140828 (Enable non-leaf Frame Pointers for Arm64 Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request May 9, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#140801 (Use span before macro expansion in lint for-loops-over-falibles)
 - rust-lang#140804 (add signed ints to unn- transmutes to ensure feature parity)
 - rust-lang#140812 (Fix `tests/rustdoc-json` triagebot message path)
 - rust-lang#140817 (bootstrap: more consistent use of `...` when citing configuration snippets)
 - rust-lang#140828 (Enable non-leaf Frame Pointers for Arm64 Windows)

r? `@ghost`
`@rustbot` modify labels: rollup

---
try-job: test-various
bors added a commit to rust-lang-ci/rust that referenced this pull request May 9, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#140801 (Use span before macro expansion in lint for-loops-over-falibles)
 - rust-lang#140804 (add signed ints to unn- transmutes to ensure feature parity)
 - rust-lang#140812 (Fix `tests/rustdoc-json` triagebot message path)
 - rust-lang#140817 (bootstrap: more consistent use of `...` when citing configuration snippets)
 - rust-lang#140828 (Enable non-leaf Frame Pointers for Arm64 Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d91e86e into rust-lang:master May 9, 2025
6 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 9, 2025
Rollup merge of rust-lang#140828 - dpaoliello:arm64fp, r=workingjubilee

Enable non-leaf Frame Pointers for Arm64 Windows

Microsoft recommends enabling frame pointers for Arm64 Windows as it enables fast stack walking, from <https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers>:

> The frame pointer (x29) is required for compatibility with fast stack walking used by ETW and other services. It must point to the previous {x29, x30} pair on the stack.

I'm setting this to "non-leaf" as leaf functions shouldn't be spilling registers and so won't touch the frame pointer.
@rustbot rustbot added this to the 1.88.0 milestone May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-AArch64 Armv8-A or later processors in AArch64 mode O-windows Operating system: Windows S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants