// REQUIRES: mips
// RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t
// RUN: ld.lld -shared %t -o %t2
-// RUN: llvm-readobj --symbols %t2 | FileCheck %s
+// RUN: llvm-readelf --sections --symbols %t2 | FileCheck %s
// The Mips _GLOBAL_OFFSET_TABLE_ should be defined at the start of the .got
_start:
lw $t0,%call16(f)($gp)
.word _GLOBAL_OFFSET_TABLE_ - .
-// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (1)
-// CHECK-NEXT: Value: 0x20000
-// CHECK-NEXT: Size: 0
-// CHECK-NEXT: Binding: Local (0x0)
-// CHECK-NEXT: Type: None (0x0)
-// CHECK-NEXT: Other [ (0x2)
-// CHECK-NEXT: STV_HIDDEN (0x2)
-// CHECK-NEXT: ]
-// CHECK-NEXT: Section: .got (0x9)
+
+// CHECK: {{.*}} .got PROGBITS [[GOT:[0-9a-f]+]]
+// CHECK: {{.*}} [[GOT]] {{.*}} _GLOBAL_OFFSET_TABLE_
# CHECK: Disassembly of section .text:
# CHECK-EMPTY:
# CHECK: __start:
-# CHECK-NEXT: 20000: jal 0x8020000
+# CHECK-NEXT: [[ADDR:[0-9a-f]+]]: jal 0x80[[ADDR]]
.text
.global __start
# RUN: %S/Inputs/mips-dynamic.s -o %t2.o
# RUN: ld.lld %t2.o -shared -o %t.so
# RUN: ld.lld %t1.o %t.so -o %t.exe
-# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.exe | FileCheck %s
# RUN: llvm-readobj --dynamic-table -S -r --mips-plt-got %t.exe \
# RUN: | FileCheck -check-prefix=REL %s
# CHECK: Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: bar:
-# CHECK-NEXT: 20000: jal 131096 <loc>
-# CHECK-NEXT: 20004: nop
+# CHECK-NEXT: [[BAR:[0-9a-f]+]]: jal 0x[[LOC:[0-9a-f]+]] <loc>
+# CHECK-NEXT: {{.*}}: nop
#
# CHECK: __start:
-# CHECK-NEXT: 20008: jal 131072 <bar>
-# CHECK-NEXT: 2000c: nop
-# CHECK-NEXT: 20010: jal 131136
-# ^-- 0x20040 gotplt[foo0]
-# CHECK-NEXT: 20014: nop
+# CHECK-NEXT: {{.*}}: jal 0x[[BAR]] <bar>
+# CHECK-NEXT: {{.*}}: nop
+# CHECK-NEXT: {{.*}}: jal 0x[[FOO0:[0-9a-f]+]]
+# ^-- gotplt[foo0]
+# CHECK-NEXT: {{.*}}: nop
#
# CHECK: loc:
-# CHECK-NEXT: 20018: nop
+# CHECK-NEXT: [[LOC]]: nop
# CHECK-EMPTY:
# CHECK-NEXT: Disassembly of section .plt:
# CHECK-EMPTY:
# CHECK-NEXT: .plt:
-# CHECK-NEXT: 20020: lui $gp, 3
-# CHECK-NEXT: 20024: lw $25, 4($gp)
-# CHECK-NEXT: 20028: addiu $gp, $gp, 4
-# CHECK-NEXT: 2002c: subu $24, $24, $gp
-# CHECK-NEXT: 20030: move $15, $ra
-# CHECK-NEXT: 20034: srl $24, $24, 2
-# CHECK-NEXT: 20038: jalr $25
-# CHECK-NEXT: 2003c: addiu $24, $24, -2
-# CHECK-NEXT: 20040: lui $15, 3
-# CHECK-NEXT: 20044: lw $25, 12($15)
-# CHECK-NEXT: 20048: jr $25
-# CHECK-NEXT: 2004c: addiu $24, $15, 12
+# CHECK-NEXT: {{.*}}: lui $gp, 0x3
+# CHECK-NEXT: {{.*}}: lw $25, {{.*}}($gp)
+# CHECK-NEXT: {{.*}}: addiu $gp, $gp, {{.*}}
+# CHECK-NEXT: {{.*}}: subu $24, $24, $gp
+# CHECK-NEXT: {{.*}}: move $15, $ra
+# CHECK-NEXT: {{.*}}: srl $24, $24, 0x2
+# CHECK-NEXT: {{.*}}: jalr $25
+# CHECK-NEXT: {{.*}}: addiu $24, $24, -0x2
+# CHECK-NEXT: [[FOO0]]: lui $15, 0x3
+# CHECK-NEXT: {{.*}}: lw $25, {{.*}}($15)
+# CHECK-NEXT: {{.*}}: jr $25
+# CHECK-NEXT: {{.*}}: addiu $24, $15, {{.*}}
# REL: Name: .plt
# REL-NEXT: Type: SHT_PROGBITS
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-be.o
# RUN: ld.lld -shared %t-be.o -o %t-be.so
# RUN: llvm-objdump -t -s %t-be.so | FileCheck -check-prefixes=SYM,BE %s
-# RUN: llvm-readobj -r --dynamic-table --mips-plt-got %t-be.so \
+# RUN: llvm-readelf -r -s --dynamic-table --mips-plt-got %t-be.so \
# RUN: | FileCheck -check-prefix=REL %s
# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o
# RUN: ld.lld -shared %t-el.o -o %t-el.so
# RUN: llvm-objdump -t -s %t-el.so | FileCheck -check-prefixes=SYM,EL %s
-# RUN: llvm-readobj -r --dynamic-table --mips-plt-got %t-el.so \
+# RUN: llvm-readelf -r -s --dynamic-table --mips-plt-got %t-el.so \
# RUN: | FileCheck -check-prefix=REL %s
.globl __start
.word v1 # R_MIPS_32 target v1 addend 0
# BE: Contents of section .data:
-# BE-NEXT: 20000 00000000 00000004 00020000
-# ^-- v2+4 ^-- v1
+# BE-NEXT: {{.*}} 00000000 00000004 00020000
+# ^-- v2+4 ^-- v1
# EL: Contents of section .data:
-# EL-NEXT: 20000 00000000 04000000 00000200
-# ^-- v2+4 ^-- v1
+# EL-NEXT: {{.*}} 00000000 04000000 00000200
+# ^-- v2+4 ^-- v1
# SYM: SYMBOL TABLE:
# SYM: 00020000 l O .data 00000004 v1
-# SYM: 00020004 g O .data 00000008 v2
-# REL: Relocations [
-# REL-NEXT: Section (7) .rel.dyn {
-# REL-NEXT: 0x20008 R_MIPS_REL32 - 0x0
-# REL-NEXT: 0x20004 R_MIPS_REL32 v2 0x0
-# REL-NEXT: }
-# REL-NEXT: ]
+# Relocation section
+# REL: {{.*}} R_MIPS_REL32
+# REL-NEXT: {{.*}} R_MIPS_REL32 [[V2:[0-9a-f]+]]
-# REL: DynamicSection [
-# REL: Tag Type Name/Value
-# REL: 0x00000012 RELSZ 16 (bytes)
-# REL: 0x00000013 RELENT 8 (bytes)
-# REL-NOT: 0x6FFFFFFA RELCOUNT
+# REL: Symbol table
+# REL: {{.*}} [[V2]] {{.*}} v2
-# REL: Primary GOT {
-# REL-NEXT: Canonical gp value:
-# REL-NEXT: Reserved entries [
-# REL: ]
-# REL-NEXT: Local entries [
-# REL-NEXT: ]
-# REL-NEXT: Global entries [
-# REL-NEXT: Entry {
-# REL-NEXT: Address:
-# REL-NEXT: Access:
-# REL-NEXT: Initial: 0x20004
-# REL-NEXT: Value: 0x20004
-# REL-NEXT: Type: Object
-# REL-NEXT: Section: .data
-# REL-NEXT: Name: v2
-# REL-NEXT: }
-# REL-NEXT: ]
-# REL-NEXT: Number of TLS and multi-GOT entries: 0
-# REL-NEXT: }
+# Dynamic section
+# REL: (RELSZ) 16
+# REL: (RELENT) 8
+# REL-NOT: (RELCOUNT)
+
+# REL: Global entries
+# REL: {{.*}} -32744(gp) [[V2]] {{.*}} v2
# RUN: ld.lld %t.so.o -shared -soname=t.so -o %t.so
# RUN: ld.lld %t.exe.o %t.so -o %t.exe
# RUN: llvm-objdump -d -t --no-show-raw-insn %t.exe | FileCheck %s
-# RUN: llvm-readelf -r --mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s
+# RUN: llvm-readelf -r -s --mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s
# CHECK: __start:
-# CHECK-NEXT: 20000: addiu $2, $2, -32704
-# CHECK-NEXT: 20004: addiu $2, $2, -32736
-# CHECK-NEXT: 20008: addiu $2, $2, -32728
-# CHECK-NEXT: 2000c: addiu $2, $2, -32720
-# CHECK-NEXT: 20010: addiu $2, $2, -32712
+# CHECK-NEXT: {{.*}}: addiu $2, $2, -32704
+# CHECK-EMPTY:
+# CHECK-NEXT: b4:
+# CHECK-NEXT: {{.*}}: addiu $2, $2, -32736
+# CHECK-EMPTY:
+# CHECK-NEXT: b8:
+# CHECK-NEXT: {{.*}}: addiu $2, $2, -32728
+# CHECK-EMPTY:
+# CHECK-NEXT: b12:
+# CHECK-NEXT: {{.*}}: addiu $2, $2, -32720
+# CHECK-NEXT: {{.*}}: addiu $2, $2, -32712
-# CHECK: 0000000000020014 .text 00000000 foo
-# CHECK: 0000000000020000 .text 00000000 __start
-# CHECK: 0000000000000000 g F *UND* 00000000 foo1a
+# GOT: Symbol table '.symtab'
+# GOT: {{.*}} [[B12:[0-9a-f]+]] {{.*}} b12
+# GOT: {{.*}} [[B04:[0-9a-f]+]] {{.*}} b4
+# GOT: {{.*}} [[B08:[0-9a-f]+]] {{.*}} b8
+# GOT: {{.*}} [[FOO:[0-9a-f]+]] {{.*}} foo
# GOT: Primary GOT:
-# GOT-NEXT: Canonical gp value: 0000000000038000
+# GOT-NEXT: Canonical gp value:
# GOT-EMPTY:
# GOT-NEXT: Reserved entries:
-# GOT-NEXT: Address Access Initial Purpose
-# GOT-NEXT: 0000000000030010 -32752(gp) 0000000000000000 Lazy resolver
-# GOT-NEXT: 0000000000030018 -32744(gp) 8000000000000000 Module pointer (GNU extension)
+# GOT-NEXT: Address Access Initial Purpose
+# GOT-NEXT: {{.*}} -32752(gp) 0000000000000000 Lazy resolver
+# GOT-NEXT: {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
# GOT-EMPTY:
# GOT-NEXT: Local entries:
-# GOT-NEXT: Address Access Initial
-# GOT-NEXT: 0000000000030020 -32736(gp) 0000000000020014
-# GOT-NEXT: 0000000000030028 -32728(gp) 0000000000020004
-# GOT-NEXT: 0000000000030030 -32720(gp) 0000000000020008
-# GOT-NEXT: 0000000000030038 -32712(gp) 000000000002000c
+# GOT-NEXT: Address Access Initial
+# GOT-NEXT: {{.*}} -32736(gp) [[FOO]]
+# GOT-NEXT: {{.*}} -32728(gp) [[B04]]
+# GOT-NEXT: {{.*}} -32720(gp) [[B08]]
+# GOT-NEXT: {{.*}} -32712(gp) [[B12]]
# GOT-EMPTY:
# GOT-NEXT: Global entries:
-# GOT-NEXT: Address Access Initial Sym.Val. Type Ndx Name
-# GOT-NEXT: 0000000000030040 -32704(gp) 0000000000000000 0000000000000000 FUNC UND foo1a
+# GOT-NEXT: Address Access Initial Sym.Val. Type Ndx Name
+# GOT-NEXT: {{.*}} -32704(gp) 0000000000000000 0000000000000000 FUNC UND foo1a
.text
.global __start
__start:
addiu $v0,$v0,%got_disp(foo1a) # R_MIPS_GOT_DISP
+b4:
addiu $v0,$v0,%got_disp(foo) # R_MIPS_GOT_DISP
+b8:
addiu $v0,$v0,%got_disp(.text+4) # R_MIPS_GOT_DISP
+b12:
addiu $v0,$v0,%got_disp(.text+8) # R_MIPS_GOT_DISP
addiu $v0,$v0,%got_disp(.text+12) # R_MIPS_GOT_DISP