2 # Check R_MIPS_26 relocation handling.
4 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o
5 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
6 # RUN: %S/Inputs/mips-dynamic.s -o %t2.o
7 # RUN: ld.lld %t2.o -shared -o %t.so
8 # RUN: ld.lld %t1.o %t.so -o %t.exe
9 # RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.exe | FileCheck %s
10 # RUN: llvm-readobj -S --dynamic-table -r -A %t.exe \
11 # RUN: | FileCheck -check-prefix=REL %s
13 # CHECK: Disassembly of section .text:
16 # CHECK-NEXT: [[BAR:[0-9a-f]+]]: jal 0x[[LOC:[0-9a-f]+]] <loc>
17 # CHECK-NEXT: {{.*}}: nop
20 # CHECK-NEXT: {{.*}}: jal 0x[[BAR]] <bar>
21 # CHECK-NEXT: {{.*}}: nop
22 # CHECK-NEXT: {{.*}}: jal 0x[[FOO0:[0-9a-f]+]]
24 # CHECK-NEXT: {{.*}}: nop
27 # CHECK-NEXT: [[LOC]]: nop
29 # CHECK-NEXT: Disassembly of section .plt:
32 # CHECK-NEXT: {{.*}}: lui $gp, 0x3
33 # CHECK-NEXT: {{.*}}: lw $25, {{.*}}($gp)
34 # CHECK-NEXT: {{.*}}: addiu $gp, $gp, {{.*}}
35 # CHECK-NEXT: {{.*}}: subu $24, $24, $gp
36 # CHECK-NEXT: {{.*}}: move $15, $ra
37 # CHECK-NEXT: {{.*}}: srl $24, $24, 0x2
38 # CHECK-NEXT: {{.*}}: jalr $25
39 # CHECK-NEXT: {{.*}}: addiu $24, $24, -0x2
40 # CHECK-NEXT: [[FOO0]]: lui $15, 0x3
41 # CHECK-NEXT: {{.*}}: lw $25, {{.*}}($15)
42 # CHECK-NEXT: {{.*}}: jr $25
43 # CHECK-NEXT: {{.*}}: addiu $24, $15, {{.*}}
46 # REL-NEXT: Type: SHT_PROGBITS
47 # REL-NEXT: Flags [ (0x6)
49 # REL-NEXT: SHF_EXECINSTR
51 # REL-NEXT: Address: 0x[[PLTADDR:[0-9A-F]+]]
54 # REL-NEXT: Type: SHT_PROGBITS
55 # REL-NEXT: Flags [ (0x3)
59 # REL-NEXT: Address: 0x[[GOTPLTADDR:[0-9A-F]+]]
61 # REL: 0x70000032 MIPS_PLTGOT 0x[[GOTPLTADDR]]
64 # REL-NEXT: Section (7) .rel.plt {
65 # REL-NEXT: 0x[[PLTSLOT:[0-9A-F]+]] R_MIPS_JUMP_SLOT foo0
70 # REL: Local entries [
72 # REL-NEXT: Global entries [
77 # REL-NEXT: Address: 0x[[PLTSLOT]]
78 # REL-NEXT: Initial: 0x[[PLTADDR]]
79 # REL-NEXT: Value: 0x0
80 # REL-NEXT: Type: Function
81 # REL-NEXT: Section: Undefined
82 # REL-NEXT: Name: foo0
89 jal loc
# R_MIPS_26 against .text + offset
93 jal bar
# R_MIPS_26 against global 'bar' from object file
94 jal foo0
# R_MIPS_26 against 'foo0' from DSO