]> granicus.if.org Git - llvm/commitdiff
[llvm-objdump] Fix llvm-objdump --all-headers output order
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 13 Sep 2019 08:56:28 +0000 (08:56 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 13 Sep 2019 08:56:28 +0000 (08:56 +0000)
Patch by Justice Adams!

Made llvm-objdump --all-headers output match the order of GNU objdump for compatibility reasons.

Old order of the headers output:
* file header
* section header table
* symbol table
* program header table
* dynamic section

New order of the headers output (GNU compatible):
* file header information
* program header table
* dynamic section
* section header table
* symbol table

(Relevant BugZilla Bug: https://bugs.llvm.org/show_bug.cgi?id=41830)

Differential revision: https://reviews.llvm.org/D67357

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371826 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-objdump/all-headers.test
tools/llvm-objdump/llvm-objdump.cpp

index 2cb239b4b300db8d7c5d5fc39b57d8cc784fd52c..ea45eccee35657c8831fb79d42affc5c0981fb79 100644 (file)
@@ -9,10 +9,10 @@
 # CHECK-NEXT:  architecture: x86_64
 # CHECK-NEXT:  start address: 0x0000000000000000
 # CHECK-EMPTY:
-# CHECK-NEXT:  Sections:
-# CHECK: SYMBOL TABLE:
-# CHECK: Program Header:
+# CHECK-NEXT: Program Header:
 # CHECK: Dynamic Section:
+# CHECK: Sections:
+# CHECK: SYMBOL TABLE:
 
 ## Check how we dump the archives.
 ## Check we dump the appropriate headers for each file in the archive.
 # ARCHIVE: architecture: x86_64
 # ARCHIVE: start address: 0x0000000000000000
 # ARCHIVE: rw-r--r--
-# ARCHIVE: Sections:
-# ARCHIVE: SYMBOL TABLE:
 # ARCHIVE: Program Header:
 # ARCHIVE: Dynamic Section:
+# ARCHIVE: Sections:
+# ARCHIVE: SYMBOL TABLE:
 # ARCHIVE: {{.*}}.a({{.*}}2):   file format ELF64-x86-64
 # ARCHIVE: architecture: x86_64
 # ARCHIVE: start address: 0x0000000000000000
 # ARCHIVE: rw-r--r--
-# ARCHIVE: Sections:
-# ARCHIVE: SYMBOL TABLE:
 # ARCHIVE: Program Header:
 # ARCHIVE: Dynamic Section:
+# ARCHIVE: Sections:
+# ARCHIVE: SYMBOL TABLE:
 
 !ELF
 FileHeader:
index e066365cb1b0cf7607f42aaa2a6220915056e83c..f50d3448df398b82e783e50f452df3fe5b4c9f2a 100644 (file)
@@ -2087,6 +2087,8 @@ static void dumpObject(ObjectFile *O, const Archive *A = nullptr,
     printRelocations(O);
   if (DynamicRelocations)
     printDynamicRelocations(O);
+  if (PrivateHeaders || FirstPrivateHeader)
+    printPrivateFileHeaders(O, FirstPrivateHeader);
   if (SectionHeaders)
     printSectionHeaders(O);
   if (SectionContents)
@@ -2095,8 +2097,6 @@ static void dumpObject(ObjectFile *O, const Archive *A = nullptr,
     printSymbolTable(O, ArchiveName);
   if (UnwindInfo)
     printUnwindInfo(O);
-  if (PrivateHeaders || FirstPrivateHeader)
-    printPrivateFileHeaders(O, FirstPrivateHeader);
   if (ExportsTrie)
     printExportsTrie(O);
   if (Rebase)