This is an archive of the discontinued LLVM Phabricator instance.

Alternative way to detemplate GotSection
ClosedPublic

Authored by rafael on May 12 2017, 2:31 PM.

Details

Reviewers
ruiu
Summary

GetSection is a template because write calls relocate.

relocate has two parts. The non alloc code really has to be a template, as it is looking a raw input file data.

The alloc part is only a template because of getSize.

This patch folds the value of getSize early, detemplates getRelocTargetVA and splits relocate into a templated non alloc case and a regular function for the alloc case. This has the nice advantage of making sure we collect all the information we need for relocations before getting to InputSection::relocateNonAlloc.

Since we know got is alloc, it can just call the function directly and avoid the template.

Diff Detail

Event Timeline

rafael created this revision.May 12 2017, 2:31 PM
grimar added a subscriber: grimar.May 15 2017, 7:54 AM
rafael edited the summary of this revision. (Show Details)

Rebased.

ruiu accepted this revision.May 17 2017, 10:32 PM

LGTM.

Nice! I like this.

This revision is now accepted and ready to land.May 17 2017, 10:32 PM
espindola closed this revision.Mar 14 2018, 4:11 PM
espindola added a subscriber: espindola.

303355