|
49 | 49 | #include "llvm/Support/TargetSelect.h" |
50 | 50 | #include "llvm/Support/TimeProfiler.h" |
51 | 51 | #include "llvm/TargetParser/Host.h" |
52 | | -#include "llvm/TextAPI/Architecture.h" |
53 | 52 | #include "llvm/TextAPI/PackedVersion.h" |
54 | 53 |
|
55 | 54 | #include <algorithm> |
@@ -1043,53 +1042,41 @@ static bool shouldEmitChainedFixups(const InputArgList &args) { |
1043 | 1042 | if (arg && arg->getOption().matches(OPT_no_fixup_chains)) |
1044 | 1043 | return false; |
1045 | 1044 |
|
1046 | | - bool requested = arg && arg->getOption().matches(OPT_fixup_chains); |
1047 | | - if (!config->isPic) { |
1048 | | - if (requested) |
1049 | | - error("-fixup_chains is incompatible with -no_pie"); |
| 1045 | + bool isRequested = arg != nullptr; |
1050 | 1046 |
|
1051 | | - return false; |
| 1047 | + // Version numbers taken from the Xcode 13.3 release notes. |
| 1048 | + static const std::array<std::pair<PlatformType, VersionTuple>, 4> minVersion = |
| 1049 | + {{{PLATFORM_MACOS, VersionTuple(11, 0)}, |
| 1050 | + {PLATFORM_IOS, VersionTuple(13, 4)}, |
| 1051 | + {PLATFORM_TVOS, VersionTuple(14, 0)}, |
| 1052 | + {PLATFORM_WATCHOS, VersionTuple(7, 0)}}}; |
| 1053 | + PlatformType platform = removeSimulator(config->platformInfo.target.Platform); |
| 1054 | + auto it = llvm::find_if(minVersion, |
| 1055 | + [&](const auto &p) { return p.first == platform; }); |
| 1056 | + if (it != minVersion.end() && |
| 1057 | + it->second > config->platformInfo.target.MinDeployment) { |
| 1058 | + if (!isRequested) |
| 1059 | + return false; |
| 1060 | + |
| 1061 | + warn("-fixup_chains requires " + getPlatformName(config->platform()) + " " + |
| 1062 | + it->second.getAsString() + ", which is newer than target minimum of " + |
| 1063 | + config->platformInfo.target.MinDeployment.getAsString()); |
1052 | 1064 | } |
1053 | 1065 |
|
1054 | 1066 | if (!is_contained({AK_x86_64, AK_x86_64h, AK_arm64}, config->arch())) { |
1055 | | - if (requested) |
| 1067 | + if (isRequested) |
1056 | 1068 | error("-fixup_chains is only supported on x86_64 and arm64 targets"); |
1057 | | - |
1058 | 1069 | return false; |
1059 | 1070 | } |
1060 | 1071 |
|
1061 | | - if (args.hasArg(OPT_preload)) { |
1062 | | - if (requested) |
1063 | | - error("-fixup_chains is incompatible with -preload"); |
1064 | | - |
| 1072 | + if (!config->isPic) { |
| 1073 | + if (isRequested) |
| 1074 | + error("-fixup_chains is incompatible with -no_pie"); |
1065 | 1075 | return false; |
1066 | 1076 | } |
1067 | 1077 |
|
1068 | | - if (requested) |
1069 | | - return true; |
1070 | | - |
1071 | | - static const std::array<std::pair<PlatformType, VersionTuple>, 7> minVersion = |
1072 | | - {{ |
1073 | | - {PLATFORM_IOS, VersionTuple(13, 4)}, |
1074 | | - {PLATFORM_IOSSIMULATOR, VersionTuple(16, 0)}, |
1075 | | - {PLATFORM_MACOS, VersionTuple(13, 0)}, |
1076 | | - {PLATFORM_TVOS, VersionTuple(14, 0)}, |
1077 | | - {PLATFORM_TVOSSIMULATOR, VersionTuple(15, 0)}, |
1078 | | - {PLATFORM_WATCHOS, VersionTuple(7, 0)}, |
1079 | | - {PLATFORM_WATCHOSSIMULATOR, VersionTuple(8, 0)}, |
1080 | | - }}; |
1081 | | - PlatformType platform = config->platformInfo.target.Platform; |
1082 | | - auto it = llvm::find_if(minVersion, |
1083 | | - [&](const auto &p) { return p.first == platform; }); |
1084 | | - |
1085 | | - // We don't know the versions for other platforms, so default to disabled. |
1086 | | - if (it == minVersion.end()) |
1087 | | - return false; |
1088 | | - |
1089 | | - if (it->second > config->platformInfo.target.MinDeployment) |
1090 | | - return false; |
1091 | | - |
1092 | | - return true; |
| 1078 | + // TODO: Enable by default once stable. |
| 1079 | + return isRequested; |
1093 | 1080 | } |
1094 | 1081 |
|
1095 | 1082 | void SymbolPatterns::clear() { |
|
0 commit comments