Skip to main content

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    base.supports_fentry = true;
16    // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
17    base.crt_static_default = true;
18
19    // The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
20    // implementation, apparently relies on frame pointers existing... somehow.
21    // It's not clear to me why nor where this dependency is introduced, but the
22    // test suite does not pass with frame pointers eliminated and it passes
23    // with frame pointers present.
24    //
25    // If you think that this is no longer necessary, then please feel free to
26    // ignore! If it still passes the test suite and the bots then sounds good
27    // to me.
28    //
29    // This may or may not be related to this bug:
30    // https://llvm.org/bugs/show_bug.cgi?id=30879
31    base.frame_pointer = FramePointer::Always;
32
33    Target {
34        llvm_target: "i686-unknown-linux-musl".into(),
35        metadata: TargetMetadata {
36            description: Some("32-bit Linux with musl 1.2.5".into()),
37            tier: Some(2),
38            host_tools: Some(false),
39            std: Some(true),
40        },
41        pointer_width: 32,
42        data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
43            i128:128-f64:32:64-f80:32-n8:16:32-S128"
44            .into(),
45        arch: Arch::X86,
46        options: base,
47    }
48}