1# REQUIRES: mips
2# Check R_MIPS_26 relocation handling in case of N64 ABIs.
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=mips64-unknown-linux \
10# RUN:         %S/Inputs/mips-dynamic.s -o %t-so.o
11# RUN: ld.lld %t-so.o -shared -soname=t.so -o %t.so
12# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o
13# RUN: ld.lld %t.o %t.so -script %t.script -o %t.exe
14# RUN: llvm-objdump -d --no-show-raw-insn %t.exe \
15# RUN:   | FileCheck %s --check-prefixes=CHECK,DEFAULT
16# RUN: ld.lld %t-so.o -shared -soname=t.so -o %t.so -z hazardplt
17# RUN: ld.lld %t.o %t.so -script %t.script -o %t.exe -z hazardplt
18# RUN: llvm-objdump -d --no-show-raw-insn %t.exe \
19# RUN:   | FileCheck %s --check-prefixes=CHECK,HAZARDPLT
20
21# CHECK:      Disassembly of section .text:
22# CHECK-EMPTY:
23# CHECK-NEXT: <__start>:
24# CHECK-NEXT:    20000:       jal     131120
25# CHECK-NEXT:    20004:       nop
26# CHECK-EMPTY:
27# CHECK-NEXT: Disassembly of section .plt:
28# CHECK-EMPTY:
29# CHECK-NEXT: <.plt>:
30# CHECK-NEXT:    20010:       lui     $14, 3
31# CHECK-NEXT:    20014:       ld      $25, 8($14)
32# CHECK-NEXT:    20018:       addiu   $14, $14, 8
33# CHECK-NEXT:    2001c:       subu    $24, $24, $14
34# CHECK-NEXT:    20020:       move    $15, $ra
35# CHECK-NEXT:    20024:       srl     $24, $24, 3
36# DEFAULT:       20028:       jalr    $25
37# HAZARDPLT:     20028:       jalr.hb $25
38# CHECK-NEXT:    2002c:       addiu   $24, $24, -2
39# CHECK-NEXT:    20030:       lui     $15, 3
40# CHECK-NEXT:    20034:       ld      $25, 24($15)
41# DEFAULT:       20038:       jr      $25
42# HAZARDPLT:     20038:       jr.hb   $25
43# CHECK-NEXT:    2003c:       daddiu  $24, $15, 24
44
45  .text
46  .option pic0
47  .global __start
48__start:
49  jal   foo0
50