summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
diff options
context:
space:
mode:
authorJordan Rupprecht <rupprecht@google.com>2019-10-03 22:01:08 +0000
committerJordan Rupprecht <rupprecht@google.com>2019-10-03 22:01:08 +0000
commit9d4a6b1bb2cee55c43ec44664d61fdb3cf932f7a (patch)
tree209e3e967c6b7d06cdbbd36fc3c479004a2e8c3a /llvm/tools/llvm-objdump
parente0a398bf3195746d026d06721a5521d21cc23f3e (diff)
downloadbcm5719-llvm-9d4a6b1bb2cee55c43ec44664d61fdb3cf932f7a.tar.gz
bcm5719-llvm-9d4a6b1bb2cee55c43ec44664d61fdb3cf932f7a.zip
[llvm-objdump] Further rearrange llvm-objdump sections for compatability
Summary: rL371826 rearranged some output from llvm-objdump for GNU objdump compatability, but there still seem to be some more. I think this rearrangement is a little closer. Overview of the ordering which matches GNU objdump: * Archive headers * File headers * Section headers * Symbol table * Dwarf debugging * Relocations (if `--disassemble` is not used) * Section contents * Disassembly Reviewers: jhenderson, justice_adams, grimar, ychen, espindola Reviewed By: jhenderson Subscribers: aprantl, emaste, arichardson, jrtc27, atanasyan, seiya, llvm-commits, MaskRay Tags: #llvm Differential Revision: https://reviews.llvm.org/D68066 llvm-svn: 373671
Diffstat (limited to 'llvm/tools/llvm-objdump')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index f50d3448df3..8b0a04c6104 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2076,27 +2076,37 @@ static void dumpObject(ObjectFile *O, const Archive *A = nullptr,
if (StartAddress.getNumOccurrences() || StopAddress.getNumOccurrences())
checkForInvalidStartStopAddress(O, StartAddress, StopAddress);
+ // Note: the order here matches GNU objdump for compatability.
StringRef ArchiveName = A ? A->getFileName() : "";
- if (FileHeaders)
- printFileHeaders(O);
if (ArchiveHeaders && !MachOOpt && C)
printArchiveChild(ArchiveName, *C);
- if (Disassemble)
- disassembleObject(O, Relocations);
- if (Relocations && !Disassemble)
- printRelocations(O);
- if (DynamicRelocations)
- printDynamicRelocations(O);
+ if (FileHeaders)
+ printFileHeaders(O);
if (PrivateHeaders || FirstPrivateHeader)
printPrivateFileHeaders(O, FirstPrivateHeader);
if (SectionHeaders)
printSectionHeaders(O);
- if (SectionContents)
- printSectionContents(O);
if (SymbolTable)
printSymbolTable(O, ArchiveName);
+ if (DwarfDumpType != DIDT_Null) {
+ std::unique_ptr<DIContext> DICtx = DWARFContext::create(*O);
+ // Dump the complete DWARF structure.
+ DIDumpOptions DumpOpts;
+ DumpOpts.DumpType = DwarfDumpType;
+ DICtx->dump(outs(), DumpOpts);
+ }
+ if (Relocations && !Disassemble)
+ printRelocations(O);
+ if (DynamicRelocations)
+ printDynamicRelocations(O);
+ if (SectionContents)
+ printSectionContents(O);
+ if (Disassemble)
+ disassembleObject(O, Relocations);
if (UnwindInfo)
printUnwindInfo(O);
+
+ // Mach-O specific options:
if (ExportsTrie)
printExportsTrie(O);
if (Rebase)
@@ -2107,17 +2117,12 @@ static void dumpObject(ObjectFile *O, const Archive *A = nullptr,
printLazyBindTable(O);
if (WeakBind)
printWeakBindTable(O);
+
+ // Other special sections:
if (RawClangAST)
printRawClangAST(O);
if (FaultMapSection)
printFaultMaps(O);
- if (DwarfDumpType != DIDT_Null) {
- std::unique_ptr<DIContext> DICtx = DWARFContext::create(*O);
- // Dump the complete DWARF structure.
- DIDumpOptions DumpOpts;
- DumpOpts.DumpType = DwarfDumpType;
- DICtx->dump(outs(), DumpOpts);
- }
}
static void dumpObject(const COFFImportFile *I, const Archive *A,
OpenPOWER on IntegriCloud