This is an archive of the discontinued LLVM Phabricator instance.

[ELF][MIPS] Fix primary GOT sometimes overflowing by one or two words
ClosedPublic

Authored by jrtc27 on Jul 17 2018, 5:52 AM.

Details

Summary

If we fail to merge a secondary GOT with the primary GOT but so far only
one merged GOT has been created (the primary one), the final element in
MergedGots is the primary GOT. Thus we should not try to merge with this
final element passing IsPrimary=false, since this will ignore the fact
that the destination GOT does in fact need a header, and those extra two
entries can be enough to allow the merge to incorrectly occur. Instead
we should check for this case before attempting the second merge.

Diff Detail

Repository
rL LLVM

Event Timeline

jrtc27 created this revision.Jul 17 2018, 5:52 AM
atanasyan accepted this revision.Jul 17 2018, 7:12 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Jul 17 2018, 7:12 AM

BTW it would be nice if you add a test case

jrtc27 updated this revision to Diff 156791.Jul 23 2018, 8:06 AM

Added regression test

jrtc27 updated this revision to Diff 156792.Jul 23 2018, 8:08 AM

Removed redundant check prefixes from an earlier revision of the test case

Do you have commit access?

Do you have commit access?

No, I don't, so please do so on my behalf if it's ready to land.

This revision was automatically updated to reflect the committed changes.

Thanks for the patch.