@@ -11,7 +11,6 @@ use Arch::*;
1111#[ allow( non_camel_case_types) ]
1212#[ derive( Copy , Clone ) ]
1313pub enum Arch {
14- Armv7 ,
1514 Armv7k ,
1615 Armv7s ,
1716 Arm64 ,
@@ -29,7 +28,6 @@ pub enum Arch {
2928impl Arch {
3029 pub fn target_name ( self ) -> & ' static str {
3130 match self {
32- Armv7 => "armv7" ,
3331 Armv7k => "armv7k" ,
3432 Armv7s => "armv7s" ,
3533 Arm64 | Arm64_macabi | Arm64_sim => "arm64" ,
@@ -43,7 +41,7 @@ impl Arch {
4341
4442 pub fn target_arch ( self ) -> Cow < ' static , str > {
4543 Cow :: Borrowed ( match self {
46- Armv7 | Armv7k | Armv7s => "arm" ,
44+ Armv7k | Armv7s => "arm" ,
4745 Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64" ,
4846 I386 | I686 => "x86" ,
4947 X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64" ,
@@ -52,7 +50,7 @@ impl Arch {
5250
5351 fn target_abi ( self ) -> & ' static str {
5452 match self {
55- Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "" ,
53+ Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "" ,
5654 X86_64_macabi | Arm64_macabi => "macabi" ,
5755 // x86_64-apple-ios is a simulator target, even though it isn't
5856 // declared that way in the target like the other ones...
@@ -62,18 +60,20 @@ impl Arch {
6260
6361 fn target_cpu ( self ) -> & ' static str {
6462 match self {
65- Armv7 => "cortex-a8" , // iOS7 is supported on iPhone 4 and higher
6663 Armv7k => "cortex-a8" ,
67- Armv7s => "cortex-a9" ,
64+ Armv7s => "swift" , // iOS 10 is only supported on iPhone 5 or higher.
6865 Arm64 => "apple-a7" ,
6966 Arm64_32 => "apple-s4" ,
70- I386 | I686 => "yonah" ,
71- X86_64 | X86_64_sim => "core2" ,
67+ // Only macOS 10.12+ is supported, which means
68+ // all x86_64/x86 CPUs must be running at least penryn
69+ // https://github.com/llvm/llvm-project/blob/01f924d0e37a5deae51df0d77e10a15b63aa0c0f/clang/lib/Driver/ToolChains/Arch/X86.cpp#L79-L82
70+ I386 | I686 => "penryn" ,
71+ X86_64 | X86_64_sim => "penryn" ,
72+ X86_64_macabi => "penryn" ,
7273 // Note: `core-avx2` is slightly more advanced than `x86_64h`, see
7374 // comments (and disabled features) in `x86_64h_apple_darwin` for
74- // details.
75+ // details. It is a higher baseline then `penryn` however.
7576 X86_64h => "core-avx2" ,
76- X86_64_macabi => "core2" ,
7777 Arm64_macabi => "apple-a12" ,
7878 Arm64_sim => "apple-a12" ,
7979 }
@@ -115,21 +115,6 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
115115}
116116
117117pub 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 ) ;
132-
133118 let abi = arch. target_abi ( ) ;
134119
135120 TargetOptions {
@@ -145,12 +130,17 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
145130 pre_link_args : pre_link_args ( os, arch, abi) ,
146131 families : cvs ! [ "unix" ] ,
147132 is_like_osx : true ,
148- default_dwarf_version : 2 ,
133+ // LLVM notes that macOS 10.11+ and iOS 9+ default
134+ // to v4, so we do the same.
135+ // https://github.com/llvm/llvm-project/blob/378778a0d10c2f8d5df8ceff81f95b6002984a4b/clang/lib/Driver/ToolChains/Darwin.cpp#L1203
136+ default_dwarf_version : 4 ,
149137 frame_pointer : FramePointer :: Always ,
150138 has_rpath : true ,
151139 dll_suffix : ".dylib" . into ( ) ,
152140 archive_format : "darwin" . into ( ) ,
153- has_thread_local,
141+ // Thread locals became available with iOS 8 and macOS 10.7,
142+ // and both are far below our minimum.
143+ has_thread_local : true ,
154144 abi_return_struct_as_int : true ,
155145 emit_debug_gdb_scripts : false ,
156146 eh_frame_header : false ,
@@ -239,9 +229,7 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
239229 match arch {
240230 // Note: Arm64_sim is not included since macOS has no simulator.
241231 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 ) ,
232+ _ => ( 10 , 12 ) ,
245233 }
246234}
247235
@@ -292,8 +280,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
292280 // Otherwise if cross-compiling for a different OS/SDK, remove any part
293281 // of the linking environment that's wrong and reversed.
294282 match arch {
295- Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim
296- | X86_64h | Arm64_sim => {
283+ Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim | X86_64h
284+ | Arm64_sim => {
297285 cvs ! [ "MACOSX_DEPLOYMENT_TARGET" ]
298286 }
299287 X86_64_macabi | Arm64_macabi => cvs ! [ "IPHONEOS_DEPLOYMENT_TARGET" ] ,
@@ -303,7 +291,7 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
303291
304292fn ios_deployment_target ( ) -> ( u32 , u32 ) {
305293 // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
306- from_set_deployment_target ( "IPHONEOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( 7 , 0 ) )
294+ from_set_deployment_target ( "IPHONEOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( 10 , 0 ) )
307295}
308296
309297fn mac_catalyst_deployment_target ( ) -> ( u32 , u32 ) {
@@ -334,7 +322,7 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String {
334322
335323fn tvos_deployment_target ( ) -> ( u32 , u32 ) {
336324 // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
337- from_set_deployment_target ( "TVOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( 7 , 0 ) )
325+ from_set_deployment_target ( "TVOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( 10 , 0 ) )
338326}
339327
340328fn tvos_lld_platform_version ( ) -> String {
0 commit comments