2 # Check R_MIPS_GOT_DISP relocations against various kind of symbols.
4 # RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
5 # RUN: %p/Inputs/mips-pic.s -o %t.so.o
6 # RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.exe.o
7 # RUN: ld.lld %t.so.o -shared -soname=t.so -o %t.so
8 # RUN: ld.lld %t.exe.o %t.so -o %t.exe
9 # RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s
10 # RUN: llvm-readelf -r -s -A %t.exe | FileCheck -check-prefix=GOT %s
13 # CHECK-NEXT: {{.*}}: addiu $2, $2, -32704
16 # CHECK-NEXT: {{.*}}: addiu $2, $2, -32736
19 # CHECK-NEXT: {{.*}}: addiu $2, $2, -32728
22 # CHECK-NEXT: {{.*}}: addiu $2, $2, -32720
23 # CHECK-NEXT: {{.*}}: addiu $2, $2, -32712
25 # GOT: Symbol table '.symtab'
26 # GOT: {{.*}} [[B04:[0-9a-f]+]] {{.*}} b4
27 # GOT: {{.*}} [[FOO:[0-9a-f]+]] {{.*}} foo
28 # GOT: {{.*}} [[B08:[0-9a-f]+]] {{.*}} b8
29 # GOT: {{.*}} [[B12:[0-9a-f]+]] {{.*}} b12
32 # GOT-NEXT: Canonical gp value:
34 # GOT-NEXT: Reserved entries:
35 # GOT-NEXT: Address Access Initial Purpose
36 # GOT-NEXT: {{.*}} -32752(gp) 0000000000000000 Lazy resolver
37 # GOT-NEXT: {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
39 # GOT-NEXT: Local entries:
40 # GOT-NEXT: Address Access Initial
41 # GOT-NEXT: {{.*}} -32736(gp) [[FOO]]
42 # GOT-NEXT: {{.*}} -32728(gp) [[B04]]
43 # GOT-NEXT: {{.*}} -32720(gp) [[B08]]
44 # GOT-NEXT: {{.*}} -32712(gp) [[B12]]
46 # GOT-NEXT: Global entries:
47 # GOT-NEXT: Address Access Initial Sym.Val. Type Ndx Name
48 # GOT-NEXT: {{.*}} -32704(gp) 0000000000000000 0000000000000000 FUNC UND foo1a
53 addiu $v0
,$v0
,%got_disp
(foo1a
) # R_MIPS_GOT_DISP
55 addiu $v0
,$v0
,%got_disp
(foo
) # R_MIPS_GOT_DISP
57 addiu $v0
,$v0
,%got_disp
(.text+4) # R_MIPS_GOT_DISP
59 addiu $v0
,$v0
,%got_disp
(.text+8) # R_MIPS_GOT_DISP
60 addiu $v0
,$v0
,%got_disp
(.text+12) # R_MIPS_GOT_DISP