@@ -5,7 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
55use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
66use rustc_span:: { Symbol , sym} ;
77
8- use crate :: spec:: { Abi , Arch , FloatAbi , RustcAbi , Target } ;
8+ use crate :: spec:: { Arch , FloatAbi , RustcAbi , Target } ;
99
1010/// Features that control behaviour of rustc, rather than the codegen.
1111/// These exist globally and are not in the target-specific lists below.
@@ -1170,17 +1170,21 @@ impl Target {
11701170 Arch :: AArch64 | Arch :: Arm64EC => {
11711171 // Aarch64 has no sane ABI specifier, and LLVM doesn't even have a way to force
11721172 // the use of soft-float, so all we can do here is some crude hacks.
1173- if self . abi == Abi :: SoftFloat {
1174- // LLVM will use float registers when `fp-armv8` is available, e.g. for
1175- // calls to built-ins. The only way to ensure a consistent softfloat ABI
1176- // on aarch64 is to never enable `fp-armv8`, so we enforce that.
1177- // In Rust we tie `neon` and `fp-armv8` together, therefore `neon` is the
1178- // feature we have to mark as incompatible.
1179- FeatureConstraints { required : & [ ] , incompatible : & [ "neon" ] }
1180- } else {
1181- // Everything else is assumed to use a hardfloat ABI. neon and fp-armv8 must be enabled.
1182- // `FeatureConstraints` uses Rust feature names, hence only "neon" shows up.
1183- FeatureConstraints { required : & [ "neon" ] , incompatible : & [ ] }
1173+ match self . rustc_abi {
1174+ Some ( RustcAbi :: Softfloat ) => {
1175+ // LLVM will use float registers when `fp-armv8` is available, e.g. for
1176+ // calls to built-ins. The only way to ensure a consistent softfloat ABI
1177+ // on aarch64 is to never enable `fp-armv8`, so we enforce that.
1178+ // In Rust we tie `neon` and `fp-armv8` together, therefore `neon` is the
1179+ // feature we have to mark as incompatible.
1180+ FeatureConstraints { required : & [ ] , incompatible : & [ "neon" ] }
1181+ }
1182+ None => {
1183+ // Everything else is assumed to use a hardfloat ABI. neon and fp-armv8 must be enabled.
1184+ // `FeatureConstraints` uses Rust feature names, hence only "neon" shows up.
1185+ FeatureConstraints { required : & [ "neon" ] , incompatible : & [ ] }
1186+ }
1187+ Some ( r) => panic ! ( "invalid Rust ABI for aarch64: {r:?}" ) ,
11841188 }
11851189 }
11861190 Arch :: RiscV32 | Arch :: RiscV64 => {
0 commit comments