[COFF, ARM64] Handle ADRP immediate offsets in relocations
authorMartin Storsjo <martin@martin.st>
Wed, 26 Jul 2017 20:51:47 +0000 (20:51 +0000)
committerMartin Storsjo <martin@martin.st>
Wed, 26 Jul 2017 20:51:47 +0000 (20:51 +0000)
commit38608c0975772513007ec08116a1a3fb6160722b
treedb6e7ec6aad3591215ce11a053da32369174c012
parent853ce87a4d11a4dd60953c7851d3b3a667cf6a82
[COFF, ARM64] Handle ADRP immediate offsets in relocations

Also handle overflow correctly in LDR/STR relocations. Even if the
offset range of a 8 byte LDR instruction is 15 bit (even if the immediate
itself is 12 bit) due to a 3 bit shift, only include up to 12 bits of offset
after doing the relocation, by limiting the range of the immediate by the
number of shifted bits.

Differential Revision: https://reviews.llvm.org/D35792

llvm-svn: 309175
lld/COFF/Chunks.cpp
lld/test/COFF/arm64-relocs-imports.test