]> git.ipfire.org Git - thirdparty/elfutils.git/commit
Handle merged strtab/shstrtab string tables in strip and unstrip.
authorMark Wielaard <mjw@redhat.com>
Tue, 11 Aug 2015 19:38:38 +0000 (21:38 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 5 Oct 2015 19:55:51 +0000 (21:55 +0200)
commitdf7dfab451246e8b088040e052ca01f9d6aba774
tree7c6bf28c6ac102a94a7ebcd9c2ee87e5b29141c9
parent3adda3ce2a83e2733aa0c84da9bb7949413d02fd
Handle merged strtab/shstrtab string tables in strip and unstrip.

ELF files can share the section header string table (e_shstrndx) with
the symtab .strtab section. That might in some cases save a bit of space
since symbols and sections might share some (sub)strings. To handle that
eu-strip just needs to not unconditionally remove the .shstrtab section
(it will be properly marked as used/unused as needed). eu-unstrip needs
to make sure the section names are added to the strtab if it decides to
rewrite that section. Also makes sure that eu-strip won't move around
a SHT_NOBITS section that has SHF_ALLOC set. Although it is allowed to
move such sections around, there is no benefit. And some tools might
expect no allocated section to move around, not even a nobits section.
It also makes it harder to do "roundtripping" sanity checks that make
sure splitting a file with eu-strip and then reconstructed with eu-unstrip
produce the same ELF file (as is done in the new run-strip-strmerge.sh).

Introduces a somewhat large test generator elfstrmerge.c that will
hopefully turn into a more generic string table merger program.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/strip.c
src/unstrip.c
tests/ChangeLog
tests/Makefile.am
tests/elfstrmerge.c [new file with mode: 0644]
tests/run-strip-strmerge.sh [new file with mode: 0755]