The aim here is to add assertions when root.u.def is accessed that
the field is valid, ie. we have a bfd_link_hash_defined or
bfd_link_hash_defweak symbol. On doing so I found the assertion
triggering on one of the ld undefweak tests, fixed with the
elf64_hppa_finish_dynamic_symbol change.
The patch also refactors code using text_hash_entry and
data_hash_entry.
* elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Use zero
value for both undefined and undefweak symbols, and when
non-pic too. Assert when accessing root.u.def that the symbol
is the correct type.
(elf64_hppa_finalize_opd, elf64_hppa_finalize_dlt),
(elf64_hppa_finalize_dynreloc): Similarly assert here.
(elf64_hppa_finalize_dlt): Move duplicate code involving
text_hash_entry and data_hash_entry out of conditionals.
(elf64_hppa_finalize_dynreloc, elf_hppa_dlt_dynrel_reloc),
(elf_hppa_final_link_relocate): Likewise.