[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / mips-micro-jal.s
blob73797b4ae9952a7f32dd6d7193edb195140c8f8b
1 # REQUIRES: mips
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) } \
7 # RUN: }" > %t.script
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
58 # R2: .plt:
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
67 # R2-NEXT: nop
68 # R2-NEXT: ...
69 # R2-NEXT: 20320: addiupc $2, 28
70 # R2-NEXT: lw $25, 0($2)
71 # R2-NEXT: jr16 $25
72 # R2-NEXT: move $24, $2
74 # R6: .plt:
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
82 # R6-NEXT: jalr $25
84 # R6: 20320: lapc $2, 28
85 # R6-NEXT: lw $25, 0($2)
86 # R6-NEXT: move16 $24, $2
87 # R6-NEXT: jrc16 $25
89 # PLT: PLT GOT:
90 # PLT: Entries:
91 # PLT-NEXT: Address Initial Sym.Val. Type Ndx Name
92 # PLT-NEXT: 0002033c 00020301 00000000 FUNC UND foo
93 # ^ 0x20320 + 28
95 .text
96 .set micromips
97 .global __start
98 __start:
99 jal foo