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