]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
Rollup merge of #93824 - Amanieu:stable_cfg_target_has_atomic, r=davidtwco
[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".to_string();
7     base.max_atomic_width = Some(128); // core2 support cmpxchg16b
8     base.frame_pointer = FramePointer::Always;
9     base.pre_link_args.insert(
10         LinkerFlavor::Gcc,
11         vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()],
12     );
13     base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
14     // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
15     base.stack_probes = StackProbeType::Call;
16     base.supported_sanitizers =
17         SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;
18
19     // Clang automatically chooses a more specific target based on
20     // MACOSX_DEPLOYMENT_TARGET.  To enable cross-language LTO to work
21     // correctly, we do too.
22     let arch = "x86_64";
23     let llvm_target = super::apple_base::macos_llvm_target(&arch);
24
25     Target {
26         llvm_target,
27         pointer_width: 64,
28         data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
29             .to_string(),
30         arch: arch.to_string(),
31         options: TargetOptions { mcount: "\u{1}mcount".to_string(), ..base },
32     }
33 }