strip, unstrip: Handle SHT_GROUP correctly.
authorMark Wielaard <mark@klomp.org>
Sat, 13 Oct 2018 08:27:47 +0000 (10:27 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 17 Oct 2018 11:49:53 +0000 (13:49 +0200)
commitc06ab0bbb4761a69d2f188675d21d1a9131e9ecb
treecf6bc383262aaed1029562f2364893acfa38ddd6
parent2876b3b648f665736ac9c879d34de5e3866ba8f9
strip, unstrip: Handle SHT_GROUP correctly.

The usage of annobin in Fedora showed a couple of bugs when using
eu-strip and eu-unstrip on ET_REL files that contain multiple group
sections.

When stripping we should not remove the SHF_GROUP flag from sections
even if the group section itself might be removed. Either the section
itself gets removed, and so the flag doesn't matter. Or it gets moved
together with the group section into the debug file, and then it still
needs to have the flag set. Also we would "renumber" the section group
flag field (which isn't a section index, and so shouldn't be changed).

Often the group sections have the exact same name (".group"), flags
(none) and sometimes the same sizes. Which makes matching them hard.
Extract the group signature and compare those when comparing two
group sections.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/strip.c
src/unstrip.c
tests/ChangeLog
tests/Makefile.am
tests/run-annobingroup.sh
tests/testfile-annobingroup-x86_64.o.bz2 [new file with mode: 0644]