1# RUN: rm -rf %t && mkdir -p %t 2# RUN: llvm-mc -triple=riscv64 -filetype=obj -riscv-asm-relax-branches=0 \ 3# RUN: -o %t/elf_riscv64_branch.o %s 4# RUN: llvm-mc -triple=riscv32 -filetype=obj -riscv-asm-relax-branches=0 \ 5# RUN: -o %t/elf_riscv32_branch.o %s 6# RUN: llvm-jitlink -noexec \ 7# RUN: -slab-allocate 100Kb -slab-address 0xfff00ff4 -slab-page-size 4096 \ 8# RUN: -abs external_func_positive_offset=0xfff00ffc -abs external_func_negative_offset=0xfff00000\ 9# RUN: -check %s %t/elf_riscv64_branch.o 10# RUN: llvm-jitlink -noexec \ 11# RUN: -slab-allocate 100Kb -slab-address 0xfff00ff4 -slab-page-size 4096 \ 12# RUN: -abs external_func_positive_offset=0xfff00ffc -abs external_func_negative_offset=0xfff00000 \ 13# RUN: -check %s %t/elf_riscv32_branch.o 14# 15 16 .text 17# Empty main entry point. 18 .globl main 19 .p2align 1 20 .type main,@function 21main: 22 ret 23 24 .size main, .-main 25 26# Test R_RISCV_BRANCH 27 28# jitlink-check: decode_operand(test_branch, 2)[12:0] = (external_func_positive_offset - test_branch)[12:0] 29# jitlink-check: decode_operand(test_branch+4, 2)[12:0] = (external_func_negative_offset - test_branch - 4)[12:0] 30 .globl test_branch 31 .p2align 1 32 .type test_branch,@function 33test_branch: 34 bge a0, a1, external_func_positive_offset 35 bge a0, a1, external_func_negative_offset 36 37 .size test_branch, .-test_branch 38