diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-17 12:32:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-17 12:32:55 +0200 |
| commit | 64cd65758cefc02e4fa7518b20582465fbce5a6c (patch) | |
| tree | 463fa1734bbb3c27689ea62b525abed512e4c66b /compiler | |
| parent | d956734f9f077d46d4237745fcf2cafdc5ded6ce (diff) | |
| parent | 8439080f270956e8bba3e57a3432e455fd62ab85 (diff) | |
| download | rust-64cd65758cefc02e4fa7518b20582465fbce5a6c.tar.gz rust-64cd65758cefc02e4fa7518b20582465fbce5a6c.zip | |
Rollup merge of #100621 - taiki-e:armv4t-atomics-32, r=cuviper
Pass +atomics-32 feature for {arm,thumb}v4t-none-eabi
Similar to https://github.com/rust-lang/rust/commit/89582e8193e0da64a54c4ffae7f9fa64ed9fe2af, 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. (https://github.com/taiki-e/portable-atomic/pull/28#discussion_r946604136)
Closes #100619
r? ``@nikic``
cc ``@Lokathor``
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_target/src/spec/armv4t_none_eabi.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_target/src/spec/armv4t_none_eabi.rs b/compiler/rustc_target/src/spec/armv4t_none_eabi.rs index a76ffe808c3..797dfe52bd1 100644 --- a/compiler/rustc_target/src/spec/armv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armv4t_none_eabi.rs @@ -38,7 +38,9 @@ pub fn target() -> Target { linker_flavor: LinkerFlavor::Ld, linker: Some("arm-none-eabi-ld".into()), asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",], - features: "+soft-float,+strict-align".into(), + // Force-enable 32-bit atomics, which allows the use of atomic load/store only. + // The resulting atomics are ABI incompatible with atomics backed by libatomic. + features: "+soft-float,+strict-align,+atomics-32".into(), main_needs_argc_argv: false, atomic_cas: false, has_thumb_interworking: true, diff --git a/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs index 7125d141af7..bdaaed8b5d0 100644 --- a/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs @@ -47,7 +47,9 @@ pub fn target() -> Target { asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",], // minimum extra features, these cannot be disabled via -C - features: "+soft-float,+strict-align".into(), + // Also force-enable 32-bit atomics, which allows the use of atomic load/store only. + // The resulting atomics are ABI incompatible with atomics backed by libatomic. + features: "+soft-float,+strict-align,+atomics-32".into(), panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, |
