Skip to content

Commit f683e8b

Browse files
committed
Auto merge of rust-lang#117307 - taiki-e:espidf-atomic-64, r=Amanieu
Set max_atomic_width for riscv32*-esp-espidf to 32 Fixes rust-lang#117305 > Since riscv32 does not have 64-bit atomic instructions, I do not believe there is any way to fix this problem other than setting max_atomic_width of these targets to 32. This is a breaking change because Atomic\*64 will become unavailable, but all affected targets are tier 3, and the current Atomic*64 violates the standard library's API contract and can cause problems with code that rely on the standard library's atomic types being lock-free. r? `@Amanieu` cc `@ivmarkov` `@MabezDev`
2 parents 7fc6365 + ecefd4e commit f683e8b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/rustc_target/src/spec/riscv32imac_esp_espidf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn target() -> Target {
1717

1818
// As RiscV32IMAC architecture does natively support atomics,
1919
// automatically enable the support for the Rust STD library.
20-
max_atomic_width: Some(64),
20+
max_atomic_width: Some(32),
2121
atomic_cas: true,
2222

2323
features: "+m,+a,+c".into(),

compiler/rustc_target/src/spec/riscv32imc_esp_espidf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ pub fn target() -> Target {
1616
cpu: "generic-rv32".into(),
1717

1818
// While the RiscV32IMC architecture does not natively support atomics, ESP-IDF does support
19-
// the __atomic* and __sync* GCC builtins, so setting `max_atomic_width` to `Some(64)`
19+
// the __atomic* and __sync* GCC builtins, so setting `max_atomic_width` to `Some(32)`
2020
// and `atomic_cas` to `true` will cause the compiler to emit libcalls to these builtins.
2121
//
2222
// Support for atomics is necessary for the Rust STD library, which is supported by the ESP-IDF framework.
23-
max_atomic_width: Some(64),
23+
max_atomic_width: Some(32),
2424
atomic_cas: true,
2525

2626
features: "+m,+c".into(),

0 commit comments

Comments
 (0)