@@ -3200,9 +3200,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
32003200}
32013201
32023202fn add_apple_sdk ( cmd : & mut dyn Linker , sess : & Session , flavor : LinkerFlavor ) -> Option < PathBuf > {
3203- let arch = & sess. target . arch ;
32043203 let os = & sess. target . os ;
3205- let llvm_target = & sess. target . llvm_target ;
32063204 if sess. target . vendor != "apple"
32073205 || !matches ! ( os. as_ref( ) , "ios" | "tvos" | "watchos" | "visionos" | "macos" )
32083206 || !matches ! ( flavor, LinkerFlavor :: Darwin ( ..) )
@@ -3214,30 +3212,8 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) ->
32143212 return None ;
32153213 }
32163214
3217- let sdk_name = match ( arch. as_ref ( ) , os. as_ref ( ) ) {
3218- ( "aarch64" , "tvos" ) if llvm_target. ends_with ( "-simulator" ) => "appletvsimulator" ,
3219- ( "aarch64" , "tvos" ) => "appletvos" ,
3220- ( "x86_64" , "tvos" ) => "appletvsimulator" ,
3221- ( "arm" , "ios" ) => "iphoneos" ,
3222- ( "aarch64" , "ios" ) if llvm_target. contains ( "macabi" ) => "macosx" ,
3223- ( "aarch64" , "ios" ) if llvm_target. ends_with ( "-simulator" ) => "iphonesimulator" ,
3224- ( "aarch64" , "ios" ) => "iphoneos" ,
3225- ( "x86" , "ios" ) => "iphonesimulator" ,
3226- ( "x86_64" , "ios" ) if llvm_target. contains ( "macabi" ) => "macosx" ,
3227- ( "x86_64" , "ios" ) => "iphonesimulator" ,
3228- ( "x86_64" , "watchos" ) => "watchsimulator" ,
3229- ( "arm64_32" , "watchos" ) => "watchos" ,
3230- ( "aarch64" , "watchos" ) if llvm_target. ends_with ( "-simulator" ) => "watchsimulator" ,
3231- ( "aarch64" , "watchos" ) => "watchos" ,
3232- ( "aarch64" , "visionos" ) if llvm_target. ends_with ( "-simulator" ) => "xrsimulator" ,
3233- ( "aarch64" , "visionos" ) => "xros" ,
3234- ( "arm" , "watchos" ) => "watchos" ,
3235- ( _, "macos" ) => "macosx" ,
3236- _ => {
3237- sess. dcx ( ) . emit_err ( errors:: UnsupportedArch { arch, os } ) ;
3238- return None ;
3239- }
3240- } ;
3215+ let sdk_name = apple:: sdk_name ( & sess. target ) ;
3216+
32413217 let sdk_root = match get_apple_sdk_root ( sdk_name) {
32423218 Ok ( s) => s,
32433219 Err ( e) => {
0 commit comments