Skip to content

Commit 4c0e424

Browse files
committed
Apply c_enum_min_bits = 8 to (arm|thumb)-none- platforms
1 parent fd116c8 commit 4c0e424

7 files changed

+14
-0
lines changed

compiler/rustc_target/src/spec/armebv7r_none_eabi.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pub fn target() -> Target {
2020
panic_strategy: PanicStrategy::Abort,
2121
max_atomic_width: Some(32),
2222
emit_debug_gdb_scripts: false,
23+
// GCC and Clang default to 8 for arm-none here
24+
c_enum_min_bits: 8,
2325
..Default::default()
2426
},
2527
}

compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub fn target() -> Target {
2121
features: "+vfp3,-d32,-fp16".to_string(),
2222
max_atomic_width: Some(32),
2323
emit_debug_gdb_scripts: false,
24+
// GCC and Clang default to 8 for arm-none here
25+
c_enum_min_bits: 8,
2426
..Default::default()
2527
},
2628
}

compiler/rustc_target/src/spec/armv7a_none_eabi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub fn target() -> Target {
2828
max_atomic_width: Some(64),
2929
panic_strategy: PanicStrategy::Abort,
3030
emit_debug_gdb_scripts: false,
31+
c_enum_min_bits: 8,
3132
..Default::default()
3233
};
3334
Target {

compiler/rustc_target/src/spec/armv7a_none_eabihf.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pub fn target() -> Target {
1919
max_atomic_width: Some(64),
2020
panic_strategy: PanicStrategy::Abort,
2121
emit_debug_gdb_scripts: false,
22+
// GCC and Clang default to 8 for arm-none here
23+
c_enum_min_bits: 8,
2224
..Default::default()
2325
};
2426
Target {

compiler/rustc_target/src/spec/armv7r_none_eabi.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pub fn target() -> Target {
1919
panic_strategy: PanicStrategy::Abort,
2020
max_atomic_width: Some(32),
2121
emit_debug_gdb_scripts: false,
22+
// GCC and Clang default to 8 for arm-none here
23+
c_enum_min_bits: 8,
2224
..Default::default()
2325
},
2426
}

compiler/rustc_target/src/spec/armv7r_none_eabihf.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pub fn target() -> Target {
2020
features: "+vfp3,-d32,-fp16".to_string(),
2121
max_atomic_width: Some(32),
2222
emit_debug_gdb_scripts: false,
23+
// GCC and Clang default to 8 for arm-none here
24+
c_enum_min_bits: 8,
2325
..Default::default()
2426
},
2527
}

compiler/rustc_target/src/spec/thumb_base.rs

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ pub fn opts() -> TargetOptions {
5353
// LLVM is eager to trash the link register when calling `noreturn` functions, which
5454
// breaks debugging. Preserve LR by default to prevent that from happening.
5555
frame_pointer: FramePointer::Always,
56+
// ARM supports multiple ABIs for enums, the linux one matches the default of 32 here
57+
// but any arm-none or thumb-none target will be defaulted to 8 on GCC and clang
58+
c_enum_min_bits: 8,
5659
..Default::default()
5760
}
5861
}

0 commit comments

Comments
 (0)