Skip to content

Commit 9be95fb

Browse files
Avoid emulating wider atomics
Generally, Rust eschews emulating atomics where it can. This is done precisely so people can write interrupt handlers in Rust, without accidentally arriving in other interrupt handlers, or other complications that such things tend to induce. No solution is yet proposed for the xtensa-esp32s2-espidf target. However, it would be less-than-ideal if an ecosystem grew up around Rust-on-Xtensa that was dependent on something historically rejected by upstream Rust in the cases where it was easily avoidable.
1 parent edc37d2 commit 9be95fb

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

compiler/rustc_target/src/spec/xtensa_esp32_espidf.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ pub fn target() -> Target {
2020
cpu: "esp32".into(),
2121
linker: Some("xtensa-esp32-elf-gcc".into()),
2222

23-
// The esp32 only supports native 32bit atomics. However, esp-idf will emulate 64bit atomics
24-
// so we claim a max atomic width of 64 here.
25-
max_atomic_width: Some(64),
23+
// esp-idf can emulate 64-bit atomics, but Rust eschews non-hardware atomics
24+
max_atomic_width: Some(32),
2625
atomic_cas: true,
2726

2827
..super::xtensa_base::opts()
2928
},
3029
}
31-
}
30+
}

compiler/rustc_target/src/spec/xtensa_esp32s3_espidf.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ pub fn target() -> Target {
2020
cpu: "esp32-s3".into(),
2121
linker: Some("xtensa-esp32s3-elf-gcc".into()),
2222

23-
// The esp32s3 only supports native 32bit atomics. However, esp-idf will emulate 64bit atomics
24-
// so we claim a max atomic width of 64 here.
25-
max_atomic_width: Some(64),
23+
// esp-idf can emulate 64-bit atomics, but Rust eschews non-hardware atomics
24+
max_atomic_width: Some(32),
2625
atomic_cas: true,
2726

2827
..super::xtensa_base::opts()
2928
},
3029
}
31-
}
30+
}

0 commit comments

Comments
 (0)