aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-12-01 07:53:16 +1030
committerAlan Modra <amodra@gmail.com>2017-12-01 09:06:30 +1030
commit4a7e52349807017f9bc09ea25f07924f2ec971b3 (patch)
tree8af3ae5d5d1b97d6b83258f22095afec0500d46d /bfd/elf32-ppc.c
parent6f14765f9f448bbe03750634eb42c4a9db6521b8 (diff)
downloadgdb-4a7e52349807017f9bc09ea25f07924f2ec971b3.zip
gdb-4a7e52349807017f9bc09ea25f07924f2ec971b3.tar.gz
gdb-4a7e52349807017f9bc09ea25f07924f2ec971b3.tar.bz2
PR22533, dynamic relocs generated for weak aliases
This cleans up yet more craziness with non_got_ref. PR 22533 * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Don't do anything special with non_got_ref for weak aliases. (elf32_hppa_check_relocs): Tweak setting of non_got_ref. (elf32_hppa_adjust_dynamic_symbol): When initialising weak aliases, don't uselessly copy non_got_ref. Clear dyn_relocs instead if strong symbol is allocated in dynbss. Tidy comments. (elf32_hppa_relocate_section): Comment fix. * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Don't do anything special with non_got_ref for weak aliases. (ppc_elf_adjust_dynamic_symbol): When initialising weak aliases, don't uselessly copy non_got_ref. Clear dyn_relocs instead if strong symbol is allocated in dynbss. Tidy comments. * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't do anything special with non_got_ref for weak aliases. (ppc64_elf_adjust_dynamic_symbol): When initialising weak aliases, don't uselessly copy non_got_ref. Clear dyn_relocs instead if strong symbol is allocated in dynbss. Tidy comments.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 8906971..80454eb 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -3579,18 +3579,11 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info,
edir->tls_mask |= eind->tls_mask;
edir->has_sda_refs |= eind->has_sda_refs;
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy non_got_ref.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- if (!(ELIMINATE_COPY_RELOCS
- && eind->elf.root.type != bfd_link_hash_indirect
- && edir->elf.dynamic_adjusted))
- edir->elf.non_got_ref |= eind->elf.non_got_ref;
-
if (edir->elf.versioned != versioned_hidden)
edir->elf.ref_dynamic |= eind->elf.ref_dynamic;
edir->elf.ref_regular |= eind->elf.ref_regular;
edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
+ edir->elf.non_got_ref |= eind->elf.non_got_ref;
edir->elf.needs_plt |= eind->elf.needs_plt;
edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
@@ -5571,8 +5564,10 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = def->root.u.def.value;
- if (ELIMINATE_COPY_RELOCS)
- h->non_got_ref = def->non_got_ref;
+ if (def->root.u.def.section == htab->elf.sdynbss
+ || def->root.u.def.section == htab->elf.sdynrelro
+ || def->root.u.def.section == htab->dynsbss)
+ ppc_elf_hash_entry (h)->dyn_relocs = NULL;
return TRUE;
}
@@ -5641,7 +5636,6 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
Of course, if the symbol is referenced using SDAREL relocs, we
must instead allocate it in .sbss. */
-
if (ppc_elf_hash_entry (h)->has_sda_refs)
s = htab->dynsbss;
else if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
@@ -5650,14 +5644,13 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
s = htab->elf.sdynbss;
BFD_ASSERT (s != NULL);
- /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
- copy the initial value out of the dynamic object and into the
- runtime process image. We need to remember the offset into the
- .rela.bss section we are going to use. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
asection *srel;
+ /* We must generate a R_PPC_COPY reloc to tell the dynamic
+ linker to copy the initial value out of the dynamic object
+ and into the runtime process image. */
if (ppc_elf_hash_entry (h)->has_sda_refs)
srel = htab->relsbss;
else if ((h->root.u.def.section->flags & SEC_READONLY) != 0)