diff options
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 17 |
2 files changed, 20 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5528251..a0d796f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2001-06-25 Alan Modra <amodra@bigpond.net.au> + * elf32-i386.c (elf_i386_check_relocs <R_386_32, R_386_PC32>): + 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 <R_386_32, R_386_PC32>): .. 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 <R_386_32, R_386_PC32>): Remove diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 8e6c18a..3989a9a 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; |