diff options
author | Cyndy Ishida <cyndy_ishida@apple.com> | 2023-03-23 14:51:37 -0700 |
---|---|---|
committer | Cyndy Ishida <cyndy_ishida@apple.com> | 2023-03-23 14:58:41 -0700 |
commit | 397486566e995a019c249784b1d07c53b6ac670d (patch) | |
tree | 52ee97018e3336daf8299db2c778dc2551090d05 /llvm/lib/TextAPI/Platform.cpp | |
parent | ec2333d88538c1675227a555140a13bc27aafb69 (diff) | |
download | llvm-397486566e995a019c249784b1d07c53b6ac670d.zip llvm-397486566e995a019c249784b1d07c53b6ac670d.tar.gz llvm-397486566e995a019c249784b1d07c53b6ac670d.tar.bz2 |
[llvm][TextAPI] Handle implicitly upgraded deployment versions
Sometimes the clang driver will receive a target triple where the
deployment version is too low to support the platform + arch. In those
cases, the compiler upgrades the final minOS which is what gets recorded
ultimately by the linker in LC_BUILD_VERSION. TextAPI should also reuse
this logic for capturing minOS in recorded TBDv5 files.
Reviewed By: ributzka
Differential Revision: https://reviews.llvm.org/D145690
Diffstat (limited to 'llvm/lib/TextAPI/Platform.cpp')
-rw-r--r-- | llvm/lib/TextAPI/Platform.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/TextAPI/Platform.cpp b/llvm/lib/TextAPI/Platform.cpp index 673fcb7..a432462 100644 --- a/llvm/lib/TextAPI/Platform.cpp +++ b/llvm/lib/TextAPI/Platform.cpp @@ -132,5 +132,12 @@ std::string getOSAndEnvironmentName(PlatformType Platform, llvm_unreachable("Unknown llvm::MachO::PlatformType enum"); } +VersionTuple mapToSupportedOSVersion(const Triple &Triple) { + const VersionTuple MinSupportedOS = Triple.getMinimumSupportedOSVersion(); + if (MinSupportedOS > Triple.getOSVersion()) + return MinSupportedOS; + return Triple.getOSVersion(); +} + } // end namespace MachO. } // end namespace llvm. |