@@ -9,11 +9,12 @@ mod tests;
9
9
10
10
use Arch :: * ;
11
11
#[ allow( non_camel_case_types) ]
12
- #[ derive( Copy , Clone ) ]
12
+ #[ derive( Copy , Clone , PartialEq ) ]
13
13
pub enum Arch {
14
14
Armv7k ,
15
15
Armv7s ,
16
16
Arm64 ,
17
+ Arm64e ,
17
18
Arm64_32 ,
18
19
I386 ,
19
20
I686 ,
@@ -31,6 +32,7 @@ impl Arch {
31
32
Armv7k => "armv7k" ,
32
33
Armv7s => "armv7s" ,
33
34
Arm64 | Arm64_macabi | Arm64_sim => "arm64" ,
35
+ Arm64e => "arm64e" ,
34
36
Arm64_32 => "arm64_32" ,
35
37
I386 => "i386" ,
36
38
I686 => "i686" ,
@@ -42,15 +44,15 @@ impl Arch {
42
44
pub fn target_arch ( self ) -> Cow < ' static , str > {
43
45
Cow :: Borrowed ( match self {
44
46
Armv7k | Armv7s => "arm" ,
45
- Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64" ,
47
+ Arm64 | Arm64e | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64" ,
46
48
I386 | I686 => "x86" ,
47
49
X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64" ,
48
50
} )
49
51
}
50
52
51
53
fn target_abi ( self ) -> & ' static str {
52
54
match self {
53
- Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "" ,
55
+ Armv7k | Armv7s | Arm64 | Arm64e | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "" ,
54
56
X86_64_macabi | Arm64_macabi => "macabi" ,
55
57
// x86_64-apple-ios is a simulator target, even though it isn't
56
58
// declared that way in the target like the other ones...
@@ -63,6 +65,7 @@ impl Arch {
63
65
Armv7k => "cortex-a8" ,
64
66
Armv7s => "swift" , // iOS 10 is only supported on iPhone 5 or higher.
65
67
Arm64 => "apple-a7" ,
68
+ Arm64e => "apple-a12" ,
66
69
Arm64_32 => "apple-s4" ,
67
70
// Only macOS 10.12+ is supported, which means
68
71
// all x86_64/x86 CPUs must be running at least penryn
@@ -88,7 +91,7 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
88
91
} ;
89
92
90
93
let platform_version: StaticCow < str > = match os {
91
- "ios" => ios_lld_platform_version ( ) ,
94
+ "ios" => ios_lld_platform_version ( arch ) ,
92
95
"tvos" => tvos_lld_platform_version ( ) ,
93
96
"watchos" => watchos_lld_platform_version ( ) ,
94
97
"macos" => macos_lld_platform_version ( arch) ,
@@ -202,12 +205,22 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
202
205
let ( major, minor) = match & * target. os {
203
206
"macos" => {
204
207
// This does not need to be specific. It just needs to handle x86 vs M1.
205
- let arch = if target. arch == "x86" || target. arch == "x86_64" { X86_64 } else { Arm64 } ;
208
+ let arch = match target. arch . as_ref ( ) {
209
+ "x86" | "x86_64" => X86_64 ,
210
+ "arm64e" => Arm64e ,
211
+ _ => Arm64 ,
212
+ } ;
206
213
macos_deployment_target ( arch)
207
214
}
208
215
"ios" => match & * target. abi {
209
216
"macabi" => mac_catalyst_deployment_target ( ) ,
210
- _ => ios_deployment_target ( ) ,
217
+ _ => {
218
+ let arch = match target. arch . as_ref ( ) {
219
+ "arm64e" => Arm64e ,
220
+ _ => Arm64 ,
221
+ } ;
222
+ ios_deployment_target ( arch)
223
+ }
211
224
} ,
212
225
"watchos" => watchos_deployment_target ( ) ,
213
226
"tvos" => tvos_deployment_target ( ) ,
@@ -228,7 +241,7 @@ fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> {
228
241
fn macos_default_deployment_target ( arch : Arch ) -> ( u32 , u32 ) {
229
242
match arch {
230
243
// Note: Arm64_sim is not included since macOS has no simulator.
231
- Arm64 | Arm64_macabi => ( 11 , 0 ) ,
244
+ Arm64 | Arm64e | Arm64_macabi => ( 11 , 0 ) ,
232
245
_ => ( 10 , 12 ) ,
233
246
}
234
247
}
@@ -280,18 +293,19 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
280
293
// Otherwise if cross-compiling for a different OS/SDK, remove any part
281
294
// of the linking environment that's wrong and reversed.
282
295
match arch {
283
- Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim | X86_64h
284
- | Arm64_sim => {
296
+ Armv7k | Armv7s | Arm64 | Arm64e | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim
297
+ | X86_64h | Arm64_sim => {
285
298
cvs ! [ "MACOSX_DEPLOYMENT_TARGET" ]
286
299
}
287
300
X86_64_macabi | Arm64_macabi => cvs ! [ "IPHONEOS_DEPLOYMENT_TARGET" ] ,
288
301
}
289
302
}
290
303
}
291
304
292
- fn ios_deployment_target ( ) -> ( u32 , u32 ) {
305
+ fn ios_deployment_target ( arch : Arch ) -> ( u32 , u32 ) {
293
306
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
294
- from_set_deployment_target ( "IPHONEOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( 10 , 0 ) )
307
+ let ( major, minor) = if arch == Arm64e { ( 14 , 0 ) } else { ( 10 , 0 ) } ;
308
+ from_set_deployment_target ( "IPHONEOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( major, minor) )
295
309
}
296
310
297
311
fn mac_catalyst_deployment_target ( ) -> ( u32 , u32 ) {
@@ -306,17 +320,17 @@ pub fn ios_llvm_target(arch: Arch) -> String {
306
320
// set high enough. Luckily one LC_BUILD_VERSION is enough, for Xcode
307
321
// to pick it up (since std and core are still built with the fallback
308
322
// of version 7.0 and hence emit the old LC_IPHONE_MIN_VERSION).
309
- let ( major, minor) = ios_deployment_target ( ) ;
323
+ let ( major, minor) = ios_deployment_target ( arch ) ;
310
324
format ! ( "{}-apple-ios{}.{}.0" , arch. target_name( ) , major, minor)
311
325
}
312
326
313
- fn ios_lld_platform_version ( ) -> String {
314
- let ( major, minor) = ios_deployment_target ( ) ;
327
+ fn ios_lld_platform_version ( arch : Arch ) -> String {
328
+ let ( major, minor) = ios_deployment_target ( arch ) ;
315
329
format ! ( "{major}.{minor}" )
316
330
}
317
331
318
332
pub fn ios_sim_llvm_target ( arch : Arch ) -> String {
319
- let ( major, minor) = ios_deployment_target ( ) ;
333
+ let ( major, minor) = ios_deployment_target ( arch ) ;
320
334
format ! ( "{}-apple-ios{}.{}.0-simulator" , arch. target_name( ) , major, minor)
321
335
}
322
336
0 commit comments