+
+ // <rdar://problem/25680358> verify dylibs use same version of Swift language
+ if ( file.swiftVersion() != 0 ) {
+ if ( _internal.swiftVersion == 0 ) {
+ _internal.swiftVersion = file.swiftVersion();
+ }
+ else if ( file.swiftVersion() != _internal.swiftVersion ) {
+ char fileVersion[64];
+ char otherVersion[64];
+ Options::userReadableSwiftVersion(file.swiftVersion(), fileVersion);
+ Options::userReadableSwiftVersion(_internal.swiftVersion, otherVersion);
+ if ( file.swiftVersion() > _internal.swiftVersion ) {
+ if ( _options.warnOnSwiftABIVersionMismatches() ) {
+ warning("%s compiled with newer version of Swift language (%s) than previous files (%s)",
+ file.path(), fileVersion, otherVersion);
+ } else {
+ throwf("%s compiled with newer version of Swift language (%s) than previous files (%s)",
+ file.path(), fileVersion, otherVersion);
+ }
+ }
+ else {
+ if ( _options.warnOnSwiftABIVersionMismatches() ) {
+ warning("%s compiled with older version of Swift language (%s) than previous files (%s)",
+ file.path(), fileVersion, otherVersion);
+ } else {
+ throwf("%s compiled with older version of Swift language (%s) than previous files (%s)",
+ file.path(), fileVersion, otherVersion);
+ }
+ }
+ }
+ }
+
+ if ( _options.checkDylibsAreAppExtensionSafe() && !dylibFile->appExtensionSafe() ) {
+ warning("linking against a dylib which is not safe for use in application extensions: %s", file.path());
+ }
+ const char* depInstallName = dylibFile->installPath();
+ // <rdar://problem/17229513> embedded frameworks are only supported on iOS 8 and later
+ if ( (depInstallName != NULL) && (depInstallName[0] != '/') ) {
+ if ( (_options.iOSVersionMin() != iOSVersionUnset) && (_options.iOSVersionMin() < iOS_8_0) ) {
+ // <rdar://problem/17598404> only warn about linking against embedded dylib if it is built for iOS 8 or later
+ if ( dylibFile->minOSVersion() >= iOS_8_0 )
+ throwf("embedded dylibs/frameworks are only supported on iOS 8.0 and later (%s)", depInstallName);
+ }
+ }
+ if ( _options.sharedRegionEligible() ) {
+ assert(depInstallName != NULL);
+ if ( depInstallName[0] == '@' ) {
+ warning("invalid -install_name (%s) in dependent dylib (%s). Dylibs/frameworks which might go in dyld shared cache "
+ "cannot link with dylib that uses @rpath, @loader_path, etc.", depInstallName, dylibFile->path());
+ } else if ( (strncmp(depInstallName, "/usr/lib/", 9) != 0) && (strncmp(depInstallName, "/System/Library/", 16) != 0) ) {
+ warning("invalid -install_name (%s) in dependent dylib (%s). Dylibs/frameworks which might go in dyld shared cache "
+ "cannot link with dylibs that won't be in the shared cache", depInstallName, dylibFile->path());
+ }
+ }