Skip to content

Commit 36f233c

Browse files
committed
aarch64-softfloat: forbid enabling the neon target feature
1 parent c02a4f0 commit 36f233c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/rustc_target/src/target_features.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -946,14 +946,16 @@ impl Target {
946946
// the use of soft-float, so all we can do here is some crude hacks.
947947
match &*self.abi {
948948
"softfloat" => {
949-
// This is not fully correct, LLVM actually doesn't let us enforce the softfloat
950-
// ABI properly... see <https://github.com/rust-lang/rust/issues/134375>.
951-
// FIXME: should we forbid "neon" here? But that would be a breaking change.
952-
NOTHING
949+
// LLVM will use float registers when `fp-armv8` is available, e.g. for
950+
// calls to built-ins. The only way to ensure a consistent softfloat ABI
951+
// on aarch64 is to never enable `fp-armv8`, so we enforce that.
952+
// In Rust we tie `neon` and `fp-armv8` together, therefore `neon` is the
953+
// feature we have to mark as incompatible.
954+
FeatureConstraints { required: &[], incompatible: &["neon"] }
953955
}
954956
_ => {
955957
// Everything else is assumed to use a hardfloat ABI. neon and fp-armv8 must be enabled.
956-
// These are Rust feature names and we use "neon" to control both of them.
958+
// `FeatureConstraints` uses Rust feature names, hence only "neon" shows up.
957959
FeatureConstraints { required: &["neon"], incompatible: &[] }
958960
}
959961
}

0 commit comments

Comments
 (0)