A distinction that doesn't _usually_ matter is that the
MachO::SymbolKind is really a mapping of entries in TBD files not
symbols. To better understand this, rename the enum so it represents an
encoding mapped to TBDs as opposed to symbols alone.
For example, it can be a bit confusing that "GlobalSymbol" is a enum
value when all of those values can represent a GlobalSymbol.
Stubify broadly takes either tbd files or binary dylibs and turns them
into tbd files. In future patches, stubify will also allow additional
information to be embedded into the final TBD output too.
Add Util APIs to TextAPI for common operations used by readtapi for now.
Introduce RecordVisitor. This is used for different clients that want to
extract information out of RecordSlice types.
The first and immediate use case is for serializing symbol information
into TBD files.
> Add support for reading binary Mach-o dynamic libraries. It uses
libObject APIs for extracting information relevant to TAPI and tbd
files. This includes but is not limited to load commands encode data
like install names, current/compat versions, and symbols.
This originally broke because DylibReader uses Object and Object depends
on TextAPI. Breaking this up in a nested library prevents this cycle.
This reverts commit aa217eb04459039b5ff18b6b134020ed0248a241.
This reverts commit 634feddc84bfd402fc916d331627528c41346d8c.
This breaks buildbots by introducing cycle dependency between libObject
and TextAPI and breaks gcc compiles on buildbots.
Add support for reading binary Mach-o dynamic libraries. It uses
libObject APIs for extracting information relavant to TAPI and tbd
files. This includes but is not limited to load commands encode data
like install names, current/compat versions and symbols.
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.
I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
`Record`'s hold target triple specific information about APIs and
symbols. This holds information about the relationship between ObjC
symbols and their linkage properties. It will be used to compare and run
significant operations between the frontend representation of symbols in
AST and symbol information extracted from Mach-O binaries. This differs
from the lighter weight Symbol and SymbolSet class where they are
deduplicated across targets and only represent exported symbols, that
class is mostly used for serializing.
This change adds the PLATFORM XMACRO to simplify the addition of new MachO
platforms and reduce the number of required changes. Many of the changes needed
for adding a new platform are mechanical, such as adding new cases to a switch
statement. This will help streamline the process by consolidating much of the
necessary information into the MachO.def file.
Both Swift & LLD use TextAPI reader/writer apis to interface with TBD
files. Add doc strings to document what each API does. Also, add
shortcut APIs for validating input is a TBD file.
This reduces the differences between downstream and how tapi calls into
these APIs.
TBD files now record minimum deplyoment versions and tapi interfaces
with apple system linker by a packed version encoding. Support mapping
between that and `VersionTuple`s.
This adds a new optional flag sim_support which is the same as
MH_SIM_SUPPORT in the MachO header.
Reviewed By: ributzka
Differential Revision: https://reviews.llvm.org/D157433
The minOS version is recorded in tbd-v5 so the linker can report
diagnostics when a library and client are misconfigured.
Dylibs should always have a minOS recorded, but in was not recorded in
previous TBD versions. To accommodate the format transition, treat
unrecorded minOS versions as 0.
Reviewed By: zixuw
Differential Revision: https://reviews.llvm.org/D156487
* Expand understood `FileType`s that InterfaceFile class can represent.
* Add `hasTarget` function.
* Cleanup symbol `<` comparator to account for SymbolSet operations.
InterfaceFile is the in-memory representation for tbd files. Add APIs to
merge, extract, remove, and inline reexported libraries.
Reviewed By: zixuw
Differential Revision: https://reviews.llvm.org/D153398
UUID's & `installapi` flag are no longer useful in recent apple linker/tapi.
The reason for removing them is that these are attributes that record
how a library was built but not really about the library itself. TBD
files now only track information this is important as link time
dependencies.
Reviewed By: ributzka
Differential Revision: https://reviews.llvm.org/D149861
SymbolSet is a structure that acts as a simple container class for exported symbols that
belong to a library interface. It allows tapi to decouple the globals
from the other library attributes. It's uniqued by symbol name and `kind`, which all contain their assigned target triples.
Reviewed By: zixuw
Differential Revision: https://reviews.llvm.org/D149860
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
This includes handling of new attributes for symbols & rpath.
In the event that an older format file is compared to tbd_v5, ignore these new attributes.
Reviewed By: ributzka
Differential Revision: https://reviews.llvm.org/D144529
* Always print out maccatalyst in format
* Traverse symbols via InterfaceFile symbol APIs
* Properly track addition of flags.
Reviewed By: ributzka
Differential Revision: https://reviews.llvm.org/D144428
Create writer for new JSON format.
The new JSON format allows practically all attributes to be defined per
target in a universal library however the internal representation only
allows one for the time being. For now the write will always write those
attributes as default available for all targets (install name,
compatability & current version, swift abi, flags e.g. flatnamepace &
app exenstion safety)
rdar://102076911
Reviewed By: ributzka
Differential Revision: https://reviews.llvm.org/D144339
Create writer for new JSON format.
The new JSON format allows practically all attributes to be defined per
target in a universal library however the internal representation only
allows one for the time being. For now the write will always write those
attributes as default available for all targets (install name,
compatability & current version, swift abi, flags e.g. flatnamepace &
app exenstion safety)
rdar://102076911
Reviewed By: ributzka
Differential Revision: https://reviews.llvm.org/D144339
* Deployment Versions for targets
* Run Search Paths
* Text vs Data Segment attributes to symbols
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D144158
Introduce initial reader for TBDv5 which is in JSON. This captures all
the currently understood fields within the internal structure
`InterfaceFile`.
New fields will be followed up in future PRs.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D144156
This reverts commit b861b1225380175a5a724e2a677754f5f74e5b0d.
This reverts commit 4be17641b05df1e63fa8e069af92676f1246eb83.
This patch wont build on some compilers on buildbot.
[TextAPI] Implement TBDv5 Reader
Introduce initial reader for TBDv5 which is in JSON. This captures all
the currently understood fields within the internal structure
`InterfaceFile`.
New fields & follow up tests will be followed up in future PRs.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D144156