Fix comments about GCC/Clang's enum width for arm-none targets.

GCC uses the `-fshort-enums` ABI for arm-none and the `int`-sized enum
ABI for arm-linux.
Clang uses the `int`-sized enum ABI for all arm targets.

Both options are permitted by AAPCS.

Rust is matching GCC's behavior for these targets, as interop with code
code compiled by GCC is desirable in the bare-metal context. See #87917.
This commit is contained in:
Chris Copeland 2023-07-17 22:13:15 -07:00
parent ef8994827e
commit 8e54caba04
No known key found for this signature in database
GPG Key ID: 14550DA72485DF30
7 changed files with 8 additions and 8 deletions

View File

@ -18,7 +18,7 @@ pub fn target() -> Target {
panic_strategy: PanicStrategy::Abort,
max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
// GCC defaults to 8 for arm-none here.
c_enum_min_bits: Some(8),
..Default::default()
},

View File

@ -19,7 +19,7 @@ pub fn target() -> Target {
features: "+vfp3,-d32,-fp16".into(),
max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
// GCC defaults to 8 for arm-none here.
c_enum_min_bits: Some(8),
..Default::default()
},

View File

@ -39,9 +39,9 @@ pub fn target() -> Target {
has_thumb_interworking: true,
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
// from thumb_base, rust-lang/rust#44993.
// From thumb_base, rust-lang/rust#44993.
emit_debug_gdb_scripts: false,
// from thumb_base, apparently gcc/clang give enums a minimum of 8 bits on no-os targets
// From thumb_base, GCC gives enums a minimum of 8 bits on no-os targets.
c_enum_min_bits: Some(8),
..Default::default()
},

View File

@ -18,7 +18,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64),
panic_strategy: PanicStrategy::Abort,
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
// GCC defaults to 8 for arm-none here.
c_enum_min_bits: Some(8),
..Default::default()
};

View File

@ -17,7 +17,7 @@ pub fn target() -> Target {
panic_strategy: PanicStrategy::Abort,
max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
// GCC defaults to 8 for arm-none here.
c_enum_min_bits: Some(8),
..Default::default()
},

View File

@ -18,7 +18,7 @@ pub fn target() -> Target {
features: "+vfp3,-d32,-fp16".into(),
max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
// GCC defaults to 8 for arm-none here.
c_enum_min_bits: Some(8),
..Default::default()
},

View File

@ -52,7 +52,7 @@ pub fn opts() -> TargetOptions {
// breaks debugging. Preserve LR by default to prevent that from happening.
frame_pointer: FramePointer::Always,
// ARM supports multiple ABIs for enums, the linux one matches the default of 32 here
// but any arm-none or thumb-none target will be defaulted to 8 on GCC and clang
// but any arm-none or thumb-none target will be defaulted to 8 on GCC.
c_enum_min_bits: Some(8),
..Default::default()
}