[llvm] r199422 - llvm-objdump/COFF: Print DLL name in the export table header.
Rui Ueyama
ruiu at google.com
Thu Jan 16 12:50:34 PST 2014
Author: ruiu
Date: Thu Jan 16 14:50:34 2014
New Revision: 199422
URL: http://llvm.org/viewvc/llvm-project?rev=199422&view=rev
Log:
llvm-objdump/COFF: Print DLL name in the export table header.
Modified:
llvm/trunk/include/llvm/Object/COFF.h
llvm/trunk/lib/Object/COFFObjectFile.cpp
llvm/trunk/test/tools/llvm-objdump/coff-private-headers.test
llvm/trunk/tools/llvm-objdump/COFFDump.cpp
Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=199422&r1=199421&r2=199422&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Thu Jan 16 14:50:34 2014
@@ -406,9 +406,11 @@ public:
bool operator==(const ExportDirectoryEntryRef &Other) const;
error_code getNext(ExportDirectoryEntryRef &Result) const;
+
+ error_code getDllName(StringRef &Result) const;
error_code getOrdinal(uint32_t &Result) const;
error_code getExportRVA(uint32_t &Result) const;
- error_code getName(StringRef &Result) const;
+ error_code getSymbolName(StringRef &Result) const;
private:
const export_directory_table_entry *ExportTable;
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=199422&r1=199421&r2=199422&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Thu Jan 16 14:50:34 2014
@@ -949,6 +949,16 @@ ExportDirectoryEntryRef::getNext(ExportD
return object_error::success;
}
+// Returns the name of the current export symbol. If the symbol is exported only
+// by ordinal, the empty string is set as a result.
+error_code ExportDirectoryEntryRef::getDllName(StringRef &Result) const {
+ uintptr_t IntPtr = 0;
+ if (error_code EC = OwningObject->getRvaPtr(ExportTable->NameRVA, IntPtr))
+ return EC;
+ Result = StringRef(reinterpret_cast<const char *>(IntPtr));
+ 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;
@@ -968,7 +978,7 @@ error_code ExportDirectoryEntryRef::getE
// Returns the name of the current export symbol. If the symbol is exported only
// by ordinal, the empty string is set as a result.
-error_code ExportDirectoryEntryRef::getName(StringRef &Result) const {
+error_code ExportDirectoryEntryRef::getSymbolName(StringRef &Result) const {
uintptr_t IntPtr = 0;
if (error_code EC = OwningObject->getRvaPtr(
ExportTable->OrdinalTableRVA, IntPtr))
Modified: llvm/trunk/test/tools/llvm-objdump/coff-private-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/coff-private-headers.test?rev=199422&r1=199421&r2=199422&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/coff-private-headers.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/coff-private-headers.test Thu Jan 16 14:50:34 2014
@@ -11,6 +11,7 @@ IMPORT-NEXT: 365 ExitProcess
// RUN: FileCheck -check-prefix=EXPORT %s
EXPORT: Export Table:
+EXPORT-NEXT: DLL name: export.test.tmp3.dll
EXPORT-NEXT: Ordinal RVA Name
EXPORT-NEXT: 5 0x2008
EXPORT-NEXT: 6 0x2010 exportfn2
Modified: llvm/trunk/tools/llvm-objdump/COFFDump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/COFFDump.cpp?rev=199422&r1=199421&r2=199422&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/COFFDump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/COFFDump.cpp Thu Jan 16 14:50:34 2014
@@ -279,6 +279,10 @@ static void printExportTable(const COFFO
export_directory_iterator E = Obj->export_directory_end();
if (I == E)
return;
+ StringRef DllName;
+ if (I->getDllName(DllName))
+ return;
+ outs() << " DLL name: " << DllName << "\n";
outs() << " Ordinal RVA Name\n";
error_code EC;
for (; I != E; I = I.increment(EC)) {
@@ -293,7 +297,7 @@ static void printExportTable(const COFFO
outs() << format(" % 4d %# 8x", Ordinal, RVA);
StringRef Name;
- if (I->getName(Name))
+ if (I->getSymbolName(Name))
continue;
if (!Name.empty())
outs() << " " << Name;
More information about the llvm-commits
mailing list