gcc-toolset-10-binutils/SOURCES/binutils-elf-add-objects.patch

37 lines
1.3 KiB
Diff
Raw Normal View History

--- binutils.orig/bfd/elflink.c 2020-07-31 10:45:48.747912761 +0100
+++ binutils-2.35/bfd/elflink.c 2020-07-31 10:47:26.336262770 +0100
@@ -505,6 +505,16 @@ bfd_elf_link_record_dynamic_symbol (stru
const char *name;
size_t indx;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ /* An IR symbol should not be made dynamic. */
+ if (h->root.u.def.section != NULL
+ && h->root.u.def.section->owner != NULL
+ && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0)
+ return TRUE;
+ }
+
/* XXX: The ABI draft says the linker must turn hidden and
internal symbols into STB_LOCAL symbols when producing the
DSO. However, if ld.so honors st_other in the dynamic table,
@@ -5199,15 +5209,11 @@ elf_link_add_object_symbols (bfd *abfd,
break;
}
- /* Don't add DT_NEEDED for references from the dummy bfd nor
- for unmatched symbol. */
if (!add_needed
&& matched
&& definition
&& ((dynsym
- && h->ref_regular_nonweak
- && (old_bfd == NULL
- || (old_bfd->flags & BFD_PLUGIN) == 0))
+ && h->ref_regular_nonweak)
|| (h->ref_dynamic_nonweak
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
&& !on_needed_list (elf_dt_name (abfd),