diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-05-09 16:25:06 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 16:25:06 +1000 |
| commit | d91e86e963128ebd9e0baee42d1504670dab1565 (patch) | |
| tree | 5295892f3941df628923fee4a9952bd19e7a71a9 | |
| parent | e3873f51a13c184193326606fe8b44092d576640 (diff) | |
| parent | d951c41a684c886900477b7087c9de51ddba03bd (diff) | |
| download | rust-d91e86e963128ebd9e0baee42d1504670dab1565.tar.gz rust-d91e86e963128ebd9e0baee42d1504670dab1565.zip | |
Rollup merge of #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.
| -rw-r--r-- | compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs index 0d25b19f3fc..c5704c57448 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs @@ -1,10 +1,16 @@ -use crate::spec::{LinkerFlavor, Lld, Target, TargetMetadata, base}; +use crate::spec::{FramePointer, LinkerFlavor, Lld, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.max_atomic_width = Some(128); base.features = "+v8a,+neon,+fp-armv8".into(); + // Microsoft recommends enabling frame pointers on Arm64 Windows. + // 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." + base.frame_pointer = FramePointer::NonLeaf; + // MSVC emits a warning about code that may trip "Cortex-A53 MPCore processor bug #843419" (see // https://developer.arm.com/documentation/epm048406/latest) which is sometimes emitted by LLVM. // Since Arm64 Windows 10+ isn't supported on that processor, it's safe to disable the warning. |
