[obj2yaml] - Fix a comment. NFC.
[llvm-complete.git] / test / MC / RISCV / function-call.s
blobd63db714b41d5b915973e79b750a441d0e4689c0
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
8 .long foo
10 call 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
15 call 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
21 # Ensure that calls to functions whose names coincide with register names work.
23 call 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
29 call 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
35 call 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
41 call 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
47 # Ensure that calls to procedure linkage table symbols work.
49 call 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
55 # Ensure that an explicit register operand can be parsed.
57 call 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
63 call 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