diff options
Diffstat (limited to 'lib/ReaderWriter/MachO/GOTPass.cpp')
-rw-r--r-- | lib/ReaderWriter/MachO/GOTPass.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/ReaderWriter/MachO/GOTPass.cpp b/lib/ReaderWriter/MachO/GOTPass.cpp index a5816277dd71..6cdca0a9e055 100644 --- a/lib/ReaderWriter/MachO/GOTPass.cpp +++ b/lib/ReaderWriter/MachO/GOTPass.cpp @@ -54,6 +54,8 @@ public: GOTEntryAtom(const File &file, bool is64, StringRef name) : SimpleDefinedAtom(file), _is64(is64), _name(name) { } + ~GOTEntryAtom() override = default; + ContentType contentType() const override { return DefinedAtom::typeGOT; } @@ -91,10 +93,12 @@ class GOTPass : public Pass { public: GOTPass(const MachOLinkingContext &context) : _ctx(context), _archHandler(_ctx.archHandler()), - _file("<mach-o GOT Pass>") {} + _file(*_ctx.make_file<MachOFile>("<mach-o GOT Pass>")) { + _file.setOrdinal(_ctx.getNextOrdinalAndIncrement()); + } private: - std::error_code perform(SimpleFile &mergedFile) override { + llvm::Error perform(SimpleFile &mergedFile) override { // Scan all references in all atoms. for (const DefinedAtom *atom : mergedFile.defined()) { for (const Reference *ref : *atom) { @@ -130,7 +134,7 @@ private: for (const GOTEntryAtom *slot : entries) mergedFile.addAtom(*slot); - return std::error_code(); + return llvm::Error(); } bool shouldReplaceTargetWithGOTAtom(const Atom *target, bool canBypassGOT) { @@ -167,7 +171,7 @@ private: const MachOLinkingContext &_ctx; mach_o::ArchHandler &_archHandler; - MachOFile _file; + MachOFile &_file; llvm::DenseMap<const Atom*, const GOTEntryAtom*> _targetToGOT; }; |