Skip to content

Commit e42ad00

Browse files
committed
arm: use target.abi over soft-float target feature
1 parent 4a16229 commit e42ad00

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3168,14 +3168,22 @@ impl Target {
31683168
self.llvm_abiname,
31693169
);
31703170
}
3171-
"aarch64" => {
3171+
"aarch64" | "arm64ec" => {
31723172
check_matches!(
31733173
&*self.abi,
31743174
"softfloat" | "uwp" | "llvm" | "macabi" | "sim" | "ilp32" | "",
31753175
"invalid aarch64 ABI name: {}",
31763176
self.abi,
31773177
)
31783178
}
3179+
"arm" => {
3180+
check_matches!(
3181+
&*self.abi,
3182+
"eabi" | "eabihf" | "uwp" | "macabi" | "sim" | "",
3183+
"invalid aarch64 ABI name: {}",
3184+
self.abi,
3185+
)
3186+
}
31793187
_ => {}
31803188
}
31813189

compiler/rustc_target/src/target_features.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ impl Target {
759759
match &*self.arch {
760760
"x86" => {
761761
// We support 2 ABIs, hardfloat (default) and softfloat.
762+
// x86 has no sane ABI indicator so we have to use the target feature.
762763
if self.has_feature("soft-float") {
763764
NOTHING
764765
} else {
@@ -768,6 +769,7 @@ impl Target {
768769
}
769770
"x86_64" => {
770771
// We support 2 ABIs, hardfloat (default) and softfloat.
772+
// x86 has no sane ABI indicator so we have to use the target feature.
771773
if self.has_feature("soft-float") {
772774
NOTHING
773775
} else {
@@ -776,20 +778,20 @@ impl Target {
776778
}
777779
}
778780
"arm" => {
779-
// We support 2 ABIs, hardfloat (default) and softfloat.
780-
if self.has_feature("soft-float") {
781-
NOTHING
782-
} else {
783-
// Hardfloat ABI. x87 must be enabled.
784-
(&["fpregs"], &[])
781+
// It's unclear how the `abi` and the `soft-float` target feature interact.
782+
// We use the `abi` as our primary signal, and force `soft-float` to match.
783+
match &*self.abi {
784+
"eabi" => (&["soft-float"], &[]),
785+
"eabihf" | "uwp" | "macabi" | "sim" | "" => (&["fpregs"], &["soft-float"]),
786+
_ => unreachable!(),
785787
}
786788
}
787789
"aarch64" | "arm64ec" => {
788790
match &*self.abi {
789791
"softfloat" => {
790792
// This is not fully correct, LLVM actually doesn't let us enforce the softfloat
791793
// ABI properly... see <https://github.com/rust-lang/rust/issues/134375>.
792-
// FIXME: should be forbid "neon" here? But that would be a breaking change.
794+
// FIXME: should we forbid "neon" here? But that would be a breaking change.
793795
NOTHING
794796
}
795797
"uwp" | "llvm" | "macabi" | "sim" | "ilp32" | "" => {

0 commit comments

Comments
 (0)