mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-19 02:25:35 +00:00
llvm-objdump/COFF: Print DLL name in the export table header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2a8bbb30f
commit
6010e5dfee
@ -406,9 +406,11 @@ public:
|
|||||||
|
|
||||||
bool operator==(const ExportDirectoryEntryRef &Other) const;
|
bool operator==(const ExportDirectoryEntryRef &Other) const;
|
||||||
error_code getNext(ExportDirectoryEntryRef &Result) const;
|
error_code getNext(ExportDirectoryEntryRef &Result) const;
|
||||||
|
|
||||||
|
error_code getDllName(StringRef &Result) const;
|
||||||
error_code getOrdinal(uint32_t &Result) const;
|
error_code getOrdinal(uint32_t &Result) const;
|
||||||
error_code getExportRVA(uint32_t &Result) const;
|
error_code getExportRVA(uint32_t &Result) const;
|
||||||
error_code getName(StringRef &Result) const;
|
error_code getSymbolName(StringRef &Result) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const export_directory_table_entry *ExportTable;
|
const export_directory_table_entry *ExportTable;
|
||||||
|
@ -949,6 +949,16 @@ ExportDirectoryEntryRef::getNext(ExportDirectoryEntryRef &Result) const {
|
|||||||
return object_error::success;
|
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.
|
// Returns the export ordinal of the current export symbol.
|
||||||
error_code ExportDirectoryEntryRef::getOrdinal(uint32_t &Result) const {
|
error_code ExportDirectoryEntryRef::getOrdinal(uint32_t &Result) const {
|
||||||
Result = ExportTable->OrdinalBase + Index;
|
Result = ExportTable->OrdinalBase + Index;
|
||||||
@ -968,7 +978,7 @@ error_code ExportDirectoryEntryRef::getExportRVA(uint32_t &Result) const {
|
|||||||
|
|
||||||
// Returns the name of the current export symbol. If the symbol is exported only
|
// Returns the name of the current export symbol. If the symbol is exported only
|
||||||
// by ordinal, the empty string is set as a result.
|
// 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;
|
uintptr_t IntPtr = 0;
|
||||||
if (error_code EC = OwningObject->getRvaPtr(
|
if (error_code EC = OwningObject->getRvaPtr(
|
||||||
ExportTable->OrdinalTableRVA, IntPtr))
|
ExportTable->OrdinalTableRVA, IntPtr))
|
||||||
|
@ -11,6 +11,7 @@ IMPORT-NEXT: 365 ExitProcess
|
|||||||
// RUN: FileCheck -check-prefix=EXPORT %s
|
// RUN: FileCheck -check-prefix=EXPORT %s
|
||||||
|
|
||||||
EXPORT: Export Table:
|
EXPORT: Export Table:
|
||||||
|
EXPORT-NEXT: DLL name: export.test.tmp3.dll
|
||||||
EXPORT-NEXT: Ordinal RVA Name
|
EXPORT-NEXT: Ordinal RVA Name
|
||||||
EXPORT-NEXT: 5 0x2008
|
EXPORT-NEXT: 5 0x2008
|
||||||
EXPORT-NEXT: 6 0x2010 exportfn2
|
EXPORT-NEXT: 6 0x2010 exportfn2
|
||||||
|
@ -279,6 +279,10 @@ static void printExportTable(const COFFObjectFile *Obj) {
|
|||||||
export_directory_iterator E = Obj->export_directory_end();
|
export_directory_iterator E = Obj->export_directory_end();
|
||||||
if (I == E)
|
if (I == E)
|
||||||
return;
|
return;
|
||||||
|
StringRef DllName;
|
||||||
|
if (I->getDllName(DllName))
|
||||||
|
return;
|
||||||
|
outs() << " DLL name: " << DllName << "\n";
|
||||||
outs() << " Ordinal RVA Name\n";
|
outs() << " Ordinal RVA Name\n";
|
||||||
error_code EC;
|
error_code EC;
|
||||||
for (; I != E; I = I.increment(EC)) {
|
for (; I != E; I = I.increment(EC)) {
|
||||||
@ -293,7 +297,7 @@ static void printExportTable(const COFFObjectFile *Obj) {
|
|||||||
outs() << format(" % 4d %# 8x", Ordinal, RVA);
|
outs() << format(" % 4d %# 8x", Ordinal, RVA);
|
||||||
|
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
if (I->getName(Name))
|
if (I->getSymbolName(Name))
|
||||||
continue;
|
continue;
|
||||||
if (!Name.empty())
|
if (!Name.empty())
|
||||||
outs() << " " << Name;
|
outs() << " " << Name;
|
||||||
|
Loading…
Reference in New Issue
Block a user