rustc_codegen_ssa/back/
mod.rs

1use std::borrow::Cow;
2
3use rustc_session::Session;
4
5pub mod apple;
6pub mod archive;
7pub(crate) mod command;
8pub mod link;
9pub(crate) mod linker;
10pub mod lto;
11pub mod metadata;
12pub(crate) mod rpath;
13pub mod symbol_export;
14pub mod write;
15
16/// The target triple depends on the deployment target, and is required to
17/// enable features such as cross-language LTO, and for picking the right
18/// Mach-O commands.
19///
20/// Certain optimizations also depend on the deployment target.
21pub fn versioned_llvm_target(sess: &Session) -> Cow<'_, str> {
22    if sess.target.is_like_osx {
23        apple::add_version_to_llvm_target(&sess.target.llvm_target, apple::deployment_target(sess))
24            .into()
25    } else {
26        // FIXME(madsmtm): Certain other targets also include a version,
27        // we might want to move that here as well.
28        Cow::Borrowed(&sess.target.llvm_target)
29    }
30}