Skip to content

Commit 7459f78

Browse files
Follow suit with xtensa-esp32-espidf
1 parent 9be95fb commit 7459f78

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

compiler/rustc_target/src/spec/xtensa_esp32s2_espidf.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,15 @@ pub fn target() -> Target {
2222

2323
// See https://github.com/espressif/rust-esp32-example/issues/3#issuecomment-861054477
2424
//
25-
// Unlike the original ESP32 chip, ESP32-S2 does not really support atomics.
26-
// If the missing hardware instruction ends up being emulated in ESP-IDF, we might want to revert
27-
// this change and claim that atomics are supported "in hardware" (even though they would be emulated
28-
// by actually trapping the illegal instruction exception handler and calling into an ESP-IDF C emulation code).
25+
// While the ESP32-S2 chip does not natively support atomics, ESP-IDF does support
26+
// the __atomic* and __sync* compiler builtins. Setting `max_atomic_width` and `atomic_cas`
27+
// and `atomic_cas: true` will cause the compiler to emit libcalls to these builtins.
2928
//
30-
// However, for now we simultaneously claim "max_atomic_width: Some(64)" **and** atomic_cas: true,
31-
// which should force the compiler to generate libcalls to functions that emulate atomics
32-
// and which are already implemented in the ESP-IDF main branch anyway.
33-
max_atomic_width: Some(64),
29+
// Support for atomics is necessary for the Rust STD library, which is supported by ESP-IDF.
30+
max_atomic_width: Some(32),
3431
atomic_cas: true,
3532

3633
..super::xtensa_base::opts()
3734
},
3835
}
39-
}
36+
}

0 commit comments

Comments
 (0)