]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
Merge commit '7b73b60faca71d01d900e49831fcb84553e93019' into sync-rustfmt
[rust.git] / compiler / rustc_target / src / spec / x86_64_apple_darwin.rs
1 use crate::spec::TargetOptions;
2 use crate::spec::{FramePointer, LinkerFlavor, SanitizerSet, StackProbeType, Target};
3
4 pub fn target() -> Target {
5     let mut base = super::apple_base::opts("macos");
6     base.cpu = "core2".into();
7     base.max_atomic_width = Some(128); // core2 support cmpxchg16b
8     base.frame_pointer = FramePointer::Always;
9     base.pre_link_args
10         .insert(LinkerFlavor::Gcc, vec!["-m64".into(), "-arch".into(), "x86_64".into()]);
11     base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
12     // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
13     base.stack_probes = StackProbeType::Call;
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 arch = "x86_64";
21     let llvm_target = super::apple_base::macos_llvm_target(&arch);
22
23     Target {
24         llvm_target: llvm_target.into(),
25         pointer_width: 64,
26         data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
27             .into(),
28         arch: arch.into(),
29         options: TargetOptions { mcount: "\u{1}mcount".into(), ..base },
30     }
31 }