• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: mips
2
3## Check handling of the R_MIPS_JALR relocation.
4
5# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t.o
6# RUN: llvm-readelf -r %t.o | FileCheck -check-prefix=REL %s
7
8# RUN: ld.lld %t.o -shared -o %t.so
9# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=SO %s
10
11# RUN: ld.lld %t.o --defsym=bar=__start -o %t.so
12# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=EXE %s
13
14# REL: R_MIPS_JALR   {{.*}} bar
15# REL: R_MIPS_JALR   {{.*}} foo
16# REL: R_MIPS_JALR   {{.*}} far
17
18# SO: jalr  $25
19# SO: bal   -24 <foo>
20# SO: jalr  $25
21
22# SO: jr    $25
23# SO: b     -64 <foo>
24# SO: jr    $25
25
26# EXE: bal   -4 <foo>
27# EXE: bal   -24 <foo>
28# EXE: jalr  $25
29
30# EXE: b     -56 <foo>
31# EXE: b     -64 <foo>
32# EXE: jr    $25
33
34  .text
35  .global bar
36  .global __start
37  .option pic2
38far:
39  .space 0x4fff0
40__start:
41foo:
42  jal bar
43  nop
44  jal foo
45  nop
46  jal far
47  nop
48l1:
49  jr $25
50  .reloc l1, R_MIPS_JALR, bar
51l2:
52  jr $25
53  .reloc l2, R_MIPS_JALR, foo
54l3:
55  jr $25
56  .reloc l3, R_MIPS_JALR, far
57