This is an archive of the discontinued LLVM Phabricator instance.

ELF: Extract a non-ELFT base class for VersionNeedSection.
ClosedPublic

Authored by pcc on Feb 28 2019, 6:41 PM.

Details

Summary

We're going to need a separate VersionNeedSection for each partition, and
the partition data structure won't be templated.

With this the VersionTableSection class no longer needs ELFT, so detemplate it.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Feb 28 2019, 6:41 PM
Herald added a project: Restricted Project. · View Herald Transcript
ruiu added a comment.Feb 28 2019, 7:44 PM

I wonder if we can just get rid of ELFT from the class. At runtime we know endianess and word width, so in theory we can create a version table without ELFT. I'm not totally sure if this makes things easier to handle, but many classes are template with ELFT because they transitively use a ELFT-templated class. So removing ELFT from one class might allow us remove ELFT from more classes.

pcc added a comment.Feb 28 2019, 8:20 PM

I wonder if we can just get rid of ELFT from the class. At runtime we know endianess and word width, so in theory we can create a version table without ELFT. I'm not totally sure if this makes things easier to handle, but many classes are template with ELFT because they transitively use a ELFT-templated class. So removing ELFT from one class might allow us remove ELFT from more classes.

You mean from VersionNeedSection? Yes in theory, but now that createSyntheticSections is the only direct user of VersionNeedSection I think we'd also need to remove templating from RelocationSection, SymbolTableSection etc in order to detemplate anything else. And those classes are similar to VersionNeedSection in that they need to manipulate ELF data structures directly, so it's not clear that it's the right way to go.

That said, now that I've removed InX there does appear to be some low hanging fruit in finalizeSections() that can be detemplated. Let me see if I can send a patch.

grimar added a subscriber: grimar.Mar 1 2019, 12:20 AM
ruiu accepted this revision.Mar 1 2019, 4:23 PM

LGTM

This revision is now accepted and ready to land.Mar 1 2019, 4:23 PM
This revision was automatically updated to reflect the committed changes.