summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2024-11-01 17:07:18 +0100
committerMads Marquart <mads@marquart.dk>2024-11-01 17:07:18 +0100
commite1233153ac2dcc68013f9698430ac27c7abec099 (patch)
treed5d64bb039d9b54bbeda5513bfe6a29e35a7bfba /compiler/rustc_codegen_cranelift
parent20c909ff9cdd88d33768a4ddb8952927a675b0ad (diff)
downloadrust-e1233153ac2dcc68013f9698430ac27c7abec099.tar.gz
rust-e1233153ac2dcc68013f9698430ac27c7abec099.zip
Move versioned LLVM target creation to rustc_codegen_ssa
The OS version depends on the deployment target environment variables,
the access of which we want to move to later in the compilation pipeline
that has access to more information, for example `env_depinfo`.
Diffstat (limited to 'compiler/rustc_codegen_cranelift')
-rw-r--r--compiler/rustc_codegen_cranelift/src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs
index 602b1b98200..fc3bd0abd78 100644
--- a/compiler/rustc_codegen_cranelift/src/lib.rs
+++ b/compiler/rustc_codegen_cranelift/src/lib.rs
@@ -40,6 +40,7 @@ use std::sync::Arc;
 use cranelift_codegen::isa::TargetIsa;
 use cranelift_codegen::settings::{self, Configurable};
 use rustc_codegen_ssa::CodegenResults;
+use rustc_codegen_ssa::back::versioned_llvm_target;
 use rustc_codegen_ssa::traits::CodegenBackend;
 use rustc_data_structures::profiling::SelfProfilerRef;
 use rustc_errors::ErrorGuaranteed;
@@ -260,7 +261,9 @@ impl CodegenBackend for CraneliftCodegenBackend {
 }
 
 fn target_triple(sess: &Session) -> target_lexicon::Triple {
-    match sess.target.llvm_target.parse() {
+    // FIXME(madsmtm): Use `sess.target.llvm_target` once target-lexicon supports unversioned macOS.
+    // See <https://github.com/bytecodealliance/target-lexicon/pull/113>
+    match versioned_llvm_target(sess).parse() {
         Ok(triple) => triple,
         Err(err) => sess.dcx().fatal(format!("target not recognized: {}", err)),
     }