1# REQUIRES: mips
2# Check PLT entries generation in case of R6 ABI version.
3
4# RUN: echo "SECTIONS { \
5# RUN:         . = 0x10000; .text ALIGN(0x10000) : { *(.text) } \
6# RUN:         . = 0x30000; .data                : { *(.data) } \
7# RUN:       }" > %t.script
8
9# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
10# RUN:         -mcpu=mips32r6 %s -o %t1.o
11# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
12# RUN:         -mcpu=mips32r6 %S/Inputs/mips-dynamic.s -o %t2.o
13# RUN: ld.lld %t2.o -shared -soname=t.so -o %t.so
14# RUN: ld.lld %t1.o %t.so -script %t.script -o %t.exe
15# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck %s --check-prefixes=DEFAULT,CHECK
16# RUN: ld.lld %t2.o -shared -soname=t.so -o %t.so -z hazardplt
17# RUN: ld.lld %t1.o %t.so -script %t.script -o %t.exe -z hazardplt
18# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck %s --check-prefixes=HAZARDPLT,CHECK
19
20# CHECK:      Disassembly of section .text:
21# CHECK-EMPTY:
22# CHECK-NEXT: <__start>:
23# CHECK-NEXT:   20000:       jal     131120
24#                                    ^-- 0x20030 gotplt[foo0]
25# CHECK-NEXT:   20004:       nop
26#
27# CHECK-EMPTY:
28# CHECK-NEXT: Disassembly of section .plt:
29# CHECK-EMPTY:
30# CHECK-NEXT: <.plt>:
31# CHECK-NEXT:   20010:       aui     $gp, $zero, 3
32# CHECK-NEXT:   20014:       lw      $25, 4($gp)
33# CHECK-NEXT:   20018:       addiu   $gp, $gp, 4
34# CHECK-NEXT:   2001c:       subu    $24, $24, $gp
35# CHECK-NEXT:   20020:       move    $15, $ra
36# CHECK-NEXT:   20024:       srl     $24, $24, 2
37# DEFAULT:      20028:       jalr    $25
38# HAZARDPLT:    20028:       jalr.hb $25
39# CHECK-NEXT:   2002c:       addiu   $24, $24, -2
40
41# CHECK-NEXT:   20030:       aui     $15, $zero, 3
42# CHECK-NEXT:   20034:       lw      $25, 12($15)
43# DEFAULT:      20038:       jr      $25
44# HAZARDPLT:    20038:       jr.hb   $25
45# CHECK-NEXT:   2003c:       addiu   $24, $15, 12
46
47  .text
48  .global __start
49__start:
50  jal foo0        # R_MIPS_26 against 'foo0' from DSO
51