]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/x86_64_unknown_none.rs
:arrow_up: rust-analyzer
[rust.git] / compiler / rustc_target / src / spec / x86_64_unknown_none.rs
1 // Generic x86-64 target for bare-metal code - Floating point disabled
2 //
3 // Can be used in conjunction with the `target-feature` and
4 // `target-cpu` compiler flags to opt-in more hardware-specific
5 // features.
6
7 use super::{
8     CodeModel, LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, RelroLevel, StackProbeType,
9     Target, TargetOptions,
10 };
11
12 pub fn target() -> Target {
13     let opts = TargetOptions {
14         cpu: "x86-64".into(),
15         max_atomic_width: Some(64),
16         // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
17         stack_probes: StackProbeType::Call,
18         position_independent_executables: true,
19         static_position_independent_executables: true,
20         relro_level: RelroLevel::Full,
21         relocation_model: RelocModel::Pic,
22         linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
23         linker: Some("rust-lld".into()),
24         features:
25             "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"
26                 .into(),
27         disable_redzone: true,
28         panic_strategy: PanicStrategy::Abort,
29         code_model: Some(CodeModel::Kernel),
30         ..Default::default()
31     };
32     Target {
33         llvm_target: "x86_64-unknown-none-elf".into(),
34         pointer_width: 64,
35         data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
36             .into(),
37         arch: "x86_64".into(),
38         options: opts,
39     }
40 }