@@ -11,7 +11,6 @@ use Arch::*;
11
11
#[ allow( non_camel_case_types) ]
12
12
#[ derive( Copy , Clone ) ]
13
13
pub enum Arch {
14
- Armv7 ,
15
14
Armv7k ,
16
15
Armv7s ,
17
16
Arm64 ,
@@ -29,7 +28,6 @@ pub enum Arch {
29
28
impl Arch {
30
29
pub fn target_name ( self ) -> & ' static str {
31
30
match self {
32
- Armv7 => "armv7" ,
33
31
Armv7k => "armv7k" ,
34
32
Armv7s => "armv7s" ,
35
33
Arm64 | Arm64_macabi | Arm64_sim => "arm64" ,
@@ -43,7 +41,7 @@ impl Arch {
43
41
44
42
pub fn target_arch ( self ) -> Cow < ' static , str > {
45
43
Cow :: Borrowed ( match self {
46
- Armv7 | Armv7k | Armv7s => "arm" ,
44
+ Armv7k | Armv7s => "arm" ,
47
45
Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64" ,
48
46
I386 | I686 => "x86" ,
49
47
X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64" ,
@@ -52,7 +50,7 @@ impl Arch {
52
50
53
51
fn target_abi ( self ) -> & ' static str {
54
52
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 => "" ,
56
54
X86_64_macabi | Arm64_macabi => "macabi" ,
57
55
// x86_64-apple-ios is a simulator target, even though it isn't
58
56
// declared that way in the target like the other ones...
@@ -62,18 +60,20 @@ impl Arch {
62
60
63
61
fn target_cpu ( self ) -> & ' static str {
64
62
match self {
65
- Armv7 => "cortex-a8" , // iOS7 is supported on iPhone 4 and higher
66
63
Armv7k => "cortex-a8" ,
67
- Armv7s => "cortex-a9" ,
64
+ Armv7s => "swift" , // iOS 10 is only supported on iPhone 5 or higher.
68
65
Arm64 => "apple-a7" ,
69
66
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" ,
72
73
// Note: `core-avx2` is slightly more advanced than `x86_64h`, see
73
74
// comments (and disabled features) in `x86_64h_apple_darwin` for
74
- // details.
75
+ // details. It is a higher baseline then `penryn` however.
75
76
X86_64h => "core-avx2" ,
76
- X86_64_macabi => "core2" ,
77
77
Arm64_macabi => "apple-a12" ,
78
78
Arm64_sim => "apple-a12" ,
79
79
}
@@ -115,21 +115,6 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
115
115
}
116
116
117
117
pub 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
-
133
118
let abi = arch. target_abi ( ) ;
134
119
135
120
TargetOptions {
@@ -145,12 +130,17 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
145
130
pre_link_args : pre_link_args ( os, arch, abi) ,
146
131
families : cvs ! [ "unix" ] ,
147
132
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 ,
149
137
frame_pointer : FramePointer :: Always ,
150
138
has_rpath : true ,
151
139
dll_suffix : ".dylib" . into ( ) ,
152
140
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 ,
154
144
abi_return_struct_as_int : true ,
155
145
emit_debug_gdb_scripts : false ,
156
146
eh_frame_header : false ,
@@ -239,9 +229,7 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
239
229
match arch {
240
230
// Note: Arm64_sim is not included since macOS has no simulator.
241
231
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 ) ,
245
233
}
246
234
}
247
235
@@ -292,8 +280,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
292
280
// Otherwise if cross-compiling for a different OS/SDK, remove any part
293
281
// of the linking environment that's wrong and reversed.
294
282
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 => {
297
285
cvs ! [ "MACOSX_DEPLOYMENT_TARGET" ]
298
286
}
299
287
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>]>
303
291
304
292
fn ios_deployment_target ( ) -> ( u32 , u32 ) {
305
293
// 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 ) )
307
295
}
308
296
309
297
fn mac_catalyst_deployment_target ( ) -> ( u32 , u32 ) {
@@ -334,7 +322,7 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String {
334
322
335
323
fn tvos_deployment_target ( ) -> ( u32 , u32 ) {
336
324
// 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 ) )
338
326
}
339
327
340
328
fn tvos_lld_platform_version ( ) -> String {
0 commit comments