2 # Check PLT creation for microMIPS to microMIPS calls.
4 # RUN: echo "SECTIONS { \
5 # RUN: . = 0x20000; .text ALIGN(0x100) : { *(.text) } \
6 # RUN: . = 0x20300; .plt : { *(.plt) } \
9 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
10 # RUN: -mattr=micromips %S/Inputs/mips-micro.s -o %t1eb.o
11 # RUN: ld.lld -shared -soname=teb.so -o %teb.so %t1eb.o
12 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
13 # RUN: -mattr=micromips %s -o %t2eb.o
14 # RUN: ld.lld --script %t.script -o %teb.exe %t2eb.o %teb.so
15 # RUN: llvm-objdump --no-print-imm-hex -d --mattr=micromips --no-show-raw-insn %teb.exe \
16 # RUN: | FileCheck --check-prefix=R2 %s
17 # RUN: llvm-readelf -A %teb.exe | FileCheck --check-prefix=PLT %s
19 # RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux \
20 # RUN: -mattr=micromips %S/Inputs/mips-micro.s -o %t1el.o
21 # RUN: ld.lld -shared -soname=tel.so -o %tel.so %t1el.o
22 # RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux \
23 # RUN: -mattr=micromips %s -o %t2el.o
24 # RUN: ld.lld --script %t.script -o %tel.exe %t2el.o %tel.so
25 # RUN: llvm-objdump --no-print-imm-hex -d --mattr=micromips --no-show-raw-insn %tel.exe \
26 # RUN: | FileCheck --check-prefix=R2 %s
27 # RUN: llvm-readelf -A %tel.exe | FileCheck --check-prefix=PLT %s
29 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
30 # RUN: -mattr=micromips -mcpu=mips32r6 %S/Inputs/mips-micro.s -o %t1eb.o
31 # RUN: ld.lld -shared -soname=teb.so -o %teb.so %t1eb.o
32 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
33 # RUN: -mattr=micromips -mcpu=mips32r6 %s -o %t2eb.o
34 # RUN: ld.lld --script %t.script -o %teb.exe %t2eb.o %teb.so
35 # RUN: llvm-objdump --no-print-imm-hex -d --mattr=micromips %teb.exe --no-show-raw-insn \
36 # RUN: | FileCheck --check-prefix=R6 %s
38 # RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux \
39 # RUN: -mattr=micromips -mcpu=mips32r6 %S/Inputs/mips-micro.s -o %t1el.o
40 # RUN: ld.lld -shared -soname=tel.so -o %tel.so %t1el.o
41 # RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux \
42 # RUN: -mattr=micromips -mcpu=mips32r6 %s -o %t2el.o
43 # RUN: ld.lld --script %t.script -o %tel.exe %t2el.o %tel.so
44 # RUN: llvm-objdump --no-print-imm-hex -d --mattr=micromips --no-show-raw-insn %tel.exe \
45 # RUN: | FileCheck --check-prefix=R6 %s
47 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
48 # RUN: -mattr=micromips %S/Inputs/mips-micro.s -o %t1eb.o
49 # RUN: ld.lld -shared -soname=teb.so -o %teb.so %t1eb.o
50 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
51 # RUN: %S/Inputs/mips-fpic.s -o %t-reg.o
52 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
53 # RUN: -mattr=micromips %s -o %t2eb.o
54 # RUN: ld.lld --script %t.script -o %teb.exe %t-reg.o %t2eb.o %teb.so
55 # RUN: llvm-objdump --no-print-imm-hex -d --mattr=micromips --no-show-raw-insn %teb.exe \
56 # RUN: | FileCheck --check-prefix=R2 %s
59 # R2: 20300: addiupc $3, 52
60 # R2-NEXT: lw $25, 0($3)
61 # R2-NEXT: subu16 $2, $2, $3
62 # R2-NEXT: srl16 $2, $2, 2
63 # R2-NEXT: addiu $24, $2, -2
64 # R2-NEXT: move $15, $ra
65 # R2-NEXT: jalrs16 $25
66 # R2-NEXT: move $gp, $3
69 # R2-NEXT: 20320: addiupc $2, 28
70 # R2-NEXT: lw $25, 0($2)
72 # R2-NEXT: move $24, $2
75 # R6: 20300: lapc $3, 52
76 # R6-NEXT: lw $25, 0($3)
77 # R6-NEXT: subu16 $2, $2, $3
78 # R6-NEXT: srl16 $2, $2, 2
79 # R6-NEXT: addiu $24, $2, -2
80 # R6-NEXT: move16 $15, $ra
81 # R6-NEXT: move16 $gp, $3
84 # R6: 20320: lapc $2, 28
85 # R6-NEXT: lw $25, 0($2)
86 # R6-NEXT: move16 $24, $2
91 # PLT-NEXT: Address Initial Sym.Val. Type Ndx Name
92 # PLT-NEXT: 0002033c 00020301 00000000 FUNC UND foo