aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-10-25 16:19:08 +0000
committerAlan Modra <amodra@gmail.com>2005-10-25 16:19:08 +0000
commitfcfa13d2b2b18f83382c2a0cb82c9c7d21be10cb (patch)
treeec64c0d7e60df6c1bd711a63b76fbe71bff79d69 /bfd/elf.c
parent50afb01e1a80ee200521e4e3990a80df7ed3526c (diff)
downloadgdb-fcfa13d2b2b18f83382c2a0cb82c9c7d21be10cb.zip
gdb-fcfa13d2b2b18f83382c2a0cb82c9c7d21be10cb.tar.gz
gdb-fcfa13d2b2b18f83382c2a0cb82c9c7d21be10cb.tar.bz2
PR ld/1540
* elf-bfd.h (elf_backend_copy_indirect_symbol): Replace pointer to elf_backend_data with pointer to bfd_link_info. (_bfd_elf_link_hash_copy_indirect): Likewise. * elf.c (_bfd_elf_link_hash_copy_indirect): Likewise. Handle direct and indirect symbols both having dynamic link info. * elf32-arm.c (elf32_arm_copy_indirect_symbol): Likewise. * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise. * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise. * elf32-m32r.c (m32r_elf_copy_indirect_symbol): Likewise. * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Likewise. * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise. * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise. * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise. * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise. * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise. * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise. * elfxx-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_copy_indirect_symbol): Likewise. * elflink.c: Adjust all calls to bed->elf_backend_copy_indirect_symbol. * elfxx-mips.h (_bfd_mips_elf_copy_indirect_symbol): Update prototype. * elfxx-sparc.h (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index b7f38be..0e72d4e 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1458,12 +1458,11 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
old indirect symbol. Also used for copying flags to a weakdef. */
void
-_bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed,
+_bfd_elf_link_hash_copy_indirect (struct bfd_link_info *info,
struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *ind)
{
- bfd_signed_vma tmp;
- bfd_signed_vma lowest_valid = bed->can_refcount;
+ struct elf_link_hash_table *htab;
/* Copy down any references that we may have already seen to the
symbol which just became indirect. */
@@ -1480,33 +1479,32 @@ _bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed,
/* Copy over the global and procedure linkage table refcount entries.
These may have been already set up by a check_relocs routine. */
- tmp = dir->got.refcount;
- if (tmp < lowest_valid)
+ htab = elf_hash_table (info);
+ if (ind->got.refcount > htab->init_got_refcount.refcount)
{
- dir->got.refcount = ind->got.refcount;
- ind->got.refcount = tmp;
+ if (dir->got.refcount < 0)
+ dir->got.refcount = 0;
+ dir->got.refcount += ind->got.refcount;
+ ind->got.refcount = htab->init_got_refcount.refcount;
}
- else
- BFD_ASSERT (ind->got.refcount < lowest_valid);
- tmp = dir->plt.refcount;
- if (tmp < lowest_valid)
+ if (ind->plt.refcount > htab->init_plt_refcount.refcount)
{
- dir->plt.refcount = ind->plt.refcount;
- ind->plt.refcount = tmp;
+ if (dir->plt.refcount < 0)
+ dir->plt.refcount = 0;
+ dir->plt.refcount += ind->plt.refcount;
+ ind->plt.refcount = htab->init_plt_refcount.refcount;
}
- else
- BFD_ASSERT (ind->plt.refcount < lowest_valid);
- if (dir->dynindx == -1)
+ if (ind->dynindx != -1)
{
+ if (dir->dynindx != -1)
+ _bfd_elf_strtab_delref (htab->dynstr, dir->dynstr_index);
dir->dynindx = ind->dynindx;
dir->dynstr_index = ind->dynstr_index;
ind->dynindx = -1;
ind->dynstr_index = 0;
}
- else
- BFD_ASSERT (ind->dynindx == -1);
}
void