Commit 7b7760ad authored by Martin Storsjö's avatar Martin Storsjö

aarch64: Fix negative movrel offsets for windows

On windows, the offset for the relocation doesn't get stored in
the relocation itself, but as an unsigned immediate in the opcode.
Therefore, negative offsets has to be handled via a separate sub
instruction, just as on MachO.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 0c99b900
......@@ -82,6 +82,15 @@ ELF .size \name, . - \name
adrp \rd, \val+(\offset)@PAGE
add \rd, \rd, \val+(\offset)@PAGEOFF
.endif
#elif CONFIG_PIC && defined(_WIN32)
.if \offset < 0
adrp \rd, \val
add \rd, \rd, :lo12:\val
sub \rd, \rd, -(\offset)
.else
adrp \rd, \val+(\offset)
add \rd, \rd, :lo12:\val+(\offset)
.endif
#elif CONFIG_PIC
adrp \rd, \val+(\offset)
add \rd, \rd, :lo12:\val+(\offset)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment