Skip to content

Commit 3284895

Browse files
authored
Rollup merge of rust-lang#100621 - taiki-e:armv4t-atomics-32, r=cuviper
Pass +atomics-32 feature for {arm,thumb}v4t-none-eabi Similar to rust-lang@89582e8, but for ARMv4t. Pre-v6 ARM target does not have atomic CAS, except for Linux and Android where atomic CAS is provided by compiler-builtins. So, there is a similar issue as thumbv6m. I have confirmed that enabling the `atomics-32` target feature fixes the problem in the project affected by this issue. (taiki-e/portable-atomic#28 (comment)) Closes rust-lang#100619 r? `@nikic` cc `@Lokathor`
2 parents a2a4651 + 8439080 commit 3284895

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/rustc_target/src/spec/armv4t_none_eabi.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ pub fn target() -> Target {
3838
linker_flavor: LinkerFlavor::Ld,
3939
linker: Some("arm-none-eabi-ld".into()),
4040
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
41-
features: "+soft-float,+strict-align".into(),
41+
// Force-enable 32-bit atomics, which allows the use of atomic load/store only.
42+
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
43+
features: "+soft-float,+strict-align,+atomics-32".into(),
4244
main_needs_argc_argv: false,
4345
atomic_cas: false,
4446
has_thumb_interworking: true,

compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ pub fn target() -> Target {
4747
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
4848

4949
// minimum extra features, these cannot be disabled via -C
50-
features: "+soft-float,+strict-align".into(),
50+
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
51+
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
52+
features: "+soft-float,+strict-align,+atomics-32".into(),
5153

5254
panic_strategy: PanicStrategy::Abort,
5355
relocation_model: RelocModel::Static,

0 commit comments

Comments
 (0)