diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 101da0012cb4b..ec21605c39cd8 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -325,7 +325,7 @@ pub fn from_fn_attrs<'ll, 'tcx>( if let Some(f) = llvm_util::check_tied_features( cx.tcx.sess, - &function_features.iter().map(|f| (*f, true)).collect(), + &mut function_features.iter().map(|f| (*f, true)).collect(), ) { let span = cx .tcx diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 3ce594b945ac1..c291c5dd6a028 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -217,8 +217,15 @@ pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2] // ensure only valid combinations are allowed. pub fn check_tied_features( sess: &Session, - features: &FxHashMap<&str, bool>, + features: &mut FxHashMap<&str, bool>, ) -> Option<&'static [&'static str]> { + // neon implies fp, so we don't need to error in this case. + if sess.target.arch == "aarch64" && !features.contains_key("fp") { + if let Some(neon) = features.get("neon").copied() { + features.insert("fp", neon); + } + } + for tied in tied_target_features(sess) { // Tied features must be set to the same value, or not set at all let mut tied_iter = tied.iter(); @@ -487,8 +494,8 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec $DIR/tied-features.rs:25:1 + --> $DIR/tied-features.rs:26:1 | LL | #[target_feature(enable = "paca")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^