You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.3 KiB

diff -rup binutils.orig/bfd/elflink.c binutils-2.35.2/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2022-11-28 16:10:23.919422266 +0000
+++ binutils-2.35.2/bfd/elflink.c 2022-11-28 16:14:24.308499080 +0000
@@ -1260,14 +1260,25 @@ _bfd_elf_merge_symbol (bfd *abfd,
olddyn = (oldsec->symbol->flags & BSF_DYNAMIC) != 0;
}
- /* Handle a case where plugin_notice won't be called and thus won't
- set the non_ir_ref flags on the first pass over symbols. */
if (oldbfd != NULL
- && (oldbfd->flags & BFD_PLUGIN) != (abfd->flags & BFD_PLUGIN)
- && newdyn != olddyn)
+ && (oldbfd->flags & BFD_PLUGIN) != (abfd->flags & BFD_PLUGIN))
{
- h->root.non_ir_ref_dynamic = TRUE;
- hi->root.non_ir_ref_dynamic = TRUE;
+ if (newdyn != olddyn)
+ {
+ /* Handle a case where plugin_notice won't be called and thus
+ won't set the non_ir_ref flags on the first pass over
+ symbols. */
+ h->root.non_ir_ref_dynamic = TRUE;
+ hi->root.non_ir_ref_dynamic = TRUE;
+ }
+
+ if ((oldbfd->flags & BFD_PLUGIN) != 0
+ && hi->root.type == bfd_link_hash_indirect)
+ {
+ /* Change indirect symbol from IR to undefined. */
+ hi->root.type = bfd_link_hash_undefined;
+ hi->root.u.undef.abfd = oldbfd;
+ }
}
/* NEWDEF and OLDDEF indicate whether the new or old symbol,
diff -rup binutils.orig/bfd/linker.c binutils-2.35.2/bfd/linker.c
--- binutils.orig/bfd/linker.c 2022-11-28 16:10:23.822422639 +0000
+++ binutils-2.35.2/bfd/linker.c 2022-11-28 16:13:28.709712603 +0000
@@ -1672,7 +1672,7 @@ _bfd_generic_link_add_one_symbol (struct
case MIND:
/* Multiple indirect symbols. This is OK if they both point
to the same symbol. */
- if (strcmp (h->u.i.link->root.string, string) == 0)
+ if (string != NULL && strcmp (h->u.i.link->root.string, string) == 0)
break;
/* Fall through. */
case MDEF:
--- binutils.orig/bfd/elflink.c 2023-01-10 15:47:50.062668055 +0000
+++ binutils-2.35.2/bfd/elflink.c 2023-01-10 15:47:59.554659559 +0000
@@ -1271,8 +1271,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
h->root.non_ir_ref_dynamic = TRUE;
hi->root.non_ir_ref_dynamic = TRUE;
}
-
- if ((oldbfd->flags & BFD_PLUGIN) != 0
+ else if ((oldbfd->flags & BFD_PLUGIN) != 0
&& hi->root.type == bfd_link_hash_indirect)
{
/* Change indirect symbol from IR to undefined. */