Skip to main content

rustc_target/spec/targets/
x86_64_unknown_linux_gnux32.rs

1use crate::spec::{
2    Arch, Cc, CfgAbi, LinkerFlavor, Lld, 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.cfg_abi = CfgAbi::X32;
9    base.max_atomic_width = Some(64);
10    base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mx32"]);
11    base.stack_probes = StackProbeType::Inline;
12    base.has_thread_local = false;
13    // BUG(GabrielMajeri): disabling the PLT on x86_64 Linux with x32 ABI
14    // breaks code gen. See LLVM bug 36743
15    base.plt_by_default = true;
16
17    Target {
18        llvm_target: "x86_64-unknown-linux-gnux32".into(),
19        metadata: TargetMetadata {
20            description: Some("64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)".into()),
21            tier: Some(2),
22            host_tools: Some(false),
23            std: Some(true),
24        },
25        pointer_width: 32,
26        data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
27            i64:64-i128:128-f80:128-n8:16:32:64-S128"
28            .into(),
29        arch: Arch::X86_64,
30        options: base,
31    }
32}