diff --git a/binutils-ld-ir-plugin.patch b/binutils-ld-ir-plugin.patch new file mode 100644 index 0000000..79d840f --- /dev/null +++ b/binutils-ld-ir-plugin.patch @@ -0,0 +1,47 @@ +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: diff --git a/binutils.spec b/binutils.spec index 89efdb3..0922210 100644 --- a/binutils.spec +++ b/binutils.spec @@ -39,7 +39,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?name_cross}%{?_with_debug:-debug} Version: 2.35.2 -Release: 25%{?dist} +Release: 26%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -432,6 +432,10 @@ Patch57: binutils-undefined-ref-to-sym.patch # Lifetime: Fixed in 2.40 Patch58: binutils-CIE-generation.patch +# Purpose: Fix a problem with symbol versioning with the LTO plugin. +# Lifetime: Fixed in 2.38 +Patch59: binutils-ld-ir-plugin.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -1025,6 +1029,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Mon Nov 28 2022 Nick Clifton - 2.35.2-26 +- Fix handling symbol versioning with LTO plugins. (#2148469) + * Thu Sep 08 2022 Nick Clifton - 2.35.2-25 - Fix the generation of unnecesaary CIE stack unwinding frames. (#2121123)