diff --git a/lld/MachO/Symbols.h b/lld/MachO/Symbols.h --- a/lld/MachO/Symbols.h +++ b/lld/MachO/Symbols.h @@ -40,6 +40,7 @@ DylibKind, LazyKind, DSOHandleKind, + MHBundleHeaderKind, }; virtual ~Symbol() {} @@ -254,6 +255,27 @@ static bool classof(const Symbol *s) { return s->kind() == DSOHandleKind; } }; +class MHBundleHeader : public Symbol { +public: + MHBundleHeader(const MachHeaderSection *header) + : Symbol(MHBundleHeaderKind, name, nullptr), header(header) {} + const MachHeaderSection *header; + + uint64_t getVA() const override; + + uint64_t getFileOffset() const override; + + bool isWeakDef() const override { return false; } + + bool isTlv() const override { return false; } + + static constexpr StringRef name = "__mh_bundle_header"; + + static bool classof(const Symbol *s) { + return s->kind() == MHBundleHeaderKind; + } +}; + union SymbolUnion { alignas(Defined) char a[sizeof(Defined)]; alignas(Undefined) char b[sizeof(Undefined)]; @@ -261,6 +283,7 @@ alignas(DylibSymbol) char d[sizeof(DylibSymbol)]; alignas(LazySymbol) char e[sizeof(LazySymbol)]; alignas(DSOHandle) char f[sizeof(DSOHandle)]; + alignas(MHBundleHeader) char g[sizeof(MHBundleHeader)]; }; template diff --git a/lld/MachO/Symbols.cpp b/lld/MachO/Symbols.cpp --- a/lld/MachO/Symbols.cpp +++ b/lld/MachO/Symbols.cpp @@ -51,3 +51,9 @@ uint64_t DSOHandle::getFileOffset() const { return header->fileOff; } constexpr StringRef DSOHandle::name; + +uint64_t MHBundleHeader::getVA() const { return header->addr; } + +uint64_t MHBundleHeader::getFileOffset() const { return header->fileOff; } + +constexpr StringRef MHBundleHeader::name;