In rS339350 (D17519) filter_reloc() was removed, to fix the case of stripping statically linked binaries with relocations (which may come from ifunc use, for example). As a side effect this changed the behaviour when stripping object files - the output was broken both before and after rS339350 in different ways. Unfortunately GCC's build process relies on the previous behaviour, so:
- Revert rS339350, restoring filter_reloc().
- Fix an unitialized variable use (commited as r3638 in ELF Tool Chain).
- Change filter_reloc() to omit relocations referencing removed symbols, while retaining relocations with no symbol reference.
(Note this review represents only the third change.)