Skip to content

Commit

Permalink
Rollup merge of rust-lang#61675 - fintelia:riscv-frame-pointer, r=nagisa
Browse files Browse the repository at this point in the history
Include frame pointer for bare metal RISC-V targets

This changes the default setting to enable the use of the frame pointer register when targeting RISC-V. On that architecture there is a dedicated frame pointer register which LLVM would otherwise never use so there is no increase in register pressure. Further, since these are bare metal targets, getting backtraces without the frame pointer is considerably more difficult (you can't just ask the OS to load the ELF executable and parse DWARF symbols). It is true that this setting can also be changed with the `-C force-frame-pointers` flag but that won't impact the compilation of the standard library, meaning that backtraces from, say, a panic handler would be useless.
  • Loading branch information
Centril authored Jun 12, 2019
2 parents 96b5830 + 493d1b4 commit 0d8d08d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv32imac_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv32imc_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv64gc_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv64imac_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down

0 comments on commit 0d8d08d

Please sign in to comment.