llvm-objdump: Dump COFF import table if -private-headers option is given.

This is a patch to add capability to llvm-objdump to dump COFF Import Table
entries, so that we can write tests for LLD checking Import Table contents.

llvm-objdump did not print anything but just file name if the format is COFF
and -private-headers option is given. This is a patch adds capability for
dumping DLL Import Table, which is specific to the COFF format.

In this patch I defined a new iterator to iterate over import table entries.
Also added a few functions to COFFObjectFile.cpp to access fields of the entry.

Differential Revision: http://llvm-reviews.chandlerc.com/D1719

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191472 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama
2013-09-27 00:07:01 +00:00
parent deac137da7
commit 0c873adc82
15 changed files with 390 additions and 160 deletions

View File

@@ -770,6 +770,14 @@ static void PrintUnwindInfo(const ObjectFile *o) {
}
}
static void printPrivateFileHeader(const ObjectFile *o) {
if (o->isELF()) {
printELFFileHeader(o);
} else if (o->isCOFF()) {
printCOFFFileHeader(o);
}
}
static void DumpObject(const ObjectFile *o) {
outs() << '\n';
outs() << o->getFileName()
@@ -787,8 +795,8 @@ static void DumpObject(const ObjectFile *o) {
PrintSymbolTable(o);
if (UnwindInfo)
PrintUnwindInfo(o);
if (PrivateHeaders && o->isELF())
printELFFileHeader(o);
if (PrivateHeaders)
printPrivateFileHeader(o);
}
/// @brief Dump each object file in \a a;