aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-06-25 08:16:44 +0000
committerAlan Modra <amodra@gmail.com>2001-06-25 08:16:44 +0000
commit28d0b90eb7141710a923e212370bb0238f861fc8 (patch)
tree8b2dfaffe3d72baa9d7dd2c5a0c1fdeb7a14ed81
parent37ffda1076b1dad37edffa64ff6363d501cf720d (diff)
downloadgdb-28d0b90eb7141710a923e212370bb0238f861fc8.zip
gdb-28d0b90eb7141710a923e212370bb0238f861fc8.tar.gz
gdb-28d0b90eb7141710a923e212370bb0238f861fc8.tar.bz2
* 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.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-i386.c17
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;