llvm-readobj: Add support for dumping the DOS header in PE files

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221333 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-11-05 06:24:35 +00:00
parent 07e1080b89
commit 4787059b2f
5 changed files with 67 additions and 17 deletions

View File

@ -36,7 +36,7 @@ typedef content_iterator<ImportedSymbolRef> imported_symbol_iterator;
/// The DOS compatible header at the front of all PE/COFF executables.
struct dos_header {
support::ulittle16_t Magic;
char Magic[2];
support::ulittle16_t UsedBytesInTheLastPage;
support::ulittle16_t FileSizeInPages;
support::ulittle16_t NumberOfRelocationItems;
@ -621,6 +621,11 @@ public:
delay_import_directories() const;
iterator_range<export_directory_iterator> export_directories() const;
const dos_header *getDOSHeader() const {
if (!PE32Header && !PE32PlusHeader)
return nullptr;
return reinterpret_cast<const dos_header *>(base());
}
std::error_code getPE32Header(const pe32_header *&Res) const;
std::error_code getPE32PlusHeader(const pe32plus_header *&Res) const;
std::error_code getDataDirectory(uint32_t index,