[InstallAPI] capture compatibility versions (#85261)

This commit is contained in:
Cyndy Ishida
2024-03-14 11:24:16 -07:00
committed by GitHub
parent 4f873730d6
commit b058b7e628
3 changed files with 9 additions and 6 deletions

View File

@@ -2,7 +2,8 @@
// RUN: split-file %s %t
/// Check basic arguments are captured.
// RUN: clang-installapi -x objective-c -target arm64-apple-ios13.0.0 \
// RUN: -fapplication-extension -current_version 1 -install_name /usr/lib/basic.dylib \
// RUN: -fapplication-extension -current_version 1 -compatibility_version 1 \
// RUN: -install_name /usr/lib/basic.dylib \
// RUN: %t/basic_inputs.json -o %t/basic.tbd 2>&1 | FileCheck %s --allow-empty
// RUN: llvm-readtapi -compare %t/basic.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty
@@ -25,11 +26,6 @@
//--- expected.tbd
{
"main_library": {
"compatibility_versions": [
{
"version": "0"
}
],
"install_names": [
{
"name": "/usr/lib/basic.dylib"

View File

@@ -85,6 +85,9 @@ bool Options::processLinkerOptions(InputArgList &Args) {
if (auto *Arg = Args.getLastArg(OPT_current__version))
LinkerOpts.CurrentVersion.parse64(Arg->getValue());
if (auto *Arg = Args.getLastArg(OPT_compatibility__version))
LinkerOpts.CompatVersion.parse64(Arg->getValue());
LinkerOpts.IsDylib = Args.hasArg(OPT_dynamiclib);
LinkerOpts.AppExtensionSafe =
@@ -159,6 +162,7 @@ InstallAPIContext Options::createContext() {
Ctx.BA.InstallName = LinkerOpts.InstallName;
Ctx.BA.CurrentVersion = LinkerOpts.CurrentVersion;
Ctx.BA.CompatVersion = LinkerOpts.CompatVersion;
Ctx.BA.AppExtensionSafe = LinkerOpts.AppExtensionSafe;
Ctx.FT = DriverOpts.OutFT;
Ctx.OutputLoc = DriverOpts.OutputPath;

View File

@@ -49,6 +49,9 @@ struct LinkerOptions {
/// \brief The current version to use for the dynamic library.
PackedVersion CurrentVersion;
/// \brief The compatibility version to use for the dynamic library.
PackedVersion CompatVersion;
/// \brief Is application extension safe.
bool AppExtensionSafe = false;