rustc_target/spec/targets/
i686_unknown_linux_gnu.rs

1use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, SanitizerSet, StackProbeType, Target, base};
2
3pub(crate) fn target() -> Target {
4    let mut base = base::linux_gnu::opts();
5    base.rustc_abi = Some(RustcAbi::X86Sse2);
6    // Dear distribution packager, if you are changing the base CPU model with the goal of removing
7    // the SSE2 requirement, make sure to also set the `rustc_abi` to `None` above or else the compiler
8    // will complain that the chosen ABI cannot be realized with the given CPU features.
9    // Also note that x86 without SSE2 is *not* considered a Tier 1 target by the Rust project, and
10    // it has some known floating-point correctness issues mostly caused by a lack of people caring
11    // for LLVM's x87 support (double-rounding, value truncation; see
12    // <https://github.com/rust-lang/rust/issues/114479> for details). This can lead to incorrect
13    // math (Rust generally promises exact math, so this can break code in unexpected ways) and it
14    // can lead to memory safety violations if floating-point values are used e.g. to access an
15    // array. If users run into such issues and report bugs upstream and then it turns out that the
16    // bugs are caused by distribution patches, that leads to confusion and frustration.
17    base.cpu = "pentium4".into();
18    base.max_atomic_width = Some(64);
19    base.supported_sanitizers = SanitizerSet::ADDRESS;
20    base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
21    base.stack_probes = StackProbeType::Inline;
22
23    Target {
24        llvm_target: "i686-unknown-linux-gnu".into(),
25        metadata: crate::spec::TargetMetadata {
26            description: Some("32-bit Linux (kernel 3.2, glibc 2.17+)".into()),
27            tier: Some(1),
28            host_tools: Some(true),
29            std: Some(true),
30        },
31        pointer_width: 32,
32        data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
33            i128:128-f64:32:64-f80:32-n8:16:32-S128"
34            .into(),
35        arch: "x86".into(),
36        options: base,
37    }
38}