]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
Merge apple_base and apple_sdk_base into one module
[rust.git] / compiler / rustc_target / src / spec / x86_64_apple_darwin.rs
1 use super::apple_base::{macos_link_env_remove, macos_llvm_target, opts, Arch};
2 use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet};
3 use crate::spec::{StackProbeType, Target, TargetOptions};
4
5 pub fn target() -> Target {
6     let arch = Arch::X86_64;
7     let mut base = opts("macos", arch);
8     base.cpu = "core2".into();
9     base.max_atomic_width = Some(128); // core2 support cmpxchg16b
10     base.frame_pointer = FramePointer::Always;
11     base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]);
12     base.link_env_remove.to_mut().extend(macos_link_env_remove());
13     base.stack_probes = StackProbeType::X86;
14     base.supported_sanitizers =
15         SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;
16
17     // Clang automatically chooses a more specific target based on
18     // MACOSX_DEPLOYMENT_TARGET.  To enable cross-language LTO to work
19     // correctly, we do too.
20     let llvm_target = macos_llvm_target(arch.target_name());
21
22     Target {
23         llvm_target: llvm_target.into(),
24         pointer_width: 64,
25         data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
26             .into(),
27         arch: "x86_84".into(),
28         options: TargetOptions { mcount: "\u{1}mcount".into(), ..base },
29     }
30 }