Skip to content

Commit

Permalink
Rollup merge of rust-lang#99227 - Lokathor:fix-thumbv4t-none-eabi-fra…
Browse files Browse the repository at this point in the history
…me-pointer, r=davidtwco

Fix thumbv4t-none-eabi frame pointer setting

The `thumb_base` profile has changed since I last remember seeing it, and now it sets the frame pointer to "always keep", which is not desired for this target. Hooking a debugger to the running program is not really done, it's preferable to have the register available for actual program use, so the default "may omit" is now set.

I thought that the target was already using "may omit" when I checked on it last month, because I forgot that the target was previously based on `thumb_base` rather than `Default::default()`. I only noticed the issue just now when creating the `armv4t-none-eabi` target (rust-lang#99226), though this PR is not in any way conditional on that one.
  • Loading branch information
JohnTitor authored Jul 29, 2022
2 parents 3924dac + 2eac6f3 commit 36ab4ec
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
//!
//! Please ping @Lokathor if changes are needed.
//!
//! This target profile assumes that you have the ARM binutils in your path (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free for all major OSes from the ARM developer's website, and they may also be available in your system's package manager. Unfortunately, the standard linker that Rust uses (`lld`) only supports as far back as `ARMv5TE`, so we must use the GNU `ld` linker.
//! This target profile assumes that you have the ARM binutils in your path
//! (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free
//! for all major OSes from the ARM developer's website, and they may also be
//! available in your system's package manager. Unfortunately, the standard
//! linker that Rust uses (`lld`) only supports as far back as `ARMv5TE`, so we
//! must use the GNU `ld` linker.
//!
//! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
//! **Important:** This target profile **does not** specify a linker script. You
//! just get the default link script when you build a binary for this target.
//! The default link script is very likely wrong, so you should use
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.

use crate::spec::{cvs, LinkerFlavor, Target, TargetOptions};
use crate::spec::{
cvs, FramePointer, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions,
};

pub fn target() -> Target {
Target {
Expand Down Expand Up @@ -39,6 +49,14 @@ pub fn target() -> Target {
// minimum extra features, these cannot be disabled via -C
features: "+soft-float,+strict-align".into(),

panic_strategy: PanicStrategy::Abort,
relocation_model: RelocModel::Static,
// suggested from thumb_base, rust-lang/rust#44993.
emit_debug_gdb_scripts: false,
// suggested from thumb_base, with no-os gcc/clang use 8-bit enums
c_enum_min_bits: 8,
frame_pointer: FramePointer::MayOmit,

main_needs_argc_argv: false,

// don't have atomic compare-and-swap
Expand Down

0 comments on commit 36ab4ec

Please sign in to comment.