1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[darwin][driver] isMacosxVersionLT should check against the minimum supported OS version

This change ensures that the Darwin driver doesn't add unsupported libraries to the link
invocation when linking the Apple Silicon macOS slice.

rdar://61011136

Differential Revision: https://reviews.llvm.org/D82696
This commit is contained in:
Alex Lorenz 2020-06-29 10:23:16 -07:00
parent 8b5c0cc776
commit 7a66c0870c
2 changed files with 17 additions and 0 deletions

View File

@ -860,6 +860,12 @@ public:
/// Merge target triples.
std::string merge(const Triple &Other) const;
/// Some platforms have different minimum supported OS versions that
/// varies by the architecture specified in the triple. This function
/// returns the minimum supported OS version for this triple if one an exists,
/// or an invalid version tuple if this triple doesn't have one.
VersionTuple getMinimumSupportedOSVersion() const;
/// @}
/// @name Static helpers for IDs.
/// @{

View File

@ -1624,6 +1624,17 @@ bool Triple::isMacOSXVersionLT(unsigned Major, unsigned Minor,
}
}
VersionTuple Triple::getMinimumSupportedOSVersion() const {
if (getVendor() != Triple::Apple || getArch() != Triple::aarch64)
return VersionTuple();
/// ARM64 slice is supported starting from macOS 11.0+.
if (getOS() == Triple::MacOSX)
return VersionTuple(11, 0, 0);
if (getOS() == Triple::IOS && isMacCatalystEnvironment())
return VersionTuple(14, 0, 0);
return VersionTuple();
}
StringRef Triple::getARMCPUForArch(StringRef MArch) const {
if (MArch.empty())
MArch = getArchName();