[lld-macho] Diagnose unaligned arm64 PAGEOFF12 relocations
authorDaniel Bertalan <dani@danielbertalan.dev>
Sat, 3 Sep 2022 17:21:12 +0000 (19:21 +0200)
committerDaniel Bertalan <dani@danielbertalan.dev>
Mon, 5 Sep 2022 14:58:51 +0000 (16:58 +0200)
commit1b65d20961d3f7c30fe2fc75aac0e924e902cca3
tree8287eceaf4bb1f6afbbf78d77334e7649d859e4b
parent41c79d0b6d4ce1461f025cfb065619ba469ca96d
[lld-macho] Diagnose unaligned arm64 PAGEOFF12 relocations

The LDR and STR instructions store their immediate offsets as a multiple
of the load/store's size. Therefore, if the target address is not
aligned, the relocation is not representable. We now emit an error if
that happens, similarly to ld64.

This commit removes a test case from loh-adrp-ldr.s that contained an
unaligned LDR.

Differential Revision: https://reviews.llvm.org/D133269
lld/MachO/Arch/ARM64Common.cpp
lld/MachO/Arch/ARM64Common.h
lld/MachO/Relocations.cpp
lld/MachO/Relocations.h
lld/test/MachO/invalid/arm64-unaligned-load.s [new file with mode: 0644]
lld/test/MachO/loh-adrp-ldr.s