[PPC64] Consider localentry offset when computing branch distance
authorFangrui Song <maskray@google.com>
Wed, 24 Apr 2019 14:03:30 +0000 (14:03 +0000)
committerFangrui Song <maskray@google.com>
Wed, 24 Apr 2019 14:03:30 +0000 (14:03 +0000)
commit513d3658e708e38d2d4612fe59c7a3c3f64e8a5d
treefa4b1ed5024242524e9c4b647fdb0861f5c473f1
parent50392a3b1b84beea67bb294f6855d5fb1facd35e
[PPC64] Consider localentry offset when computing branch distance

Summary:
We don't take localentry offset into account, and thus may fail to
create a long branch when the gap is just a few bytes smaller than 2^25.

relocation R_PPC64_REL24 out of range: 33554432 is not in [-3355443233554431]
relocation R_PPC64_REL24 out of range: 33554436 is not in [-3355443233554431]

Fix that by adding the offset to the symbol VA.

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

llvm-svn: 359094
lld/ELF/Arch/PPC64.cpp
lld/test/ELF/ppc64-long-branch-localentry-offset.s [new file with mode: 0644]