From: George Rimar Date: Fri, 13 Sep 2019 08:56:28 +0000 (+0000) Subject: [llvm-objdump] Fix llvm-objdump --all-headers output order X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b7a447e5aa1de10fe70d150545078b197dbbbd2;p=llvm [llvm-objdump] Fix llvm-objdump --all-headers output order 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 --- diff --git a/test/tools/llvm-objdump/all-headers.test b/test/tools/llvm-objdump/all-headers.test index 2cb239b4b30..ea45eccee35 100644 --- a/test/tools/llvm-objdump/all-headers.test +++ b/test/tools/llvm-objdump/all-headers.test @@ -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. @@ -26,18 +26,18 @@ # 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: diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index e066365cb1b..f50d3448df3 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -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)