+ throwf("malformed dylb, load command #%d is outside size of load commands in %s", i, path);
+ }
+ // arm/arm64 objects are default to ios platform if not set.
+ // rdar://problem/21746314
+ if (lcPlatform == Options::kPlatformUnknown &&
+ (std::is_same<A, arm>::value || std::is_same<A, arm64>::value))
+ lcPlatform = Options::kPlatformiOS;
+
+ // check cross-linking
+ if ( lcPlatform != platform ) {
+ this->_wrongOS = true;
+ if ( this->_addVersionLoadCommand && !indirectDylib && !ignoreMismatchPlatform ) {
+ if ( buildingForSimulator ) {
+ if ( !this->_allowSimToMacOSXLinking ) {
+ switch (platform) {
+ case Options::kPlatformOSX:
+ 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::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;
+ }
+ }
+ }