This is an archive of the discontinued LLVM Phabricator instance.

ELF: more section creation cleanup
ClosedPublic

Authored by labath on Dec 14 2018, 7:37 AM.

Details

Summary

This patch attempts to move as much code as possible out of the
CreateSections function to make room for future improvements there. Some
of this may be slightly over-engineered (VMAddressProvider), but I
wanted to keep the logic of this function very simple, because once I
start taking segment headers into acount (as discussed in D55356), the
function is going to grow significantly.

While in there, I also added tests for various bits of functionality.

This should be NFC, except that I changed the order of hac^H^Heuristicks
for determining section type slightly. Previously, name-based deduction
(.symtab -> symtab) would take precedence over type-based (SHT_SYMTAB ->
symtab) one. In fact we would assert if we ran into a .text section with
type SHT_SYMTAB. Though unlikely to matter in practice, this order
seemed wrong to me, so I have inverted it.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

labath created this revision.Dec 14 2018, 7:37 AM
krytarowski edited reviewers, added: joerg; removed: krytarowski.Dec 14 2018, 7:47 AM

I recommend joerg@ as a reviewer for ELF specifics.

clayborg accepted this revision.Dec 14 2018, 10:45 AM

Looks good.

This revision is now accepted and ready to land.Dec 14 2018, 10:45 AM

Kamil, Joerg: most of this is fairly lldb-specific and boring. I just added you for the .symtab thingy, just in case you know of anyone using SHT_SYMTAB sections which are not called .symtab (or conversely, using the name .symtab for non-symbol-table-related things).

This revision was automatically updated to reflect the committed changes.