various xcoff rs6000 linker issues
This patch started out as an exercise in sanity checking r_symndx
before indexing symbol hashes, but grew as I noticed other issues.
Merges xcoff_ppc_relocate_section and xcoff64_ppc_relocate_section.
All of the xcoff_reloc_function now return a status, with the idea
that error reporting can be done in one place.
* libxcoff.h (xcoff_reloc_function): Return bfd_reloc_status_type
rather than bool.
(_bfd_xcoff_relocate_section): Declare.
* coff-rs6000.c (xcoff_reloc_type_noop, xcoff_reloc_type_fail),
(xcoff_reloc_type_pos, xcoff_reloc_type_neg, xcoff_reloc_type_rel),
(xcoff_reloc_type_toc, xcoff_reloc_type_ba, xcoff_reloc_type_br),
(xcoff_reloc_type_crel, xcoff_reloc_type_tls): Return
bfd_reloc_status_type rather than bool. Don't emit standard
error message and don't set bfd error. Replace r_symndx
non-negative check with check against obj_raw_syment_count.
(_bfd_xcoff_relocate_section): Extracted from
xcoff_ppc_relocate_section and xcoff64_ppc_relocate_section.
Move error reporting to end of loop. Report error for
r_symndx out of range. Adjust for reloc howto special
function change. Properly check that reloc offset is in range.
Prevent possible segfault in _bfd_coff_internal_syment_name.
* coff64-rs6000.c: Similarly.
3 files changed