hppa64: Implement segment based relocations for local symbols
There is progress in implementing 64-bit shared library support.
Fixes link error compiling vdso64.so. HP-UX dynamic linker no longer
complains that libgcc_s.4 linked with GNU ld is an invalid shared library.
Relocations are now generated for all slots in .rela.data, .rela.dlt
and .rela.opd. Relocation counts for libgcc_s.4 linked using GNU and
HP ld are the same except .rela.plt. That may be okay as GNU ld directs
pc-relative calls to stubs.
Glibc's ld.so.new appears to link okay. However, libgcc_s.4 linked with
GNU ld is still broken on HP-UX.
There are six unexpected fails in the testsuite and three unexpected
passes. There's at least one fail due to name munging in the .dynsym
table.
2025-11-02 John David Anglin <danglin@gcc.gnu.org>
bfd/ChangeLog:
* elf64-hppa.c (struct elf64_hppa_link_hash_entry): Remove
sym_ind and owner fields. Rename hash entries for __text_seg
and __data_seg. Adjust all users.
(global_sym_index): Remove.
(hppa64_elf_local_refcounts): Assert size is not 0.
(elf64_hppa_check_relocs): Drop NEED_PLT from R_PARISC_FPTR64
relocation. Don't stash abfd and r_symndx in hh->owner and
hh->sym_indx. Add global symbols with hh->eh.dynindx equal
-1 to dynamic table. Don't record section symbols to the
local dynamic symbol table.
(allocate_global_data_dlt): Don't add symbol to local dynamic
symbol table.
(allocate_global_data_opd): Likewise.
(elf64_hppa_late_size_sections): Rework code to add __text_seg
and __data_seg symbols to the dynamic table.
(elf64_hppa_finalize_dlt): Revise to use __text_seg and
__data_seg symbols.
(elf64_hppa_finalize_dynreloc): Likewise.
(elf_hppa_final_link_relocate): When generating a shared
library, ignore relocs in debugging sections. Revise
relocations needing DLT and OPD dynamic relocations to output
dynamic relocatios for local symbols. Move code to initialize
segment base values back to SEGREL case.