@@ -3201,9 +3201,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
32013201}
32023202
32033203fn add_apple_sdk ( cmd : & mut dyn Linker , sess : & Session , flavor : LinkerFlavor ) -> Option < PathBuf > {
3204- let arch = & sess. target . arch ;
32053204 let os = & sess. target . os ;
3206- let llvm_target = & sess. target . llvm_target ;
32073205 if sess. target . vendor != "apple"
32083206 || !matches ! ( os. as_ref( ) , "ios" | "tvos" | "watchos" | "visionos" | "macos" )
32093207 || !matches ! ( flavor, LinkerFlavor :: Darwin ( ..) )
@@ -3215,31 +3213,9 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) ->
32153213 return None ;
32163214 }
32173215
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) {
32433219 Ok ( s) => s,
32443220 Err ( e) => {
32453221 sess. dcx ( ) . emit_err ( e) ;
0 commit comments