How can I load the absolute address of a symbol larger than 0x7FFFFFFF in RiscV64 assembly

1

I am writing a kernel and I need to self relocate above 0x7FFFFFFF. To do that, I need to refer, using absolute addressing, to the beginning and end of my kernel and to a symbol, where execution continues after the relocation. I have been unable to figure out any way to do this. Can it be done? Is there a workaround?

assembly
riscv
relocation
asked on Stack Overflow Dec 21, 2020 by Topi Karvonen

1 Answer

0

The only way I found was to take the load address and subtract this from the destination address. You can then add this offset to any relative address to get the absolute address.

answered on Stack Overflow Dec 21, 2020 by Topi Karvonen

User contributions licensed under CC BY-SA 3.0