rustc_target/spec/targets/
x86_64_unknown_motor.rs

1use crate::spec::{
2    CodeModel, LinkSelfContainedDefault, LldFlavor, RelocModel, RelroLevel, Target, base,
3};
4
5pub(crate) fn target() -> Target {
6    let mut base = base::motor::opts();
7    base.cpu = "x86-64".into();
8    base.max_atomic_width = Some(64);
9    base.code_model = Some(CodeModel::Small);
10
11    // We want fully static relocatable binaries. It was surprisingly
12    // difficult to make it happen reliably, especially various
13    // linker-related options below. Mostly trial and error.
14    base.position_independent_executables = true;
15    base.relro_level = RelroLevel::Full;
16    base.static_position_independent_executables = true;
17    base.relocation_model = RelocModel::Pic;
18    base.lld_flavor_json = LldFlavor::Ld;
19    base.link_self_contained = LinkSelfContainedDefault::True;
20    base.dynamic_linking = false;
21    base.crt_static_default = true;
22    base.crt_static_respected = true;
23
24    Target {
25        llvm_target: "x86_64-unknown-none-elf".into(),
26        metadata: crate::spec::TargetMetadata {
27            description: Some("Motor OS".into()),
28            tier: Some(3),
29            host_tools: None,
30            std: None,
31        },
32        pointer_width: 64,
33        data_layout:
34            "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
35        arch: "x86_64".into(),
36        options: base,
37    }
38}