hppa64: get_opd in elf64_hppa_mark_exported_functions
Alan Modra
amodra@gmail.com
Mon May 11 05:11:34 GMT 2026
late_size_sections is too late to be creating a dynamic section, as it
won't be mapped to an output section. So don't pretend that this will
do anything useful, and instead omit the traversal if opd_sec is NULL.
This bug showed up when using a linker-created dynobj.
* elf64-hppa.c (elf64_hppa_mark_exported_functions): Don't
attempt to create .opd here.
(elf64_hppa_late_size_sections): Only mark exported functions
for space in .opd if .opd exists.
(elf64_hppa_finalize_dynreloc): Make the test for a discared
other_rel_sec robust.
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 8de91622465..f4b24b294f3 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -1017,10 +1017,6 @@ elf64_hppa_mark_exported_functions (struct elf_link_hash_entry *eh, void *data)
&& eh->root.u.def.section->output_section != NULL
&& eh->type == STT_FUNC)
{
- if (! hppa_info->opd_sec
- && ! get_opd (hppa_info->root.dynobj, info, hppa_info))
- return false;
-
hh->want_opd = 1;
/* Put a flag here for output_symbol_hook. */
@@ -1646,11 +1642,12 @@ elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info)
We have to traverse the main linker hash table since we have to
find functions which may not have been mentioned in any relocs. */
- elf_link_hash_traverse (&hppa_info->root,
- (hppa_info->root.dynamic_sections_created
- ? elf64_hppa_mark_milli_and_exported_functions
- : elf64_hppa_mark_exported_functions),
- info);
+ if (hppa_info->opd_sec)
+ elf_link_hash_traverse (&hppa_info->root,
+ (hppa_info->root.dynamic_sections_created
+ ? elf64_hppa_mark_milli_and_exported_functions
+ : elf64_hppa_mark_exported_functions),
+ info);
if (hppa_info->root.dynamic_sections_created)
{
@@ -2479,7 +2476,8 @@ elf64_hppa_finalize_dynreloc (struct elf_link_hash_entry *eh,
if (hppa_info == NULL)
return false;
- if (discarded_section (hppa_info->other_rel_sec))
+ if (hppa_info->other_rel_sec == NULL
+ || discarded_section (hppa_info->other_rel_sec))
return true;
if (hh->reloc_entries)
More information about the Binutils
mailing list