]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix RELOC_FOR_GLOBAL_SYMBOLS macro so that it can cope with user defined symbols...
authorNick Clifton <nickc@redhat.com>
Wed, 8 May 2024 12:42:22 +0000 (13:42 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 8 May 2024 12:42:22 +0000 (13:42 +0100)
  PR 31710

bfd/elf-bfd.h

index 92a0287d40e14d69531edcb8e3cb6ff666526be1..15a7156b3dae5feff96c98338dcc38c36690b6c0 100644 (file)
@@ -3192,8 +3192,14 @@ extern asection _bfd_elf_large_com_section;
                                                                        \
       if (info->wrap_hash != NULL                                      \
          && (input_section->flags & SEC_DEBUGGING) != 0)               \
-       h = ((struct elf_link_hash_entry *)                             \
-            unwrap_hash_lookup (info, input_bfd, &h->root));           \
+       {                                                               \
+         struct bfd_link_hash_entry * new_h;                           \
+         new_h = unwrap_hash_lookup (info, input_bfd, &h->root);       \
+         /* PR 31710: This lookup can fail if the input source has a   \
+            symbol that starts with __wrap_.  */                       \
+         if (new_h != NULL)                                            \
+           h = (struct elf_link_hash_entry *) new_h;                   \
+       }                                                               \
                                                                        \
       while (h->root.type == bfd_link_hash_indirect                    \
             || h->root.type == bfd_link_hash_warning)                  \