1 # RUN: rm -rf %t && mkdir -p %t
2 # RUN: llvm-mc -triple=riscv64 -position-independent -filetype=obj -o %t/elf_riscv64_sm_pic_reloc.o %s
3 # RUN: llvm-mc -triple=riscv32 -position-independent -filetype=obj -o %t/elf_riscv32_sm_pic_reloc.o %s
4 # RUN: llvm-jitlink -noexec -slab-allocate 100Kb -slab-address 0xfff00000 \
5 # RUN: -define-abs external_func=0x1 -define-abs external_data=0x2 \
6 # RUN: -check %s %t/elf_riscv64_sm_pic_reloc.o
7 # RUN: llvm-jitlink -noexec -slab-allocate 100Kb -slab-address 0xfff00000\
8 # RUN: -define-abs external_func=0x1 -define-abs external_data=0x2 \
9 # RUN: -check %s %t/elf_riscv32_sm_pic_reloc.o
11 # Test ELF small/PIC relocations
16 # Empty main entry point.
25 # Test R_RISCV_PCREL_HI20 and R_RISCV_PCREL_LO
26 # jitlink-check: decode_operand(test_pcrel32, 1) = ((external_data - test_pcrel32) + 0x800)[31:12]
27 # jitlink-check: decode_operand(test_pcrel32+4, 2)[11:0] = (external_data - test_pcrel32)[11:0]
30 .type test_pcrel32,@function
32 auipc a0
, %pcrel_hi
(external_data
)
33 lw a0
, %pcrel_lo
(test_pcrel32
)(a0
)
35 .size test_pcrel32, .-test_pcrel32
38 # jitlink-check: decode_operand(test_call, 1) = ((external_func - test_call) + 0x800)[31:12]
39 # jitlink-check: decode_operand(test_call+4, 2)[11:0] = (external_func - test_call)[11:0]
42 .type test_call,@function
46 .size test_call, .-test_call