about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-09-20 17:55:03 +0200
committerGitHub <noreply@github.com>2025-09-20 17:55:03 +0200
commit5f8062bfcc8fca1c99c2b73946b5bfd95e2fc5a7 (patch)
treecc0cfe899731eaf2670c3fd79d7027137692b20c /compiler/rustc_codegen_llvm/src
parent9f2ef0f14d6028c5108643cafa6e2c617834594b (diff)
parent4841d8c5ffb6a7bd025c14d8e9d2c23e6c458792 (diff)
downloadrust-5f8062bfcc8fca1c99c2b73946b5bfd95e2fc5a7.tar.gz
rust-5f8062bfcc8fca1c99c2b73946b5bfd95e2fc5a7.zip
Rollup merge of #144592 - fee1-dead-contrib:target_spec, r=Noratrieb
generate list of all variants with `target_spec_enum`

This helps us avoid the hardcoded lists elsewhere.

r? ``@Noratrieb``
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/lib.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs
index 6fb23d09843..13bdb7cb1a2 100644
--- a/compiler/rustc_codegen_llvm/src/lib.rs
+++ b/compiler/rustc_codegen_llvm/src/lib.rs
@@ -45,6 +45,7 @@ use rustc_middle::util::Providers;
 use rustc_session::Session;
 use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest};
 use rustc_span::Symbol;
+use rustc_target::spec::{RelocModel, TlsModel};
 
 mod abi;
 mod allocator;
@@ -244,16 +245,7 @@ impl CodegenBackend for LlvmCodegenBackend {
         match req.kind {
             PrintKind::RelocationModels => {
                 writeln!(out, "Available relocation models:").unwrap();
-                for name in &[
-                    "static",
-                    "pic",
-                    "pie",
-                    "dynamic-no-pic",
-                    "ropi",
-                    "rwpi",
-                    "ropi-rwpi",
-                    "default",
-                ] {
+                for name in RelocModel::ALL.iter().map(RelocModel::desc).chain(["default"]) {
                     writeln!(out, "    {name}").unwrap();
                 }
                 writeln!(out).unwrap();
@@ -267,9 +259,7 @@ impl CodegenBackend for LlvmCodegenBackend {
             }
             PrintKind::TlsModels => {
                 writeln!(out, "Available TLS models:").unwrap();
-                for name in
-                    &["global-dynamic", "local-dynamic", "initial-exec", "local-exec", "emulated"]
-                {
+                for name in TlsModel::ALL.iter().map(TlsModel::desc) {
                     writeln!(out, "    {name}").unwrap();
                 }
                 writeln!(out).unwrap();