Rollup merge of #66548 - lenary:riscv/disable-atomics-non-a, r=alexcrichton
[RISCV] Disable Atomics on all Non-A RISC-V targets In a `TargetOptions` configuration, `max_atomic_width: None` causes `max_atomic_width()` to return `Some(target_pointer_width)`. So, contrary to assumptions, `max_atomic_width: None` means you do have atomic support! RISC-V's rv32i and rv32imc do not have architectural support for atomic memory accesses of any size, because they do not include the `A` architecture extension. This means the values in the target definition should be `Some(0)`. This bug has been observed via a build failure with oreboot/oreboot#191, where LLVM was still generating libcalls for atomic operations. According to rust-lang/compiler-builtins, "Rust only exposes atomic types on platforms that support them, and therefore does not need to fall back to software implementations." - so this PR tries to bring rustc inline with this decision. This commit also removes the outdated bug link, which references a now irrelevant GCC bug. I will likely also have to revisit the `min_atomic_width` of all the RISC-V targets so they are correct and match what the hardware is capable of (which is more restricted than one might imagine). r? @alexcrichton
This commit is contained in:
commit
fff8ae1aa8
2 changed files with 2 additions and 3 deletions
|
@ -17,7 +17,7 @@ pub fn target() -> TargetResult {
|
|||
options: TargetOptions {
|
||||
linker: Some("rust-lld".to_string()),
|
||||
cpu: "generic-rv32".to_string(),
|
||||
max_atomic_width: None,
|
||||
max_atomic_width: Some(0),
|
||||
atomic_cas: false,
|
||||
features: String::new(),
|
||||
executables: true,
|
||||
|
|
|
@ -17,8 +17,7 @@ pub fn target() -> TargetResult {
|
|||
options: TargetOptions {
|
||||
linker: Some("rust-lld".to_string()),
|
||||
cpu: "generic-rv32".to_string(),
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86005
|
||||
max_atomic_width: None, //Some(32),
|
||||
max_atomic_width: Some(0),
|
||||
atomic_cas: false,
|
||||
features: "+m,+c".to_string(),
|
||||
executables: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue