- if ( lcPlatform != platform ) {
- this->_wrongOS = true;
- if ( this->_addVersionLoadCommand && !indirectDylib && !ignoreMismatchPlatform ) {
- if ( buildingForSimulator ) {
- if ( !this->_allowSimToMacOSXLinking ) {
- switch (platform) {
- case Options::kPlatformOSX:
- case Options::kPlatform_bridgeOS:
- case Options::kPlatformiOS:
- if ( lcPlatform == Options::kPlatformUnknown )
- break;
- // fall through if the Platform is not Unknown
- case Options::kPlatformWatchOS:
- // WatchOS errors on cross-linking when building for bitcode
- if ( usingBitcode )
- throwf("building for %s simulator, but linking against dylib built for %s,",
- Options::platformName(platform),
- Options::platformName(lcPlatform));
- else
- warning("URGENT: building for %s simulator, but linking against dylib (%s) built for %s. "
- "Note: This will be an error in the future.",
- Options::platformName(platform), path,
- Options::platformName(lcPlatform));
- break;
- #if SUPPORT_APPLE_TV
- case Options::kPlatform_tvOS:
- // tvOS is a warning temporarily. rdar://problem/21746965
- if ( usingBitcode )
- throwf("building for %s simulator, but linking against dylib built for %s,",
- Options::platformName(platform),
- Options::platformName(lcPlatform));
- else
- warning("URGENT: building for %s simulator, but linking against dylib (%s) built for %s. "
- "Note: This will be an error in the future.",
- Options::platformName(platform), path,
- Options::platformName(lcPlatform));
- break;
- #endif
- case Options::kPlatformUnknown:
- // skip if the target platform is unknown
- break;
- }
- }
- }
- else {
- switch (platform) {
- case Options::kPlatformOSX:
- case Options::kPlatform_bridgeOS:
- case Options::kPlatformiOS:
- if ( lcPlatform == Options::kPlatformUnknown )
- break;
- // fall through if the Platform is not Unknown
- case Options::kPlatformWatchOS:
- // WatchOS errors on cross-linking when building for bitcode
- if ( usingBitcode )
- throwf("building for %s, but linking against dylib built for %s,",
- Options::platformName(platform),
- Options::platformName(lcPlatform));
- else
- warning("URGENT: building for %s, but linking against dylib (%s) built for %s. "
- "Note: This will be an error in the future.",
- Options::platformName(platform), path,
- Options::platformName(lcPlatform));
- break;
- #if SUPPORT_APPLE_TV
- case Options::kPlatform_tvOS:
- // tvOS is a warning temporarily. rdar://problem/21746965
- if ( usingBitcode )
- throwf("building for %s, but linking against dylib built for %s,",
- Options::platformName(platform),
- Options::platformName(lcPlatform));
- else
- warning("URGENT: building for %s, but linking against dylib (%s) built for %s. "
- "Note: This will be an error in the future.",
- Options::platformName(platform), path,
- Options::platformName(lcPlatform));
- break;
- #endif
- case Options::kPlatformUnknown:
- // skip if the target platform is unknown
- break;
+ platforms.forEach(^(ld::Platform platform, uint32_t version, bool &stop) {
+ if (!lcPlatforms.contains(platform) ) {
+ this->_wrongOS = true;
+ if ( this->_addVersionLoadCommand && !indirectDylib && !ignoreMismatchPlatform ) {
+ if (buildingForSimulator && !this->_allowSimToMacOSXLinking) {
+ if ( usingBitcode )
+ throwf("building for %s simulator, but linking against dylib built for %s,",
+ platforms.to_str().c_str(), lcPlatforms.to_str().c_str());
+ else
+ warning("URGENT: building for %s simulator, but linking against dylib (%s) built for %s. "
+ "Note: This will be an error in the future.",
+ platforms.to_str().c_str(), path, lcPlatforms.to_str().c_str());