aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-cris.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-01-11 09:32:53 +0000
committerAlan Modra <amodra@gmail.com>2005-01-11 09:32:53 +0000
commit3eb128b2a5632a80460a8c22414e3541d1531d02 (patch)
tree13ad7265d567a369e3b24fbc35cda9c7a97d8cd0 /bfd/elf32-cris.c
parent264a1fe053aad624f8072e11e501f853b1a221a5 (diff)
downloadgdb-3eb128b2a5632a80460a8c22414e3541d1531d02.zip
gdb-3eb128b2a5632a80460a8c22414e3541d1531d02.tar.gz
gdb-3eb128b2a5632a80460a8c22414e3541d1531d02.tar.bz2
* elf64-ppc.c (ppc64_elf_gc_sweep_hook): Follow indirect and warning
symbols. * elf32-arm.c (elf32_arm_gc_sweep_hook): Likewise. * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise. * elf32-i386.c (elf_i386_gc_sweep_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise. * elf32-m68k.c (elf_m68k_gc_sweep_hook): Likewise. * elf32-ppc.c (ppc_elf_gc_sweep_hook): Likewise. * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise. * elf32-sh.c (sh_elf_gc_sweep_hook): Likewise. * elf32-sparc.c (elf32_sparc_gc_sweep_hook): Likewise. * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise. * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise. * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise. * elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
Diffstat (limited to 'bfd/elf32-cris.c')
-rw-r--r--bfd/elf32-cris.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index d043111..44cae03 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1,5 +1,6 @@
/* CRIS-specific support for 32-bit ELF.
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson, based on elf32-fr30.c
PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c.
@@ -1984,16 +1985,23 @@ cris_elf_gc_sweep_hook (abfd, info, sec, relocs)
for (rel = relocs; rel < relend; rel++)
{
unsigned long r_symndx;
- struct elf_link_hash_entry *h;
+ struct elf_link_hash_entry *h = NULL;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
case R_CRIS_16_GOT:
case R_CRIS_32_GOT:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
+ if (h != NULL)
{
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
if (h->got.refcount > 0)
{
--h->got.refcount;
@@ -2027,23 +2035,22 @@ cris_elf_gc_sweep_hook (abfd, info, sec, relocs)
case R_CRIS_16_GOTPLT:
case R_CRIS_32_GOTPLT:
/* For local symbols, treat these like GOT relocs. */
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx < symtab_hdr->sh_info)
+ if (h == NULL)
goto local_got_reloc;
/* Fall through. */
+
case R_CRIS_32_PLT_GOTREL:
/* FIXME: We don't garbage-collect away the .got section. */
if (local_got_refcounts != NULL)
local_got_refcounts[-1]--;
/* Fall through. */
+
case R_CRIS_8_PCREL:
case R_CRIS_16_PCREL:
case R_CRIS_32_PCREL:
case R_CRIS_32_PLT_PCREL:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
+ if (h != NULL)
{
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
&& h->plt.refcount > 0)
--h->plt.refcount;