summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/IdataPass.h
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/IdataPass.h')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/IdataPass.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/IdataPass.h b/lld/lib/ReaderWriter/PECOFF/IdataPass.h
index 0adf2dd881e..efba5835e1d 100644
--- a/lld/lib/ReaderWriter/PECOFF/IdataPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/IdataPass.h
@@ -126,6 +126,41 @@ public:
StringRef customSectionName() const override { return ".idata.d"; }
};
+/// The class for the the delay-load import table.
+class DelayImportDirectoryAtom : public IdataAtom {
+public:
+ DelayImportDirectoryAtom(
+ IdataContext &context, StringRef loadName,
+ const std::vector<COFFSharedLibraryAtom *> &sharedAtoms)
+ : IdataAtom(context, createContent()) {
+ addRelocations(context, loadName, sharedAtoms);
+ }
+
+ StringRef customSectionName() const override { return ".didat.d"; }
+
+private:
+ std::vector<uint8_t> createContent();
+ void addRelocations(IdataContext &context, StringRef loadName,
+ const std::vector<COFFSharedLibraryAtom *> &sharedAtoms);
+
+ mutable llvm::BumpPtrAllocator _alloc;
+};
+
+/// Terminator of the delay-load import table. The content of this atom is all
+/// zero.
+class DelayNullImportDirectoryAtom : public IdataAtom {
+public:
+ explicit DelayNullImportDirectoryAtom(IdataContext &context)
+ : IdataAtom(context, createContent()) {}
+ StringRef customSectionName() const override { return ".didat.d"; }
+
+private:
+ std::vector<uint8_t> createContent() const {
+ return std::vector<uint8_t>(
+ sizeof(llvm::object::delay_import_directory_table_entry), 0);
+ }
+};
+
} // namespace idata
class IdataPass : public lld::Pass {
OpenPOWER on IntegriCloud