This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Make input section's writeTo virtual (required to make .got.plt section synthetic)
ClosedPublic

Authored by evgeny777 on Nov 3 2016, 7:35 AM.

Details

Summary

The .got.plt section needs to write VA of .dynamic section, so we cannot build its output buffer in finalizeSections().
There are two approaches to deal with this:

a) Make writeTo virtual, so that section is written after assignAddresses() is called. This is what this patch does.
b) Implement special procedure for writing synthetic input sections (like we do with writeBuildId).

Diff Detail

Event Timeline

evgeny777 updated this revision to Diff 76855.Nov 3 2016, 7:35 AM
evgeny777 retitled this revision from to [ELF] Make input section's writeTo virtual (required to make .got.plt section synthetic).
evgeny777 updated this object.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: grimar, ikudrin, llvm-commits.
ruiu edited edge metadata.Nov 3 2016, 11:59 AM

I'm okay with virtualizing writeTo, but Rafael might have something to say because he seems to try to avoid virtual functions for InputSection class.

ruiu accepted this revision.Nov 4 2016, 10:38 AM
ruiu edited edge metadata.

LGTM. Rafael, if you have any comment, please do it as a post commit review.

This revision is now accepted and ready to land.Nov 4 2016, 10:38 AM
This revision was automatically updated to reflect the committed changes.