[Lldb-commits] [PATCH] D55998: ELF: create "container" sections from PT_LOAD segments

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 21 06:03:59 PST 2018

labath created this revision.
labath added reviewers: clayborg, jankratochvil, krytarowski, joerg.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

This is the result of the discussion in D55356 <https://reviews.llvm.org/D55356>, where it was suggested
as a solution to representing the addresses that logically belong to a
module in memory, but are not a part of any of its sections.

The ELF PT_LOAD segments are similar to the MachO "load commands",
except that the relationship between them and the object file sections
is a bit weaker. While in the MachO case, the sections belonging to a
specific segment are placed directly inside it in the object file
logical structur, in the ELF case, the sections and segments form two
separate hierarchies. This means that it is in theory possible to create
an elf file where only a part of a section would belong to some segment
(and another part to a different one). However, I am not aware of any
tool which would produce such a file (and most tools will have problems
ingesting them), so this means it is still possible to follow the MachO
model and make sections children of the PT_LOAD segments.

In case we run into (corrupt?) files with overlapping sections, I have
added code (and tests) which adjusts the sizes and/or drops the offending
sections in order to present a reasonable image to the upper layers of
LLDB. This is mostly done for completeness, as I don't anticipate
running into this situation in the real world. However, if we do run
into it, and the current behavior is not suitable for some reason, we
can implement this logic differently.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55998.179278.patch
Type: text/x-patch
Size: 21527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181221/805a6140/attachment-0001.bin>

More information about the lldb-commits mailing list