Index: lld/trunk/test/ELF/arm-icf-exidx.s =================================================================== --- lld/trunk/test/ELF/arm-icf-exidx.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/arm-target1.s =================================================================== --- lld/trunk/test/ELF/arm-target1.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/eh-frame-hdr-abs-fde.s =================================================================== --- lld/trunk/test/ELF/eh-frame-hdr-abs-fde.s +++ lld/trunk/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: Index: lld/trunk/test/ELF/got32-i386.s =================================================================== --- lld/trunk/test/ELF/got32-i386.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/got32x-i386.s =================================================================== --- lld/trunk/test/ELF/got32x-i386.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/i386-pc8-pc16-addend.s =================================================================== --- lld/trunk/test/ELF/i386-pc8-pc16-addend.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/i386-reloc8-reloc16-addend.s =================================================================== --- lld/trunk/test/ELF/i386-reloc8-reloc16-addend.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/i386-retpoline-nopic.s =================================================================== --- lld/trunk/test/ELF/i386-retpoline-nopic.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/i386-retpoline-pic.s =================================================================== --- lld/trunk/test/ELF/i386-retpoline-pic.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-32.s =================================================================== --- lld/trunk/test/ELF/mips-32.s +++ lld/trunk/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]+]] Index: lld/trunk/test/ELF/mips-64-got.s =================================================================== --- lld/trunk/test/ELF/mips-64-got.s +++ lld/trunk/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' Index: lld/trunk/test/ELF/mips-64-rels.s =================================================================== --- lld/trunk/test/ELF/mips-64-rels.s +++ lld/trunk/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: ] Index: lld/trunk/test/ELF/mips-64.s =================================================================== --- lld/trunk/test/ELF/mips-64.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-got16-relocatable.s =================================================================== --- lld/trunk/test/ELF/mips-got16-relocatable.s +++ lld/trunk/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) Index: lld/trunk/test/ELF/mips-got16.s =================================================================== --- lld/trunk/test/ELF/mips-got16.s +++ lld/trunk/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. Index: lld/trunk/test/ELF/mips-gp-disp.s =================================================================== --- lld/trunk/test/ELF/mips-gp-disp.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-gp-ext.s =================================================================== --- lld/trunk/test/ELF/mips-gp-ext.s +++ lld/trunk/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) Index: lld/trunk/test/ELF/mips-gp-local.s =================================================================== --- lld/trunk/test/ELF/mips-gp-local.s +++ lld/trunk/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: Index: lld/trunk/test/ELF/mips-gprel32-relocs-gp0.s =================================================================== --- lld/trunk/test/ELF/mips-gprel32-relocs-gp0.s +++ lld/trunk/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: Index: lld/trunk/test/ELF/mips-gprel32-relocs.s =================================================================== --- lld/trunk/test/ELF/mips-gprel32-relocs.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-hilo-gp-disp.s =================================================================== --- lld/trunk/test/ELF/mips-hilo-gp-disp.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-hilo-hi-only.s =================================================================== --- lld/trunk/test/ELF/mips-hilo-hi-only.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-hilo.s =================================================================== --- lld/trunk/test/ELF/mips-hilo.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-mgot.s =================================================================== --- lld/trunk/test/ELF/mips-mgot.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-micro-cross-calls.s =================================================================== --- lld/trunk/test/ELF/mips-micro-cross-calls.s +++ lld/trunk/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]+]] +# REG-NEXT: jalx 0x[[MIC]] # 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]+]] +# REG-NEXT: j 0x[[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]+]] - -# 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]] .text .set nomicromips Index: lld/trunk/test/ELF/mips-micro-relocs.s =================================================================== --- lld/trunk/test/ELF/mips-micro-relocs.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-micror6-relocs.s =================================================================== --- lld/trunk/test/ELF/mips-micror6-relocs.s +++ lld/trunk/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 -# CHECK: 00020100 g F .text 00000000 0x80 foo -# CHECK: 00020110 .text 00000000 0x80 __start - .text .set micromips .global __start Index: lld/trunk/test/ELF/mips-n32-rels.s =================================================================== --- lld/trunk/test/ELF/mips-n32-rels.s +++ lld/trunk/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) Index: lld/trunk/test/ELF/mips-nonalloc.s =================================================================== --- lld/trunk/test/ELF/mips-nonalloc.s +++ lld/trunk/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: [[SYM:[0-9a-f]+]] .text 00000000 __start + # CHECK: Contents of section .debug_info: -# CHECK-NEXT: 0000 ffffffff [[SYM:[0-9a-f]+]] [[SYM]] -# ^------------------^-- __start +# CHECK-NEXT: 0000 ffffffff [[SYM]] [[SYM]] +# ^-------^-- __start -# CHECK: [[SYM]] .text 00000000 __start .global __start __start: Index: lld/trunk/test/ELF/mips-pc-relocs.s =================================================================== --- lld/trunk/test/ELF/mips-pc-relocs.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-tls-64.s =================================================================== --- lld/trunk/test/ELF/mips-tls-64.s +++ lld/trunk/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 { Index: lld/trunk/test/ELF/mips-tls-hilo.s =================================================================== --- lld/trunk/test/ELF/mips-tls-hilo.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-tls-static-64.s =================================================================== --- lld/trunk/test/ELF/mips-tls-static-64.s +++ lld/trunk/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: SYMBOL TABLE: +# 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:[0-9a-f]+]] ffffffff ffff8004 ffffffff +# CHECK-NEXT: {{.*}} [[TGA]] ffffffff ffff8004 ffffffff # CHECK-NEXT: {{.*}} ffff9004 -# -# CHECK: SYMBOL TABLE: -# CHECK: [[TGA]] .text 00000000 __tls_get_addr -# CHECK: 0000000000000000 g O .tdata 00000000 tls1 .text .global __start Index: lld/trunk/test/ELF/mips-tls-static.s =================================================================== --- lld/trunk/test/ELF/mips-tls-static.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/mips-tls.s =================================================================== --- lld/trunk/test/ELF/mips-tls.s +++ lld/trunk/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 { Index: lld/trunk/test/ELF/msp430.s =================================================================== --- lld/trunk/test/ELF/msp430.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/non-alloc-link-order-gc.s =================================================================== --- lld/trunk/test/ELF/non-alloc-link-order-gc.s +++ lld/trunk/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: Index: lld/trunk/test/ELF/relocation-common.s =================================================================== --- lld/trunk/test/ELF/relocation-common.s +++ lld/trunk/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) Index: lld/trunk/test/ELF/relocation.s =================================================================== --- lld/trunk/test/ELF/relocation.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/x86-64-retpoline-znow.s =================================================================== --- lld/trunk/test/ELF/x86-64-retpoline-znow.s +++ lld/trunk/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 Index: lld/trunk/test/ELF/x86-64-retpoline.s =================================================================== --- lld/trunk/test/ELF/x86-64-retpoline.s +++ lld/trunk/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 Index: llvm/trunk/test/MC/COFF/symidx.s =================================================================== --- llvm/trunk/test/MC/COFF/symidx.s +++ llvm/trunk/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 Index: llvm/trunk/test/tools/llvm-objdump/X86/adjust-vma.test =================================================================== --- llvm/trunk/test/tools/llvm-objdump/X86/adjust-vma.test +++ llvm/trunk/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 Index: llvm/trunk/test/tools/llvm-objdump/X86/demangle.s =================================================================== --- llvm/trunk/test/tools/llvm-objdump/X86/demangle.s +++ llvm/trunk/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(): Index: llvm/trunk/test/tools/llvm-objdump/X86/out-of-section-sym.test =================================================================== --- llvm/trunk/test/tools/llvm-objdump/X86/out-of-section-sym.test +++ llvm/trunk/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 Index: llvm/trunk/test/tools/llvm-objdump/all-headers.test =================================================================== --- llvm/trunk/test/tools/llvm-objdump/all-headers.test +++ llvm/trunk/test/tools/llvm-objdump/all-headers.test @@ -1,8 +1,9 @@ # RUN: yaml2obj %s > %t # RUN: llvm-objdump --all-headers %t | FileCheck %s -## Check we print file format, architecture and start address followed by the -## other data when using --all-headers. +## Note: --all-headers (-x) is an alias for --archive-headers --file-headers +## --section-headers --private-headers --reloc --syms (-afhprt). Test for them +## in the following order which provides GNU objdump compatability. # CHECK: file format ELF64-x86-64 # CHECK-EMPTY: @@ -13,6 +14,7 @@ # CHECK: Dynamic Section: # CHECK: Sections: # CHECK: SYMBOL TABLE: +# CHECK: RELOCATION RECORDS FOR [.text]: ## Check how we dump the archives. ## Check we dump the appropriate headers for each file in the archive. @@ -23,26 +25,49 @@ # 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: RELOCATION RECORDS FOR [.text]: # 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: # ARCHIVE: SYMBOL TABLE: +# ARCHIVE: RELOCATION RECORDS FOR [.text]: !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB - Type: ET_EXEC + Type: ET_REL Machine: EM_X86_64 Sections: + - Name: .text + Type: SHT_PROGBITS + - Name: .rel.text + Type: SHT_REL + Info: .text + Relocations: + - Offset: 0x1 + Symbol: foo + Type: R_X86_64_32 + - Name: .dynamic + Type: SHT_DYNAMIC + Flags: [ SHF_WRITE, SHF_ALLOC ] + EntSize: 0x0000000000000010 + Entries: + - Tag: DT_INIT + Value: 0x00000000000006A0 + - Tag: DT_NULL + Value: 0x0000000000000000 +Symbols: + - Name: foo + Section: .text Index: llvm/trunk/test/tools/llvm-objdump/output-ordering.test =================================================================== --- llvm/trunk/test/tools/llvm-objdump/output-ordering.test +++ llvm/trunk/test/tools/llvm-objdump/output-ordering.test @@ -0,0 +1,70 @@ +# RUN: yaml2obj %s > %t.o +# RUN: llvm-objdump --file-headers --private-headers --section-headers --syms \ +# RUN: --full-contents --dwarf=frames \ +# RUN: --reloc %t.o | FileCheck %s --check-prefixes=CHECK,RELOC +# RUN: llvm-objdump --file-headers --private-headers --section-headers --syms \ +# RUN: --full-contents --dwarf=frames \ +# RUN: --disassemble %t.o | FileCheck %s --check-prefixes=CHECK,DISASM + +## Test the ordering of most of the output. Note that --disassemble suppresses +## --reloc, so we test them independently. + +## File headers (-f) +# CHECK: file format ELF64-x86-64 +# CHECK: architecture: x86_64 +# CHECK: start address: 0x0000000000000000 +## Private headers (-p) +# CHECK: Program Header: +# CHECK: Dynamic Section: +## Section headers (-h) +# CHECK: Sections: +## Symbol table (-t) +# CHECK: SYMBOL TABLE: +## DWARF contents: +# CHECK: .eh_frame contents: +## Relocations (-r) +# RELOC: RELOCATION RECORDS FOR [.text]: +## Section contents (-s) +# CHECK: Contents of section .rel.text: +# CHECK: Contents of section .dynamic: +# CHECK: Contents of section .symtab: +# CHECK: Contents of section .strtab: +# CHECK: Contents of section .shstrtab: +## Disassembly (-d) +# DISASM: Disassembly of section .text: + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: e800000000e800000000 + - Name: .rel.text + Type: SHT_REL + Info: .text + Relocations: + - Offset: 0x1 + Symbol: foo + Type: R_X86_64_32 + - Name: .dynamic + Type: SHT_DYNAMIC + Flags: [ SHF_WRITE, SHF_ALLOC ] + EntSize: 0x0000000000000010 + Entries: + - Tag: DT_INIT + Value: 0x00000000000006A0 + - Tag: DT_NULL + Value: 0x0000000000000000 + - Name: .eh_frame + Type: SHT_X86_64_UNWIND + Flags: [ SHF_ALLOC ] + AddressAlign: 0x0000000000000001 + Content: 00000000 +Symbols: + - Name: foo + Section: .text Index: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp +++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp @@ -2076,27 +2076,37 @@ 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 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 @@ printLazyBindTable(O); if (WeakBind) printWeakBindTable(O); + + // Other special sections: if (RawClangAST) printRawClangAST(O); if (FaultMapSection) printFaultMaps(O); - if (DwarfDumpType != DIDT_Null) { - std::unique_ptr 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,