diff --git a/llvm/test/MC/COFF/symidx.s b/llvm/test/MC/COFF/symidx.s --- a/llvm/test/MC/COFF/symidx.s +++ b/llvm/test/MC/COFF/symidx.s @@ -8,8 +8,8 @@ .symidx bar .symidx foo -// CHECK: Contents of section .data: -// CHECK-NEXT: 0000 0[[BAR:[1-9]]]000000 0[[FOO:[1-9]]]000000 // CHECK: SYMBOL TABLE: -// CHECK: [ [[FOO]]](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 foo -// CHECK-NEXT: [ [[BAR]]](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000001 bar +// CHECK: [ [[FOO:[1-9]]]](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 foo +// CHECK-NEXT: [ [[BAR:[1-9]]]](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000001 bar +// CHECK: Contents of section .data: +// CHECK-NEXT: 0000 0[[BAR]]000000 0[[FOO]]000000 diff --git a/llvm/test/tools/llvm-objdump/X86/adjust-vma.test b/llvm/test/tools/llvm-objdump/X86/adjust-vma.test --- a/llvm/test/tools/llvm-objdump/X86/adjust-vma.test +++ b/llvm/test/tools/llvm-objdump/X86/adjust-vma.test @@ -3,6 +3,35 @@ # RUN: llvm-objdump --all-headers -D -z --adjust-vma=0x0 %t | FileCheck %s --check-prefixes=COMMON,NOADJUST # RUN: llvm-objdump --all-headers -D -z --adjust-vma=0x123000 %t | FileCheck %s --check-prefixes=COMMON,ADJUST +# NOADJUST: Sections: +# NOADJUST-NEXT: Idx Name Size VMA Type +# NOADJUST-NEXT: 0 00000000 0000000000000000 +# NOADJUST-NEXT: 1 .text 00000002 0000000000000000 TEXT +# NOADJUST-NEXT: 2 .debug_str 00000004 0000000000000000 +# NOADJUST-NEXT: 3 .rela.debug_str 00000018 0000000000000000 +# NOADJUST-NEXT: 4 .data 00000004 0000000000000000 DATA +# NOADJUST-NEXT: 5 .rela.data 00000018 0000000000000000 +# NOADJUST-NEXT: 6 .symtab 00000060 0000000000000000 +# NOADJUST-NEXT: 7 .strtab 00000010 0000000000000000 +# NOADJUST-NEXT: 8 .shstrtab 0000003c 0000000000000000 + +# ADJUST: Sections: +# ADJUST-NEXT: Idx Name Size VMA Type +# ADJUST-NEXT: 0 00000000 0000000000000000 +# ADJUST-NEXT: 1 .text 00000002 0000000000123000 TEXT +# ADJUST-NEXT: 2 .debug_str 00000004 0000000000000000 +# ADJUST-NEXT: 3 .rela.debug_str 00000018 0000000000000000 +# ADJUST-NEXT: 4 .data 00000004 0000000000123000 DATA +# ADJUST-NEXT: 5 .rela.data 00000018 0000000000000000 +# ADJUST-NEXT: 6 .symtab 00000060 0000000000000000 +# ADJUST-NEXT: 7 .strtab 00000010 0000000000000000 +# ADJUST-NEXT: 8 .shstrtab 0000003c 0000000000000000 + +# COMMON: SYMBOL TABLE: +# COMMON-NEXT: 0000000000000001 l F .text 00000000 func +# COMMON-NEXT: 0000000000000000 .text 00000000 sym +# COMMON-NEXT: 0000000000000000 l d .text 00000000 .text + # NOADJUST: 0000000000000000 sym: # NOADJUST-NEXT: 0: {{.*}} nop # NOADJUST: 0000000000000001 func: @@ -41,35 +70,6 @@ # COMMON-NEXT: 0: {{.*}} addb %al, (%rax) ## ... There are more lines here. We do not care. -# NOADJUST: Sections: -# NOADJUST-NEXT: Idx Name Size VMA Type -# NOADJUST-NEXT: 0 00000000 0000000000000000 -# NOADJUST-NEXT: 1 .text 00000002 0000000000000000 TEXT -# NOADJUST-NEXT: 2 .debug_str 00000004 0000000000000000 -# NOADJUST-NEXT: 3 .rela.debug_str 00000018 0000000000000000 -# NOADJUST-NEXT: 4 .data 00000004 0000000000000000 DATA -# NOADJUST-NEXT: 5 .rela.data 00000018 0000000000000000 -# NOADJUST-NEXT: 6 .symtab 00000060 0000000000000000 -# NOADJUST-NEXT: 7 .strtab 00000010 0000000000000000 -# NOADJUST-NEXT: 8 .shstrtab 0000003c 0000000000000000 - -# ADJUST: Sections: -# ADJUST-NEXT: Idx Name Size VMA Type -# ADJUST-NEXT: 0 00000000 0000000000000000 -# ADJUST-NEXT: 1 .text 00000002 0000000000123000 TEXT -# ADJUST-NEXT: 2 .debug_str 00000004 0000000000000000 -# ADJUST-NEXT: 3 .rela.debug_str 00000018 0000000000000000 -# ADJUST-NEXT: 4 .data 00000004 0000000000123000 DATA -# ADJUST-NEXT: 5 .rela.data 00000018 0000000000000000 -# ADJUST-NEXT: 6 .symtab 00000060 0000000000000000 -# ADJUST-NEXT: 7 .strtab 00000010 0000000000000000 -# ADJUST-NEXT: 8 .shstrtab 0000003c 0000000000000000 - -# COMMON: SYMBOL TABLE: -# COMMON-NEXT: 0000000000000001 l F .text 00000000 func -# COMMON-NEXT: 0000000000000000 .text 00000000 sym -# COMMON-NEXT: 0000000000000000 l d .text 00000000 .text - --- !ELF FileHeader: Class: ELFCLASS64 diff --git a/llvm/test/tools/llvm-objdump/X86/demangle.s b/llvm/test/tools/llvm-objdump/X86/demangle.s --- a/llvm/test/tools/llvm-objdump/X86/demangle.s +++ b/llvm/test/tools/llvm-objdump/X86/demangle.s @@ -1,13 +1,13 @@ # RUN: llvm-mc %s -filetype=obj -triple=x86_64-pc-linux -o %t # RUN: llvm-objdump -t -r --demangle %t | FileCheck %s -## Check we demangle symbols when printing relocations. -# CHECK: 000000000000001 R_X86_64_PLT32 foo()-4 - ## Check we demangle symbols when printing symbol table. # CHECK: SYMBOL TABLE: # CHECK-NEXT: 0000000000000000 g F .text 00000000 foo() +## Check we demangle symbols when printing relocations. +# CHECK: 000000000000001 R_X86_64_PLT32 foo()-4 + ## Check the case when relocations are inlined into disassembly. # RUN: llvm-objdump -d -r --demangle %t | FileCheck %s --check-prefix=INLINE # INLINE: foo(): diff --git a/llvm/test/tools/llvm-objdump/X86/out-of-section-sym.test b/llvm/test/tools/llvm-objdump/X86/out-of-section-sym.test --- a/llvm/test/tools/llvm-objdump/X86/out-of-section-sym.test +++ b/llvm/test/tools/llvm-objdump/X86/out-of-section-sym.test @@ -5,12 +5,13 @@ // RUN: cmp %t0 %t1 // RUN: FileCheck --input-file %t0 %s -CHECK: Disassembly of section .text: -CHECK-EMPTY: -CHECK-NEXT: _start: -CHECK-NEXT: 10: c3 retl -CHECK-NEXT: SYMBOL TABLE: +CHECK: SYMBOL TABLE: CHECK-NEXT: 00000010 l d .text 00000000 .text CHECK-NEXT: 00000010 .text 00000000 _start CHECK-NEXT: 00000020 .text 00000000 _fdata CHECK-NEXT: 00000010 .text 00000000 _ftext +CHECK-EMPTY: +CHECK-NEXT: Disassembly of section .text: +CHECK-EMPTY: +CHECK-NEXT: _start: +CHECK-NEXT: 10: c3 retl diff --git a/llvm/test/tools/llvm-objdump/all-headers.test b/llvm/test/tools/llvm-objdump/all-headers.test --- a/llvm/test/tools/llvm-objdump/all-headers.test +++ b/llvm/test/tools/llvm-objdump/all-headers.test @@ -23,17 +23,17 @@ # RUN: llvm-objdump --all-headers %t.a | FileCheck %s --check-prefix=ARCHIVE # ARCHIVE: {{.*}}.a({{.*}}): file format ELF64-x86-64 +# ARCHIVE: rw-r--r-- # ARCHIVE: architecture: x86_64 # ARCHIVE: start address: 0x0000000000000000 -# ARCHIVE: rw-r--r-- # ARCHIVE: Program Header: # ARCHIVE: Dynamic Section: # ARCHIVE: Sections: # ARCHIVE: SYMBOL TABLE: # ARCHIVE: {{.*}}.a({{.*}}2): file format ELF64-x86-64 +# ARCHIVE: rw-r--r-- # ARCHIVE: architecture: x86_64 # ARCHIVE: start address: 0x0000000000000000 -# ARCHIVE: rw-r--r-- # ARCHIVE: Program Header: # ARCHIVE: Dynamic Section: # ARCHIVE: Sections: diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2077,26 +2077,28 @@ checkForInvalidStartStopAddress(O, StartAddress, StopAddress); 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 (SectionContents) + printSectionContents(O); + if (Relocations && !Disassemble) + printRelocations(O); + if (DynamicRelocations && !Disassemble) + printDynamicRelocations(O); + if (Disassemble) + disassembleObject(O, Relocations); if (UnwindInfo) printUnwindInfo(O); + + // Mach-O specific options: if (ExportsTrie) printExportsTrie(O); if (Rebase) @@ -2107,6 +2109,8 @@ printLazyBindTable(O); if (WeakBind) printWeakBindTable(O); + + // Other special sections: if (RawClangAST) printRawClangAST(O); if (FaultMapSection)