2 # Check LA25 stubs creation. This stub code is necessary when
3 # non-PIC code calls PIC function.
5 # RUN: echo "SECTIONS { \
6 # RUN: . = 0x20000; .text ALIGN(0x100) : { *(.text) *(.text.*) } \
9 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
10 # RUN: %p/Inputs/mips-fpic.s -o %t-fpic.o
11 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
12 # RUN: %p/Inputs/mips-fnpic.s -o %t-fnpic.o
13 # RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic-r2.o
14 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
15 # RUN: %p/Inputs/mips-pic.s -o %t-pic-r2.o
16 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
17 # RUN: %s -o %t-npic-r2.o
18 # RUN: ld.lld %t-npic-r2.o %t-pic-r2.o %t-sto-pic-r2.o \
19 # RUN: -script %t.script -o %t-r2.exe
20 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t-r2.exe \
21 # RUN: | FileCheck --check-prefixes=CHECK,R2 %s
23 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
24 # RUN: %p/Inputs/mips-fpic.s -o %t-fpic.o
25 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
26 # RUN: %p/Inputs/mips-fnpic.s -o %t-fnpic.o
27 # RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic-r6.o
28 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
29 # RUN: %p/Inputs/mips-pic.s -o %t-pic-r6.o
30 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
31 # RUN: %s -o %t-npic-r6.o
32 # RUN: ld.lld %t-npic-r6.o %t-pic-r6.o %t-sto-pic-r6.o \
33 # RUN: -script %t.script -o %t-r6.exe
34 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t-r6.exe \
35 # RUN: | FileCheck --check-prefixes=CHECK,R6 %s
37 # CHECK: Disassembly of section .text:
39 # CHECK-NEXT: <__start>:
40 # CHECK-NEXT: 20100: jal {{.*}} <__LA25Thunk_foo1a>
42 # CHECK-NEXT: jal {{.*}} <__LA25Thunk_foo2>
44 # CHECK-NEXT: jal {{.*}} <__LA25Thunk_foo1b>
46 # CHECK-NEXT: jal {{.*}} <__LA25Thunk_foo2>
48 # CHECK-NEXT: jal {{.*}} <__LA25Thunk_fpic>
50 # CHECK-NEXT: jal {{.*}} <fnpic>
53 # CHECK: <__LA25Thunk_fpic>:
54 # R2: 20130: lui $25, 2
55 # R6: 20130: aui $25, $zero, 2
56 # CHECK-NEXT: j {{.*}} <fpic>
57 # CHECK-NEXT: addiu $25, $25, 320
61 # CHECK-NEXT: 20140: nop
64 # CHECK-NEXT: 20150: nop
66 # CHECK: <__LA25Thunk_foo1a>:
67 # R2: 20154: lui $25, 2
68 # R6: 20154: aui $25, $zero, 2
69 # CHECK: j {{.*}} <foo1a>
70 # CHECK-NEXT: addiu $25, $25, 384
73 # CHECK: <__LA25Thunk_foo1b>:
74 # R2: 20164: lui $25, 2
75 # R6: aui $25, $zero, 2
76 # CHECK-NEXT: j {{.*}} <foo1b>
77 # CHECK-NEXT: addiu $25, $25, 388
81 # CHECK-NEXT: 20180: nop
84 # CHECK-NEXT: 20184: nop
86 # CHECK: <__LA25Thunk_foo2>:
87 # R2: 20188: lui $25, 2
88 # R6: aui $25, $zero, 2
89 # CHECK-NEXT: j {{.*}} <foo2>
90 # CHECK-NEXT: addiu $25, $25, 416
94 # CHECK-NEXT: 201a0: nop