Skip to content

Commit 322d392

Browse files
committed
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`.
1 parent e3c1547 commit 322d392

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use std::sync::Arc;
4040
use cranelift_codegen::isa::TargetIsa;
4141
use cranelift_codegen::settings::{self, Configurable};
4242
use rustc_codegen_ssa::CodegenResults;
43+
use rustc_codegen_ssa::back::versioned_llvm_target;
4344
use rustc_codegen_ssa::traits::CodegenBackend;
4445
use rustc_data_structures::profiling::SelfProfilerRef;
4546
use rustc_errors::ErrorGuaranteed;
@@ -260,7 +261,9 @@ impl CodegenBackend for CraneliftCodegenBackend {
260261
}
261262

262263
fn target_triple(sess: &Session) -> target_lexicon::Triple {
263-
match sess.target.llvm_target.parse() {
264+
// FIXME(madsmtm): Use `sess.target.llvm_target` once target-lexicon supports unversioned macOS.
265+
// See <https://github.com/bytecodealliance/target-lexicon/pull/113>
266+
match versioned_llvm_target(sess).parse() {
264267
Ok(triple) => triple,
265268
Err(err) => sess.dcx().fatal(format!("target not recognized: {}", err)),
266269
}

0 commit comments

Comments
 (0)