[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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373671 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/ELF/arm-icf-exidx.s b/test/ELF/arm-icf-exidx.s
index 6e89300..593491f 100644
--- a/test/ELF/arm-icf-exidx.s
+++ b/test/ELF/arm-icf-exidx.s
@@ -22,6 +22,9 @@
  nop
  bx lr
 
+// CHECK: Contents of section .ARM.exidx:
+// CHECK-NEXT:  100d4 18100000 b0b0b080 14100000 01000000
+
 // CHECK: Disassembly of section .text:
 // CHECK-EMPTY:
 // CHECK-NEXT: g:
@@ -29,6 +32,3 @@
 // CHECK: __aeabi_unwind_cpp_pr0:
 // CHECK-NEXT:    110f0:        00 f0 20 e3     nop
 // CHECK-NEXT:    110f4:        1e ff 2f e1     bx      lr
-
-// CHECK: Contents of section .ARM.exidx:
-// CHECK-NEXT:  100d4 18100000 b0b0b080 14100000 01000000
diff --git a/test/ELF/arm-target1.s b/test/ELF/arm-target1.s
index 46a4f0b..99b52b0 100644
--- a/test/ELF/arm-target1.s
+++ b/test/ELF/arm-target1.s
@@ -25,12 +25,12 @@
         .word 32
 // Force generation of $d.0 as section is not all data
   nop
+// RELATIVE: SYMBOL TABLE:
+// RELATIVE: 00001154         .text           00000000 patatino
 // RELATIVE: Disassembly of section .text:
 // RELATIVE-EMPTY:
 // RELATIVE: $d.0:
 // RELATIVE:     1150:       04 00 00 00     .word   0x00000004
-// RELATIVE: SYMBOL TABLE:
-// RELATIVE: 00001154         .text           00000000 patatino
 
 // ABS: can't create dynamic relocation R_ARM_TARGET1 against symbol: patatino in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
 // ABS: >>> defined in {{.*}}.o
diff --git a/test/ELF/eh-frame-hdr-abs-fde.s b/test/ELF/eh-frame-hdr-abs-fde.s
index 797f639..f3b3cac 100644
--- a/test/ELF/eh-frame-hdr-abs-fde.s
+++ b/test/ELF/eh-frame-hdr-abs-fde.s
@@ -7,6 +7,10 @@
 # RUN: ld.lld --eh-frame-hdr %t.o -o %t
 # RUN: llvm-objdump -s -dwarf=frames %t | FileCheck %s
 
+# CHECK: Augmentation:          "zLR"
+# CHECK: Augmentation data:     00 1B
+#                                  ^-- DW_EH_PE_pcrel | DW_EH_PE_udata4 | DW_EH_PE_signed
+
 # CHECK:      Contents of section .eh_frame_hdr:
 # CHECK-NEXT:  200190 011b033b 14000000 01000000 54100000
 #                                                ^-- 0x201000 - 0x200190
@@ -15,10 +19,6 @@
 # CHECK:      Contents of section .text:
 # CHECK-NEXT:  2011e4 90
 
-# CHECK: Augmentation:          "zLR"
-# CHECK: Augmentation data:     00 1B
-#                                  ^-- DW_EH_PE_pcrel | DW_EH_PE_udata4 | DW_EH_PE_signed
-
 	.text
   .globl __start
 __start:
diff --git a/test/ELF/got32-i386.s b/test/ELF/got32-i386.s
index f3cee3a..17ba09b 100644
--- a/test/ELF/got32-i386.s
+++ b/test/ELF/got32-i386.s
@@ -13,11 +13,11 @@
  movl foo@GOT, %ebx
 
 ## 73728 == 0x12000 == ADDR(.got)
-# CHECK:       _start:
-# CHECK-NEXT:   4010f5: 8b 1d {{.*}}  movl 4202748, %ebx
 # CHECK: Sections:
 # CHECK:  Name Size     VMA
 # CHECK:  .got 00000004 00000000004020fc
+# CHECK:       _start:
+# CHECK-NEXT:   4010f5: 8b 1d {{.*}}  movl 4202748, %ebx
 
 # RUN: not ld.lld %t.o -o %t -pie 2>&1 | FileCheck %s --check-prefix=ERR
 # ERR: error: symbol 'foo' cannot be preempted; recompile with -fPIE
diff --git a/test/ELF/got32x-i386.s b/test/ELF/got32x-i386.s
index bc24795..c54e920 100644
--- a/test/ELF/got32x-i386.s
+++ b/test/ELF/got32x-i386.s
@@ -32,14 +32,14 @@
 # RUN: llvm-objdump -section-headers -d %t1 | FileCheck %s
 
 ## 73728 == 0x12000 == ADDR(.got)
+# CHECK: Sections:
+# CHECK:  Name Size     VMA
+# CHECK:  .got.plt 0000000c 0000000000403134
 # CHECK:       _start:
 # CHECK-NEXT:   401115: 8b 05 {{.*}} movl 4202800, %eax
 # CHECK-NEXT:   40111b: 8b 1d {{.*}} movl 4202800, %ebx
 # CHECK-NEXT:   401121: 8b 80 {{.*}} movl -4100(%eax), %eax
 # CHECK-NEXT:   401127: 8b 83 {{.*}} movl -4100(%ebx), %eax
-# CHECK: Sections:
-# CHECK:  Name Size     VMA
-# CHECK:  .got.plt 0000000c 0000000000403134
 
 # RUN: not ld.lld %S/Inputs/i386-got32x-baseless.elf -o %t1 -pie 2>&1 | \
 # RUN:   FileCheck %s --check-prefix=ERR
diff --git a/test/ELF/i386-pc8-pc16-addend.s b/test/ELF/i386-pc8-pc16-addend.s
index 7a4d208..5660f01 100644
--- a/test/ELF/i386-pc8-pc16-addend.s
+++ b/test/ELF/i386-pc8-pc16-addend.s
@@ -3,12 +3,12 @@
 
 # RUN: ld.lld %t1.o -o %t.out
 # RUN: llvm-objdump -s -t %t.out | FileCheck %s
+# CHECK: SYMBOL TABLE:
+# CHECK: 004010b7 .und
 # CHECK:      Contents of section .text:
 # CHECK-NEXT:  4010b4 020000
 ## 0x4010b7 - 0x4010b4 + addend(-1) = 0x02
 ## 0x4010b7 - 0x4010b5 + addend(-2) = 0x0000
-# CHECK: SYMBOL TABLE:
-# CHECK: 004010b7 .und
 
 .byte  und-.-1
 .short und-.-2
diff --git a/test/ELF/i386-reloc8-reloc16-addend.s b/test/ELF/i386-reloc8-reloc16-addend.s
index 16b953e..0fb7124 100644
--- a/test/ELF/i386-reloc8-reloc16-addend.s
+++ b/test/ELF/i386-reloc8-reloc16-addend.s
@@ -3,12 +3,12 @@
 
 # RUN: ld.lld -Ttext=0x0 %t1.o -o %t.out
 # RUN: llvm-objdump -s -t %t.out | FileCheck %s
-# CHECK:      Contents of section .text:
-# CHECK-NEXT:  0000 020100
 ## 0x3 + addend(-1) = 0x02
 ## 0x3 + addend(-2) = 0x0100
 # CHECK: SYMBOL TABLE:
 # CHECK: 00000003 .und
+# CHECK:      Contents of section .text:
+# CHECK-NEXT:  0000 020100
 
 .byte  und-1
 .short und-2
diff --git a/test/ELF/i386-retpoline-nopic.s b/test/ELF/i386-retpoline-nopic.s
index 4520d9e..4edd9ef 100644
--- a/test/ELF/i386-retpoline-nopic.s
+++ b/test/ELF/i386-retpoline-nopic.s
@@ -6,6 +6,10 @@
 // RUN: ld.lld %t1.o %t2.so -o %t.exe -z retpolineplt
 // RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
 
+// CHECK:      Contents of section .got.plt:
+// CHECK-NEXT: 40224000 00000000 00000000 10124000
+// CHECK-NEXT: 30124000
+
 // CHECK:      Disassembly of section .plt:
 // CHECK-EMPTY:
 // CHECK-NEXT: .plt:
@@ -56,10 +60,6 @@
 // CHECK-NEXT: 40123e:       int3
 // CHECK-NEXT: 40123f:       int3
 
-// CHECK:      Contents of section .got.plt:
-// CHECK-NEXT: 40224000 00000000 00000000 10124000
-// CHECK-NEXT: 30124000
-
 .global _start
 _start:
   jmp bar@PLT
diff --git a/test/ELF/i386-retpoline-pic.s b/test/ELF/i386-retpoline-pic.s
index f7eb079..a212f34 100644
--- a/test/ELF/i386-retpoline-pic.s
+++ b/test/ELF/i386-retpoline-pic.s
@@ -6,6 +6,10 @@
 // RUN: ld.lld %t1.o %t2.so -o %t.exe -z retpolineplt -pie
 // RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
 
+// CHECK:      Contents of section .got.plt:
+// CHECK-NEXT: 32a8 40220000 00000000 00000000 11120000
+// CHECK-NEXT: 32b8 31120000
+
 // CHECK:      Disassembly of section .plt:
 // CHECK-EMPTY:
 // CHECK-NEXT: .plt:
@@ -53,10 +57,6 @@
 // CHECK-NEXT: 123e:       int3
 // CHECK-NEXT: 123f:       int3
 
-// CHECK:      Contents of section .got.plt:
-// CHECK-NEXT: 32a8 40220000 00000000 00000000 11120000
-// CHECK-NEXT: 32b8 31120000
-
 .global _start
 _start:
   jmp bar@PLT
diff --git a/test/ELF/mips-32.s b/test/ELF/mips-32.s
index d2c8aff..eb49be2 100644
--- a/test/ELF/mips-32.s
+++ b/test/ELF/mips-32.s
@@ -24,6 +24,9 @@
 v2:
   .word v1   # R_MIPS_32 target v1 addend 0
 
+# SYM: SYMBOL TABLE:
+# SYM: 00011000  .data  00000000 v1
+
 # BE: Contents of section .data:
 # BE-NEXT: {{.*}} 00000004 00011000
 #                 ^-- v2+4 ^-- v1
@@ -31,10 +34,6 @@
 # EL: Contents of section .data:
 # EL-NEXT: {{.*}} 04000000 00100100
 #                 ^-- v2+4 ^-- v1
-
-# SYM: SYMBOL TABLE:
-# SYM: 00011000  .data  00000000 v1
-
 # REL: Relocation section
 # REL:      {{.*}} R_MIPS_REL32
 # REL-NEXT: {{.*}} R_MIPS_REL32 [[V2:[0-9a-f]+]]
diff --git a/test/ELF/mips-64-got.s b/test/ELF/mips-64-got.s
index 2a6b78d..59a8f1d 100644
--- a/test/ELF/mips-64-got.s
+++ b/test/ELF/mips-64-got.s
@@ -10,6 +10,8 @@
 # RUN: llvm-objdump -d -t --no-show-raw-insn %t.exe | FileCheck %s
 # RUN: llvm-readelf -r -s -A %t.exe | FileCheck -check-prefix=GOT %s
 
+# CHECK: {{[0-9a-f]+}}1c8  .text  00000000 foo
+
 # CHECK:      __start:
 # CHECK-NEXT:    {{.*}}  ld      $2, -32736($gp)
 # CHECK-NEXT:    {{.*}}  daddiu  $2,  $2, 456
@@ -17,8 +19,6 @@
 # CHECK-NEXT:    {{.*}}  addiu   $2,  $2, -32720
 # CHECK-NEXT:    {{.*}}  addiu   $2,  $2, -32712
 
-# CHECK: {{[0-9a-f]+}}1c8  .text  00000000 foo
-
 # GOT: There are no relocations in this file.
 
 # GOT: Symbol table '.symtab'
diff --git a/test/ELF/mips-64-rels.s b/test/ELF/mips-64-rels.s
index b85ba30..0e21f63 100644
--- a/test/ELF/mips-64-rels.s
+++ b/test/ELF/mips-64-rels.s
@@ -11,6 +11,12 @@
 # RUN: llvm-objdump -d -s -t --print-imm-hex --no-show-raw-insn %t.exe | FileCheck %s
 # RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
 
+# CHECK: 0000000000037ff0   .got    00000000 .hidden _gp
+
+# CHECK:      Contents of section .rodata:
+# CHECK-NEXT:  {{[0-9a-f]+}} ffffffff fffe9014
+#                            ^-- 0x21004 - 0x37ff0 = 0xfffffffffffe9014
+
 # CHECK:      __start:
 # CHECK-NEXT:    21000:  lui     $gp, 0x1
 #                                     ^-- 0x21000 - 0x37ff0
@@ -22,12 +28,6 @@
 #                                     ^-- 0 - 0xfffffffffffe9010
 #                                     ^-- %lo(0x16ff0)
 
-# CHECK:      Contents of section .rodata:
-# CHECK-NEXT:  {{[0-9a-f]+}} ffffffff fffe9014
-#                            ^-- 0x21004 - 0x37ff0 = 0xfffffffffffe9014
-
-# CHECK: 0000000000037ff0   .got    00000000 .hidden _gp
-
 # REL:      Relocations [
 # REL-NEXT: ]
 
diff --git a/test/ELF/mips-64.s b/test/ELF/mips-64.s
index 037daaf..655fee6 100644
--- a/test/ELF/mips-64.s
+++ b/test/ELF/mips-64.s
@@ -13,11 +13,11 @@
 v2:
   .quad v1   # R_MIPS_64 target v1 addend 0
 
-# SYM: Contents of section .data:
-# SYM-NEXT:  {{.*}} 00000000 00000008 00000000 [[V1:[0-9a-f]+]]
-
 # SYM: SYMBOL TABLE:
-# SYM: 00000000[[V1]]  .data  00000000 v1
+# SYM: 00000000[[V1:[0-9a-f]+]]  .data  00000000 v1
+
+# SYM: Contents of section .data:
+# SYM-NEXT:  {{.*}} 00000000 00000008 00000000 [[V1]]
 
 # CHECK: Relocation section
 # CHECK: [[V2:[0-9a-f]+]]  {{.*}} R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE
diff --git a/test/ELF/mips-got16-relocatable.s b/test/ELF/mips-got16-relocatable.s
index 5b8e0e8..e07a626 100644
--- a/test/ELF/mips-got16-relocatable.s
+++ b/test/ELF/mips-got16-relocatable.s
@@ -21,17 +21,17 @@
 # OBJ-NEXT:   addiu   $4, $25, 16
 # OBJ-NEXT:           00000014:  R_MIPS_LO16  .data
 
+# SO: SYMBOL TABLE
+# SO: {{0*}}[[D1:[0-9a-f]{1,4}]] .data {{0+}} data
+# SO: {{0*}}[[D2:[0-9a-f]{1,4}]] .data {{0+}} data
+
 # SO:      Disassembly of section .text:
 # SO-EMPTY:
 # SO-NEXT: .text:
 # SO-NEXT:    lw      $25, -0x7fe8($gp)
-# SO-NEXT:    addiu   $4, $25, 0x[[D1:[0-9a-f]+]]
+# SO-NEXT:    addiu   $4, $25, 0x[[D1]]
 # SO:         lw      $25, -0x7fe8($gp)
-# SO-NEXT:    addiu   $4, $25, 0x[[D2:[0-9a-f]+]]
-
-# SO: SYMBOL TABLE
-# SO: [[D1]]
-# SO: [[D2]]
+# SO-NEXT:    addiu   $4, $25, 0x[[D2]]
 
   .text
   lw     $t9, %got(.data)($gp)
diff --git a/test/ELF/mips-got16.s b/test/ELF/mips-got16.s
index 427da3f..c2405fc 100644
--- a/test/ELF/mips-got16.s
+++ b/test/ELF/mips-got16.s
@@ -10,6 +10,10 @@
 # RUN: llvm-objdump -d -t --no-show-raw-insn %t.so | FileCheck %s
 # RUN: llvm-readelf -r -A %t.so | FileCheck -check-prefix=GOT %s
 
+# CHECK: SYMBOL TABLE:
+# CHECK: 00024008         .data           00000000 .hidden bar
+# CHECK: 00000000         *UND*           00000000 foo
+
 # CHECK:       __start:
 # CHECK-NEXT:    lw      $8, -32744($gp)
 # CHECK-NEXT:    addi    $8, $8, 8236
@@ -22,10 +26,6 @@
 # CHECK-NEXT:    lw      $8, -32720($gp)
 # CHECK-NEXT:    addi    $8, $8, 16392
 # CHECK-NEXT:    lw      $8, -32716($gp)
-#
-# CHECK: SYMBOL TABLE:
-# CHECK: 00024008         .data           00000000 .hidden bar
-# CHECK: 00000000         *UND*           00000000 foo
 
 # GOT: There are no relocations in this file.
 
diff --git a/test/ELF/mips-gp-disp.s b/test/ELF/mips-gp-disp.s
index 2f8c625..30f3a59 100644
--- a/test/ELF/mips-gp-disp.s
+++ b/test/ELF/mips-gp-disp.s
@@ -17,14 +17,14 @@
 # INT-SO: 00000000     0 NOTYPE  LOCAL  HIDDEN   ABS _gp_disp
 # EXT-SO: 00020000     0 NOTYPE  GLOBAL DEFAULT    9 _gp_disp
 
+# DIS: 00037ff0  .got   00000000 .hidden _gp
+# DIS: 00002000  .text  00000000 __start
 # DIS:      Disassembly of section .text:
 # DIS-EMPTY:
 # DIS-NEXT: __start:
 # DIS-NEXT:    lui   $8, 3
 # DIS-NEXT:    addi  $8, $8, 24560
 #                            ^-- (_gp - __start) & 0xffff
-# DIS: 00037ff0  .got   00000000 .hidden _gp
-# DIS: 00002000  .text  00000000 __start
 
 # REL: There are no relocations in this file
 
diff --git a/test/ELF/mips-gp-ext.s b/test/ELF/mips-gp-ext.s
index 9f12f13..14fcbf8 100644
--- a/test/ELF/mips-gp-ext.s
+++ b/test/ELF/mips-gp-ext.s
@@ -25,6 +25,10 @@
 # RUN: ld.lld -shared -o %t.abs.so --script %t.abs.script %t.o
 # RUN: llvm-objdump -s -t %t.abs.so | FileCheck --check-prefix=ABS %s
 
+# REL: 000000e0         .text           00000000 foo
+# REL: 00000000         *ABS*           00000000 .hidden _gp_disp
+# REL: 000001ec         *ABS*           00000000 .hidden _gp
+
 # REL:      Contents of section .reginfo:
 # REL-NEXT:  0018 10000104 00000000 00000000 00000000
 # REL-NEXT:  0028 00000000 000001ec
@@ -42,9 +46,9 @@
 #                 ^-- 0x30-0x1ec
 #                     foo - GP
 
-# REL: 000000e0         .text           00000000 foo
-# REL: 00000000         *ABS*           00000000 .hidden _gp_disp
-# REL: 000001ec         *ABS*           00000000 .hidden _gp
+# ABS: 000000e0         .text           00000000 foo
+# ABS: 00000000         *ABS*           00000000 .hidden _gp_disp
+# ABS: 00000200         *ABS*           00000000 .hidden _gp
 
 # ABS:      Contents of section .reginfo:
 # ABS-NEXT:  0018 10000104 00000000 00000000 00000000
@@ -63,10 +67,6 @@
 #                 ^-- 0xe0-0x200
 #                     foo - GP
 
-# ABS: 000000e0         .text           00000000 foo
-# ABS: 00000000         *ABS*           00000000 .hidden _gp_disp
-# ABS: 00000200         *ABS*           00000000 .hidden _gp
-
   .text
 foo:
   lui    $t0, %hi(_gp_disp)
diff --git a/test/ELF/mips-gp-local.s b/test/ELF/mips-gp-local.s
index 650eabb..00a66f2 100644
--- a/test/ELF/mips-gp-local.s
+++ b/test/ELF/mips-gp-local.s
@@ -9,13 +9,13 @@
 # RUN: ld.lld --script %t.script -o %t.exe %t.o
 # RUN: llvm-objdump -d -t --no-show-raw-insn %t.exe | FileCheck %s
 
+# CHECK: 00037ff0  .got  00000000 .hidden _gp
+# CHECK: 00011000  .text 00000000 __start
+
 # CHECK:      __start:
 # CHECK-NEXT:    lui   $8, 3
 # CHECK-NEXT:    addi  $8, $8, 32752
 
-# CHECK: 00037ff0  .got  00000000 .hidden _gp
-# CHECK: 00011000  .text 00000000 __start
-
   .text
   .globl  __start
 __start:
diff --git a/test/ELF/mips-gprel32-relocs-gp0.s b/test/ELF/mips-gprel32-relocs-gp0.s
index 6dbe5e1..1532f14 100644
--- a/test/ELF/mips-gprel32-relocs-gp0.s
+++ b/test/ELF/mips-gprel32-relocs-gp0.s
@@ -14,16 +14,16 @@
 
 # REL: GP: 0x0
 
-# DUMP: Contents of section .rodata:
-# DUMP: 1000 fffffff4 fffffff8
-#            ^ 0x20004 + 0x7ff0 - 0x28000
-#                     ^ 0x20008 + 0x7ff0 - 0x28000
-
 # DUMP: SYMBOL TABLE:
 # DUMP: 00020008         .text          00000000 bar
 # DUMP: 00020004         .text          00000000 foo
 # DUMP: 00028000         .got           00000000 .hidden _gp
 
+# DUMP: Contents of section .rodata:
+# DUMP: 1000 fffffff4 fffffff8
+#            ^ 0x20004 + 0x7ff0 - 0x28000
+#                     ^ 0x20008 + 0x7ff0 - 0x28000
+
   .text
   .global  __start
 __start:
diff --git a/test/ELF/mips-gprel32-relocs.s b/test/ELF/mips-gprel32-relocs.s
index e6b4cb5..070e683 100644
--- a/test/ELF/mips-gprel32-relocs.s
+++ b/test/ELF/mips-gprel32-relocs.s
@@ -23,12 +23,12 @@
   .gpword foo
   .gpword bar
 
-# CHECK: Contents of section .rodata:
-# CHECK:  1000 ffff8004 ffff8008
-#              ^ 0x20004 - 0x28000
-#                       ^ 0x20008 - 0x28000
-
 # CHECK: SYMBOL TABLE:
 # CHECK: 00020008         .text           00000000 bar
 # CHECK: 00020004         .text           00000000 foo
 # CHECK: 00028000         .got            00000000 .hidden _gp
+
+# CHECK: Contents of section .rodata:
+# CHECK:  1000 ffff8004 ffff8008
+#              ^ 0x20004 - 0x28000
+#                       ^ 0x20008 - 0x28000
diff --git a/test/ELF/mips-hilo-gp-disp.s b/test/ELF/mips-hilo-gp-disp.s
index ba5315b..f4bce04 100644
--- a/test/ELF/mips-hilo-gp-disp.s
+++ b/test/ELF/mips-hilo-gp-disp.s
@@ -23,6 +23,11 @@
   lui    $t0,%hi(_gp_disp)
   addi   $t0,$t0,%lo(_gp_disp)
 
+# CHECK: SYMBOL TABLE:
+# CHECK: 0001100c     .text   00000000 bar
+# CHECK: 00037ff0     .got    00000000 .hidden _gp
+# CHECK: 00011000     .text   00000000 __start
+
 # CHECK:      Disassembly of section .text:
 # CHECK-EMPTY:
 # CHECK-NEXT: __start:
@@ -35,8 +40,3 @@
 #                                      ^-- %hi(0x37ff0-0x1100c)
 # CHECK-NEXT:  11010:       addi   $8, $8, 28644
 #                                          ^-- %lo(0x37ff0-0x11010+4)
-
-# CHECK: SYMBOL TABLE:
-# CHECK: 0001100c     .text   00000000 bar
-# CHECK: 00037ff0     .got    00000000 .hidden _gp
-# CHECK: 00011000     .text   00000000 __start
diff --git a/test/ELF/mips-hilo-hi-only.s b/test/ELF/mips-hilo-hi-only.s
index e85c0a5..0a82ee8 100644
--- a/test/ELF/mips-hilo-hi-only.s
+++ b/test/ELF/mips-hilo-hi-only.s
@@ -15,12 +15,12 @@
 
 # WARN: can't find matching R_MIPS_LO16 relocation for R_MIPS_HI16
 
+# CHECK: SYMBOL TABLE:
+# CHECK: 00020{{0*}}[[VAL:[0-9a-f]+]] .text   00000000 _label
+# CHECK: 00020{{.*}}                  .text   00000000 __start
+
 # CHECK:      __start:
 # CHECK-NEXT:  lui    $8, 0x3
 #                         ^-- %hi(__start) w/o addend
-# CHECK-NEXT:  addi   $8, $8, 0x[[VAL:[0-9a-f]+]]
+# CHECK-NEXT:  addi   $8, $8, 0x[[VAL]]
 #                             ^-- %lo(_label)
-
-# CHECK: SYMBOL TABLE:
-# CHECK: 00020{{0*}}[[VAL]] .text   00000000 _label
-# CHECK: 00020{{.*}}        .text   00000000 __start
diff --git a/test/ELF/mips-hilo.s b/test/ELF/mips-hilo.s
index 3cc0912..e0e46b7 100644
--- a/test/ELF/mips-hilo.s
+++ b/test/ELF/mips-hilo.s
@@ -30,6 +30,11 @@
 g1:
   .word 0
 
+# CHECK: SYMBOL TABLE:
+# CHECK: 0021020 l     O .data   00000004 l1
+# CHECK: 0021000         .text   00000000 __start
+# CHECK: 0021024 g     O .data   00000004 g1
+
 # CHECK:      __start:
 # CHECK-NEXT:  21000:   lui    $8, 2
 #                                  ^-- %hi(__start+4)
@@ -45,8 +50,3 @@
 #                                  ^-- %hi(l1+0x20000-4)
 # CHECK-NEXT:  21018:   addi   $8, $8, 4124
 #                                      ^-- %lo(l1-4)
-
-# CHECK: SYMBOL TABLE:
-# CHECK: 0021020 l     O .data   00000004 l1
-# CHECK: 0021000         .text   00000000 __start
-# CHECK: 0021024 g     O .data   00000004 g1
diff --git a/test/ELF/mips-mgot.s b/test/ELF/mips-mgot.s
index 62b2cc0..696301d 100644
--- a/test/ELF/mips-mgot.s
+++ b/test/ELF/mips-mgot.s
@@ -14,20 +14,20 @@
 # RUN: llvm-objdump -s -section=.got -t %t.so | FileCheck %s
 # RUN: llvm-readobj -r --dyn-syms -A %t.so | FileCheck -check-prefix=GOT %s
 
+# CHECK: SYMBOL TABLE:
+# CHECK:           00000000 l    O .tdata          00000000 loc0
+# CHECK: [[FOO0:[0-9a-f]+]]        .text           00000000 foo0
+# CHECK:           00000000 g    O .tdata          00000000 tls0
+# CHECK:           00000004 g    O .tdata          00000000 tls1
+# CHECK: [[FOO2:[0-9a-f]+]]        .text           00000000 foo2
+
 # CHECK:      Contents of section .got:
-# CHECK-NEXT:  70000 00000000 80000000 [[FOO0:[0-9a-f]+]] [[FOO2:[0-9a-f]+]]
+# CHECK-NEXT:  70000 00000000 80000000 [[FOO0]] [[FOO2]]
 # CHECK-NEXT:  70010 00000000 00000004 00010000 00020000
 # CHECK-NEXT:  70020 00030000 00040000 00050000 00060000
 # CHECK-NEXT:  70030 00000000 00000000 00000000 00000000
 # CHECK-NEXT:  70040 00000000 00000000 00000000
 
-# CHECK: SYMBOL TABLE:
-# CHECK: 00000000 l    O .tdata          00000000 loc0
-# CHECK: [[FOO0]]        .text           00000000 foo0
-# CHECK: 00000000 g    O .tdata          00000000 tls0
-# CHECK: 00000004 g    O .tdata          00000000 tls1
-# CHECK: [[FOO2]]        .text           00000000 foo2
-
 # GOT:      Relocations [
 # GOT-NEXT:   Section (7) .rel.dyn {
 # GOT-NEXT:     0x70018 R_MIPS_REL32 - 0x0
diff --git a/test/ELF/mips-micro-cross-calls.s b/test/ELF/mips-micro-cross-calls.s
index 1663413..52fa87d 100644
--- a/test/ELF/mips-micro-cross-calls.s
+++ b/test/ELF/mips-micro-cross-calls.s
@@ -14,31 +14,31 @@
 # RUN:              --no-show-raw-insn --print-imm-hex %t-eb.exe \
 # RUN:   | FileCheck --check-prefixes=SYM,MICRO %s
 
+# REG:  {{0*}}[[FOOT:[0-9a-f]+]]   l     F .text  0000000e 0x80 __microLA25Thunk_foo
+# REG:  {{0*}}[[BAR:[0-9a-f]+]]    g     F .text  00000000 bar
+# REG:  {{0*}}[[MIC:[0-9a-f]+]]            .text  00000000 0x80 micro
+
 # REG:        __start:
-# REG-NEXT:      jalx 0x[[MIC:[0-9a-f]+]] <micro>
+# REG-NEXT:      jalx 0x[[MIC]] <micro>
 # REG-NEXT:      nop
-# REG-NEXT:      jalx 0x[[FOOT:[0-9a-f]+]] <__microLA25Thunk_foo>
+# REG-NEXT:      jalx 0x[[FOOT]] <__microLA25Thunk_foo>
 
 # REG:        __LA25Thunk_bar:
 # REG-NEXT:      lui  $25, 0x2
-# REG-NEXT:      j    0x[[BAR:[0-9a-f]+]] <bar>
+# REG-NEXT:      j    0x[[BAR]] <bar>
+
+# MICRO: {{0*}}[[BART:[0-9a-f]+]]  l     F .text  00000010 __LA25Thunk_bar
+# MICRO: {{0*}}[[START:[0-9a-f]+]]         .text  00000000 __start
+# MICRO: {{0*}}[[FOO:[0-9a-f]+]]   g     F .text  00000000 0x80 foo
 
 # MICRO:      micro:
-# MICRO-NEXT:    jalx 0x[[START:[0-9a-f]+]]
+# MICRO-NEXT:    jalx 0x[[START]]
 # MICRO-NEXT:    nop
-# MICRO-NEXT:    jalx 0x[[BART:[0-9a-f]+]]
+# MICRO-NEXT:    jalx 0x[[BART]]
 
 # MICRO:      __microLA25Thunk_foo:
 # MICRO-NEXT:    lui  $25, 0x2
-# MICRO-NEXT:    j    0x[[FOO:[0-9a-f]+]] <foo>
-
-# REG:  [[FOOT]]   l     F .text  0000000e 0x80 __microLA25Thunk_foo
-# REG:  [[BAR]]    g     F .text  00000000 bar
-# REG:  [[MIC]]            .text  00000000 0x80 micro
-
-# MICRO: [[BART]]  l     F .text  00000010 __LA25Thunk_bar
-# MICRO: [[START]]         .text  00000000 __start
-# MICRO: [[FOO]]   g     F .text  00000000 0x80 foo
+# MICRO-NEXT:    j    0x[[FOO]] <foo>
 
   .text
   .set nomicromips
diff --git a/test/ELF/mips-micro-relocs.s b/test/ELF/mips-micro-relocs.s
index b9235eb..0902f10 100644
--- a/test/ELF/mips-micro-relocs.s
+++ b/test/ELF/mips-micro-relocs.s
@@ -25,16 +25,9 @@
 # RUN:   | FileCheck --check-prefixes=ASM,EL %s
 # RUN: llvm-readelf -h %tel.exe | FileCheck --check-prefix=ELF %s
 
-# ASM:      __start:
-# ASM-NEXT:      20110:  lui     $3, 1
-# ASM-NEXT:              addiu   $3, $3, 32495
-# ASM-NEXT:              lw      $3, -32744($gp)
-# ASM-NEXT:              lw      $3, -32744($3)
-# ASM-NEXT:              beqz16  $6, -32
-# ASM-NEXT:              sll     $3, $fp, 0
-# ASM-NEXT:              b16     -40
-# ASM-NEXT:              nop
-# ASM-NEXT:              b       -44
+# ASM: 00038000         .got   00000000 .hidden _gp
+# ASM: 00020100 g F     .text  00000000 0x80 foo
+# ASM: 00020110         .text  00000000 0x80 __start
 
 # EB:      Contents of section .data:
 # EB-NEXT:  30000 fffe8111
@@ -48,9 +41,16 @@
 # EL:      Contents of section .debug_info
 # EL-NEXT:  0000 11010200
 
-# ASM: 00038000         .got   00000000 .hidden _gp
-# ASM: 00020100 g F     .text  00000000 0x80 foo
-# ASM: 00020110         .text  00000000 0x80 __start
+# ASM:      __start:
+# ASM-NEXT:      20110:  lui     $3, 1
+# ASM-NEXT:              addiu   $3, $3, 32495
+# ASM-NEXT:              lw      $3, -32744($gp)
+# ASM-NEXT:              lw      $3, -32744($3)
+# ASM-NEXT:              beqz16  $6, -32
+# ASM-NEXT:              sll     $3, $fp, 0
+# ASM-NEXT:              b16     -40
+# ASM-NEXT:              nop
+# ASM-NEXT:              b       -44
 
 # ELF: Entry point address: 0x20111
 
diff --git a/test/ELF/mips-micror6-relocs.s b/test/ELF/mips-micror6-relocs.s
index e5d2182..2908197 100644
--- a/test/ELF/mips-micror6-relocs.s
+++ b/test/ELF/mips-micror6-relocs.s
@@ -20,14 +20,14 @@
 # RUN: llvm-objdump -d -t -mattr=micromips --no-show-raw-insn %tel.exe \
 # RUN:   | FileCheck %s
 
+# CHECK: 00020100 g F     .text  00000000 0x80 foo
+# CHECK: 00020110         .text  00000000 0x80 __start
+
 # CHECK:      __start:
 # CHECK-NEXT:    20110:  lapc   $2, -12
 # CHECK-NEXT:            beqzc  $3, -36
 # CHECK-NEXT:            balc   -24 <foo>
 
-# CHECK: 00020100 g F     .text  00000000 0x80 foo
-# CHECK: 00020110         .text  00000000 0x80 __start
-
   .text
   .set micromips
   .global __start
diff --git a/test/ELF/mips-n32-rels.s b/test/ELF/mips-n32-rels.s
index 7afa3a8..d7a5bdd 100644
--- a/test/ELF/mips-n32-rels.s
+++ b/test/ELF/mips-n32-rels.s
@@ -26,6 +26,14 @@
   .section  .rodata,"a",@progbits
   .gpword(loc)                                # R_MIPS_GPREL32
 
+# CHECK: 00020104      .text   00000000 loc
+# CHECK: 00028100      .got    00000000 .hidden _gp
+# CHECK: 00020100 g  F .text   00000000 __start
+
+# CHECK:      Contents of section .rodata:
+# CHECK-NEXT:  {{[0-9a-f]+}} ffff8004
+#                            ^-- loc - _gp
+
 # CHECK:      Disassembly of section .text:
 # CHECK-EMPTY:
 # CHECK-NEXT: __start:
@@ -39,14 +47,6 @@
 #                                          ^-- 0 - 0xffff8000
 #                                          ^-- %lo(0x8000)
 
-# CHECK:      Contents of section .rodata:
-# CHECK-NEXT:  {{[0-9a-f]+}} ffff8004
-#                            ^-- loc - _gp
-
-# CHECK: 00020104      .text   00000000 loc
-# CHECK: 00028100      .got    00000000 .hidden _gp
-# CHECK: 00020100 g  F .text   00000000 __start
-
 # ELF: Class:                ELF32
 # ELF: Data:                 2's complement, big endian
 # ELF: Version:              1 (current)
diff --git a/test/ELF/mips-nonalloc.s b/test/ELF/mips-nonalloc.s
index a255a65..5ec308d 100644
--- a/test/ELF/mips-nonalloc.s
+++ b/test/ELF/mips-nonalloc.s
@@ -7,11 +7,12 @@
 # RUN: ld.lld %t1.o %t2.o -o %t.exe
 # RUN: llvm-objdump -t -s %t.exe | FileCheck %s
 
-# CHECK:      Contents of section .debug_info:
-# CHECK-NEXT:  0000 ffffffff [[SYM:[0-9a-f]+]] [[SYM]]
-#                            ^------------------^-- __start
+# CHECK: [[SYM:[0-9a-f]+]]  .text  00000000 __start
 
-# CHECK: [[SYM]]  .text  00000000 __start
+# CHECK:      Contents of section .debug_info:
+# CHECK-NEXT:  0000 ffffffff [[SYM]] [[SYM]]
+#                            ^-------^-- __start
+
 
   .global __start
 __start:
diff --git a/test/ELF/mips-pc-relocs.s b/test/ELF/mips-pc-relocs.s
index 06d4644..6b8d934 100644
--- a/test/ELF/mips-pc-relocs.s
+++ b/test/ELF/mips-pc-relocs.s
@@ -26,6 +26,13 @@
   .data
   .word _foo+8-.                    # R_MIPS_PC32
 
+# CHECK: 00020000         .text           00000000 __start
+# CHECK: 00020020         .text           00000000 _foo
+
+# CHECK: Contents of section .data:
+# CHECK-NEXT: 30000 ffff0028 00000000 00000000 00000000
+#                   ^-- 0x20020 + 8 - 0x30000
+
 # CHECK:      Disassembly of section .text:
 # CHECK-EMPTY:
 # CHECK-NEXT: __start:
@@ -41,10 +48,3 @@
 #                                         ^-- %hi(0x20020-0x20010)
 # CHECK-NEXT:    20014:       addiu   $2, $2, 12
 #                                             ^-- %lo(0x20020-0x20014)
-
-# CHECK: Contents of section .data:
-# CHECK-NEXT: 30000 ffff0028 00000000 00000000 00000000
-#                   ^-- 0x20020 + 8 - 0x30000
-
-# CHECK: 00020000         .text           00000000 __start
-# CHECK: 00020020         .text           00000000 _foo
diff --git a/test/ELF/mips-tls-64.s b/test/ELF/mips-tls-64.s
index 296bbc3..ffaaccc 100644
--- a/test/ELF/mips-tls-64.s
+++ b/test/ELF/mips-tls-64.s
@@ -21,12 +21,9 @@
 # RUN:   | FileCheck -check-prefix=DIS-SO %s
 # RUN: llvm-readobj -r -A %t-out.so | FileCheck -check-prefix=SO %s
 
-# DIS:      __start:
-# DIS-NEXT:    addiu   $2, $3, -32720
-# DIS-NEXT:    addiu   $2, $3, -32736
-# DIS-NEXT:    addiu   $2, $3, -32704
-# DIS-NEXT:    addiu   $2, $3, -32688
-# DIS-NEXT:    addiu   $2, $3, -32728
+# DIS: 0000000000000000 l     O .tdata          00000000 loc
+# DIS: 0000000000000004 g     O .tdata          00000000 bar
+# DIS: 0000000000000000 g     O *UND*           00000000 foo
 
 # DIS:      Contents of section .got:
 # DIS-NEXT:  30000 00000000 00000000 80000000 00000000
@@ -35,9 +32,12 @@
 # DIS-NEXT:  30030 00000000 00000001 00000000 00000000
 # DIS-NEXT:  30040 00000000 00000001 ffffffff ffff8004
 
-# DIS: 0000000000000000 l     O .tdata          00000000 loc
-# DIS: 0000000000000004 g     O .tdata          00000000 bar
-# DIS: 0000000000000000 g     O *UND*           00000000 foo
+# DIS:      __start:
+# DIS-NEXT:    addiu   $2, $3, -32720
+# DIS-NEXT:    addiu   $2, $3, -32736
+# DIS-NEXT:    addiu   $2, $3, -32704
+# DIS-NEXT:    addiu   $2, $3, -32688
+# DIS-NEXT:    addiu   $2, $3, -32728
 
 # CHECK:      Relocations [
 # CHECK-NEXT:   Section (7) .rel.dyn {
diff --git a/test/ELF/mips-tls-hilo.s b/test/ELF/mips-tls-hilo.s
index b557e96..d675646 100644
--- a/test/ELF/mips-tls-hilo.s
+++ b/test/ELF/mips-tls-hilo.s
@@ -10,6 +10,8 @@
 # RUN: ld.lld %t.o -shared -o %t.so
 # RUN: llvm-readobj -r -A %t.so | FileCheck -check-prefix=SO %s
 
+# DIS: 00000000 l    O .tdata          00000000 loc0
+
 # DIS:      __start:
 # DIS-NEXT:    addiu   $2, $3, 0
 #                              ^-- %hi(loc0 - .tdata - 0x8000)
@@ -20,8 +22,6 @@
 # DIS-NEXT:    addiu   $2, $3, -28672
 #                              ^-- %lo(loc0 - .tdata - 0x7000)
 
-# DIS: 00000000 l    O .tdata          00000000 loc0
-
 # CHECK:      Relocations [
 # CHECK-NEXT: ]
 # CHECK-NOT:  Primary GOT
diff --git a/test/ELF/mips-tls-static-64.s b/test/ELF/mips-tls-static-64.s
index 26b5195..80f5c68 100644
--- a/test/ELF/mips-tls-static-64.s
+++ b/test/ELF/mips-tls-static-64.s
@@ -6,13 +6,13 @@
 # RUN: ld.lld -static %t -o %t.exe
 # RUN: llvm-objdump -s -t %t.exe | FileCheck %s
 
-# CHECK:      Contents of section .data:
-# CHECK-NEXT:  {{.*}} [[TGA:[0-9a-f]+]] ffffffff ffff8004 ffffffff
-# CHECK-NEXT:  {{.*}} ffff9004
-#
 # CHECK: SYMBOL TABLE:
-# CHECK:          [[TGA]]        .text           00000000 __tls_get_addr
-# CHECK: 0000000000000000 g    O .tdata          00000000 tls1
+# CHECK: [[TGA:[0-9a-f]{8}]]        .text           00000000 __tls_get_addr
+# CHECK:    0000000000000000 g    O .tdata          00000000 tls1
+#
+# CHECK:      Contents of section .data:
+# CHECK-NEXT:  {{.*}} [[TGA]] ffffffff ffff8004 ffffffff
+# CHECK-NEXT:  {{.*}} ffff9004
 
   .text
   .global __start
diff --git a/test/ELF/mips-tls-static.s b/test/ELF/mips-tls-static.s
index 877a38a..28b02c8 100644
--- a/test/ELF/mips-tls-static.s
+++ b/test/ELF/mips-tls-static.s
@@ -6,15 +6,15 @@
 # RUN: ld.lld -static %t -o %t.exe
 # RUN: llvm-objdump -s -t %t.exe | FileCheck %s
 
+# CHECK: SYMBOL TABLE:
+# CHECK:  [[TGA:[0-9a-f]+]]        .text           00000000 __tls_get_addr
+# CHECK:           00000000 g    O .tdata          00000000 tls1
+#
 # CHECK:      Contents of section .data:
-# CHECK-NEXT:  {{.*}} [[TGA:[0-9a-f]+]] ffff8004 ffff9004
+# CHECK-NEXT:  {{.*}} [[TGA]] ffff8004 ffff9004
 # CHECK:      Contents of section .got:
 # CHECK-NEXT:  {{.*}} 00000000 80000000 ffff9000 00000001
 # CHECK-NEXT:  {{.*}} ffff8000 00000001 00000000
-#
-# CHECK: SYMBOL TABLE:
-# CHECK:  [[TGA]]        .text           00000000 __tls_get_addr
-# CHECK: 00000000 g    O .tdata          00000000 tls1
 
   .text
   .global __start
diff --git a/test/ELF/mips-tls.s b/test/ELF/mips-tls.s
index 4e4f1c2..7a8a4d5 100644
--- a/test/ELF/mips-tls.s
+++ b/test/ELF/mips-tls.s
@@ -21,21 +21,21 @@
 # RUN:   | FileCheck -check-prefix=DIS-SO %s
 # RUN: llvm-readobj -r -A %t-out.so | FileCheck -check-prefix=SO %s
 
-# DIS:      __start:
-# DIS-NEXT:    addiu   $2, $3, -32736
-# DIS-NEXT:    addiu   $2, $3, -32744
-# DIS-NEXT:    addiu   $2, $3, -32728
-# DIS-NEXT:    addiu   $2, $3, -32720
-# DIS-NEXT:    addiu   $2, $3, -32740
+# DIS: 00000000 l    O .tdata          00000000 loc
+# DIS: 00000004 g    O .tdata          00000000 bar
+# DIS: 00000000 g    O *UND*           00000000 foo
 
 # DIS:      Contents of section .got:
 # DIS-NEXT:  30000 00000000 80000000 00000000 ffff9004
 # DIS-NEXT:  30010 00000000 00000000 00000001 00000000
 # DIS-NEXT:  30020 00000001 ffff8004
 
-# DIS: 00000000 l    O .tdata          00000000 loc
-# DIS: 00000004 g    O .tdata          00000000 bar
-# DIS: 00000000 g    O *UND*           00000000 foo
+# DIS:      __start:
+# DIS-NEXT:    addiu   $2, $3, -32736
+# DIS-NEXT:    addiu   $2, $3, -32744
+# DIS-NEXT:    addiu   $2, $3, -32728
+# DIS-NEXT:    addiu   $2, $3, -32720
+# DIS-NEXT:    addiu   $2, $3, -32740
 
 # CHECK:      Relocations [
 # CHECK-NEXT:   Section (7) .rel.dyn {
diff --git a/test/ELF/msp430.s b/test/ELF/msp430.s
index eb645d8..58120f6 100644
--- a/test/ELF/msp430.s
+++ b/test/ELF/msp430.s
@@ -6,6 +6,17 @@
 
 ;; Check handling of basic msp430 relocation types.
 
+  .data
+;; R_MSP430_8
+  .byte _byte
+;; R_MSP430_16
+  .word _start
+;; R_MSP430_32
+  .long _start
+
+; CHECK:      Contents of section .data:
+; CHECK-NEXT: 2000 21008000 800000
+
   .text
   .global foo
 foo:
@@ -29,16 +40,5 @@
 
 ; CHECK:      800a: {{.*}} mov #-1, -12
 
-  .data
-;; R_MSP430_8
-  .byte _byte
-;; R_MSP430_16
-  .word _start
-;; R_MSP430_32
-  .long _start
-
-; CHECK:      Contents of section .data:
-; CHECK-NEXT: 2000 21008000 800000
-
 ; RUN: od -x %t.exe | FileCheck -check-prefix=TRAP %s
 ; TRAP: 4343 4343 4343 4343 4343 4343 4343 4343
diff --git a/test/ELF/non-alloc-link-order-gc.s b/test/ELF/non-alloc-link-order-gc.s
index 93fff35..d58c75a 100644
--- a/test/ELF/non-alloc-link-order-gc.s
+++ b/test/ELF/non-alloc-link-order-gc.s
@@ -5,14 +5,14 @@
 
 ## Check that we are able to GC non-allocatable metadata sections without crash.
 
+# CHECK:      Name          Size
+# CHECK:      .stack_sizes  00000001
+
 # CHECK:      Disassembly of section .stack_sizes:
 # CHECK-EMPTY:
 # CHECK-NEXT:   .stack_sizes:
 # CHECK-NEXT:    01
 
-# CHECK:      Name          Size
-# CHECK:      .stack_sizes  00000001
-
 .section .text.live,"ax",@progbits
 .globl live
 live:
diff --git a/test/ELF/relocation-common.s b/test/ELF/relocation-common.s
index 49c3627..460328d 100644
--- a/test/ELF/relocation-common.s
+++ b/test/ELF/relocation-common.s
@@ -10,5 +10,5 @@
 .global sym1
 .comm sym1,4,4
 
-# CHECK: 201158: {{.*}} movl    $1, 4098(%rip)
 # CHECK: 0000000000202164 g     O .bss            00000004 sym1
+# CHECK: 201158: {{.*}} movl    $1, 4098(%rip)
diff --git a/test/ELF/relocation.s b/test/ELF/relocation.s
index e77e22e..fe51882 100644
--- a/test/ELF/relocation.s
+++ b/test/ELF/relocation.s
@@ -46,6 +46,39 @@
 // SEC-NEXT:   EntrySize: 0
 // SEC-NEXT:   }
 
+.section .R_X86_64_64,"a",@progbits
+.global R_X86_64_64
+R_X86_64_64:
+ .quad R_X86_64_64
+
+// CHECK:      Contents of section .R_X86_64_64:
+// CHECK-NEXT:   2002f8 f8022000 00000000
+
+.section .R_X86_64_GOTPCREL,"a",@progbits
+.global R_X86_64_GOTPCREL
+R_X86_64_GOTPCREL:
+ .long zed@gotpcrel
+
+// 0x202460(.got) - 0x200300(.R_X86_64_GOTPCREL) = 0x2160
+// CHECK:      Contents of section .R_X86_64_GOTPCREL
+// CHECK-NEXT:   200300 60210000
+
+.section .R_X86_64_GOT32,"a",@progbits
+.global R_X86_64_GOT32
+R_X86_64_GOT32:
+        .long zed@got
+
+// CHECK: Contents of section .R_X86_64_GOT32:
+// CHECK-NEXT: f8efffff
+
+
+// CHECK: Contents of section .R_X86_64_GOT64:
+// CHECK-NEXT: f8efffff ffffffff
+.section .R_X86_64_GOT64,"a",@progbits
+.global R_X86_64_GOT64
+R_X86_64_GOT64:
+        .quad zed@got
+
 .section       .text,"ax",@progbits,unique,1
 .global _start
 _start:
@@ -111,36 +144,3 @@
 // CHECK-EMPTY:
 // CHECK-NEXT: R_X86_64_32S_2:
 // CHECK-NEXT: 201331: {{.*}}  movl    2102112, %eax
-
-.section .R_X86_64_64,"a",@progbits
-.global R_X86_64_64
-R_X86_64_64:
- .quad R_X86_64_64
-
-// CHECK:      Contents of section .R_X86_64_64:
-// CHECK-NEXT:   2002f8 f8022000 00000000
-
-.section .R_X86_64_GOTPCREL,"a",@progbits
-.global R_X86_64_GOTPCREL
-R_X86_64_GOTPCREL:
- .long zed@gotpcrel
-
-// 0x202460(.got) - 0x200300(.R_X86_64_GOTPCREL) = 0x2160
-// CHECK:      Contents of section .R_X86_64_GOTPCREL
-// CHECK-NEXT:   200300 60210000
-
-.section .R_X86_64_GOT32,"a",@progbits
-.global R_X86_64_GOT32
-R_X86_64_GOT32:
-        .long zed@got
-
-// CHECK: Contents of section .R_X86_64_GOT32:
-// CHECK-NEXT: f8efffff
-
-
-// CHECK: Contents of section .R_X86_64_GOT64:
-// CHECK-NEXT: f8efffff ffffffff
-.section .R_X86_64_GOT64,"a",@progbits
-.global R_X86_64_GOT64
-R_X86_64_GOT64:
-        .quad zed@got
diff --git a/test/ELF/x86-64-retpoline-znow.s b/test/ELF/x86-64-retpoline-znow.s
index 1b9da3a..44b799a 100644
--- a/test/ELF/x86-64-retpoline-znow.s
+++ b/test/ELF/x86-64-retpoline-znow.s
@@ -6,6 +6,11 @@
 // RUN: ld.lld -shared %t1.o %t2.so -o %t.exe -z retpolineplt -z now
 // RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
 
+// CHECK:      Contents of section .got.plt:
+// CHECK-NEXT: 23f0 10230000 00000000 00000000 00000000
+// CHECK-NEXT: 2400 00000000 00000000 00000000 00000000
+// CHECK-NEXT: 2410 00000000 00000000
+
 // CHECK:      Disassembly of section .plt:
 // CHECK-EMPTY:
 // CHECK-NEXT: .plt:
@@ -43,11 +48,6 @@
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 
-// CHECK:      Contents of section .got.plt:
-// CHECK-NEXT: 23f0 10230000 00000000 00000000 00000000
-// CHECK-NEXT: 2400 00000000 00000000 00000000 00000000
-// CHECK-NEXT: 2410 00000000 00000000
-
 .global _start
 _start:
   jmp bar@PLT
diff --git a/test/ELF/x86-64-retpoline.s b/test/ELF/x86-64-retpoline.s
index 9cd2a32..ff17b2d 100644
--- a/test/ELF/x86-64-retpoline.s
+++ b/test/ELF/x86-64-retpoline.s
@@ -6,6 +6,11 @@
 // RUN: ld.lld -shared %t1.o %t2.so -o %t.exe -z retpolineplt
 // RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
 
+// CHECK:      Contents of section .got.plt:
+// CHECK-NEXT: 3430 70230000 00000000 00000000 00000000
+// CHECK-NEXT: 3440 00000000 00000000 41130000 00000000
+// CHECK-NEXT: 3450 61130000 00000000
+
 // CHECK:      Disassembly of section .plt:
 // CHECK-EMPTY:
 // CHECK-NEXT: .plt:
@@ -56,11 +61,6 @@
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 
-// CHECK:      Contents of section .got.plt:
-// CHECK-NEXT: 3430 70230000 00000000 00000000 00000000
-// CHECK-NEXT: 3440 00000000 00000000 41130000 00000000
-// CHECK-NEXT: 3450 61130000 00000000
-
 .global _start
 _start:
   jmp bar@PLT