rustc_codegen_ssa/back/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)
    }
}