mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
llmv-objdump/COFF: Print export table contents.
This patch adds the capability to dump export table contents. An example output is this: Export Table: Ordinal RVA Name 5 0x2008 exportfn1 6 0x2010 exportfn2 By adding this feature to llvm-objdump, we will be able to use it to check export table contents in LLD's tests. Currently we are doing binary comparison in the tests, which is fragile and not readable to humans. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199358 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -24,7 +24,9 @@ namespace llvm {
|
||||
|
||||
namespace object {
|
||||
class ImportDirectoryEntryRef;
|
||||
class ExportDirectoryEntryRef;
|
||||
typedef content_iterator<ImportDirectoryEntryRef> import_directory_iterator;
|
||||
typedef content_iterator<ExportDirectoryEntryRef> export_directory_iterator;
|
||||
|
||||
/// The DOS compatible header at the front of all PE/COFF executables.
|
||||
struct dos_header {
|
||||
@@ -245,6 +247,7 @@ struct coff_aux_section_definition {
|
||||
class COFFObjectFile : public ObjectFile {
|
||||
private:
|
||||
friend class ImportDirectoryEntryRef;
|
||||
friend class ExportDirectoryEntryRef;
|
||||
const coff_file_header *COFFHeader;
|
||||
const pe32_header *PE32Header;
|
||||
const data_directory *DataDirectory;
|
||||
@@ -254,6 +257,7 @@ private:
|
||||
uint32_t StringTableSize;
|
||||
const import_directory_table_entry *ImportDirectory;
|
||||
uint32_t NumberOfImportDirectory;
|
||||
const export_directory_table_entry *ExportDirectory;
|
||||
|
||||
error_code getString(uint32_t offset, StringRef &Res) const;
|
||||
|
||||
@@ -263,6 +267,7 @@ private:
|
||||
|
||||
error_code initSymbolTablePtr();
|
||||
error_code initImportTablePtr();
|
||||
error_code initExportTablePtr();
|
||||
|
||||
protected:
|
||||
virtual error_code getSymbolNext(DataRefImpl Symb, SymbolRef &Res) const;
|
||||
@@ -336,6 +341,8 @@ public:
|
||||
|
||||
import_directory_iterator import_directory_begin() const;
|
||||
import_directory_iterator import_directory_end() const;
|
||||
export_directory_iterator export_directory_begin() const;
|
||||
export_directory_iterator export_directory_end() const;
|
||||
|
||||
error_code getHeader(const coff_file_header *&Res) const;
|
||||
error_code getCOFFHeader(const coff_file_header *&Res) const;
|
||||
@@ -388,6 +395,26 @@ private:
|
||||
uint32_t Index;
|
||||
const COFFObjectFile *OwningObject;
|
||||
};
|
||||
|
||||
// The iterator for the export directory table entry.
|
||||
class ExportDirectoryEntryRef {
|
||||
public:
|
||||
ExportDirectoryEntryRef() : OwningObject(0) {}
|
||||
ExportDirectoryEntryRef(const export_directory_table_entry *Table, uint32_t I,
|
||||
const COFFObjectFile *Owner)
|
||||
: ExportTable(Table), Index(I), OwningObject(Owner) {}
|
||||
|
||||
bool operator==(const ExportDirectoryEntryRef &Other) const;
|
||||
error_code getNext(ExportDirectoryEntryRef &Result) const;
|
||||
error_code getOrdinal(uint32_t &Result) const;
|
||||
error_code getExportRVA(uint32_t &Result) const;
|
||||
error_code getName(StringRef &Result) const;
|
||||
|
||||
private:
|
||||
const export_directory_table_entry *ExportTable;
|
||||
uint32_t Index;
|
||||
const COFFObjectFile *OwningObject;
|
||||
};
|
||||
} // end namespace object
|
||||
} // end namespace llvm
|
||||
|
||||
|
Reference in New Issue
Block a user