xref: /llvm-project/bolt/test/RISCV/internal-func-reloc.s (revision 86bc486785ee26ca527e5c830a95479c751ce11e)
1/// Check that functions with internal relocations are considered "simple" and
2/// get transformed by BOLT. The tests rely on the "remove-nops" optimization:
3/// if nops got removed from the function, it got transformed by BOLT.
4
5// RUN: llvm-mc -triple riscv64 -filetype=obj -o %t.o %s
6// RUN: ld.lld --emit-relocs -o %t %t.o
7// RUN: llvm-bolt -o %t.bolt %t
8// RUN: llvm-objdump -d %t.bolt | FileCheck %s
9
10  .text
11  .globl _start
12  .p2align 2
13// CHECK: <_start>:
14// CHECK-NEXT: j 0x{{.*}} <_start>
15_start:
16  nop
171:
18  j 1b
19  .size _start, .-_start
20
21  .globl f
22  .p2align 2
23// CHECK: <f>:
24// CHECK-NEXT: auipc a0, [[#]]
25// CHECK-NEXT: addi a0, a0, [[#]]
26f:
27  nop
281:
29  /// Same as "la a0, g" but more explicit
30  auipc a0, %pcrel_hi(g)
31  addi  a0, a0, %pcrel_lo(1b)
32  ret
33  .size f, .-f
34
35  .globl g
36  .p2align 2
37g:
38  ret
39  .size g, .-g
40