ELF: more section creation cleanup
authorPavel Labath <pavel@labath.sk>
Sat, 15 Dec 2018 13:45:38 +0000 (13:45 +0000)
committerPavel Labath <pavel@labath.sk>
Sat, 15 Dec 2018 13:45:38 +0000 (13:45 +0000)
commit62a8254f29d85f28b6bcdf69929986bcc775b9ce
tree73a61c9881cdc65a24531268cf08c87823092729
parentc8e364e80d148613b2430c19425aacf282153c64
ELF: more section creation cleanup

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.

Reviewers: clayborg, krytarowski, espindola

Subscribers: emaste, arichardson, lldb-commits

Differential Revision: https://reviews.llvm.org/D55706

llvm-svn: 349268
lldb/lit/Modules/ELF/compressed-sections.yaml
lldb/lit/Modules/ELF/section-addresses.yaml [new file with mode: 0644]
lldb/lit/Modules/ELF/section-permissions.yaml [new file with mode: 0644]
lldb/lit/Modules/ELF/section-types-edgecases.yaml [new file with mode: 0644]
lldb/lit/Modules/ELF/section-types.yaml
lldb/lit/Modules/MachO/subsections.yaml
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/tools/lldb-test/lldb-test.cpp