From 28d0b90eb7141710a923e212370bb0238f861fc8 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 25 Jun 2001 08:16:44 +0000 Subject: [PATCH] * elf32-i386.c (elf_i386_check_relocs ): Ensure syms are dynamic if we might be emitting a reloc. (allocate_plt_and_got_and_discard_relocs): Don't discard relocs for undefweak or undefined syms.. (elf_i386_relocate_section ): .. and emit. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-i386.c | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5528251c3f3..a0d796f170d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2001-06-25 Alan Modra + * elf32-i386.c (elf_i386_check_relocs ): + Ensure syms are dynamic if we might be emitting a reloc. + (allocate_plt_and_got_and_discard_relocs): Don't discard relocs + for undefweak or undefined syms.. + (elf_i386_relocate_section ): .. and emit. + * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Discard relocs without ELF_LINK_HASH_DEF_DYNAMIC set. (elf_i386_relocate_section ): Remove diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 8e6c18a2bf0..3989a9a0097 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -725,6 +725,13 @@ elf_i386_check_relocs (abfd, info, sec, relocs) this reloc. */ if (dynobj == NULL) htab->root.dynobj = dynobj = abfd; + + if (h != NULL && h->dynindx == -1) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } + if (sreloc == NULL) { const char *name; @@ -1195,7 +1202,9 @@ allocate_plt_and_got_and_discard_relocs (h, inf) || (!info->shared && (h->dynindx == -1 || (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0))) + || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_undefined)))) { struct elf_i386_link_hash_entry *eh; struct elf_i386_dyn_relocs *c; @@ -1694,8 +1703,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, && h != NULL && h->dynindx != -1 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + || h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined))) { Elf_Internal_Rel outrel; boolean skip, relocate; -- 2.30.2