@@ -9,11 +9,12 @@ mod tests;
99
1010use Arch :: * ;
1111#[ allow( non_camel_case_types) ]
12- #[ derive( Copy , Clone ) ]
12+ #[ derive( Copy , Clone , PartialEq ) ]
1313pub enum Arch {
1414 Armv7k ,
1515 Armv7s ,
1616 Arm64 ,
17+ Arm64e ,
1718 Arm64_32 ,
1819 I386 ,
1920 I686 ,
@@ -31,6 +32,7 @@ impl Arch {
3132 Armv7k => "armv7k" ,
3233 Armv7s => "armv7s" ,
3334 Arm64 | Arm64_macabi | Arm64_sim => "arm64" ,
35+ Arm64e => "arm64e" ,
3436 Arm64_32 => "arm64_32" ,
3537 I386 => "i386" ,
3638 I686 => "i686" ,
@@ -42,15 +44,15 @@ impl Arch {
4244 pub fn target_arch ( self ) -> Cow < ' static , str > {
4345 Cow :: Borrowed ( match self {
4446 Armv7k | Armv7s => "arm" ,
45- Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64" ,
47+ Arm64 | Arm64e | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64" ,
4648 I386 | I686 => "x86" ,
4749 X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64" ,
4850 } )
4951 }
5052
5153 fn target_abi ( self ) -> & ' static str {
5254 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 => "" ,
5456 X86_64_macabi | Arm64_macabi => "macabi" ,
5557 // x86_64-apple-ios is a simulator target, even though it isn't
5658 // declared that way in the target like the other ones...
@@ -63,6 +65,7 @@ impl Arch {
6365 Armv7k => "cortex-a8" ,
6466 Armv7s => "swift" , // iOS 10 is only supported on iPhone 5 or higher.
6567 Arm64 => "apple-a7" ,
68+ Arm64e => "apple-a12" ,
6669 Arm64_32 => "apple-s4" ,
6770 // Only macOS 10.12+ is supported, which means
6871 // 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 {
8891 } ;
8992
9093 let platform_version: StaticCow < str > = match os {
91- "ios" => ios_lld_platform_version ( ) ,
94+ "ios" => ios_lld_platform_version ( arch ) ,
9295 "tvos" => tvos_lld_platform_version ( ) ,
9396 "watchos" => watchos_lld_platform_version ( ) ,
9497 "macos" => macos_lld_platform_version ( arch) ,
@@ -202,12 +205,22 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
202205 let ( major, minor) = match & * target. os {
203206 "macos" => {
204207 // 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+ } ;
206213 macos_deployment_target ( arch)
207214 }
208215 "ios" => match & * target. abi {
209216 "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+ }
211224 } ,
212225 "watchos" => watchos_deployment_target ( ) ,
213226 "tvos" => tvos_deployment_target ( ) ,
@@ -228,7 +241,7 @@ fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> {
228241fn macos_default_deployment_target ( arch : Arch ) -> ( u32 , u32 ) {
229242 match arch {
230243 // Note: Arm64_sim is not included since macOS has no simulator.
231- Arm64 | Arm64_macabi => ( 11 , 0 ) ,
244+ Arm64 | Arm64e | Arm64_macabi => ( 11 , 0 ) ,
232245 _ => ( 10 , 12 ) ,
233246 }
234247}
@@ -280,18 +293,19 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
280293 // Otherwise if cross-compiling for a different OS/SDK, remove any part
281294 // of the linking environment that's wrong and reversed.
282295 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 => {
285298 cvs ! [ "MACOSX_DEPLOYMENT_TARGET" ]
286299 }
287300 X86_64_macabi | Arm64_macabi => cvs ! [ "IPHONEOS_DEPLOYMENT_TARGET" ] ,
288301 }
289302 }
290303}
291304
292- fn ios_deployment_target ( ) -> ( u32 , u32 ) {
305+ fn ios_deployment_target ( arch : Arch ) -> ( u32 , u32 ) {
293306 // 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) )
295309}
296310
297311fn mac_catalyst_deployment_target ( ) -> ( u32 , u32 ) {
@@ -306,17 +320,17 @@ pub fn ios_llvm_target(arch: Arch) -> String {
306320 // set high enough. Luckily one LC_BUILD_VERSION is enough, for Xcode
307321 // to pick it up (since std and core are still built with the fallback
308322 // 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 ) ;
310324 format ! ( "{}-apple-ios{}.{}.0" , arch. target_name( ) , major, minor)
311325}
312326
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 ) ;
315329 format ! ( "{major}.{minor}" )
316330}
317331
318332pub fn ios_sim_llvm_target ( arch : Arch ) -> String {
319- let ( major, minor) = ios_deployment_target ( ) ;
333+ let ( major, minor) = ios_deployment_target ( arch ) ;
320334 format ! ( "{}-apple-ios{}.{}.0-simulator" , arch. target_name( ) , major, minor)
321335}
322336
0 commit comments