This is an archive of the discontinued LLVM Phabricator instance.

[PPC64] Consider localentry offset when computing branch distance
ClosedPublic

Authored by MaskRay on Apr 24 2019, 2:13 AM.

Details

Summary

We don't take localentry offset into account, and thus may fail to
create 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 [-33554432, 33554431]
relocation R_PPC64_REL24 out of range: 33554436 is not in [-33554432, 33554431]

Fix that.

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Apr 24 2019, 2:13 AM
Herald added a project: Restricted Project. · View Herald Transcript

This occurred extremely rarely (the distance must be exactly 33554432 or 33554436!) ... probably less than 0.01% or even 0.001%, but thanks to our numerous targets for exposing the bug 😊

MaskRay updated this revision to Diff 196402.Apr 24 2019, 2:28 AM
MaskRay edited the summary of this revision. (Show Details)

.

ruiu added a comment.Apr 24 2019, 6:45 AM

LGTM

Nice. Even if the probability of a failure for each relocation is very low, we have huge number of relocations. Apparently the latter overwhelms the former!

ruiu accepted this revision.Apr 24 2019, 6:45 AM
This revision is now accepted and ready to land.Apr 24 2019, 6:45 AM
This revision was automatically updated to reflect the committed changes.