about summary refs log tree commit diff
path: root/src
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
commit940cbb8f2834c4c142d43c16dd3ec9fa8087a0ef (patch)
treeec1e71a6104501330be68d5acae382740ec0c924 /src
parentf06f5684112ac2de345819b9da513035f253764b (diff)
downloadrust-940cbb8f2834c4c142d43c16dd3ec9fa8087a0ef.tar.gz
rust-940cbb8f2834c4c142d43c16dd3ec9fa8087a0ef.zip
add ABI target features *before* -Ctarget-features
Diffstat (limited to 'src')
-rw-r--r--src/gcc_util.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gcc_util.rs b/src/gcc_util.rs
index 3e579d75d86..e9dfb4e4cf4 100644
--- a/src/gcc_util.rs
+++ b/src/gcc_util.rs
@@ -154,12 +154,12 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
     // 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 GCC 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 GCC features.
     let feats = all_rust_features