diff options
| author | Rui Ueyama <ruiu@google.com> | 2014-10-09 02:48:14 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2014-10-09 02:48:14 +0000 |
| commit | 7be03d09cd2e2bc76c86bb0730770796629fb76c (patch) | |
| tree | d78757c0b9e945abafeeaa00f733f932ec5861c2 /lld/lib/ReaderWriter/PECOFF/IdataPass.h | |
| parent | 979fb40be0ba586f63a9c973581117ecef99b601 (diff) | |
| download | bcm5719-llvm-7be03d09cd2e2bc76c86bb0730770796629fb76c.tar.gz bcm5719-llvm-7be03d09cd2e2bc76c86bb0730770796629fb76c.zip | |
[PECOFF] Emit the delay-import table
This is a partial patch to emit the delay-import table. With this,
LLD is now able to emit the table that llvm-readobj can read and
dump.
The table lacks a few fields, such as the address of HMODULE, the
import address table, etc. They'll be added in subsequent patches.
llvm-svn: 219384
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/IdataPass.h')
| -rw-r--r-- | lld/lib/ReaderWriter/PECOFF/IdataPass.h | 35 |
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 { |

