hppa64: Improve HP-UX support and fix some relocation issues

With this patch, gcc-16 test results are now similar to those
using the HP ld.

The change fixes dynamic symbol handling.  At the moment, we
only have a single stub section and no support for long pc-relative
calls.  So, we only need to redirect pc-relative branches through
the PLT when the call is to a dynamic function.

The change to elf64_hppa_finalize_dynreloc() fixes C++ VTT support.
This fixed many tests in the gcc g++ and libstdc++ testsuites.

The next step is to add support for long pc-relative branches via
the PLT.

2026-03-14  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

	* elf64-hppa.c (elf64_hppa_check_relocs): Only set NEED_PLT
	and NEED_STUB for symbols with function types.
	(elf64_hppa_dynamic_symbol_p): Return false for millicode
	symbols.
	(allocate_global_data_dlt): Only allocate DLT entries for
	symbols that are dynamic or defined.  Clear hh->want_dlt
	if we don't want a DLT entry.
	(allocate_global_data_plt): Only allocate PLT entries for
	dynamic symbols.
	(allocate_global_data_stub): Likewise, Only allocate stubs
	for dynamic symbols.
	(elf64_hppa_create_dynamic_sections): Fix flags for .dynamic
	section and remove duplicated flags for other dynamic
	sections.
	(allocate_dynrel_entries): Fix DLT and PLT allocations.
	(elf64_hppa_late_size_sections): Don't sort relocations.
	Tweak code to set section used to set __text_seg.
	(elf64_hppa_finish_dynamic_symbol): Use eh->dynindx instead
	of hh->eh.dynindx.  Don't call elf64_hppa_dynamic_symbol_p
	to determine whether PLT entries and stubs need initialization.
	(elf64_hppa_finalize_dynreloc): Add rent->addend to value
	calculation.
	(elf_hppa_remark_useless_dynamic_symbols): Revise symbols
	checked.
	(elf_hppa_final_link_relocate): Revise code to redirect
	pc-relative calls to stubs.
	(elf_backend_want_p_paddr_set_to_zero): Define to 1 on HP-UX
	target.
1 file changed