aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-05-05 14:12:05 +0000
committerAlan Modra <amodra@gmail.com>2003-05-05 14:12:05 +0000
commit4e795f50c1c5f7e59a8ab1f127bc5267d81600f1 (patch)
treec12accdbcf0bc42bfecc1c143f6e035e353817a2 /bfd/elf32-ppc.c
parent1b883d351364d8b9e00021462e06d5dba0d61460 (diff)
downloadgdb-4e795f50c1c5f7e59a8ab1f127bc5267d81600f1.zip
gdb-4e795f50c1c5f7e59a8ab1f127bc5267d81600f1.tar.gz
gdb-4e795f50c1c5f7e59a8ab1f127bc5267d81600f1.tar.bz2
* elf32-i386.c (allocate_dynrelocs): For undef weak syms with
non-default visibility, a) don't make them dynamic, b) discard space for dynamic relocs. * elf64-x86-64.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs): For undef weak syms with non-default visibility, a) don't allocate plt entries, b) don't allocate .got relocs, c) discard dyn rel space, (ppc_elf_relocate_section): d) don't generate .got relocs, e) don't generate dynamic relocs. * elf64-ppc.c (allocate_dynrelocs): As above. (ppc64_elf_relocate_section): As above.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 69bb0d6..81a4b62 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2694,7 +2694,9 @@ allocate_dynrelocs (h, inf)
htab = ppc_elf_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
+ && h->plt.refcount > 0
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
{
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1
@@ -2789,8 +2791,10 @@ allocate_dynrelocs (h, inf)
else
htab->got->_raw_size += 4;
dyn = htab->elf.dynamic_sections_created;
- if (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
+ if ((info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
+ && (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
+ || eh->elf.root.type != bfd_link_hash_undefweak))
{
/* All the entries we allocated need relocs. */
htab->relgot->_raw_size
@@ -2831,6 +2835,12 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
else if (ELIMINATE_COPY_RELOCS)
{
@@ -4793,7 +4803,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
/* Generate relocs for the dynamic linker. */
- if (info->shared || indx != 0)
+ if ((info->shared || indx != 0)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
{
outrel.r_offset = (htab->got->output_section->vma
+ htab->got->output_offset
@@ -4995,6 +5008,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* Fall thru. */
if ((info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& (MUST_BE_DYN_RELOC (r_type)
|| (h != NULL
&& h->dynindx != -1