This patch adds a new flag "-coff-imports" to llvm-readobj.

When the flag is given, the command prints out the COFF import table.

Currently only the import table directory will be printed.
I'm going to make another patch to print out the imported symbols.

The implementation of import directory entry iterator in
COFFObjectFile.cpp was buggy. This patch fixes that too.

http://reviews.llvm.org/D5569



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218891 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama
2014-10-02 17:02:18 +00:00
parent ddc725b9b8
commit f3cd10bdc3
8 changed files with 68 additions and 5 deletions

View File

@@ -141,6 +141,10 @@ namespace opts {
cl::opt<bool>
MipsPLTGOT("mips-plt-got",
cl::desc("Display the MIPS GOT and PLT GOT sections"));
// -coff-imports
cl::opt<bool>
COFFImports("coff-imports", cl::desc("Display the PE/COFF import table"));
} // namespace opts
static int ReturnValue = EXIT_SUCCESS;
@@ -266,6 +270,8 @@ static void dumpObject(const ObjectFile *Obj) {
if (isMipsArch(Obj->getArch()) && Obj->isELF())
if (opts::MipsPLTGOT)
Dumper->printMipsPLTGOT();
if (opts::COFFImports)
Dumper->printCOFFImports();
}