-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing __atomic_load & __atomic_store intrinsics' implementation for esp32c3 (& maybe esp32s2) (IDFGH-5896) #7591
Comments
@igrr ^^^ (Playing with ESP-IDF master in cargo-native build and - to my surprise - got Implementing the suggested fix takes care of the linker errors. |
Ah yes, so this is because GCC implemented the native load/stores (that are theoretically UB, whether it happens in practice is unknown) but as you know from that link, its not implemented in llvm. I think your fix is correct, and simple to implement. |
@igrr The committed fix is not quite correct, because the missing atomics are ONLY implemented when building with clang However, we need them when the ESP-IDF is built with GCC too, because:
|
Provide emulated atomic load & store libcalls for u8, u16 & u32 integer types. This is required when building with Clang as llvm does not lower these operations to native load / stores, where as gcc does. Provide `sync_lock_test_and_set` atomic implementations for all supported integer types. Closes #7591. Closes #7592.
The implementation of atomics here is broken for Rust+LLVM+ESP-IDF+esp32c3 in that it does not define the
__atomic_load
and__atomic_store
intrinsics for esp32c3. By the way, it does not define these for esp32s2 either?It might be a simple omission, or it might be a misinterpretation of what the compiler (Rust + LLVM at least, not sure for GCC) would generate in terms of atomic libcalls on the Riscv32IMC architecture:
__atomic_load
/__atomic_store
even though loads/stores on that architecture are atomic, because - as per this comment - it is not safe to mix CPU-implemented atomicity (load/store) with libcall-implemented atomicity (e.g. CAS). Since CAS is not natively supported on Riscv32IMC, Rust+LLVM in fact does generate calls to__atomic_load
/__atomic_store
.Suggested fix: just add
... here.
The text was updated successfully, but these errors were encountered: