@@ -98,12 +98,11 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
98
98
} ;
99
99
100
100
let min_version: StaticCow < str > = {
101
- let ( major, minor) = match ( os, abi) {
102
- ( "ios" , "macabi" ) => mac_catalyst_deployment_target ( ) ,
103
- ( "ios" , _) => ios_deployment_target ( arch) ,
104
- ( "tvos" , _) => tvos_deployment_target ( ) ,
105
- ( "watchos" , _) => watchos_deployment_target ( ) ,
106
- ( "macos" , _) => macos_deployment_target ( arch) ,
101
+ let ( major, minor) = match os {
102
+ "ios" => ios_deployment_target ( arch, abi) ,
103
+ "tvos" => tvos_deployment_target ( ) ,
104
+ "watchos" => watchos_deployment_target ( ) ,
105
+ "macos" => macos_deployment_target ( arch) ,
107
106
_ => unreachable ! ( ) ,
108
107
} ;
109
108
format ! ( "{major}.{minor}" ) . into ( )
@@ -232,16 +231,13 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
232
231
} ;
233
232
macos_deployment_target ( arch)
234
233
}
235
- "ios" => match & * target. abi {
236
- "macabi" => mac_catalyst_deployment_target ( ) ,
237
- _ => {
238
- let arch = match target. arch . as_ref ( ) {
239
- "arm64e" => Arm64e ,
240
- _ => Arm64 ,
241
- } ;
242
- ios_deployment_target ( arch)
243
- }
244
- } ,
234
+ "ios" => {
235
+ let arch = match target. arch . as_ref ( ) {
236
+ "arm64e" => Arm64e ,
237
+ _ => Arm64 ,
238
+ } ;
239
+ ios_deployment_target ( arch, & target. abi )
240
+ }
245
241
"watchos" => watchos_deployment_target ( ) ,
246
242
"tvos" => tvos_deployment_target ( ) ,
247
243
_ => return None ,
@@ -311,35 +307,34 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
311
307
}
312
308
}
313
309
314
- fn ios_deployment_target ( arch : Arch ) -> ( u32 , u32 ) {
310
+ fn ios_deployment_target ( arch : Arch , abi : & str ) -> ( u32 , u32 ) {
315
311
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
316
- let ( major, minor) = if arch == Arm64e { ( 14 , 0 ) } else { ( 10 , 0 ) } ;
312
+ let ( major, minor) = match ( arch, abi) {
313
+ ( Arm64e , _) => ( 14 , 0 ) ,
314
+ ( _, "macabi" ) => ( 14 , 0 ) ,
315
+ _ => ( 10 , 0 ) ,
316
+ } ;
317
317
from_set_deployment_target ( "IPHONEOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( major, minor) )
318
318
}
319
319
320
- fn mac_catalyst_deployment_target ( ) -> ( u32 , u32 ) {
321
- // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
322
- from_set_deployment_target ( "IPHONEOS_DEPLOYMENT_TARGET" ) . unwrap_or ( ( 14 , 0 ) )
323
- }
324
-
325
320
pub fn ios_llvm_target ( arch : Arch ) -> String {
326
321
// Modern iOS tooling extracts information about deployment target
327
322
// from LC_BUILD_VERSION. This load command will only be emitted when
328
323
// we build with a version specific `llvm_target`, with the version
329
324
// set high enough. Luckily one LC_BUILD_VERSION is enough, for Xcode
330
325
// to pick it up (since std and core are still built with the fallback
331
326
// of version 7.0 and hence emit the old LC_IPHONE_MIN_VERSION).
332
- let ( major, minor) = ios_deployment_target ( arch) ;
327
+ let ( major, minor) = ios_deployment_target ( arch, "" ) ;
333
328
format ! ( "{}-apple-ios{}.{}.0" , arch. target_name( ) , major, minor)
334
329
}
335
330
336
331
pub fn mac_catalyst_llvm_target ( arch : Arch ) -> String {
337
- let ( major, minor) = mac_catalyst_deployment_target ( ) ;
332
+ let ( major, minor) = ios_deployment_target ( arch , "macabi" ) ;
338
333
format ! ( "{}-apple-ios{}.{}.0-macabi" , arch. target_name( ) , major, minor)
339
334
}
340
335
341
336
pub fn ios_sim_llvm_target ( arch : Arch ) -> String {
342
- let ( major, minor) = ios_deployment_target ( arch) ;
337
+ let ( major, minor) = ios_deployment_target ( arch, "sim" ) ;
343
338
format ! ( "{}-apple-ios{}.{}.0-simulator" , arch. target_name( ) , major, minor)
344
339
}
345
340
0 commit comments