52 lines · plain
1## Test that long branches are not relaxed with .option exact2# RUN: split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c \4# RUN: %t/pass.s \5# RUN: | llvm-objdump -dr -M no-aliases - \6# RUN: | FileCheck %t/pass.s7# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=+c -o /dev/null \8# RUN: %t/fail.s 2>&1 \9# RUN: | FileCheck %t/fail.s10 11#--- pass.s12 .option exact13 14 .text15test_undefined:16## Branches to undefined symbols should not be relaxed17# CHECK: bne a0, a1, {{.*}}18# CHECK-NEXT: R_RISCV_BRANCH foo19 bne a0, a1, foo20# CHECK: c.beqz a0, {{.*}}21# CHECK-NEXT: R_RISCV_RVC_BRANCH foo22 c.beqz a0, foo23# CHECK: c.j {{.*}}24# CHECK-NEXT: R_RISCV_RVC_JUMP foo25 c.j foo26 27## Branches to defined in-range symbols should work normally28test_defined_in_range:29# CHECK: bne a0, a1, {{.*}} <bar>30 bne a0, a1, bar31# CHECK: c.beqz a0, {{.*}} <bar>32 c.beqz a0, bar33# CHECK: c.j {{.*}} <bar>34 c.j bar35bar:36 37#--- fail.s38 .option exact39 40 .text41## Branches to defined out-of-range symbols should report an error42test_defined_out_of_range:43 bne a0, a1, 1f # CHECK: :[[#@LINE]]:15: error: fixup value out of range44 .skip (1 << 12)451:46 c.beqz a0, 1f # CHECK: :[[#@LINE]]:14: error: fixup value out of range47 .skip (1 << 8)481:49 c.j 1f # CHECK: :[[#@LINE]]:7: error: fixup value out of range50 .skip (1 << 11)511:52