Hi,
strip had a couple of issues with elf section groups. binutils gas was
recently fixed so that section group signature symbols are actually real
symbols with names instead of naming the section after the signature and
using the section symbol (which doesn't have a name, so couldn't
technically be used as signature symbol). There was an assert in strip
that fell over the new/correct signature symbol usage. When not all
sections of a section group were removed strip still tried to remove the
section group itself. And when moving a section group to the debug file
it didn't retain the type and original section list (which gets
rewritten for the stripped file). All issues were actually detected by
elflint, so writing a test was easy. The following fixes these issues.
2011-05-18 Mark Wielaard <mjw(a)redhat.com>
* strip.c (handle_elf): Make sure all sections of a removed group
section are removed too. Don't discard SHT_GROUP sections, copy
section table before it gets modified. Section group signature
symbols don't have to be retained.
Patch attached. The git branch mjw/strip-group contains the same plus an
extra testcase for the above issues, which fails before and succeeds
after this patch. Please let me know if I missed anything important in
this fix before I push it to master.
There is still an issue with unstrip which depends on comparing section
names for unallocated sections. New binutils gas names all group
sections ".group" and unstrip would need to compare the signature symbol
names in case of a SHT_GROUP section. I have not fixed that yet.
Cheers,
Mark