aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-02-19 22:35:47 +0000
committerJakub Jelinek <jakub@redhat.com>2001-02-19 22:35:47 +0000
commit8701c1bc04f3f34f3bca69411b6c27701bfddb33 (patch)
tree107d1f7dacd97c92259295b0a67fd77d9ab0904b
parent911413e6b33649e8d78227ef77265eb9eb27721b (diff)
downloadgdb-8701c1bc04f3f34f3bca69411b6c27701bfddb33.zip
gdb-8701c1bc04f3f34f3bca69411b6c27701bfddb33.tar.gz
gdb-8701c1bc04f3f34f3bca69411b6c27701bfddb33.tar.bz2
* elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Don't make PLT
entries that could serve as a definition for a weak symbol. * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Likewise.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-sparc.c7
-rw-r--r--bfd/elf64-sparc.c7
3 files changed, 20 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 19aabe3..1b74b5c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2001-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Don't make PLT
+ entries that could serve as a definition for a weak symbol.
+ * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Likewise.
+
2001-02-18 David O'Brien <obrien@FreeBSD>
* configure.in: Recognize FreeBSD/arm, FreeBSD/PowerPC, and treat
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index e892e9d..8b64f19 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1759,6 +1759,13 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value alone. */
sym->st_shndx = SHN_UNDEF;
+ /* If the symbol is weak, we do need to clear the value.
+ Otherwise, the PLT entry would provide a definition for
+ the symbol even if the symbol wasn't defined anywhere,
+ and so the symbol would never be NULL. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
+ == 0)
+ sym->st_value = 0;
}
}
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 77fc7e2..18b6b75 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -2709,6 +2709,13 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value alone. */
sym->st_shndx = SHN_UNDEF;
+ /* If the symbol is weak, we do need to clear the value.
+ Otherwise, the PLT entry would provide a definition for
+ the symbol even if the symbol wasn't defined anywhere,
+ and so the symbol would never be NULL. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
+ == 0)
+ sym->st_value = 0;
}
}