aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@geoffk.org>2000-10-14 23:30:12 +0000
committerGeoffrey Keating <geoffk@geoffk.org>2000-10-14 23:30:12 +0000
commita4b120e1dbadd011de3b3e419df754d8636b29af (patch)
tree33b65afaebcaed0af95162d49828a04281829e7d /bfd/elf32-ppc.c
parent5af5b85bc37de9e224e9fd0ae11c2183b219500a (diff)
downloadgdb-a4b120e1dbadd011de3b3e419df754d8636b29af.zip
gdb-a4b120e1dbadd011de3b3e419df754d8636b29af.tar.gz
gdb-a4b120e1dbadd011de3b3e419df754d8636b29af.tar.bz2
* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make PLT
entries that could serve as a definition for a weak symbol.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 3c7999b..c4d352b 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -1715,7 +1715,8 @@ ppc_elf_adjust_dynamic_symbol (info, h)
2. We know for certain that a symbol is defined in
this object, because this object is the application,
- is linked with -Bsymbolic, or because the symbol is local.
+ is linked with -Bsymbolic, the symbol is local,
+ or because the symbol is protected or hidden.
3. GC has rendered the entry unused.
Note, however, that in an executable all references to the
@@ -2675,6 +2676,13 @@ ppc_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;
}
}