Only elf files with strange GNU_RELRO segments fail the load, save, cycle.
It would maybe a good idea to separate the layout functionality from the
current save. The current coupling of layout and save make it
impossible to build layouts which contain the elf header via the public
API.
Many example elfs (hello_32, hello_64, asm ...) require that the
first section directly follows the program header table. The
section header is then placed between segments or at the end.
This change prepares the late placement of section header table.
We have some elf files where a section (.ARM.exidx) is located in multiple segments.
To keep this property it is necessary to keep track of the emitted sections.
Furthermore, the correct sequence for the segment emission has to be determined.
This is done by postponing segments which are actually a subsequence of another segment.
Additionally the alignment is not considered as part of the file size of a segment anymore.
Fix segment header position when no segments are present
Dumper - dynamic section output added
Dynamic section reader tests are added
Signed-off-by: Serge Lamikhov-Center <to_serge@users.sourceforge.net>