]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
Merge commit '98e2b9f25b6db4b2680a3d388456d9f95cb28344' into clippyup
[rust.git] / compiler / rustc_target / src / spec / x86_64_apple_darwin.rs
1 use crate::spec::{LinkerFlavor, SanitizerSet, StackProbeType, Target, TargetOptions};
2
3 pub fn target() -> Target {
4     let mut base = super::apple_base::opts("macos");
5     base.cpu = "core2".to_string();
6     base.max_atomic_width = Some(128); // core2 support cmpxchg16b
7     base.eliminate_frame_pointer = false;
8     base.pre_link_args.insert(
9         LinkerFlavor::Gcc,
10         vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()],
11     );
12     base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
13     base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
14     base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
15
16     // Clang automatically chooses a more specific target based on
17     // MACOSX_DEPLOYMENT_TARGET.  To enable cross-language LTO to work
18     // correctly, we do too.
19     let arch = "x86_64";
20     let llvm_target = super::apple_base::macos_llvm_target(&arch);
21
22     Target {
23         llvm_target,
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             .to_string(),
27         arch: arch.to_string(),
28         options: TargetOptions { mcount: "\u{1}mcount".to_string(), ..base },
29     }
30 }