Auto merge of #98333 - SimonSapin:riscv-atomic, r=Amanieu
Re-enable atomic loads and stores for all RISC-V targets This roughly reverts PR https://github.com/rust-lang/rust/pull/66548 Atomic "CAS" are still disabled for targets without the *“A” Standard Extension for Atomic Instructions*. However this extension only adds instructions for operations more complex than simple loads and stores, which are always atomic when aligned. In the [Unprivileged Spec v. 20191213](https://riscv.org/technical/specifications/) section 2.6 *Load and Store Instructions* of chapter 2 *RV32I Base Integer Instruction Set* (emphasis mine): > Even when misaligned loads and stores complete successfully, these accesses might run extremely slowly depending on the implementation (e.g., when implemented via an invisible trap). Further-more, whereas **naturally aligned loads and stores are guaranteed to execute atomically**, misaligned loads and stores might not, and hence require additional synchronization to ensure atomicity. Unfortunately PR https://github.com/rust-lang/rust/pull/66548 did not provide much details on the bug that motivated it, but https://github.com/rust-lang/rust/issues/66240 and https://github.com/rust-lang/rust/issues/85736 appear related and happen with targets that do have the A extension.
This commit is contained in:
commit
90f0b24ad3
3 changed files with 3 additions and 3 deletions
|
@ -11,7 +11,7 @@ pub fn target() -> Target {
|
|||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
cpu: "generic-rv32".into(),
|
||||
max_atomic_width: Some(0),
|
||||
max_atomic_width: Some(32),
|
||||
atomic_cas: false,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
relocation_model: RelocModel::Static,
|
||||
|
|
|
@ -11,7 +11,7 @@ pub fn target() -> Target {
|
|||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
cpu: "generic-rv32".into(),
|
||||
max_atomic_width: Some(0),
|
||||
max_atomic_width: Some(32),
|
||||
atomic_cas: false,
|
||||
features: "+m".into(),
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
|
|
|
@ -11,7 +11,7 @@ pub fn target() -> Target {
|
|||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
cpu: "generic-rv32".into(),
|
||||
max_atomic_width: Some(0),
|
||||
max_atomic_width: Some(32),
|
||||
atomic_cas: false,
|
||||
features: "+m,+c".into(),
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue