From 3e2470e9a7617c1bdd0b3e3dc555a91de528d59c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 27 Jul 2026 18:15:09 +0200 Subject: [PATCH] test suite: add ARM case to ABI-required target feature check for -Ctarget-cpu --- ...t-feature-missing-in-target-cpu.arm.stderr | 7 ++++++ ...ed-target-feature-missing-in-target-cpu.rs | 23 +++++++++++++++++++ ...-feature-missing-in-target-cpu.x86.stderr} | 0 ...arget-cpu-lacks-required-target-feature.rs | 15 ------------ 4 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.arm.stderr create mode 100644 tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs rename tests/ui/target-feature/{target-cpu-lacks-required-target-feature.stderr => abi-required-target-feature-missing-in-target-cpu.x86.stderr} (100%) delete mode 100644 tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs diff --git a/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.arm.stderr b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.arm.stderr new file mode 100644 index 0000000000000..52862ec5151b3 --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.arm.stderr @@ -0,0 +1,7 @@ +warning: target feature `fpregs` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116344 + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs new file mode 100644 index 0000000000000..c07479eca0f7b --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs @@ -0,0 +1,23 @@ +//! Sometimes `-Ctarget-cpu` can *disable* target features that would by default be enabled on the +//! current target. Ensure that we catch the case where those target features are important for the +//! ABI. + +//@ compile-flags: --crate-type=lib +//@ revisions: x86 arm +//@[x86] compile-flags: --target=i686-unknown-linux-gnu -Ctarget-cpu=pentium +//@[x86] needs-llvm-components: x86 +//@[arm] compile-flags: --target=armv8r-none-eabihf -Ctarget-cpu=cortex-r4 +//@[arm] needs-llvm-components: arm + +// For now this is just a warning. +//@ build-pass +//@ ignore-backends: gcc +//@ add-minicore + +#![feature(no_core)] +#![no_core] + +extern crate minicore; +use minicore::*; + +//~? WARN must be enabled to ensure that the ABI of the current target can be implemented correctly diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.x86.stderr similarity index 100% rename from tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr rename to tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.x86.stderr diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs deleted file mode 100644 index 5e46ea8adf64a..0000000000000 --- a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ compile-flags: --target=i686-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-cpu=pentium -// For now this is just a warning. -//@ build-pass -//@ ignore-backends: gcc -//@ add-minicore - -#![feature(no_core)] -#![no_core] - -extern crate minicore; -use minicore::*; - -//~? WARN target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly