diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs index 1e4f70ebcd310..7ce3adc69d8d6 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+strict-align,+v6,+vfp2".into(), + features: "+strict-align,+v6,+vfp2,-d32".into(), max_atomic_width: Some(64), mcount: "\u{1}__gnu_mcount_nc".into(), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 5b1d1e2a5a48e..3de0cc76786ca 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { llvm_floatabi: Some(FloatAbi::Hard), // Most of these settings are copied from the arm_unknown_linux_gnueabihf // target. - features: "+strict-align,+v6,+vfp2".into(), + features: "+strict-align,+v6,+vfp2,-d32".into(), max_atomic_width: Some(64), mcount: "\u{1}mcount".into(), // FIXME(compiler-team#422): musl targets should be dynamically linked by default. diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs index bd71c839e0b51..b5d8b84f67174 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+v6,+vfp2".into(), + features: "+v6,+vfp2,-d32".into(), max_atomic_width: Some(64), mcount: "\u{1}__gnu_mcount_nc".into(), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs index 5e5468d467d38..b5656b5497acd 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+v6,+vfp2".into(), + features: "+v6,+vfp2,-d32".into(), max_atomic_width: Some(64), mcount: "__mcount".into(), ..base::netbsd::opts() diff --git a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs index 99adc85947aba..5857b2e88959d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs @@ -28,7 +28,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::Eabi, llvm_floatabi: Some(FloatAbi::Soft), - features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(), + features: "-d32,+v7,+thumb-mode,+thumb2,+vfp3d16".into(), supported_sanitizers: SanitizerSet::ADDRESS, max_atomic_width: Some(64), ..base diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs index cd6d8b76f1a99..3241b409b1f28 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+v7,+vfp3d16,+thumb2,-neon".into(), + features: "-d32,+v7,+vfp3d16,+thumb2".into(), max_atomic_width: Some(64), mcount: "\u{1}__gnu_mcount_nc".into(), ..base::freebsd::opts() diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs index 8bf3dfd247229..f4b2ac9e515a2 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs @@ -21,7 +21,7 @@ pub(crate) fn target() -> Target { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), // Info about features at https://wiki.debian.org/ArmHardFloatPort - features: "+v7,+vfp3d16,+thumb2,-neon".into(), + features: "-d32,+v7,+vfp3d16,+thumb2".into(), max_atomic_width: Some(64), mcount: "\u{1}__gnu_mcount_nc".into(), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 6ce45de909a8b..92a2becaa2588 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+v7,+vfp3d16,+thumb2,-neon".into(), + features: "-d32,+v7,+vfp3d16,+thumb2".into(), max_atomic_width: Some(64), mcount: "\u{1}mcount".into(), // FIXME(compiler-team#422): musl targets should be dynamically linked by default. diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs index 63845a1a555c5..db8c6caee7c7e 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { // Info about features at https://wiki.debian.org/ArmHardFloatPort - features: "+v7,+vfp3d16,+thumb2,-neon".into(), + features: "-d32,+v7,+vfp3d16,+thumb2".into(), cpu: "generic".into(), max_atomic_width: Some(64), mcount: "_mcount".into(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs index 4000e395c5bcb..4c032d670fed1 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+v7,+vfp3d16,+thumb2,-neon".into(), + features: "-d32,+v7,+vfp3d16,+thumb2".into(), max_atomic_width: Some(64), mcount: "__mcount".into(), ..base::netbsd::opts() diff --git a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs index 63f82a0d7e68d..24870821dc58c 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), // Info about features at https://wiki.debian.org/ArmHardFloatPort - features: "+v7,+vfp3d16,+thumb2,-neon".into(), + features: "-d32,+v7,+vfp3d16,+thumb2".into(), max_atomic_width: Some(64), ..base::vxworks::opts() }, diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs index b59ce32b48e04..b0376eb7aed24 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), linker: Some("arm-kmc-eabi-gcc".into()), - features: "+v7,+vfp3d16,+thumb2,-neon".into(), + features: "-d32,+v7,+vfp3d16,+thumb2".into(), relocation_model: RelocModel::Static, disable_redzone: true, max_atomic_width: Some(64), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs index cbeb409110ff7..78e29ac7fd35f 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+vfp3d16,-neon,+strict-align".into(), + features: "-d32,+vfp3d16,+strict-align".into(), max_atomic_width: Some(64), has_thumb_interworking: true, ..base::arm_none::opts() diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_none_eabihf.rs index 4baa73c3cdb8b..5123cb727c57a 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_none_eabihf.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { options: TargetOptions { cfg_abi: CfgAbi::EabiHf, llvm_floatabi: Some(FloatAbi::Hard), - features: "+vfp3d16,-neon,+strict-align".into(), + features: "-d32,+vfp3d16,+strict-align".into(), max_atomic_width: Some(64), has_thumb_interworking: true, ..base::arm_none::opts() diff --git a/src/doc/rustc/src/platform-support/arm-linux.md b/src/doc/rustc/src/platform-support/arm-linux.md index e077597698d28..358394e3418b1 100644 --- a/src/doc/rustc/src/platform-support/arm-linux.md +++ b/src/doc/rustc/src/platform-support/arm-linux.md @@ -215,3 +215,7 @@ export CXX_arm_unknown_linux_gnueabi=arm-linux-gnueabi-g++ export CC_arm_unknown_linux_gnueabi=arm-linux-gnueabi-gcc cargo +nightly build -Zbuild-std --target=arm-unknown-linux-gnueabi ``` + +> **Note**: From version 1.94 up to 1.99, some hardfloat targets required `VFPv3-D32` as a minimum +> as they erroneously enabled the `d32` feature. Breakage introduced as a result of correcting this +> can be fixed by passing `-Ctarget-feature=+d32` to Rust. diff --git a/src/doc/rustc/src/platform-support/arm-none-eabi.md b/src/doc/rustc/src/platform-support/arm-none-eabi.md index 4a6c4783f6d7b..4f5e4f3eb31a0 100644 --- a/src/doc/rustc/src/platform-support/arm-none-eabi.md +++ b/src/doc/rustc/src/platform-support/arm-none-eabi.md @@ -202,6 +202,10 @@ Most of `core` should work as expected, with the following notes: Rust programs are output as ELF files. +> **Note**: From version 1.94 up to 1.99, some hardfloat targets required `VFPv3-D32` as a minimum +> as they erroneously enabled the `d32` feature. Breakage introduced as a result of correcting this +> can be fixed by passing `-Ctarget-feature=+d32` to Rust. + [atomic-load]: https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU32.html#method.load [atomic-store]: https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU32.html#method.store [fetch-add]: https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU32.html#method.fetch_add diff --git a/src/doc/rustc/src/platform-support/armv7-unknown-linux-gnueabi.md b/src/doc/rustc/src/platform-support/armv7-unknown-linux-gnueabi.md index c7888571df3d0..ac485f853173e 100644 --- a/src/doc/rustc/src/platform-support/armv7-unknown-linux-gnueabi.md +++ b/src/doc/rustc/src/platform-support/armv7-unknown-linux-gnueabi.md @@ -38,6 +38,10 @@ ar = "arm-linux-gnu-ar" linker = "arm-linux-gnu-gcc" ``` +> **Note**: From version 1.94 up to 1.99 the hardfloat target required `VFPv3-D32` as a minimum as it +> erroneously enabled the `d32` feature. Breakage introduced as a result of correcting this can be +> fixed by passing `-Ctarget-feature=+d32` to Rust. + ## Building Rust programs These targets is distributed through `rustup`, and otherwise requires no special configuration. diff --git a/src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabihf.md b/src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabihf.md index d2635f12db21b..71127d2e6b3bf 100644 --- a/src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabihf.md +++ b/src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabihf.md @@ -44,6 +44,10 @@ cc = "/TOOLCHAIN_PATH/bin/arm-buildroot-linux-uclibcgnueabihf-gcc" ./x.py build --stage 2 ``` +> **Note**: From version 1.94 up to 1.99 this target required `VFPv3-D32` as a minimum as it +> erroneously enabled the `d32` feature. Breakage introduced as a result of correcting this can be +> fixed by passing `-Ctarget-feature=+d32` to Rust. + ## Building and Running Rust Programs To test cross-compiled binaries on a `x86_64` system, you can use the `qemu-arm` [userspace emulation](https://qemu-project.gitlab.io/qemu/user/main.html) program. This avoids having a full emulated ARM system by doing dynamic binary translation and dynamic system call translation. It lets you run ARM programs directly on your `x86_64` kernel. It's very convenient! diff --git a/src/doc/rustc/src/platform-support/armv7a-none-eabi.md b/src/doc/rustc/src/platform-support/armv7a-none-eabi.md index 73f2e303579a0..b8ffcd514272e 100644 --- a/src/doc/rustc/src/platform-support/armv7a-none-eabi.md +++ b/src/doc/rustc/src/platform-support/armv7a-none-eabi.md @@ -49,10 +49,10 @@ disabled as needed with `-C target-feature=(+/-)`. In general, the following four combinations are possible: -- VFPv3-D16, target feature `+vfp3` and `-d32` -- VFPv3-D32, target feature `+vfp3` and `+d32` -- VFPv4-D16, target feature `+vfp4` and `-d32` -- VFPv4-D32, target feature `+vfp4` and `+d32` +- VFPv3-D16, target default +- VFPv3-D32, target feature `+d32` +- VFPv4-D16, llvm target feature `+vfp4d16` +- VFPv4-D32, target feature `+vfp4` An Armv7-A processor may optionally include a NEON hardware unit which provides Single Instruction Multiple Data (SIMD) operations. The @@ -63,6 +63,10 @@ You can refer to the [arm-none-eabi](arm-none-eabi.md) documentation for a generic guide on target feature and target CPU specification and how to enable and disable them via `.cargo/config.toml` file. +> **Note**: From version 1.94 up to 1.99 the hardfloat targets required `VFPv3-D32` as a minimum as +> they erroneously enabled the `d32` feature. Breakage introduced as a result of correcting this can +> be fixed by passing `-Ctarget-feature=+d32` to Rust. + [vfp]: https://developer.arm.com/documentation/den0013/0400/Floating-Point/Floating-point-basics-and-the-IEEE-754-standard/ARM-VFP ## Start-up and Low-Level Code diff --git a/tests/ui/asm/arm-high-dregs.rs b/tests/ui/asm/arm-high-dregs.rs new file mode 100644 index 0000000000000..a51372613c4ca --- /dev/null +++ b/tests/ui/asm/arm-high-dregs.rs @@ -0,0 +1,21 @@ +//@ add-minicore +//@ check-fail +//@ only-arm +//@ only-eabihf +//@ ignore-backends: gcc + +// As well as the error message, this also tests that d32 is not enabled by default on arm hardfloat +// targets + +#![feature(f16, no_core)] +#![crate_type = "rlib"] +#![no_core] + +extern crate minicore; +use minicore::*; + +#[no_mangle] +pub unsafe fn high(x: f64) { + asm!("vmov.f64 d16, d0", in("d16") x); + //~^ ERROR register class `dreg` requires at least one of the following target features: d32, neon +} diff --git a/tests/ui/asm/arm-high-dregs.stderr b/tests/ui/asm/arm-high-dregs.stderr new file mode 100644 index 0000000000000..aa48051e42bad --- /dev/null +++ b/tests/ui/asm/arm-high-dregs.stderr @@ -0,0 +1,8 @@ +error: register class `dreg` requires at least one of the following target features: d32, neon + --> $DIR/arm-high-dregs.rs:19:30 + | +LL | asm!("vmov.f64 d16, d0", in("d16") x); + | ^^^^^^^^^^^ + +error: aborting due to 1 previous error +