about summary refs log tree commit diff
path: root/tests/codegen/frame-pointer.rs
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2025-05-08 14:30:33 -0700
committerJubilee Young <workingjubilee@gmail.com>2025-05-17 06:42:46 +0200
commit0c157b51d339fbfe51b6ef21acd4b21452c76f2c (patch)
tree8ca1e01cad9d2a78a2dba64764f962a6c1842458 /tests/codegen/frame-pointer.rs
parentc8bda740ea5c21af42fe4afa907f89805ab2b905 (diff)
downloadrust-0c157b51d339fbfe51b6ef21acd4b21452c76f2c.tar.gz
rust-0c157b51d339fbfe51b6ef21acd4b21452c76f2c.zip
aarch64-linux: Default to FramePointer::NonLeaf
For aarch64-apple and aarch64-windows, platform docs state that code
must use frame pointers correctly. This is because the AAPCS64 mandates
that a platform specify its frame pointer conformance requirements:
- Apple: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Respect-the-purpose-of-specific-CPU-registers
- Windows: https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers
- AAPCS64: https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer

Unwinding code either requires unwind tables or frame pointers, and
on aarch64 the expectation is that one can use frame pointers for this.
Most Linux targets represent a motley variety of possible distributions,
so it is unclear who to defer to on conformance, other than perhaps Arm.
In the absence of a specific edict for a given aarch64-linux target,
Rust will assume aarch64-linux targets use non-leaf frame pointers.
This reflects what compilers like clang do.
Diffstat (limited to 'tests/codegen/frame-pointer.rs')
-rw-r--r--tests/codegen/frame-pointer.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/codegen/frame-pointer.rs b/tests/codegen/frame-pointer.rs
index 1f7c9a59c98..23989653fa8 100644
--- a/tests/codegen/frame-pointer.rs
+++ b/tests/codegen/frame-pointer.rs
@@ -26,8 +26,10 @@ pub fn peach(x: u32) -> u32 {
 
 // CHECK: attributes [[PEACH_ATTRS]] = {
 // x64-linux-NOT: {{.*}}"frame-pointer"{{.*}}
-// aarch64-linux-NOT: {{.*}}"frame-pointer"{{.*}}
 // x64-apple-SAME: {{.*}}"frame-pointer"="all"
 // force-SAME: {{.*}}"frame-pointer"="all"
+//
+// AAPCS64 demands frame pointers:
+// aarch64-linux-SAME: {{.*}}"frame-pointer"="non-leaf"
 // aarch64-apple-SAME: {{.*}}"frame-pointer"="non-leaf"
 // CHECK-SAME: }