Skip to content

Commit f27ed88

Browse files
codegen: test frame pointer attr prefers CLI opt
This test only makes sense if you send it back in time and run it with a now-old Rust commit, e.g. 50e0cc5 However, if you do go back that far in time, you will see it pass.
1 parent df8102f commit f27ed88

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// compile-flags: --crate-type=rlib -Copt-level=0
2+
// revisions: force-on aarch64-apple aarch64-apple-off
3+
// [force-on] compile-flags: -Cforce-frame-pointers=on
4+
// [aarch64-apple] needs-llvm-components: aarch64
5+
// [aarch64-apple] compile-flags: --target=aarch64-apple-darwin
6+
// [aarch64-apple-off] needs-llvm-components: aarch64
7+
// [aarch64-apple-off] compile-flags: --target=aarch64-apple-darwin -Cforce-frame-pointers=off
8+
/*
9+
Tests that the frame pointers can be controlled by the CLI. We find aarch64-apple-darwin useful
10+
because of its icy-clear policy regarding frame pointers (software SHALL be compiled with them),
11+
e.g. https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms says:
12+
13+
* The frame pointer register (x29) must always address a valid frame record. Some functions —
14+
such as leaf functions or tail calls — may opt not to create an entry in this list.
15+
As a result, stack traces are always meaningful, even without debug information.
16+
*/
17+
#![feature(no_core, lang_items)]
18+
#![no_core]
19+
#[lang = "sized"]
20+
trait Sized {}
21+
#[lang = "copy"]
22+
trait Copy {}
23+
impl Copy for u32 {}
24+
25+
// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
26+
#[no_mangle]
27+
pub fn peach(x: u32) -> u32 {
28+
x
29+
}
30+
31+
// CHECK: attributes [[PEACH_ATTRS]] = {
32+
// force-on-SAME: {{.*}}"frame-pointer"="all"
33+
// aarch64-apple-SAME: {{.*}}"frame-pointer"="all"
34+
// aarch64-apple-off-NOT: {{.*}}"frame-pointer"{{.*}}
35+
// CHECK-SAME: }

0 commit comments

Comments
 (0)