Page MenuHomePhabricator

D56588.diff
No OneTemporary

File Metadata

Created
Sun, May 19, 5:33 AM

D56588.diff

Index: llvm/trunk/test/tools/llvm-objdump/all-headers.test
===================================================================
--- llvm/trunk/test/tools/llvm-objdump/all-headers.test
+++ llvm/trunk/test/tools/llvm-objdump/all-headers.test
@@ -0,0 +1,20 @@
+# RUN: yaml2obj %s > %t
+# RUN: llvm-objdump --all-headers %t | FileCheck %s
+
+## Check we print file format, architecture and start address before
+## anything else when using --all-headers.
+
+# CHECK: file format ELF64-x86-64
+# CHECK-EMPTY:
+# CHECK-NEXT: architecture: x86_64
+# CHECK-NEXT: start address: 0x0000000000000000
+# CHECK-EMPTY:
+# CHECK-NEXT: Sections:
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: EM_X86_64
+Sections:
Index: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
@@ -2301,8 +2301,7 @@
StringRef Fmt = o->getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64;
uint64_t Address = StartAddrOrErr.get();
outs() << "start address: "
- << "0x" << format(Fmt.data(), Address)
- << "\n";
+ << "0x" << format(Fmt.data(), Address) << "\n\n";
}
static void printArchiveChild(StringRef Filename, const Archive::Child &C) {
@@ -2382,6 +2381,8 @@
outs() << ":\tfile format " << o->getFileFormatName() << "\n\n";
}
+ if (FileHeaders)
+ printFileHeaders(o);
if (ArchiveHeaders && !MachOOpt && c)
printArchiveChild(ArchiveName, *c);
if (Disassemble)
@@ -2400,8 +2401,6 @@
PrintUnwindInfo(o);
if (PrivateHeaders || FirstPrivateHeader)
printPrivateFileHeaders(o, FirstPrivateHeader);
- if (FileHeaders)
- printFileHeaders(o);
if (ExportsTrie)
printExportsTrie(o);
if (Rebase)
@@ -2510,7 +2509,8 @@
InputFilenames.push_back("a.out");
if (AllHeaders)
- PrivateHeaders = Relocations = SectionHeaders = SymbolTable = true;
+ FileHeaders = PrivateHeaders = Relocations = SectionHeaders = SymbolTable =
+ true;
if (DisassembleAll || PrintSource || PrintLines)
Disassemble = true;

Event Timeline