From c79f701fae5b6db00fe2df4791870e33363f1e33 Mon Sep 17 00:00:00 2001 From: Kajetan Puchalski Date: Mon, 29 Jul 2024 13:08:31 +0100 Subject: [PATCH] rustc_target: Remove fpmr target feature FEAT_FPMR has been removed from upstream LLVM as of LLVM 19. Remove the feature from the target features list and temporarily hack the LLVM codegen to always enable it until the minimum LLVM version is bumped to 19. --- compiler/rustc_codegen_llvm/src/attributes.rs | 6 ++++++ compiler/rustc_target/src/target_features.rs | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 4ef8cd7ce3000..f8d6921e8cab1 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -502,6 +502,12 @@ pub fn from_fn_attrs<'ll, 'tcx>( InstructionSetAttr::ArmA32 => "-thumb-mode".to_string(), InstructionSetAttr::ArmT32 => "+thumb-mode".to_string(), })) + // HACK: LLVM versions 19+ do not have the FPMR feature and treat it as always enabled + // It only exists as a feature in LLVM 18, cannot be passed down for any other version + .chain(match &*cx.tcx.sess.target.arch { + "aarch64" if llvm_util::get_version().0 == 18 => vec!["+fpmr".to_string()], + _ => vec![], + }) .collect::>(); if cx.tcx.sess.target.is_like_wasm { diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 395dd6c66ada8..0ca1ea1bc8c1e 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -132,8 +132,6 @@ const AARCH64_ALLOWED_FEATURES: &[(&str, Stability)] = &[ ("fp8dot4", Unstable(sym::aarch64_unstable_target_feature)), // FEAT_FP8FMA ("fp8fma", Unstable(sym::aarch64_unstable_target_feature)), - // FEAT_FPMR - ("fpmr", Unstable(sym::aarch64_unstable_target_feature)), // FEAT_FRINTTS ("frintts", Stable), // FEAT_HBC