@@ -67,13 +67,16 @@ impl Arch {
6767 Armv7s => "cortex-a9" ,
6868 Arm64 => "apple-a7" ,
6969 Arm64_32 => "apple-s4" ,
70- I386 | I686 => "yonah" ,
71- X86_64 | X86_64_sim => "core2" ,
70+ // Only macOS 10.12+ is supported, which means
71+ // all x86_64/x86 CPUs must be running at least penryn
72+ // https://github.com/llvm/llvm-project/blob/01f924d0e37a5deae51df0d77e10a15b63aa0c0f/clang/lib/Driver/ToolChains/Arch/X86.cpp#L79-L82
73+ I386 | I686 => "penryn" ,
74+ X86_64 | X86_64_sim => "penryn" ,
75+ X86_64_macabi => "penryn" ,
7276 // Note: `core-avx2` is slightly more advanced than `x86_64h`, see
7377 // comments (and disabled features) in `x86_64h_apple_darwin` for
74- // details.
78+ // details. It is a higher baseline then `penryn` however.
7579 X86_64h => "core-avx2" ,
76- X86_64_macabi => "core2" ,
7780 Arm64_macabi => "apple-a12" ,
7881 Arm64_sim => "apple-a12" ,
7982 }
@@ -115,20 +118,8 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
115118}
116119
117120pub fn opts ( os : & ' static str , arch : Arch ) -> TargetOptions {
118- // Static TLS is only available in macOS 10.7+. If you try to compile for 10.6
119- // either the linker will complain if it is used or the binary will end up
120- // segfaulting at runtime when run on 10.6. Rust by default supports macOS
121- // 10.7+, but there is a standard environment variable,
122- // MACOSX_DEPLOYMENT_TARGET, which is used to signal targeting older
123- // versions of macOS. For example compiling on 10.10 with
124- // MACOSX_DEPLOYMENT_TARGET set to 10.6 will cause the linker to generate
125- // warnings about the usage of static TLS.
126- //
127- // Here we detect what version is being requested, defaulting to 10.7. Static
128- // TLS is flagged as enabled if it looks to be supported. The architecture
129- // only matters for default deployment target which is 11.0 for ARM64 and
130- // 10.7 for everything else.
131- let has_thread_local = os == "macos" && macos_deployment_target ( Arch :: X86_64 ) >= ( 10 , 7 ) ;
121+ // TODO: iOS 10+ always has TLS too.
122+ let has_thread_local = os == "macos" ;
132123
133124 let abi = arch. target_abi ( ) ;
134125
@@ -239,9 +230,7 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
239230 match arch {
240231 // Note: Arm64_sim is not included since macOS has no simulator.
241232 Arm64 | Arm64_macabi => ( 11 , 0 ) ,
242- // x86_64h-apple-darwin only supports macOS 10.8 and later
243- X86_64h => ( 10 , 8 ) ,
244- _ => ( 10 , 7 ) ,
233+ _ => ( 10 , 12 ) ,
245234 }
246235}
247236
0 commit comments