Assembler instructions used for calling functions
In this section:
This section presents the assembler instructions that can be used for calling and returning from functions on RISC-V.
Functions can be called in different ways—directly or via a function pointer. In this section we will discuss how these types of calls will be performed.
The normal function calling instruction is the call instruction:
call labelThis is an assembler pseudo instruction that expands to two instructions in object files:
auipc ra, %hi(label) jalr ra, ra, %lo(label)
When the linker resolves addresses, it might replace this sequence with a shorter (and faster) option if the destination is within range. Possible replacements are c.jal and jalr.