[PPC64] Fix offset checks on rel24 call relocations.
authorSean Fertile <sfertile@ca.ibm.com>
Thu, 18 Oct 2018 15:43:41 +0000 (15:43 +0000)
committerSean Fertile <sfertile@ca.ibm.com>
Thu, 18 Oct 2018 15:43:41 +0000 (15:43 +0000)
commit3acfe400a2d9bbc00c8c5eb7ae0cc205209d4338
tree683621559fc48659ac577ef9a2b5e703438b55ca
parentb1f4a4b61da658f50c6c860dfa487f22c97a7c9f
[PPC64] Fix offset checks on rel24 call relocations.

Adjusted the range check on a call instruction from 24 bits signed to
26 bits signed. While the instruction only encodes 24 bits, the target is
assumed to be 4 byte aligned, and the value that is encoded in the instruction
gets shifted left by 2 to form the offset. Also added a check that the offset is
indeed at least 4 byte aligned.

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

llvm-svn: 344747
lld/ELF/Arch/PPC64.cpp
lld/test/ELF/ppc64-call-reach.s [new file with mode: 0644]