rustc_target/spec/targets/
x86_64_unknown_linux_gnu.rs

1use crate::spec::{
2    Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetMetadata, base,
3};
4
5pub(crate) fn target() -> Target {
6    let mut base = base::linux_gnu::opts();
7    base.cpu = "x86-64".into();
8    base.plt_by_default = false;
9    base.max_atomic_width = Some(64);
10    base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
11    base.stack_probes = StackProbeType::Inline;
12    base.static_position_independent_executables = true;
13    base.supported_sanitizers = SanitizerSet::ADDRESS
14        | SanitizerSet::CFI
15        | SanitizerSet::KCFI
16        | SanitizerSet::DATAFLOW
17        | SanitizerSet::LEAK
18        | SanitizerSet::MEMORY
19        | SanitizerSet::SAFESTACK
20        | SanitizerSet::THREAD;
21    base.supports_xray = true;
22
23    // When we're asked to use the `rust-lld` linker by default, set the appropriate lld-using
24    // linker flavor, and self-contained linker component.
25    if option_env!("CFG_USE_SELF_CONTAINED_LINKER").is_some() {
26        base.linker_flavor = LinkerFlavor::Gnu(Cc::Yes, Lld::Yes);
27        base.link_self_contained = crate::spec::LinkSelfContainedDefault::with_linker();
28    }
29
30    Target {
31        llvm_target: "x86_64-unknown-linux-gnu".into(),
32        metadata: TargetMetadata {
33            description: Some("64-bit Linux (kernel 3.2+, glibc 2.17+)".into()),
34            tier: Some(1),
35            host_tools: Some(true),
36            std: Some(true),
37        },
38        pointer_width: 64,
39        data_layout:
40            "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
41        arch: "x86_64".into(),
42        options: base,
43    }
44}