strip: Don't remove real symbols from allocated symbol tables.

Having a symbol in an allocated symbol table (like .dynsym) that
points to an unallocated section is wrong. Traditionally strip
has removed such symbols if they are section or group symbols.
But removing a real symbol from an allocate symbol table is hard
and probably a mistake. Really removing it means rewriting the
dynamic segment and hash sections. Since we don't do that, don't
remove the symbol (and corrupt the ELF file). Do warn and set
the symbol section to SHN_UNDEF.

https://bugzilla.redhat.com/show_bug.cgi?id=1380961

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2 files changed