[clang] [InstallAPI] Handle zippered frameworks (PR #88205)
Cyndy Ishida via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 9 15:22:07 PDT 2024
https://github.com/cyndyishida created https://github.com/llvm/llvm-project/pull/88205
A zippered framework is a single framework that can be loaded in both macOS and macatalyst processes. Broadly to InstallAPI, it means the same interface can represent two separate platforms.
A dylib's symbol table does not distinguish between macOS/macCatalyst.
`InstallAPI` provides the ability for the tbd file to distinct
symbols between them.
The verifier handles this special logic by tracking all unavailable and obsoleted APIs in this context and checking against those when determining dylib symbols with no matching declaration.
* If there exists an available decl for either platform, do not warn.
* If there is no available decl, emit a diagnostic and print the source location for both decls.
>From cf8e63e06d8ed8ee626aab4fdf5ec499ed476b51 Mon Sep 17 00:00:00 2001
From: Cyndy Ishida <cyndy_ishida at apple.com>
Date: Tue, 9 Apr 2024 14:14:10 -0700
Subject: [PATCH] [InstallAPI] Handle zippered frameworks
A zippered framework is a single framework that can be loaded in both macOS and
macatalyst processes. Broadly to InstallAPI, it means the same interface can
represent two seperate platforms.
A dylib's symbol table does not distinct between macOS/macCatalyst.
`InstallAPI` provides ability for the tbd file to distinct
symbols between them.
The verifier handles this special logic by tracking all unavailable and
obsoleted APIs in this context and check against those when determining
dylib symbols with no matching declaration.
* If there exists an available decl for either platform, do not warn.
* If there is no available decl, emit an diagnostic and print the source
location for both decls.
---
.../clang/Basic/DiagnosticInstallAPIKinds.td | 4 +
.../include/clang/InstallAPI/DylibVerifier.h | 32 +-
clang/lib/InstallAPI/DylibVerifier.cpp | 98 ++-
.../Inputs/MacOSX13.0.sdk/SDKSettings.json | 19 +
.../test/InstallAPI/diagnostics-zippered.test | 765 ++++++++++++++++++
.../InstallAPI/driver-invalid-options.test | 7 +
clang/tools/clang-installapi/Options.cpp | 52 +-
clang/tools/clang-installapi/Options.h | 3 +
8 files changed, 964 insertions(+), 16 deletions(-)
create mode 100644 clang/test/InstallAPI/Inputs/MacOSX13.0.sdk/SDKSettings.json
create mode 100644 clang/test/InstallAPI/diagnostics-zippered.test
diff --git a/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td b/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td
index 0a477da7186b09..396bff0146a373 100644
--- a/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td
+++ b/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td
@@ -20,6 +20,10 @@ def warn_no_such_excluded_header_file : Warning<"no such excluded %select{public
def warn_glob_did_not_match: Warning<"glob '%0' did not match any header file">, InGroup<InstallAPIViolation>;
def err_no_such_umbrella_header_file : Error<"%select{public|private|project}1 umbrella header file not found in input: '%0'">;
def err_cannot_find_reexport : Error<"cannot find re-exported %select{framework|library}0: '%1'">;
+def err_no_matching_target : Error<"no matching target found for target variant '%0'">;
+def err_unsupported_vendor : Error<"vendor '%0' is not supported: '%1'">;
+def err_unsupported_environment : Error<"environment '%0' is not supported: '%1'">;
+def err_unsupported_os : Error<"os '%0' is not supported: '%1'">;
} // end of command line category.
let CategoryName = "Verification" in {
diff --git a/clang/include/clang/InstallAPI/DylibVerifier.h b/clang/include/clang/InstallAPI/DylibVerifier.h
index a3df25f10de4b1..31de212fc423a5 100644
--- a/clang/include/clang/InstallAPI/DylibVerifier.h
+++ b/clang/include/clang/InstallAPI/DylibVerifier.h
@@ -28,6 +28,16 @@ enum class VerificationMode {
using LibAttrs = llvm::StringMap<ArchitectureSet>;
using ReexportedInterfaces = llvm::SmallVector<llvm::MachO::InterfaceFile, 8>;
+// Pointers to information about a zippered declaration used for
+// querying and reporting violations against different
+// declarations that all map to the same symbol.
+struct ZipperedDeclSource {
+ const FrontendAttrs *FA;
+ clang::SourceManager *SrcMgr;
+ Target T;
+};
+using ZipperedDeclSources = std::vector<ZipperedDeclSource>;
+
/// Service responsible to tracking state of verification across the
/// lifetime of InstallAPI.
/// As declarations are collected during AST traversal, they are
@@ -68,10 +78,10 @@ class DylibVerifier : llvm::MachO::RecordVisitor {
DylibVerifier() = default;
DylibVerifier(llvm::MachO::Records &&Dylib, ReexportedInterfaces &&Reexports,
- DiagnosticsEngine *Diag, VerificationMode Mode, bool Demangle,
- StringRef DSYMPath)
+ DiagnosticsEngine *Diag, VerificationMode Mode, bool Zippered,
+ bool Demangle, StringRef DSYMPath)
: Dylib(std::move(Dylib)), Reexports(std::move(Reexports)), Mode(Mode),
- Demangle(Demangle), DSYMPath(DSYMPath),
+ Zippered(Zippered), Demangle(Demangle), DSYMPath(DSYMPath),
Exports(std::make_unique<SymbolSet>()), Ctx(VerifierContext{Diag}) {}
Result verify(GlobalRecord *R, const FrontendAttrs *FA);
@@ -118,6 +128,15 @@ class DylibVerifier : llvm::MachO::RecordVisitor {
/// symbols should be omitted from the text-api file.
bool shouldIgnoreReexport(const Record *R, SymbolContext &SymCtx) const;
+ // Ignore and omit unavailable symbols in zippered libraries.
+ bool shouldIgnoreZipperedAvailability(const Record *R, SymbolContext &SymCtx);
+
+ // Check if an internal declaration in zippered library has an
+ // external declaration for a different platform. This results
+ // in the symbol being in a "seperate" platform slice.
+ bool shouldIgnoreInternalZipperedSymbol(const Record *R,
+ const SymbolContext &SymCtx) const;
+
/// Compare the visibility declarations to the linkage of symbol found in
/// dylib.
Result compareVisibility(const Record *R, SymbolContext &SymCtx,
@@ -173,6 +192,9 @@ class DylibVerifier : llvm::MachO::RecordVisitor {
// Controls what class of violations to report.
VerificationMode Mode = VerificationMode::Invalid;
+ // Library is zippered.
+ bool Zippered = false;
+
// Attempt to demangle when reporting violations.
bool Demangle = false;
@@ -182,6 +204,10 @@ class DylibVerifier : llvm::MachO::RecordVisitor {
// Valid symbols in final text file.
std::unique_ptr<SymbolSet> Exports = std::make_unique<SymbolSet>();
+ // Unavailable or obsoleted declarations for a zippered library.
+ // These are cross referenced against symbols in the dylib.
+ llvm::StringMap<ZipperedDeclSources> DeferredZipperedSymbols;
+
// Track current state of verification while traversing AST.
VerifierContext Ctx;
diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp
index 4fa2d4e9292c72..84d9b5892e88da 100644
--- a/clang/lib/InstallAPI/DylibVerifier.cpp
+++ b/clang/lib/InstallAPI/DylibVerifier.cpp
@@ -176,7 +176,13 @@ void DylibVerifier::addSymbol(const Record *R, SymbolContext &SymCtx,
bool DylibVerifier::shouldIgnoreObsolete(const Record *R, SymbolContext &SymCtx,
const Record *DR) {
- return SymCtx.FA->Avail.isObsoleted();
+ if (!SymCtx.FA->Avail.isObsoleted())
+ return false;
+
+ if (Zippered)
+ DeferredZipperedSymbols[SymCtx.SymbolName].emplace_back(ZipperedDeclSource{
+ SymCtx.FA, &Ctx.Diag->getSourceManager(), Ctx.Target});
+ return true;
}
bool DylibVerifier::shouldIgnoreReexport(const Record *R,
@@ -195,6 +201,28 @@ bool DylibVerifier::shouldIgnoreReexport(const Record *R,
return false;
}
+bool DylibVerifier::shouldIgnoreInternalZipperedSymbol(
+ const Record *R, const SymbolContext &SymCtx) const {
+ if (!Zippered)
+ return false;
+
+ return Exports->findSymbol(SymCtx.Kind, SymCtx.SymbolName,
+ SymCtx.ObjCIFKind) != nullptr;
+}
+
+bool DylibVerifier::shouldIgnoreZipperedAvailability(const Record *R,
+ SymbolContext &SymCtx) {
+ if (!(Zippered && SymCtx.FA->Avail.isUnavailable()))
+ return false;
+
+ // Collect source location incase there is an exported symbol to diagnose
+ // during `verifyRemainingSymbols`.
+ DeferredZipperedSymbols[SymCtx.SymbolName].emplace_back(
+ ZipperedDeclSource{SymCtx.FA, SourceManagers.back().get(), Ctx.Target});
+
+ return true;
+}
+
bool DylibVerifier::compareObjCInterfaceSymbols(const Record *R,
SymbolContext &SymCtx,
const ObjCInterfaceRecord *DR) {
@@ -294,6 +322,9 @@ DylibVerifier::Result DylibVerifier::compareVisibility(const Record *R,
if (shouldIgnorePrivateExternAttr(SymCtx.FA->D))
return Result::Ignore;
+ if (shouldIgnoreInternalZipperedSymbol(R, SymCtx))
+ return Result::Ignore;
+
unsigned ID;
Result Outcome;
if (Mode == VerificationMode::ErrorsAndWarnings) {
@@ -321,6 +352,9 @@ DylibVerifier::Result DylibVerifier::compareAvailability(const Record *R,
if (!SymCtx.FA->Avail.isUnavailable())
return Result::Valid;
+ if (shouldIgnoreZipperedAvailability(R, SymCtx))
+ return Result::Ignore;
+
const bool IsDeclAvailable = SymCtx.FA->Avail.isUnavailable();
switch (Mode) {
@@ -588,13 +622,58 @@ void DylibVerifier::visitSymbolInDylib(const Record &R, SymbolContext &SymCtx) {
}
}
+ const bool IsLinkerSymbol = SymbolName.starts_with("$ld$");
+
+ if (R.isVerified()) {
+ // Check for unavailable symbols.
+ // This should only occur in the zippered case where we ignored
+ // availability until all headers have been parsed.
+ auto It = DeferredZipperedSymbols.find(SymCtx.SymbolName);
+ if (It == DeferredZipperedSymbols.end()) {
+ updateState(Result::Valid);
+ return;
+ }
+
+ ZipperedDeclSources Locs;
+ for (const ZipperedDeclSource &ZSource : It->second) {
+ if (ZSource.FA->Avail.isObsoleted()) {
+ updateState(Result::Ignore);
+ return;
+ }
+ if (ZSource.T.Arch != Ctx.Target.Arch)
+ continue;
+ Locs.emplace_back(ZSource);
+ }
+ assert(Locs.size() == 2 && "Expected two decls for zippered symbol");
+
+ // Print violating declarations per platform.
+ for (const ZipperedDeclSource &ZSource : Locs) {
+ unsigned DiagID = 0;
+ if (Mode == VerificationMode::Pedantic || IsLinkerSymbol) {
+ updateState(Result::Invalid);
+ DiagID = diag::err_header_availability_mismatch;
+ } else if (Mode == VerificationMode::ErrorsAndWarnings) {
+ updateState(Result::Ignore);
+ DiagID = diag::warn_header_availability_mismatch;
+ } else {
+ updateState(Result::Ignore);
+ return;
+ }
+ // Bypass emitDiag banner and print the target everytime.
+ Ctx.Diag->setSourceManager(ZSource.SrcMgr);
+ Ctx.Diag->Report(diag::warn_target) << getTargetTripleName(ZSource.T);
+ Ctx.Diag->Report(ZSource.FA->Loc, DiagID)
+ << getAnnotatedName(&R, SymCtx) << ZSource.FA->Avail.isUnavailable()
+ << ZSource.FA->Avail.isUnavailable();
+ }
+ return;
+ }
+
if (shouldIgnoreCpp(SymbolName, R.isWeakDefined())) {
updateState(Result::Valid);
return;
}
- const bool IsLinkerSymbol = SymbolName.starts_with("$ld$");
-
// All checks at this point classify as some kind of violation.
// The different verification modes dictate whether they are reported to the
// user.
@@ -647,8 +726,6 @@ void DylibVerifier::visitSymbolInDylib(const Record &R, SymbolContext &SymCtx) {
}
void DylibVerifier::visitGlobal(const GlobalRecord &R) {
- if (R.isVerified())
- return;
SymbolContext SymCtx;
SimpleSymbol Sym = parseSymbol(R.getName());
SymCtx.SymbolName = Sym.Name;
@@ -658,8 +735,6 @@ void DylibVerifier::visitGlobal(const GlobalRecord &R) {
void DylibVerifier::visitObjCIVar(const ObjCIVarRecord &R,
const StringRef Super) {
- if (R.isVerified())
- return;
SymbolContext SymCtx;
SymCtx.SymbolName = ObjCIVarRecord::createScopedName(Super, R.getName());
SymCtx.Kind = EncodeKind::ObjectiveCInstanceVariable;
@@ -679,8 +754,6 @@ void DylibVerifier::accumulateSrcLocForDylibSymbols() {
}
void DylibVerifier::visitObjCInterface(const ObjCInterfaceRecord &R) {
- if (R.isVerified())
- return;
SymbolContext SymCtx;
SymCtx.SymbolName = R.getName();
SymCtx.ObjCIFKind = assignObjCIFSymbolKind(&R);
@@ -713,9 +786,12 @@ DylibVerifier::Result DylibVerifier::verifyRemainingSymbols() {
DWARFContext DWARFInfo;
DWARFCtx = &DWARFInfo;
- Ctx.DiscoveredFirstError = false;
- Ctx.PrintArch = true;
+ Ctx.Target = Target(Architecture::AK_unknown, PlatformType::PLATFORM_UNKNOWN);
for (std::shared_ptr<RecordsSlice> Slice : Dylib) {
+ if (Ctx.Target.Arch == Slice->getTarget().Arch)
+ continue;
+ Ctx.DiscoveredFirstError = false;
+ Ctx.PrintArch = true;
Ctx.Target = Slice->getTarget();
Ctx.DylibSlice = Slice.get();
Slice->visit(*this);
diff --git a/clang/test/InstallAPI/Inputs/MacOSX13.0.sdk/SDKSettings.json b/clang/test/InstallAPI/Inputs/MacOSX13.0.sdk/SDKSettings.json
new file mode 100644
index 00000000000000..258d8288fc6b40
--- /dev/null
+++ b/clang/test/InstallAPI/Inputs/MacOSX13.0.sdk/SDKSettings.json
@@ -0,0 +1,19 @@
+{
+ "DefaultVariant": "macos", "DisplayName": "macOS 13",
+ "Version": "13.0",
+ "MaximumDeploymentTarget": "13.0.99",
+ "PropertyConditionFallbackNames": [], "VersionMap": {
+ "iOSMac_macOS": {
+ "16.1": "13.0",
+ "15.0": "12.0",
+ "13.1": "10.15",
+ "14.0": "11.0"
+ },
+ "macOS_iOSMac": {
+ "13.0": "16.1",
+ "12.0": "15.0",
+ "11.0": "14.0",
+ "10.15": "13.1"
+ }
+ }
+}
diff --git a/clang/test/InstallAPI/diagnostics-zippered.test b/clang/test/InstallAPI/diagnostics-zippered.test
new file mode 100644
index 00000000000000..59fd0bb673a3da
--- /dev/null
+++ b/clang/test/InstallAPI/diagnostics-zippered.test
@@ -0,0 +1,765 @@
+; RUN: rm -rf %t
+; RUN: split-file %s %t
+; RUN: cp -r %S/Inputs/Foundation/Foundation.framework %t/System/Library/Frameworks/
+; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json
+; RUN: yaml2obj %t/Mismatch.yaml -o %t/System/Library/Frameworks/Mismatch.framework/Mismatch
+
+; RUN: not clang-installapi --target=arm64-apple-macos13 \
+; RUN: --target=x86_64-apple-macos13 -darwin-target-variant x86_64-apple-ios16.0-macabi \
+; RUN: -darwin-target-variant arm64-apple-ios16.0-macabi \
+; RUN: -F %t/System/Library/Frameworks -isysroot %S/Inputs/MacOSX13.0.sdk \
+; RUN: -install_name /System/Library/Frameworks/Mismatch.framework/Versions/A/Mismatch \
+; RUN: -current_version 1 -compatibility_version 1 %t/inputs.json -o %t/Mismatch.tbd \
+; RUN: --verify-against=%t/System/Library/Frameworks/Mismatch.framework/Mismatch \
+; RUN: --verify-mode=Pedantic 2>&1 | FileCheck %s
+
+; CHECK: warning: violations found for x86_64-apple-macos13
+; CHECK: error: declaration has external linkage, but dynamic library doesn't have symbol 'foo_arch_x86'
+; CHECK-NEXT: extern int foo_arch_x86();
+
+; CHECK: error: symbol exported in dynamic library, but marked hidden in declaration 'baz'
+; CHECK-NEXT: int baz() __attribute__((visibility("hidden")));
+
+; CHECK-NOT: inlinedFunc
+
+; CHECK: error: declaration has external linkage, but symbol has internal linkage in dynamic library 'bar'
+; CHECK-NEXT: extern int bar();
+
+; CHECK: error: declaration has external linkage, but dynamic library doesn't have symbol 'NSFoo'
+; CHECK-NEXT: @interface NSFoo
+
+; CHECK: error: declaration has external linkage, but dynamic library doesn't have symbol 'NSFoo.nsint'
+; CHECK-NEXT: int nsint;
+
+; CHECK: error: declaration has external linkage, but dynamic library doesn't have symbol 'NSFooExcept'
+; CHECK-NEXT: @interface NSFooExcept
+
+; CHECK: warning: violations found for arm64-apple-macos13
+; CHECK: error: declaration has external linkage, but dynamic library doesn't have symbol 'foo_arch_arm'
+; CHECK-NEXT: extern int foo_arch_arm();
+
+; CHECK: warning: violations found for x86_64
+; CHECK-NEXT: error: no declaration found for exported symbol '_fooBar' in dynamic library
+
+; CHECK: warning: violations found for arm64
+; CHECK-NEXT: error: no declaration found for exported symbol '_fooBar' in dynamic library
+; CHECK: warning: violations found for arm64-apple-macos13
+; CHECK-NEXT: error: declaration 'unavailableSymbol' is marked unavailable, but symbol is exported in dynamic library
+; CHECK-NEXT: extern int unavailableSymbol
+; CHECK: warning: violations found for arm64-apple-ios16.0-macabi
+; CHECK-NEXT: error: declaration 'unavailableSymbol' is marked unavailable, but symbol is exported in dynamic library
+; CHECK-NEXT: extern int unavailableSymbol
+
+
+;--- System/Library/Frameworks/Mismatch.framework/Headers/Mismatch.h
+#if defined(__x86_64__)
+extern int foo_arch_x86();
+#else
+extern int foo_arch_arm();
+#endif
+
+int foo();
+int baz() __attribute__((visibility("hidden")));
+
+__attribute__((visibility("hidden"))) inline int inlinedFunc() { return 1; }
+
+;--- System/Library/Frameworks/Mismatch.framework/PrivateHeaders/Mismatch_Private.h
+#include <Foundation/Foundation.h>
+extern int bar();
+
+ at interface NSFoo : NSObject {
+ int nsint;
+}
+ at end
+
+__attribute__((objc_exception))
+ at interface NSFooExcept : NSObject
+ at end
+
+extern int unavailableSymbol __attribute__((
+ availability(macosx, unavailable), availability(macCatalyst, unavailable)));
+
+
+// Generated from source:
+// ***
+// int inlinedFunc() { return 1; }
+// int foo() { return 1; }
+// __attribute__((visibility("hidden"))) int bar() { return 1; }
+// int baz() { return 1; }
+// int fooBar = 1;
+// int unavailableSymbol = 1;
+// ***
+// xcrun -sdk macosx clang -target x86_64-apple-macos13 --target-variant=x86_64-apple-ios16-macabi -dynamiclib
+// xcrun -sdk macosx clang -target arm64-apple-macos13 --target-variant=arm64-apple-ios16-macabi -dynamiclib
+// then lipo'ed together.
+
+;--- Mismatch.yaml
+--- !fat-mach-o
+FatHeader:
+ magic: 0xCAFEBABE
+ nfat_arch: 2
+FatArchs:
+ - cputype: 0x1000007
+ cpusubtype: 0x3
+ offset: 0x1000
+ size: 20768
+ align: 12
+ - cputype: 0x100000C
+ cpusubtype: 0x0
+ offset: 0x8000
+ size: 49984
+ align: 14
+Slices:
+ - !mach-o
+ FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x1000007
+ cpusubtype: 0x3
+ filetype: 0x6
+ ncmds: 15
+ sizeofcmds: 1584
+ flags: 0x100085
+ reserved: 0x0
+ LoadCommands:
+ - cmd: LC_SEGMENT_64
+ cmdsize: 312
+ segname: __TEXT
+ vmaddr: 0
+ vmsize: 12288
+ fileoff: 0
+ filesize: 12288
+ maxprot: 5
+ initprot: 5
+ nsects: 3
+ flags: 0
+ Sections:
+ - sectname: __text
+ segname: __TEXT
+ addr: 0x1090
+ size: 59
+ offset: 0x1090
+ align: 4
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x80000400
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: 554889E5B8010000005DC30F1F440000554889E5B8010000005DC30F1F440000554889E5B8010000005DC30F1F440000554889E5B8010000005DC3
+ - sectname: __unwind_info
+ segname: __TEXT
+ addr: 0x10CC
+ size: 4152
+ offset: 0x10CC
+ align: 2
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x0
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: 010000001C000000010000002000000000000000200000000200000000000001901000003800000038000000CB1000000000000038000000030000000C0001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ - sectname: __eh_frame
+ segname: __TEXT
+ addr: 0x2108
+ size: 24
+ offset: 0x2108
+ align: 3
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x6000000B
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: 1400000000000000017A520001781001100C070890010000
+ - cmd: LC_SEGMENT_64
+ cmdsize: 152
+ segname: __DATA_CONST
+ vmaddr: 12288
+ vmsize: 4096
+ fileoff: 12288
+ filesize: 4096
+ maxprot: 3
+ initprot: 3
+ nsects: 1
+ flags: 16
+ Sections:
+ - sectname: __objc_imageinfo
+ segname: __DATA_CONST
+ addr: 0x3000
+ size: 8
+ offset: 0x3000
+ align: 0
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x0
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: '0000000040000000'
+ - cmd: LC_SEGMENT_64
+ cmdsize: 152
+ segname: __DATA
+ vmaddr: 16384
+ vmsize: 4096
+ fileoff: 16384
+ filesize: 4096
+ maxprot: 3
+ initprot: 3
+ nsects: 1
+ flags: 0
+ Sections:
+ - sectname: __data
+ segname: __DATA
+ addr: 0x4000
+ size: 8
+ offset: 0x4000
+ align: 2
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x0
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: '0100000001000000'
+ - cmd: LC_SEGMENT_64
+ cmdsize: 72
+ segname: __LINKEDIT
+ vmaddr: 20480
+ vmsize: 288
+ fileoff: 20480
+ filesize: 288
+ maxprot: 1
+ initprot: 1
+ nsects: 0
+ flags: 0
+ - cmd: LC_DYLD_INFO_ONLY
+ cmdsize: 48
+ rebase_off: 0
+ rebase_size: 0
+ bind_off: 0
+ bind_size: 0
+ weak_bind_off: 0
+ weak_bind_size: 0
+ lazy_bind_off: 0
+ lazy_bind_size: 0
+ export_off: 20480
+ export_size: 88
+ - cmd: LC_SYMTAB
+ cmdsize: 24
+ symoff: 20576
+ nsyms: 7
+ stroff: 20688
+ strsize: 80
+ - cmd: LC_DYSYMTAB
+ cmdsize: 80
+ ilocalsym: 0
+ nlocalsym: 1
+ iextdefsym: 1
+ nextdefsym: 5
+ iundefsym: 6
+ nundefsym: 1
+ tocoff: 0
+ ntoc: 0
+ modtaboff: 0
+ nmodtab: 0
+ extrefsymoff: 0
+ nextrefsyms: 0
+ indirectsymoff: 0
+ nindirectsyms: 0
+ extreloff: 0
+ nextrel: 0
+ locreloff: 0
+ nlocrel: 0
+ - cmd: LC_ID_DYLIB
+ cmdsize: 96
+ dylib:
+ name: 24
+ timestamp: 0
+ current_version: 65536
+ compatibility_version: 65536
+ Content: '/System/Library/Frameworks/Mismatch.framework/Versions/A/Mismatch'
+ ZeroPadBytes: 7
+ - cmd: LC_UUID
+ cmdsize: 24
+ uuid: 4C4C4421-5555-3144-A16C-E4AA63D66775
+ - cmd: LC_BUILD_VERSION
+ cmdsize: 32
+ platform: 1
+ minos: 851968
+ sdk: 983040
+ ntools: 1
+ Tools:
+ - tool: 4
+ version: 1245184
+ - cmd: LC_BUILD_VERSION
+ cmdsize: 32
+ platform: 6
+ minos: 1048576
+ sdk: 1048576
+ ntools: 1
+ Tools:
+ - tool: 4
+ version: 1245184
+ - cmd: LC_LOAD_DYLIB
+ cmdsize: 56
+ dylib:
+ name: 24
+ timestamp: 0
+ current_version: 14942208
+ compatibility_version: 65536
+ Content: '/usr/lib/libobjc.A.dylib'
+ ZeroPadBytes: 8
+ - cmd: LC_LOAD_DYLIB
+ cmdsize: 56
+ dylib:
+ name: 24
+ timestamp: 0
+ current_version: 88539136
+ compatibility_version: 65536
+ Content: '/usr/lib/libSystem.B.dylib'
+ ZeroPadBytes: 6
+ - cmd: LC_FUNCTION_STARTS
+ cmdsize: 16
+ dataoff: 20568
+ datasize: 8
+ - cmd: LC_DATA_IN_CODE
+ cmdsize: 16
+ dataoff: 20576
+ datasize: 0
+ LinkEditData:
+ ExportTrie:
+ TerminalSize: 0
+ NodeOffset: 0
+ Name: ''
+ Flags: 0x0
+ Address: 0x0
+ Other: 0x0
+ ImportName: ''
+ Children:
+ - TerminalSize: 0
+ NodeOffset: 5
+ Name: _
+ Flags: 0x0
+ Address: 0x0
+ Other: 0x0
+ ImportName: ''
+ Children:
+ - TerminalSize: 3
+ NodeOffset: 49
+ Name: inlinedFunc
+ Flags: 0x0
+ Address: 0x1090
+ Other: 0x0
+ ImportName: ''
+ - TerminalSize: 3
+ NodeOffset: 54
+ Name: foo
+ Flags: 0x0
+ Address: 0x10A0
+ Other: 0x0
+ ImportName: ''
+ Children:
+ - TerminalSize: 4
+ NodeOffset: 64
+ Name: Bar
+ Flags: 0x0
+ Address: 0x4000
+ Other: 0x0
+ ImportName: ''
+ - TerminalSize: 4
+ NodeOffset: 70
+ Name: unavailableSymbol
+ Flags: 0x0
+ Address: 0x4004
+ Other: 0x0
+ ImportName: ''
+ - TerminalSize: 3
+ NodeOffset: 76
+ Name: baz
+ Flags: 0x0
+ Address: 0x10C0
+ Other: 0x0
+ ImportName: ''
+ NameList:
+ - n_strx: 20
+ n_type: 0x1E
+ n_sect: 1
+ n_desc: 0
+ n_value: 4272
+ - n_strx: 2
+ n_type: 0xF
+ n_sect: 1
+ n_desc: 0
+ n_value: 4240
+ - n_strx: 15
+ n_type: 0xF
+ n_sect: 1
+ n_desc: 0
+ n_value: 4256
+ - n_strx: 25
+ n_type: 0xF
+ n_sect: 1
+ n_desc: 0
+ n_value: 4288
+ - n_strx: 30
+ n_type: 0xF
+ n_sect: 5
+ n_desc: 0
+ n_value: 16384
+ - n_strx: 38
+ n_type: 0xF
+ n_sect: 5
+ n_desc: 0
+ n_value: 16388
+ - n_strx: 57
+ n_type: 0x1
+ n_sect: 0
+ n_desc: 512
+ n_value: 0
+ StringTable:
+ - ' '
+ - _inlinedFunc
+ - _foo
+ - _bar
+ - _baz
+ - _fooBar
+ - _unavailableSymbol
+ - dyld_stub_binder
+ - ''
+ - ''
+ - ''
+ - ''
+ - ''
+ - ''
+ FunctionStarts: [ 0x1090, 0x10A0, 0x10B0, 0x10C0 ]
+ - !mach-o
+ FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x100000C
+ cpusubtype: 0x0
+ filetype: 0x6
+ ncmds: 16
+ sizeofcmds: 1104
+ flags: 0x100085
+ reserved: 0x0
+ LoadCommands:
+ - cmd: LC_SEGMENT_64
+ cmdsize: 232
+ segname: __TEXT
+ vmaddr: 0
+ vmsize: 16384
+ fileoff: 0
+ filesize: 16384
+ maxprot: 5
+ initprot: 5
+ nsects: 2
+ flags: 0
+ Sections:
+ - sectname: __text
+ segname: __TEXT
+ addr: 0x1050
+ size: 32
+ offset: 0x1050
+ align: 2
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x80000400
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: 20008052C0035FD620008052C0035FD620008052C0035FD620008052C0035FD6
+ - sectname: __unwind_info
+ segname: __TEXT
+ addr: 0x1070
+ size: 4152
+ offset: 0x1070
+ align: 2
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x0
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: 010000001C000000010000002000000000000000200000000200000000000002501000003800000038000000701000000000000038000000030000000C0001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ - cmd: LC_SEGMENT_64
+ cmdsize: 152
+ segname: __DATA_CONST
+ vmaddr: 16384
+ vmsize: 16384
+ fileoff: 16384
+ filesize: 16384
+ maxprot: 3
+ initprot: 3
+ nsects: 1
+ flags: 16
+ Sections:
+ - sectname: __objc_imageinfo
+ segname: __DATA_CONST
+ addr: 0x4000
+ size: 8
+ offset: 0x4000
+ align: 0
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x0
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: '0000000040000000'
+ - cmd: LC_SEGMENT_64
+ cmdsize: 152
+ segname: __DATA
+ vmaddr: 32768
+ vmsize: 16384
+ fileoff: 32768
+ filesize: 16384
+ maxprot: 3
+ initprot: 3
+ nsects: 1
+ flags: 0
+ Sections:
+ - sectname: __data
+ segname: __DATA
+ addr: 0x8000
+ size: 8
+ offset: 0x8000
+ align: 2
+ reloff: 0x0
+ nreloc: 0
+ flags: 0x0
+ reserved1: 0x0
+ reserved2: 0x0
+ reserved3: 0x0
+ content: '0100000001000000'
+ - cmd: LC_SEGMENT_64
+ cmdsize: 72
+ segname: __LINKEDIT
+ vmaddr: 49152
+ vmsize: 832
+ fileoff: 49152
+ filesize: 832
+ maxprot: 1
+ initprot: 1
+ nsects: 0
+ flags: 0
+ - cmd: LC_DYLD_INFO_ONLY
+ cmdsize: 48
+ rebase_off: 0
+ rebase_size: 0
+ bind_off: 0
+ bind_size: 0
+ weak_bind_off: 0
+ weak_bind_size: 0
+ lazy_bind_off: 0
+ lazy_bind_size: 0
+ export_off: 49152
+ export_size: 88
+ - cmd: LC_SYMTAB
+ cmdsize: 24
+ symoff: 49248
+ nsyms: 7
+ stroff: 49360
+ strsize: 80
+ - cmd: LC_DYSYMTAB
+ cmdsize: 80
+ ilocalsym: 0
+ nlocalsym: 1
+ iextdefsym: 1
+ nextdefsym: 5
+ iundefsym: 6
+ nundefsym: 1
+ tocoff: 0
+ ntoc: 0
+ modtaboff: 0
+ nmodtab: 0
+ extrefsymoff: 0
+ nextrefsyms: 0
+ indirectsymoff: 0
+ nindirectsyms: 0
+ extreloff: 0
+ nextrel: 0
+ locreloff: 0
+ nlocrel: 0
+ - cmd: LC_ID_DYLIB
+ cmdsize: 96
+ dylib:
+ name: 24
+ timestamp: 0
+ current_version: 65536
+ compatibility_version: 65536
+ Content: '/System/Library/Frameworks/Mismatch.framework/Versions/A/Mismatch'
+ ZeroPadBytes: 7
+ - cmd: LC_UUID
+ cmdsize: 24
+ uuid: 4C4C4428-5555-3144-A12B-7130A3C946D2
+ - cmd: LC_BUILD_VERSION
+ cmdsize: 32
+ platform: 1
+ minos: 851968
+ sdk: 983040
+ ntools: 1
+ Tools:
+ - tool: 4
+ version: 1245184
+ - cmd: LC_BUILD_VERSION
+ cmdsize: 32
+ platform: 6
+ minos: 1048576
+ sdk: 1048576
+ ntools: 1
+ Tools:
+ - tool: 4
+ version: 1245184
+ - cmd: LC_LOAD_DYLIB
+ cmdsize: 56
+ dylib:
+ name: 24
+ timestamp: 0
+ current_version: 14942208
+ compatibility_version: 65536
+ Content: '/usr/lib/libobjc.A.dylib'
+ ZeroPadBytes: 8
+ - cmd: LC_LOAD_DYLIB
+ cmdsize: 56
+ dylib:
+ name: 24
+ timestamp: 0
+ current_version: 88539136
+ compatibility_version: 65536
+ Content: '/usr/lib/libSystem.B.dylib'
+ ZeroPadBytes: 6
+ - cmd: LC_FUNCTION_STARTS
+ cmdsize: 16
+ dataoff: 49240
+ datasize: 8
+ - cmd: LC_DATA_IN_CODE
+ cmdsize: 16
+ dataoff: 49248
+ datasize: 0
+ - cmd: LC_CODE_SIGNATURE
+ cmdsize: 16
+ dataoff: 49440
+ datasize: 544
+ LinkEditData:
+ ExportTrie:
+ TerminalSize: 0
+ NodeOffset: 0
+ Name: ''
+ Flags: 0x0
+ Address: 0x0
+ Other: 0x0
+ ImportName: ''
+ Children:
+ - TerminalSize: 0
+ NodeOffset: 5
+ Name: _
+ Flags: 0x0
+ Address: 0x0
+ Other: 0x0
+ ImportName: ''
+ Children:
+ - TerminalSize: 3
+ NodeOffset: 49
+ Name: inlinedFunc
+ Flags: 0x0
+ Address: 0x1050
+ Other: 0x0
+ ImportName: ''
+ - TerminalSize: 3
+ NodeOffset: 54
+ Name: foo
+ Flags: 0x0
+ Address: 0x1058
+ Other: 0x0
+ ImportName: ''
+ Children:
+ - TerminalSize: 4
+ NodeOffset: 64
+ Name: Bar
+ Flags: 0x0
+ Address: 0x8000
+ Other: 0x0
+ ImportName: ''
+ - TerminalSize: 4
+ NodeOffset: 70
+ Name: unavailableSymbol
+ Flags: 0x0
+ Address: 0x8004
+ Other: 0x0
+ ImportName: ''
+ - TerminalSize: 3
+ NodeOffset: 76
+ Name: baz
+ Flags: 0x0
+ Address: 0x1068
+ Other: 0x0
+ ImportName: ''
+ NameList:
+ - n_strx: 20
+ n_type: 0x1E
+ n_sect: 1
+ n_desc: 0
+ n_value: 4192
+ - n_strx: 2
+ n_type: 0xF
+ n_sect: 1
+ n_desc: 0
+ n_value: 4176
+ - n_strx: 15
+ n_type: 0xF
+ n_sect: 1
+ n_desc: 0
+ n_value: 4184
+ - n_strx: 25
+ n_type: 0xF
+ n_sect: 1
+ n_desc: 0
+ n_value: 4200
+ - n_strx: 30
+ n_type: 0xF
+ n_sect: 4
+ n_desc: 0
+ n_value: 32768
+ - n_strx: 38
+ n_type: 0xF
+ n_sect: 4
+ n_desc: 0
+ n_value: 32772
+ - n_strx: 57
+ n_type: 0x1
+ n_sect: 0
+ n_desc: 512
+ n_value: 0
+ StringTable:
+ - ' '
+ - _inlinedFunc
+ - _foo
+ - _bar
+ - _baz
+ - _fooBar
+ - _unavailableSymbol
+ - dyld_stub_binder
+ - ''
+ - ''
+ - ''
+ - ''
+ - ''
+ - ''
+ FunctionStarts: [ 0x1050, 0x1058, 0x1060, 0x1068 ]
+...
+
+;--- inputs.json.in
+{
+ "headers": [
+ {
+ "path" : "DSTROOT/System/Library/Frameworks/Mismatch.framework/PrivateHeaders/Mismatch_Private.h",
+ "type" : "private"
+ },
+ {
+ "path" : "DSTROOT/System/Library/Frameworks/Mismatch.framework/Headers/Mismatch.h",
+ "type" : "public"
+ }
+ ],
+ "version": "3"
+}
diff --git a/clang/test/InstallAPI/driver-invalid-options.test b/clang/test/InstallAPI/driver-invalid-options.test
index 2b2c551fca2025..8efefd1b8c5947 100644
--- a/clang/test/InstallAPI/driver-invalid-options.test
+++ b/clang/test/InstallAPI/driver-invalid-options.test
@@ -19,3 +19,10 @@
// RUN: -isysroot /no/such/path -o tmp.tbd 2> %t
// RUN: FileCheck --check-prefix INVALID_ISYSROOT -input-file %t %s
// INVALID_ISYSROOT: error: no such sysroot directory: {{.*}}no/such/path'
+
+/// Check invalid target-variant.
+// RUN: not clang-installapi -target x86_64-apple-macosx12 \
+// RUN: -darwin-target-variant arm64-apple-ios15-macabi \
+// RUN: -install_name tmp.dylib -o tmp.tbd 2> %t
+// RUN: FileCheck --check-prefix INVALID_TARGET_VARIANT -input-file %t %s
+// INVALID_TARGET_VARIANT: error: no matching target found for target variant 'arm64-apple-ios15-macabi'
diff --git a/clang/tools/clang-installapi/Options.cpp b/clang/tools/clang-installapi/Options.cpp
index d1f91181280096..120ff3da899868 100644
--- a/clang/tools/clang-installapi/Options.cpp
+++ b/clang/tools/clang-installapi/Options.cpp
@@ -104,7 +104,7 @@ bool Options::processDriverOptions(InputArgList &Args) {
auto *ArgArch = Args.getLastArgNoClaim(drv::OPT_arch);
auto *ArgTarget = Args.getLastArgNoClaim(drv::OPT_target);
auto *ArgTargetVariant =
- Args.getLastArgNoClaim(drv::OPT_darwin_target_variant_triple);
+ Args.getLastArgNoClaim(drv::OPT_darwin_target_variant);
if (ArgArch && (ArgTarget || ArgTargetVariant)) {
Diags->Report(clang::diag::err_drv_argument_not_allowed_with)
<< ArgArch->getAsString(Args)
@@ -135,6 +135,53 @@ bool Options::processDriverOptions(InputArgList &Args) {
}
}
+ // Capture target variants.
+ DriverOpts.Zippered = ArgTargetVariant != nullptr;
+ for (Arg *A : Args.filtered(drv::OPT_darwin_target_variant)) {
+ A->claim();
+ Triple Variant(A->getValue());
+ if (Variant.getVendor() != Triple::Apple) {
+ Diags->Report(diag::err_unsupported_vendor)
+ << Variant.getVendorName() << A->getAsString(Args);
+ return false;
+ }
+
+ switch (Variant.getOS()) {
+ default:
+ Diags->Report(diag::err_unsupported_os)
+ << Variant.getOSName() << A->getAsString(Args);
+ return false;
+ case Triple::MacOSX:
+ case Triple::IOS:
+ break;
+ }
+
+ switch (Variant.getEnvironment()) {
+ default:
+ Diags->Report(diag::err_unsupported_environment)
+ << Variant.getEnvironmentName() << A->getAsString(Args);
+ return false;
+ case Triple::UnknownEnvironment:
+ case Triple::MacABI:
+ break;
+ }
+
+ Target TAPIVariant(Variant);
+ // See if there is a matching --target option for this --target-variant
+ // option.
+ auto It = find_if(DriverOpts.Targets, [&](const auto &T) {
+ return (T.first.Arch == TAPIVariant.Arch) &&
+ (T.first.Platform != PlatformType::PLATFORM_UNKNOWN);
+ });
+
+ if (It == DriverOpts.Targets.end()) {
+ Diags->Report(diag::err_no_matching_target) << Variant.str();
+ return false;
+ }
+
+ DriverOpts.Targets[TAPIVariant] = Variant;
+ }
+
DriverOpts.Verbose = Args.hasArgNoClaim(drv::OPT_v);
return true;
@@ -803,7 +850,8 @@ InstallAPIContext Options::createContext() {
Ctx.Verifier = std::make_unique<DylibVerifier>(
std::move(*Slices), std::move(ReexportedIFs), Diags,
- DriverOpts.VerifyMode, DriverOpts.Demangle, DriverOpts.DSYMPath);
+ DriverOpts.VerifyMode, DriverOpts.Zippered, DriverOpts.Demangle,
+ DriverOpts.DSYMPath);
return Ctx;
}
diff --git a/clang/tools/clang-installapi/Options.h b/clang/tools/clang-installapi/Options.h
index 6da1469de2c898..984366c94e91ce 100644
--- a/clang/tools/clang-installapi/Options.h
+++ b/clang/tools/clang-installapi/Options.h
@@ -75,6 +75,9 @@ struct DriverOptions {
/// \brief Verification mode for comparing symbols.
VerificationMode VerifyMode = VerificationMode::Pedantic;
+ /// \brief Whether the library is zippered.
+ bool Zippered = false;
+
/// \brief Print demangled symbols when reporting errors.
bool Demangle = false;
More information about the cfe-commits
mailing list