Comment by dzaima
2 years ago
Direct function calls are usually done relative to the program counter (pc in auipc). So you get 32 bits of displacement, which is fine as long as your code is less than 4GB, and you get position-independent code for free. This is the same as on x86-64 and aarch64 too, which also have ~32 bits for call target immediates. (also, compilers have "code model" options for choosing the size of code to support)
I assume there's also support for a kind of calculated long jump done at elf load time? I know that's done as part of the relocations on aarch64.