Skip to content

Commit

Permalink
Turn off frame pointer elimination on all Apple platforms.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jrmuizel committed Jun 2, 2021
1 parent ff2c947 commit aab8545
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/aarch64_apple_ios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub fn target() -> Target {
arch: "aarch64".to_string(),
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false,
max_atomic_width: Some(128),
unsupported_abis: super::arm_base::unsupported_abis(),
forces_embed_bitcode: true,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub fn target() -> Target {
arch: "aarch64".to_string(),
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a12".to_string(),
eliminate_frame_pointer: false,
max_atomic_width: Some(128),
unsupported_abis: super::arm_base::unsupported_abis(),
forces_embed_bitcode: true,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub fn target() -> Target {
arch: "aarch64".to_string(),
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false,
max_atomic_width: Some(128),
unsupported_abis: super::arm_base::unsupported_abis(),
forces_embed_bitcode: true,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/aarch64_apple_tvos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub fn target() -> Target {
arch: "aarch64".to_string(),
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false,
max_atomic_width: Some(128),
unsupported_abis: super::arm_base::unsupported_abis(),
forces_embed_bitcode: true,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/apple_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn opts(os: &str) -> TargetOptions {
families: vec!["unix".to_string()],
is_like_osx: true,
dwarf_version: Some(2),
eliminate_frame_pointer: false,
has_rpath: true,
dll_suffix: ".dylib".to_string(),
archive_format: "darwin".to_string(),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/apple_sdk_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub fn opts(os: &str, arch: Arch) -> TargetOptions {
executables: true,
link_env_remove: link_env_remove(arch),
has_elf_tls: false,
eliminate_frame_pointer: false,
..super::apple_base::opts(os)
}
}

0 comments on commit aab8545

Please sign in to comment.