llvm-objdump/COFF: Print ordinal base number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199518 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama
2014-01-17 22:02:24 +00:00
parent ceaf829339
commit 9106d365f5
4 changed files with 12 additions and 0 deletions

View File

@@ -408,6 +408,7 @@ public:
error_code getNext(ExportDirectoryEntryRef &Result) const;
error_code getDllName(StringRef &Result) const;
error_code getOrdinalBase(uint32_t &Result) const;
error_code getOrdinal(uint32_t &Result) const;
error_code getExportRVA(uint32_t &Result) const;
error_code getSymbolName(StringRef &Result) const;

View File

@@ -959,6 +959,12 @@ error_code ExportDirectoryEntryRef::getDllName(StringRef &Result) const {
return object_error::success;
}
// Returns the starting ordinal number.
error_code ExportDirectoryEntryRef::getOrdinalBase(uint32_t &Result) const {
Result = ExportTable->OrdinalBase;
return object_error::success;
}
// Returns the export ordinal of the current export symbol.
error_code ExportDirectoryEntryRef::getOrdinal(uint32_t &Result) const {
Result = ExportTable->OrdinalBase + Index;

View File

@@ -12,6 +12,7 @@ IMPORT-NEXT: 365 ExitProcess
EXPORT: Export Table:
EXPORT-NEXT: DLL name: export.test.tmp3.dll
EXPORT-NEXT: Ordinal base: 5
EXPORT-NEXT: Ordinal RVA Name
EXPORT-NEXT: 5 0x2008
EXPORT-NEXT: 6 0x2010 exportfn2

View File

@@ -286,9 +286,13 @@ static void printExportTable(const COFFObjectFile *Obj) {
if (I == E)
return;
StringRef DllName;
uint32_t OrdinalBase;
if (I->getDllName(DllName))
return;
if (I->getOrdinalBase(OrdinalBase))
return;
outs() << " DLL name: " << DllName << "\n";
outs() << " Ordinal base: " << OrdinalBase << "\n";
outs() << " Ordinal RVA Name\n";
error_code EC;
for (; I != E; I = I.increment(EC)) {