1# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ 2# RUN: | llvm-objdump -d - | FileCheck --check-prefix=INSTR %s 3# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ 4# RUN: | llvm-readobj -r - | FileCheck -check-prefix=RELOC %s 5# RUN: llvm-mc -triple riscv32 < %s -show-encoding \ 6# RUN: | FileCheck -check-prefix=FIXUP %s 7 8.long foo 9 10call foo 11# RELOC: R_RISCV_CALL foo 0x0 12# INSTR: auipc ra, 0 13# INSTR: jalr ra 14# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_call 15call bar 16# RELOC: R_RISCV_CALL bar 0x0 17# INSTR: auipc ra, 0 18# INSTR: jalr ra 19# FIXUP: fixup A - offset: 0, value: bar, kind: fixup_riscv_call 20 21# Ensure that calls to functions whose names coincide with register names work. 22 23call zero 24# RELOC: R_RISCV_CALL zero 0x0 25# INSTR: auipc ra, 0 26# INSTR: jalr ra 27# FIXUP: fixup A - offset: 0, value: zero, kind: fixup_riscv_call 28 29call f1 30# RELOC: R_RISCV_CALL f1 0x0 31# INSTR: auipc ra, 0 32# INSTR: jalr ra 33# FIXUP: fixup A - offset: 0, value: f1, kind: fixup_riscv_call 34 35call ra 36# RELOC: R_RISCV_CALL ra 0x0 37# INSTR: auipc ra, 0 38# INSTR: jalr ra 39# FIXUP: fixup A - offset: 0, value: ra, kind: fixup_riscv_call 40 41call mstatus 42# RELOC: R_RISCV_CALL mstatus 0x0 43# INSTR: auipc ra, 0 44# INSTR: jalr ra 45# FIXUP: fixup A - offset: 0, value: mstatus, kind: fixup_riscv_call 46 47# Ensure that calls to procedure linkage table symbols work. 48 49call foo@plt 50# RELOC: R_RISCV_CALL_PLT foo 0x0 51# INSTR: auipc ra, 0 52# INSTR: jalr ra 53# FIXUP: fixup A - offset: 0, value: foo@plt, kind: fixup_riscv_call_plt 54 55# Ensure that an explicit register operand can be parsed. 56 57call a0, foo 58# RELOC: R_RISCV_CALL foo 0x0 59# INSTR: auipc a0, 0 60# INSTR: jalr a0 61# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_call 62 63call a0, foo@plt 64# RELOC: R_RISCV_CALL_PLT foo 0x0 65# INSTR: auipc a0, 0 66# INSTR: jalr a0 67# FIXUP: fixup A - offset: 0, value: foo@plt, kind: fixup_riscv_call_plt 68