]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
hppa64: get_opd in elf64_hppa_mark_exported_functions
authorAlan Modra <amodra@gmail.com>
Sun, 10 May 2026 23:50:52 +0000 (09:20 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 14 May 2026 06:38:52 +0000 (16:08 +0930)
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.

bfd/elf64-hppa.c

index 8de91622465321b0fe111bad56e7a2168018f283..f4b24b294f3a654ae1c1cb87f546056333ac2653 100644 (file)
@@ -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)