This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Fix writing the content of the .got section in a wrong place.
ClosedPublic

Authored by ikudrin on Jun 14 2017, 10:30 PM.

Details

Summary

When filling the .got sections, InputSection::OutSecOff was added twice to find the position to apply a relocation: first time in InputSection::writeTo() and then in SectionBase::getOffset().

Diff Detail

Repository
rL LLVM

Event Timeline

ikudrin created this revision.Jun 14 2017, 10:30 PM
ruiu edited edge metadata.Jun 21 2017, 7:26 AM

It looks like it's not the only problem for .got but for all sections. How does it work for other sections?

As far as I could check, other sections are not affected by the similar problem. Most of them don't call relocate*() methods. InputSection::writeTo uses unshifted Buf when calling relocate(). And EhInputSection avoids the problem because SectionBase::getOffset() doesn't add OutSecOff for them.

ruiu accepted this revision.Jul 11 2017, 7:15 PM

LGTM

This revision is now accepted and ready to land.Jul 11 2017, 7:15 PM
This revision was automatically updated to reflect the committed changes.