|
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" |
52 | 53 | #include "llvm/TextAPI/PackedVersion.h" |
53 | 54 |
|
54 | 55 | #include <algorithm> |
@@ -1080,42 +1081,55 @@ static bool shouldEmitChainedFixups(const InputArgList &args) { |
1080 | 1081 | if (arg && arg->getOption().matches(OPT_no_fixup_chains)) |
1081 | 1082 | return false; |
1082 | 1083 |
|
1083 | | - bool isRequested = arg != nullptr; |
1084 | | - |
1085 | | - // Version numbers taken from the Xcode 13.3 release notes. |
1086 | | - static const std::array<std::pair<PlatformType, VersionTuple>, 5> minVersion = |
1087 | | - {{{PLATFORM_MACOS, VersionTuple(11, 0)}, |
1088 | | - {PLATFORM_IOS, VersionTuple(13, 4)}, |
1089 | | - {PLATFORM_TVOS, VersionTuple(14, 0)}, |
1090 | | - {PLATFORM_WATCHOS, VersionTuple(7, 0)}, |
1091 | | - {PLATFORM_XROS, VersionTuple(1, 0)}}}; |
1092 | | - PlatformType platform = removeSimulator(config->platformInfo.target.Platform); |
1093 | | - auto it = llvm::find_if(minVersion, |
1094 | | - [&](const auto &p) { return p.first == platform; }); |
1095 | | - if (it != minVersion.end() && |
1096 | | - it->second > config->platformInfo.target.MinDeployment) { |
1097 | | - if (!isRequested) |
1098 | | - return false; |
| 1084 | + bool requested = arg && arg->getOption().matches(OPT_fixup_chains); |
| 1085 | + if (!config->isPic) { |
| 1086 | + if (requested) |
| 1087 | + error("-fixup_chains is incompatible with -no_pie"); |
1099 | 1088 |
|
1100 | | - warn("-fixup_chains requires " + getPlatformName(config->platform()) + " " + |
1101 | | - it->second.getAsString() + ", which is newer than target minimum of " + |
1102 | | - config->platformInfo.target.MinDeployment.getAsString()); |
| 1089 | + return false; |
1103 | 1090 | } |
1104 | 1091 |
|
1105 | 1092 | if (!is_contained({AK_x86_64, AK_x86_64h, AK_arm64}, config->arch())) { |
1106 | | - if (isRequested) |
| 1093 | + if (requested) |
1107 | 1094 | error("-fixup_chains is only supported on x86_64 and arm64 targets"); |
| 1095 | + |
1108 | 1096 | return false; |
1109 | 1097 | } |
1110 | 1098 |
|
1111 | | - if (!config->isPic) { |
1112 | | - if (isRequested) |
1113 | | - error("-fixup_chains is incompatible with -no_pie"); |
| 1099 | + if (args.hasArg(OPT_preload)) { |
| 1100 | + if (requested) |
| 1101 | + error("-fixup_chains is incompatible with -preload"); |
| 1102 | + |
1114 | 1103 | return false; |
1115 | 1104 | } |
1116 | 1105 |
|
1117 | | - // TODO: Enable by default once stable. |
1118 | | - return isRequested; |
| 1106 | + if (requested) |
| 1107 | + return true; |
| 1108 | + |
| 1109 | + static const std::array<std::pair<PlatformType, VersionTuple>, 9> minVersion = |
| 1110 | + {{ |
| 1111 | + {PLATFORM_IOS, VersionTuple(13, 4)}, |
| 1112 | + {PLATFORM_IOSSIMULATOR, VersionTuple(16, 0)}, |
| 1113 | + {PLATFORM_MACOS, VersionTuple(13, 0)}, |
| 1114 | + {PLATFORM_TVOS, VersionTuple(14, 0)}, |
| 1115 | + {PLATFORM_TVOSSIMULATOR, VersionTuple(15, 0)}, |
| 1116 | + {PLATFORM_WATCHOS, VersionTuple(7, 0)}, |
| 1117 | + {PLATFORM_WATCHOSSIMULATOR, VersionTuple(8, 0)}, |
| 1118 | + {PLATFORM_XROS, VersionTuple(1, 0)}, |
| 1119 | + {PLATFORM_XROS_SIMULATOR, VersionTuple(1, 0)}, |
| 1120 | + }}; |
| 1121 | + PlatformType platform = config->platformInfo.target.Platform; |
| 1122 | + auto it = llvm::find_if(minVersion, |
| 1123 | + [&](const auto &p) { return p.first == platform; }); |
| 1124 | + |
| 1125 | + // We don't know the versions for other platforms, so default to disabled. |
| 1126 | + if (it == minVersion.end()) |
| 1127 | + return false; |
| 1128 | + |
| 1129 | + if (it->second > config->platformInfo.target.MinDeployment) |
| 1130 | + return false; |
| 1131 | + |
| 1132 | + return true; |
1119 | 1133 | } |
1120 | 1134 |
|
1121 | 1135 | static bool shouldEmitRelativeMethodLists(const InputArgList &args) { |
|
0 commit comments