]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/x86_64_unknown_none.rs
Add LLVM KCFI support to the Rust compiler
[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::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy};
8 use super::{RelroLevel, SanitizerSet, StackProbeType, Target, TargetOptions};
9
10 pub fn target() -> Target {
11     let opts = TargetOptions {
12         cpu: "x86-64".into(),
13         max_atomic_width: Some(64),
14         stack_probes: StackProbeType::X86,
15         position_independent_executables: true,
16         static_position_independent_executables: true,
17         relro_level: RelroLevel::Full,
18         linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
19         linker: Some("rust-lld".into()),
20         features:
21             "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"
22                 .into(),
23         supported_sanitizers: SanitizerSet::KCFI,
24         disable_redzone: true,
25         panic_strategy: PanicStrategy::Abort,
26         code_model: Some(CodeModel::Kernel),
27         ..Default::default()
28     };
29     Target {
30         llvm_target: "x86_64-unknown-none-elf".into(),
31         pointer_width: 64,
32         data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
33             .into(),
34         arch: "x86_64".into(),
35         options: opts,
36     }
37 }