Skip to content

Commit aab8545

Browse files
committed
Turn off frame pointer elimination on all Apple platforms.
This ends up disabling frame pointer elimination on aarch64_apple_darwin which matches what clang does by default along with the aarch64_apple_ios and x86_64_apple_darwin targets. Further, the Apple docs "Writing ARM64 Code for Apple Platforms" has a section called "Respect the Purpose of Specific CPU Registers" which specifically calls out the frame pointer register (x29): The frame pointer register (x29) must always address a valid frame record. Some functions — such as leaf functions or tail calls — may opt not to create an entry in this list As a result, stack traces are always meaningful, even without debug information. Other platforms are updated to not override the default.
1 parent ff2c947 commit aab8545

File tree

6 files changed

+1
-5
lines changed

6 files changed

+1
-5
lines changed

compiler/rustc_target/src/spec/aarch64_apple_ios.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn target() -> Target {
1010
arch: "aarch64".to_string(),
1111
options: TargetOptions {
1212
features: "+neon,+fp-armv8,+apple-a7".to_string(),
13-
eliminate_frame_pointer: false,
1413
max_atomic_width: Some(128),
1514
unsupported_abis: super::arm_base::unsupported_abis(),
1615
forces_embed_bitcode: true,

compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn target() -> Target {
1010
arch: "aarch64".to_string(),
1111
options: TargetOptions {
1212
features: "+neon,+fp-armv8,+apple-a12".to_string(),
13-
eliminate_frame_pointer: false,
1413
max_atomic_width: Some(128),
1514
unsupported_abis: super::arm_base::unsupported_abis(),
1615
forces_embed_bitcode: true,

compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub fn target() -> Target {
1818
arch: "aarch64".to_string(),
1919
options: TargetOptions {
2020
features: "+neon,+fp-armv8,+apple-a7".to_string(),
21-
eliminate_frame_pointer: false,
2221
max_atomic_width: Some(128),
2322
unsupported_abis: super::arm_base::unsupported_abis(),
2423
forces_embed_bitcode: true,

compiler/rustc_target/src/spec/aarch64_apple_tvos.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn target() -> Target {
1010
arch: "aarch64".to_string(),
1111
options: TargetOptions {
1212
features: "+neon,+fp-armv8,+apple-a7".to_string(),
13-
eliminate_frame_pointer: false,
1413
max_atomic_width: Some(128),
1514
unsupported_abis: super::arm_base::unsupported_abis(),
1615
forces_embed_bitcode: true,

compiler/rustc_target/src/spec/apple_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub fn opts(os: &str) -> TargetOptions {
2727
families: vec!["unix".to_string()],
2828
is_like_osx: true,
2929
dwarf_version: Some(2),
30+
eliminate_frame_pointer: false,
3031
has_rpath: true,
3132
dll_suffix: ".dylib".to_string(),
3233
archive_format: "darwin".to_string(),

compiler/rustc_target/src/spec/apple_sdk_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn opts(os: &str, arch: Arch) -> TargetOptions {
4444
executables: true,
4545
link_env_remove: link_env_remove(arch),
4646
has_elf_tls: false,
47-
eliminate_frame_pointer: false,
4847
..super::apple_base::opts(os)
4948
}
5049
}

0 commit comments

Comments
 (0)