Can't compile core for msp430 - LLVM ERROR

7625e8c
Opened by Jorge Aparicio at 2022-08-17 06:57:28
$ rustup default nightly-2017-11-04

$ rustup component add rust-src

$ cp -r $(rustc --print sysroot)/lib/rustlib/src/rust/src .

$ cd src/libcore

$ cargo build --target msp430-none-elf
   Compiling core v0.0.0 (file:///home/japaric/tmp/src/libcore)
LLVM ERROR: Cannot select: t3: ch = AtomicFence t0, Constant:i16<7>, Constant:i16<1>
  t1: i16 = Constant<7>
  t2: i16 = Constant<1>
In function: _ZN4core4sync6atomic5fence17h15543a17f4e17a82E
error: Could not compile `core`.

found while bisecting #45834

cc @pftbest

  1. msp430 doesn't have atomics, so not really LLVM's fault. Why does rust started emitting atomic instructions on msp?

    Vadzim Dambrouski at 2017-11-07 16:28:22

  2. Why does rust started emitting atomic instructions on msp?

    Traced it all the way down to somewhere between nightly-2017-10-09 and nightly-2017-10-10 but I don't have time to dig further.

    Note that the LLVM error only appears when compiling core using the dev profile so this is not going to affect most users which will be compiling core in release mode (Xargo always compiles core in release mode) and that works ... or should work once #45836 is fixed.

    Jorge Aparicio at 2017-11-07 16:40:51