aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-05-17 06:16:03 +0000
committerAlan Modra <amodra@gmail.com>2003-05-17 06:16:03 +0000
commit9c7a29a32e738b51793f7f2bcaa4b403373b478c (patch)
treea925e4ef543194e6e886f4cb4ba54819d59cb067 /bfd/elf32-ppc.c
parentb8b527c5a96aec839f5c8122ffd08556f7fe0d9f (diff)
downloadfsf-binutils-gdb-9c7a29a32e738b51793f7f2bcaa4b403373b478c.zip
fsf-binutils-gdb-9c7a29a32e738b51793f7f2bcaa4b403373b478c.tar.gz
fsf-binutils-gdb-9c7a29a32e738b51793f7f2bcaa4b403373b478c.tar.bz2
* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
to trim plt entries. Move undefweak non-default visibility test.. (allocate_dynrelocs): ..from here. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't test dynamic_sections_created here. Update comment. Move undefweak non-default visibility test.. (allocate_dynrelocs): ..from here. Fix comment. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL to trim plt entries. Move undefweak non-default visibility test.. (allocate_dynrelocs): ..from here. Fix comment. * elflink.h (elf_link_output_extsym): Compare ELF_ST_VISIBILITY with STV_DEFAULT rather than comparing with zero. * elflink.c (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. Format comment.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 212e5b3..1e1ab8c 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2495,19 +2495,21 @@ ppc_elf_adjust_dynamic_symbol (info, h)
{
/* Clear procedure linkage table information for any symbol that
won't need a .plt entry. */
- if (! htab->elf.dynamic_sections_created
+ if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
- || h->plt.refcount <= 0)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))
{
/* A PLT entry is not required/allowed when:
- 1. We are not using ld.so; because then the PLT entry
- can't be set up, so we can't use one.
+ 1. We are not using ld.so; because then the PLT entry
+ can't be set up, so we can't use one. In this case,
+ ppc_elf_adjust_dynamic_symbol won't even be called.
- 2. We know for certain that a call to this symbol
- will go to this object.
+ 2. GC has rendered the entry unused.
- 3. GC has rendered the entry unused. */
+ 3. We know for certain that a call to this symbol
+ will go to this object, or will remain undefined. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
@@ -2673,9 +2675,7 @@ allocate_dynrelocs (h, inf)
htab = ppc_elf_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ && h->plt.refcount > 0)
{
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1
@@ -2799,12 +2799,12 @@ allocate_dynrelocs (h, inf)
if (info->shared)
{
- /* Relocs that use pc_count are those that appear on a call
- insn, or certain REL relocs (see MUST_BE_DYN_RELOC) that can
- generated via assembly. We want calls to protected symbols
- to resolve directly to the function rather than going via the
- plt. If people want function pointer comparisons to work as
- expected then they should avoid writing weird assembly. */
+ /* Relocs that use pc_count are those that appear on a call insn,
+ or certain REL relocs (see MUST_BE_DYN_RELOC) that can be
+ generated via assembly. We want calls to protected symbols to
+ resolve directly to the function rather than going via the plt.
+ If people want function pointer comparisons to work as expected
+ then they should avoid writing weird assembly. */
if (SYMBOL_CALLS_LOCAL (info, h))
{
struct ppc_elf_dyn_relocs **pp;