diff options
author | Nico Weber <thakis@chromium.org> | 2020-07-02 00:02:09 -0400 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2020-07-02 00:05:52 -0400 |
commit | ba5087f13025a15662e164eb371fe0678258e03f (patch) | |
tree | 08376bdcdf76424b337b7c9a4aab16b9b5bbcfe2 /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp | |
parent | 7be1661fc6ed3f5c0d0365f5528717707757a382 (diff) | |
download | llvm-ba5087f13025a15662e164eb371fe0678258e03f.zip llvm-ba5087f13025a15662e164eb371fe0678258e03f.tar.gz llvm-ba5087f13025a15662e164eb371fe0678258e03f.tar.bz2 |
ld64.lld: Add janky support for tbd files
With this, a simple hello world links against libSystem.tbd and the
old ld64.lld linker kind of works again with newer SDKs.
The motivation here is to have an arm64 cross linker that's good
enough to be able to run simple configure link checks on non-mac
systems for generating config.h files. Once -flavor darwinnew can
link arm64, we'll switch to that.
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp index 963f122..87601ca 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp @@ -576,6 +576,26 @@ private: MachOLinkingContext &_ctx; }; +class MachOTAPIReader : public Reader { +public: + MachOTAPIReader(MachOLinkingContext &ctx) : _ctx(ctx) {} + + bool canParse(file_magic magic, MemoryBufferRef mb) const override { + return magic == file_magic::tapi_file; + } + + ErrorOr<std::unique_ptr<File>> + loadFile(std::unique_ptr<MemoryBuffer> mb, + const Registry ®istry) const override { + std::unique_ptr<File> ret = + std::make_unique<TAPIFile>(std::move(mb), &_ctx); + return std::move(ret); + } + +private: + MachOLinkingContext &_ctx; +}; + } // namespace normalized } // namespace mach_o @@ -583,6 +603,7 @@ void Registry::addSupportMachOObjects(MachOLinkingContext &ctx) { MachOLinkingContext::Arch arch = ctx.arch(); add(std::unique_ptr<Reader>(new mach_o::normalized::MachOObjectReader(ctx))); add(std::unique_ptr<Reader>(new mach_o::normalized::MachODylibReader(ctx))); + add(std::unique_ptr<Reader>(new mach_o::normalized::MachOTAPIReader(ctx))); addKindTable(Reference::KindNamespace::mach_o, ctx.archHandler().kindArch(), ctx.archHandler().kindStrings()); add(std::unique_ptr<YamlIOTaggedDocumentHandler>( |