foss-for-synopsys-dwc-arc-processors/binutils-gdb — pull request #4 by T-J-Teru (2014-12-16 10:31:22+00:00)
Title: Avoid creating invalid relocations when --gc-sections is used in the linker.

The two changes in this tree avoid creating invalid relocation when `--gc-sections` is used by the linker, however, instead we create R_ARC_NONE relocations, which may not be acceptable.

I believe that the real problem is that ARC sizes the relocation sections inside `elf_arc_check_relocs`, which is before garbage collection has occurred. Later functions don't then take sufficient account of the fact that sections, and the symbols within them might have been removed. Targets like ARM and X86-64 leave sizing of the relocation containing sections to much later in the process, after garbage collection has been performed, which helps with many of these problems.

Neither of these fixes are ideal, and should be revisited as part of a bigger task; reworking how we manage the size of the relocation holding sections. However, I believe that both of these changes are safe and correct, and should allow `--gc-sections` to be used safely.

Given that I'm unlikely to be able to spend much time on this until next month now I'll leave the choice on whether to merge these fixes now, or wait for a better fix (one that avoids `R_ARC_NONE`) up to others.