rustc_target: Add msync target feature and enable it on powerpcspe targets by taiki-e · Pull Request #137860 · rust-lang/rust (original) (raw)

Some older PowerPC processors do not have the sync (sync 0) and lwsync (sync 1) instructions, but instead have the msync instruction. (IIRC msync and sync will be assembled into the same bit-pattern, but lwsync will be SIGILL. See also https://gcc.gnu.org/legacy-ml/gcc-patches/2006-11/msg01238.html.)

LLVM recognizes this as the msync feature and enables for some cpus such as e500.

powerpcspe is a target for CPUs such as e500 (Debian Wiki). However, the msync feature is currently not enabled except for vxworks, and at least since 2022-04, powerpc-unknown-linux-gnuspe was known to not work on real hardware without -C target-cpu (e.g., #96394, #117361).

rust/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs

Line 28 in8c39296

features: "+secure-plt,+msync".into(),

Fixes #117361

cc @BKPepe (powerpc-unknown-linux-muslspe target maintainer)
cc @glaubitz (who added powerpc-unknown-linux-gnuspe in #48484)
cc @th0ma7 (who opened #117361)

r? workingjubilee

@rustbot label +O-PowerPC +A-target-feature