rustc_target/spec/targets/
i686_unknown_linux_musl.rs

1use crate::spec::{
2    Arch, Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata,
3    base,
4};
5
6pub(crate) fn target() -> Target {
7    let mut base = base::linux_musl::opts();
8    base.rustc_abi = Some(RustcAbi::X86Sse2);
9    // If you want to change the base CPU, please see `i686_unknown_linux_gnu.rs`
10    // for an important comment.
11    base.cpu = "pentium4".into();
12    base.max_atomic_width = Some(64);
13    base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
14    base.stack_probes = StackProbeType::Inline;
15    // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
16    base.crt_static_default = true;
17
18    // The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
19    // implementation, apparently relies on frame pointers existing... somehow.
20    // It's not clear to me why nor where this dependency is introduced, but the
21    // test suite does not pass with frame pointers eliminated and it passes
22    // with frame pointers present.
23    //
24    // If you think that this is no longer necessary, then please feel free to
25    // ignore! If it still passes the test suite and the bots then sounds good
26    // to me.
27    //
28    // This may or may not be related to this bug:
29    // https://llvm.org/bugs/show_bug.cgi?id=30879
30    base.frame_pointer = FramePointer::Always;
31
32    Target {
33        llvm_target: "i686-unknown-linux-musl".into(),
34        metadata: TargetMetadata {
35            description: Some("32-bit Linux with musl 1.2.5".into()),
36            tier: Some(2),
37            host_tools: Some(false),
38            std: Some(true),
39        },
40        pointer_width: 32,
41        data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
42            i128:128-f64:32:64-f80:32-n8:16:32-S128"
43            .into(),
44        arch: Arch::X86,
45        options: base,
46    }
47}