Skip to content

Commit b6a3efc

Browse files
committed
aarch64-softfloat: forbid enabling the neon target feature
1 parent a8e4c68 commit b6a3efc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/rustc_target/src/target_features.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -980,14 +980,16 @@ impl Target {
980980
// the use of soft-float, so all we can do here is some crude hacks.
981981
match &*self.abi {
982982
"softfloat" => {
983-
// This is not fully correct, LLVM actually doesn't let us enforce the softfloat
984-
// ABI properly... see <https://github.com/rust-lang/rust/issues/134375>.
985-
// FIXME: should we forbid "neon" here? But that would be a breaking change.
986-
NOTHING
983+
// LLVM will use float registers when `fp-armv8` is available, e.g. for
984+
// calls to built-ins. The only way to ensure a consistent softfloat ABI
985+
// on aarch64 is to never enable `fp-armv8`, so we enforce that.
986+
// In Rust we tie `neon` and `fp-armv8` together, therefore `neon` is the
987+
// feature we have to mark as incompatible.
988+
FeatureConstraints { required: &[], incompatible: &["neon"] }
987989
}
988990
_ => {
989991
// Everything else is assumed to use a hardfloat ABI. neon and fp-armv8 must be enabled.
990-
// These are Rust feature names and we use "neon" to control both of them.
992+
// `FeatureConstraints` uses Rust feature names, hence only "neon" shows up.
991993
FeatureConstraints { required: &["neon"], incompatible: &[] }
992994
}
993995
}

0 commit comments

Comments
 (0)