Skip to content

Commit 8e54cab

Browse files
committed
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.
1 parent ef89948 commit 8e54cab

7 files changed

+8
-8
lines changed

compiler/rustc_target/src/spec/armebv7r_none_eabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn target() -> Target {
1818
panic_strategy: PanicStrategy::Abort,
1919
max_atomic_width: Some(64),
2020
emit_debug_gdb_scripts: false,
21-
// GCC and Clang default to 8 for arm-none here
21+
// GCC defaults to 8 for arm-none here.
2222
c_enum_min_bits: Some(8),
2323
..Default::default()
2424
},

compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn target() -> Target {
1919
features: "+vfp3,-d32,-fp16".into(),
2020
max_atomic_width: Some(64),
2121
emit_debug_gdb_scripts: false,
22-
// GCC and Clang default to 8 for arm-none here
22+
// GCC defaults to 8 for arm-none here.
2323
c_enum_min_bits: Some(8),
2424
..Default::default()
2525
},

compiler/rustc_target/src/spec/armv4t_none_eabi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ pub fn target() -> Target {
3939
has_thumb_interworking: true,
4040
relocation_model: RelocModel::Static,
4141
panic_strategy: PanicStrategy::Abort,
42-
// from thumb_base, rust-lang/rust#44993.
42+
// From thumb_base, rust-lang/rust#44993.
4343
emit_debug_gdb_scripts: false,
44-
// from thumb_base, apparently gcc/clang give enums a minimum of 8 bits on no-os targets
44+
// From thumb_base, GCC gives enums a minimum of 8 bits on no-os targets.
4545
c_enum_min_bits: Some(8),
4646
..Default::default()
4747
},

compiler/rustc_target/src/spec/armv7a_none_eabihf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn target() -> Target {
1818
max_atomic_width: Some(64),
1919
panic_strategy: PanicStrategy::Abort,
2020
emit_debug_gdb_scripts: false,
21-
// GCC and Clang default to 8 for arm-none here
21+
// GCC defaults to 8 for arm-none here.
2222
c_enum_min_bits: Some(8),
2323
..Default::default()
2424
};

compiler/rustc_target/src/spec/armv7r_none_eabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn target() -> Target {
1717
panic_strategy: PanicStrategy::Abort,
1818
max_atomic_width: Some(64),
1919
emit_debug_gdb_scripts: false,
20-
// GCC and Clang default to 8 for arm-none here
20+
// GCC defaults to 8 for arm-none here.
2121
c_enum_min_bits: Some(8),
2222
..Default::default()
2323
},

compiler/rustc_target/src/spec/armv7r_none_eabihf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn target() -> Target {
1818
features: "+vfp3,-d32,-fp16".into(),
1919
max_atomic_width: Some(64),
2020
emit_debug_gdb_scripts: false,
21-
// GCC and Clang default to 8 for arm-none here
21+
// GCC defaults to 8 for arm-none here.
2222
c_enum_min_bits: Some(8),
2323
..Default::default()
2424
},

compiler/rustc_target/src/spec/thumb_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn opts() -> TargetOptions {
5252
// breaks debugging. Preserve LR by default to prevent that from happening.
5353
frame_pointer: FramePointer::Always,
5454
// ARM supports multiple ABIs for enums, the linux one matches the default of 32 here
55-
// but any arm-none or thumb-none target will be defaulted to 8 on GCC and clang
55+
// but any arm-none or thumb-none target will be defaulted to 8 on GCC.
5656
c_enum_min_bits: Some(8),
5757
..Default::default()
5858
}

0 commit comments

Comments
 (0)