@@ -3201,9 +3201,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
3201
3201
}
3202
3202
3203
3203
fn add_apple_sdk ( cmd : & mut dyn Linker , sess : & Session , flavor : LinkerFlavor ) -> Option < PathBuf > {
3204
- let arch = & sess. target . arch ;
3205
3204
let os = & sess. target . os ;
3206
- let llvm_target = & sess. target . llvm_target ;
3207
3205
if sess. target . vendor != "apple"
3208
3206
|| !matches ! ( os. as_ref( ) , "ios" | "tvos" | "watchos" | "visionos" | "macos" )
3209
3207
|| !matches ! ( flavor, LinkerFlavor :: Darwin ( ..) )
@@ -3215,31 +3213,9 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) ->
3215
3213
return None ;
3216
3214
}
3217
3215
3218
- let sdk_name = match ( arch. as_ref ( ) , os. as_ref ( ) ) {
3219
- ( "aarch64" , "tvos" ) if llvm_target. ends_with ( "-simulator" ) => "appletvsimulator" ,
3220
- ( "aarch64" , "tvos" ) => "appletvos" ,
3221
- ( "x86_64" , "tvos" ) => "appletvsimulator" ,
3222
- ( "arm" , "ios" ) => "iphoneos" ,
3223
- ( "aarch64" , "ios" ) if llvm_target. contains ( "macabi" ) => "macosx" ,
3224
- ( "aarch64" , "ios" ) if llvm_target. ends_with ( "-simulator" ) => "iphonesimulator" ,
3225
- ( "aarch64" , "ios" ) => "iphoneos" ,
3226
- ( "x86" , "ios" ) => "iphonesimulator" ,
3227
- ( "x86_64" , "ios" ) if llvm_target. contains ( "macabi" ) => "macosx" ,
3228
- ( "x86_64" , "ios" ) => "iphonesimulator" ,
3229
- ( "x86_64" , "watchos" ) => "watchsimulator" ,
3230
- ( "arm64_32" , "watchos" ) => "watchos" ,
3231
- ( "aarch64" , "watchos" ) if llvm_target. ends_with ( "-simulator" ) => "watchsimulator" ,
3232
- ( "aarch64" , "watchos" ) => "watchos" ,
3233
- ( "aarch64" , "visionos" ) if llvm_target. ends_with ( "-simulator" ) => "xrsimulator" ,
3234
- ( "aarch64" , "visionos" ) => "xros" ,
3235
- ( "arm" , "watchos" ) => "watchos" ,
3236
- ( _, "macos" ) => "macosx" ,
3237
- _ => {
3238
- sess. dcx ( ) . emit_err ( errors:: UnsupportedArch { arch, os } ) ;
3239
- return None ;
3240
- }
3241
- } ;
3242
- let sdk_root = match get_apple_sdk_root ( sdk_name) {
3216
+ let sdk_name = apple:: sdk_name ( & sess. target ) . to_lowercase ( ) ;
3217
+
3218
+ let sdk_root = match get_apple_sdk_root ( & sdk_name) {
3243
3219
Ok ( s) => s,
3244
3220
Err ( e) => {
3245
3221
sess. dcx ( ) . emit_err ( e) ;
0 commit comments