about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-12-27 22:19:55 +0100
committerRalf Jung <post@ralfj.de>2024-12-31 12:41:20 +0100
commit912b7291d0f8f477388282a04ccf085d1b3715b0 (patch)
tree551e7b1143c909fe7390fafa0ee07e43007246f9 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parenteb527424a5f0206a464d0968387d85636ac9d305 (diff)
downloadrust-912b7291d0f8f477388282a04ccf085d1b3715b0.tar.gz
rust-912b7291d0f8f477388282a04ccf085d1b3715b0.zip
add ABI target features *before* -Ctarget-features
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 7fe0624e166..6ec09b29649 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -779,12 +779,12 @@ pub(crate) fn global_llvm_features(
         // we will silently correct them rather than silently producing wrong code.
         // (The target sanity check tries to catch this, but we can't know which features are
         // enabled in LLVM by default so we can't be fully sure about that check.)
-        for feature in abi_enable {
-            all_rust_features.push((true, feature));
-        }
-        for feature in abi_disable {
-            all_rust_features.push((false, feature));
-        }
+        // We add these at the beginning of the list so that `-Ctarget-features` can
+        // still override it... that's unsound, but more compatible with past behavior.
+        all_rust_features.splice(
+            0..0,
+            abi_enable.iter().map(|&f| (true, f)).chain(abi_disable.iter().map(|&f| (false, f))),
+        );
 
         // Translate this into LLVM features.
         let feats = all_rust_features