@@ -2602,7 +2602,7 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
26022602 let os = & sess. target . os ;
26032603 let llvm_target = & sess. target . llvm_target ;
26042604 if sess. target . vendor != "apple"
2605- || !matches ! ( os. as_ref( ) , "ios" | "tvos" )
2605+ || !matches ! ( os. as_ref( ) , "ios" | "tvos" | "watchos" )
26062606 || flavor != LinkerFlavor :: Gcc
26072607 {
26082608 return ;
@@ -2612,11 +2612,16 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
26122612 ( "x86_64" , "tvos" ) => "appletvsimulator" ,
26132613 ( "arm" , "ios" ) => "iphoneos" ,
26142614 ( "aarch64" , "ios" ) if llvm_target. contains ( "macabi" ) => "macosx" ,
2615- ( "aarch64" , "ios" ) if llvm_target. contains ( "sim ") => "iphonesimulator" ,
2615+ ( "aarch64" , "ios" ) if llvm_target. ends_with ( "-simulator ") => "iphonesimulator" ,
26162616 ( "aarch64" , "ios" ) => "iphoneos" ,
26172617 ( "x86" , "ios" ) => "iphonesimulator" ,
26182618 ( "x86_64" , "ios" ) if llvm_target. contains ( "macabi" ) => "macosx" ,
26192619 ( "x86_64" , "ios" ) => "iphonesimulator" ,
2620+ ( "x86_64" , "watchos" ) => "watchsimulator" ,
2621+ ( "arm64_32" , "watchos" ) => "watchos" ,
2622+ ( "aarch64" , "watchos" ) if llvm_target. ends_with ( "-simulator" ) => "watchsimulator" ,
2623+ ( "aarch64" , "watchos" ) => "watchos" ,
2624+ ( "arm" , "watchos" ) => "watchos" ,
26202625 _ => {
26212626 sess. err ( & format ! ( "unsupported arch `{}` for os `{}`" , arch, os) ) ;
26222627 return ;
@@ -2663,6 +2668,11 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, String> {
26632668 "macosx10.15"
26642669 if sdkroot. contains ( "iPhoneOS.platform" )
26652670 || sdkroot. contains ( "iPhoneSimulator.platform" ) => { }
2671+ "watchos"
2672+ if sdkroot. contains ( "WatchSimulator.platform" )
2673+ || sdkroot. contains ( "MacOSX.platform" ) => { }
2674+ "watchsimulator"
2675+ if sdkroot. contains ( "WatchOS.platform" ) || sdkroot. contains ( "MacOSX.platform" ) => { }
26662676 // Ignore `SDKROOT` if it's not a valid path.
26672677 _ if !p. is_absolute ( ) || p == Path :: new ( "/" ) || !p. exists ( ) => { }
26682678 _ => return Ok ( sdkroot) ,
0 commit comments