about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-15 14:40:49 +0200
committerGitHub <noreply@github.com>2024-06-15 14:40:49 +0200
commit21de99258fbed776d797a3e91513e5ca78474f9d (patch)
tree57dcedef83b2f0448374751c9058fc326f165b74 /compiler/rustc_codegen_llvm/src
parent0f2cc21547cda91e515dc934d3d325088b043655 (diff)
parent04af37170cc6a608f87b48706d49be3504585f58 (diff)
downloadrust-21de99258fbed776d797a3e91513e5ca78474f9d.tar.gz
rust-21de99258fbed776d797a3e91513e5ca78474f9d.zip
Rollup merge of #126424 - Enselic:sort-target-features, r=lqd
 Also sort `crt-static` in `--print target-features` output

I didn't find `crt-static` at first (for `x86_64-unknown-linux-gnu`), because it was put at the bottom of the large and otherwise sorted list.

Fully sort the list before we print it.

Note that `llvm_target_features` starts out and remains sorted and does not need to be sorted an extra time.

On my machine the diff is just:

```diff
$ diff -u /tmp/before2.txt /tmp/after2.txt
--- /tmp/before2.txt    2024-06-13 20:40:27.091636592 +0200
+++ /tmp/after2.txt     2024-06-13 20:39:54.584894891 +0200
``@@`` -20,6 +20,7 ``@@``
     bmi1                            - Support BMI instructions.
     bmi2                            - Support BMI2 instructions.
     cmpxchg16b                      - 64-bit with cmpxchg16b (this is true for most x86-64 chips, but not the first AMD chips).
+    crt-static                      - Enables C Run-time Libraries to be statically linked.
     ermsb                           - REP MOVS/STOS are fast.
     f16c                            - Support 16-bit floating point conversion instructions.
     fma                             - Enable three-operand fused multiple-add.
``@@`` -49,7 +50,6 ``@@``
     xsavec                          - Support xsavec instructions.
     xsaveopt                        - Support xsaveopt instructions.
     xsaves                          - Support xsaves instructions.
-    crt-static                      - Enables C Run-time Libraries to be statically linked.

 Code-generation features supported by LLVM for this target:
     16bit-mode                      - 16-bit mode (i8086).
```

I couldn't find a ui test that tested this output. Let's see if CI finds a regression tests.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 53b9b530e9b..7e0f264a4ae 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -394,10 +394,15 @@ fn print_target_features(out: &mut dyn PrintBackendInfo, sess: &Session, tm: &ll
             (*feature, desc)
         })
         .collect::<Vec<_>>();
+
+    // Since we add this at the end ...
     rustc_target_features.extend_from_slice(&[(
         "crt-static",
         "Enables C Run-time Libraries to be statically linked",
     )]);
+    // ... we need to sort the list again.
+    rustc_target_features.sort();
+
     llvm_target_features.retain(|(f, _d)| !known_llvm_target_features.contains(f));
 
     let max_feature_len = llvm_target_features