summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-07-18 22:44:20 +0000
committerRui Ueyama <ruiu@google.com>2013-07-18 22:44:20 +0000
commita20b9f52d4e202d9ca056b7b9e90a6858b68bb07 (patch)
treee7c11fef1d763e96b3ec63d953c10d406fd77702 /llvm/tools/llvm-readobj
parent03f3d34ffb309c3e35a145d590b5ecd9f07be5c9 (diff)
downloadbcm5719-llvm-a20b9f52d4e202d9ca056b7b9e90a6858b68bb07.tar.gz
bcm5719-llvm-a20b9f52d4e202d9ca056b7b9e90a6858b68bb07.zip
COFFDumper: Dump data directory entries.
Summary: Dump optional data directory entries in the PE/COFF header, so that we can test the output of LLD linker. This patch updates the test binary file, but the source of the binary is the same. I just re-linked the file. I don't know how the previous file was linked, but the previous file did not have any data directory entries for some reason. Reviewers: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1148 llvm-svn: 186623
Diffstat (limited to 'llvm/tools/llvm-readobj')
-rw-r--r--llvm/tools/llvm-readobj/COFFDumper.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp
index 1ceb8fcd316..2f309e30ec2 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/tools/llvm-readobj/COFFDumper.cpp
@@ -60,6 +60,8 @@ private:
void printRelocation(section_iterator SecI, relocation_iterator RelI);
+ void printDataDirectory(uint32_t Index, const std::string &FieldName);
+
void printX64UnwindInfo();
void printRuntimeFunction(
@@ -560,6 +562,14 @@ void COFFDumper::cacheRelocations() {
}
}
+void COFFDumper::printDataDirectory(uint32_t Index, const std::string &FieldName) {
+ const data_directory *Data;
+ if (Obj->getDataDirectory(Index, Data))
+ return;
+ W.printHex(FieldName + "RVA", Data->RelativeVirtualAddress);
+ W.printHex(FieldName + "Size", Data->Size);
+}
+
void COFFDumper::printFileHeaders() {
// Print COFF header
const coff_file_header *COFFHeader = 0;
@@ -621,6 +631,20 @@ void COFFDumper::printFileHeaders() {
W.printNumber("SizeOfHeapReserve", PEHeader->SizeOfHeapReserve);
W.printNumber("SizeOfHeapCommit", PEHeader->SizeOfHeapCommit);
W.printNumber("NumberOfRvaAndSize", PEHeader->NumberOfRvaAndSize);
+
+ if (PEHeader->NumberOfRvaAndSize > 0) {
+ DictScope D(W, "DataDirectory");
+ static const char * const directory[] = {
+ "ExportTable", "ImportTable", "ResourceTable", "ExceptionTable",
+ "CertificateTable", "BaseRelocationTable", "Debug", "Architecture",
+ "GlobalPtr", "TLSTable", "LoadConfigTable", "BoundImport", "IAT",
+ "DelayImportDescriptor", "CLRRuntimeHeader", "Reserved"
+ };
+
+ for (uint32_t i = 0; i < PEHeader->NumberOfRvaAndSize; ++i) {
+ printDataDirectory(i, directory[i]);
+ }
+ }
}
}
OpenPOWER on IntegriCloud