rust/compiler/rustc_codegen_ssa/src/back/mod.rs
Mads Marquart e1233153ac 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`.
2024-11-01 17:07:18 +01:00

30 lines
885 B
Rust

use std::borrow::Cow;
use rustc_session::Session;
pub mod apple;
pub mod archive;
pub(crate) mod command;
pub mod link;
pub(crate) mod linker;
pub mod lto;
pub mod metadata;
pub(crate) mod rpath;
pub mod symbol_export;
pub mod write;
/// The target triple depends on the deployment target, and is required to
/// enable features such as cross-language LTO, and for picking the right
/// Mach-O commands.
///
/// Certain optimizations also depend on the deployment target.
pub fn versioned_llvm_target(sess: &Session) -> Cow<'_, str> {
if sess.target.is_like_osx {
apple::add_version_to_llvm_target(&sess.target.llvm_target, apple::deployment_target(sess))
.into()
} else {
// FIXME(madsmtm): Certain other targets also include a version,
// we might want to move that here as well.
Cow::Borrowed(&sess.target.llvm_target)
}
}