This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Refactor PltSection and IPltSection common code into a base class NFC
ClosedPublic

Authored by peter.smith on Feb 7 2017, 10:24 AM.

Details

Summary

In a comment via email on D28956 Rafael suggested:
"Would it be possible to add a common base class to PltSection and Ipltsection and share this code?"

This is an attempt to add a common base class PltSectionBase that moves out most of the more complex code into the base class. It is using the same logic and interface as previously.

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Feb 7 2017, 10:24 AM
ruiu edited edge metadata.Feb 7 2017, 1:05 PM

It is probably my taste, but I'd try to keep the class hierarchy as shallow as possible. Looks like IPLT and PLT are pretty similar. I wonder if you can merge PltBase, Plt and Iplt into one class, add IsIplt boolean flag, and do whatever it is needed to do for IPLT according to the flag.

peter.smith updated this revision to Diff 87651.Feb 8 2017, 6:54 AM

Updated the diff with an attempt to use a single class for both the Plt and IPlt. I've used HeaderSize to distinguish between them as that removes a few conditional statements.

ruiu accepted this revision.Feb 8 2017, 11:39 AM

LGTM

This revision is now accepted and ready to land.Feb 8 2017, 11:39 AM
This revision was automatically updated to reflect the committed changes.