Linker can give addi too big value
E.g. if we want to load address on 0b1111_1111_1111
(relative), the linker would probably give auipc
a zero (a ^ (a & 0xfff)
) and give addi
whole value 0b1111_1111_1111
(a & 0xfff
). Unfortunately, addi
would treat it as -1
. The correct way is to give auipc
value 0b1_0000_0000_0000
and set addi
to 0b1111_1111_1111
(-1
). In total it is 0b1_0000_0000_0000 - 1 = 0b1111_1111_1111
.