-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Can't compile core for msp430 - LLVM ERROR #54511
Comments
Does the msp430 architecture not support atomic loads and stores (and I really mean atomic, not single instruction, those usually lower to atomic fence + load / store)? Or is this just an LLVM bug? I enabled atomic loads / stores on msp430 because @pftbest (iirc) asked for it. In any case, we can undo these lines to prevent this LLVM error but that would also remove the Atomic*.{load,store} API. Alternatively, we can set the What do think we should do here? |
All loads and stores are atomic on MSP430. There are no fence instructions or atomic instructions. There's no CAS instruction either (as you mention) so we'd have to expand it to turning off interrupts, CASing, then turning them back on (which is kind of silly). I'm not really clear on what "atomic" vs "volatile" means in the context of Rust, but based on your paragraph above, EDIT: all load and store instructions - obviously 32-bit loads/stores are not atomic. |
Actually, "volatile" was the wrong term to use as it doesn't describe the right semantics. With |
Okay, great - a compile-time fence is exactly the semantics we want here. My vote is definitely for |
I took at stab at this (setting
It seems that the MSP430 backend doesn't support compiler fences. Minimal example, which can be replicated using nightly: #![feature(intrinsics)]
#![feature(lang_items)]
#![feature(no_core)]
#![no_core]
extern "rust-intrinsic" {
fn atomic_singlethreadfence_acq();
}
pub unsafe fn foo(x: *mut u16) -> u16 {
atomic_singlethreadfence_acq();
*x
}
#[lang = "copy"]
trait Copy {}
impl Copy for u16 {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "sized"]
trait Sized {} $ cargo rustc --target msp430-none-elf --release -- --emit=obj
LLVM ERROR: Cannot select: 0x7f6af54571a0: ch = AtomicFence 0x7f6af54703d8, Constant:i16<4>, Constant:i16<0>
0x7f6af54570d0: i16 = Constant<4>
0x7f6af5457138: i16 = Constant<0>
In function: _ZN3foo3foo17hdc8504bb86603797E
error: Could not compile `foo`. Compare this to the ARM Cortex-M backend: $ cargo objdump --target thumbv7m-none-eabi --release --lib -- -d
foo::foo::he14a1cb0136d5f84:
0: 00 88 ldrh r0, [r0]
2: 70 47 bx lr Note that there's no instruction for the fence because this is a compiler fence. Given this fact the only path left to take here is to remove the |
msp430: remove the whole Atomic* API PR rust-lang#51953 enabled the Atomic*.{load,store} API on MSP430. Unfortunately, the LLVM backend doesn't currently support those atomic operations, so this commit removes the API and leaves instructions on how and when to enable it in the future. the second fixes compiling liballoc for msp430 closes rust-lang#54511 r? @alexcrichton cc @chernomor @awygle @cr1901 @pftbest
Last successful build was on nightly-2018-06-29-x86_64-unknown-linux-gnu rustc 1.28.0-nightly (e3bf634 2018-06-28).
Next builds fails. I check nightly-2018-07-07-x86_64-unknown-linux-gnu unchanged - rustc 1.29.0-nightly (e06c875 2018-07-06) and 1.30.0-nightly (4591a24 2018-09-22)
I see some changes for msp430 between 2018-06-29 and 2018-07-07: https://github.com/rust-lang/rust/compare/e3bf634e0..e06c87544#diff-7fdefb61a42e0c532d40f9742f7bf8cc - may it cause error?
The text was updated successfully, but these errors were encountered: