summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Paoliello <danpao@microsoft.com>2025-05-08 13:08:31 -0700
committerDaniel Paoliello <danpao@microsoft.com>2025-05-08 13:18:18 -0700
commitd951c41a684c886900477b7087c9de51ddba03bd (patch)
tree920d1614e63e44e1a5f500ce905c50416437ca5d
parentfe348cd1a8e0fa445b772393147ed865904dcd4d (diff)
downloadrust-d951c41a684c886900477b7087c9de51ddba03bd.tar.gz
rust-d951c41a684c886900477b7087c9de51ddba03bd.zip
Enable non-leaf Frame Pointers for Arm64 Windows
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs8
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.