summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-01-11 09:32:53 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-01-11 09:32:53 +0000
commit8c0550a10ae269942db3c81c57a4816c3ee0a97d (patch)
tree6bb58d0dd7b42d490104c095b69febc95136a0f9 /bfd
parentd71c71602a39b4873a8cca6ff51e100afaddd84d (diff)
downloadbinutils-redhat-8c0550a10ae269942db3c81c57a4816c3ee0a97d.tar.gz
* 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')
-rw-r--r--bfd/ChangeLog19
-rw-r--r--bfd/elf32-arm.c21
-rw-r--r--bfd/elf32-cris.c27
-rw-r--r--bfd/elf32-hppa.c5
-rw-r--r--bfd/elf32-i386.c5
-rw-r--r--bfd/elf32-m32r.c153
-rw-r--r--bfd/elf32-m68k.c21
-rw-r--r--bfd/elf32-ppc.c3
-rw-r--r--bfd/elf32-s390.c6
-rw-r--r--bfd/elf32-sh.c6
-rw-r--r--bfd/elf32-sparc.c5
-rw-r--r--bfd/elf32-vax.c31
-rw-r--r--bfd/elf32-xtensa.c9
-rw-r--r--bfd/elf64-ppc.c5
-rw-r--r--bfd/elf64-s390.c6
-rw-r--r--bfd/elf64-x86-64.c6
16 files changed, 200 insertions, 128 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a4896539ca..2c4b88a94b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,24 @@
2005-01-11 Alan Modra <amodra@bigpond.net.au>
+ * 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.
+
+2005-01-11 Alan Modra <amodra@bigpond.net.au>
+
* elf32-ppc.c (ppc_elf_create_dynamic_sections): Correct
.dynsbss flags.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 1f113e2d1f..6e24153643 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3843,8 +3843,6 @@ elf32_arm_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
struct elf32_arm_link_hash_table * globals;
globals = elf32_arm_hash_table (info);
@@ -3858,8 +3856,19 @@ elf32_arm_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
{
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h = NULL;
int r_type;
+ 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;
+ }
+
r_type = ELF32_R_TYPE (rel->r_info);
#ifndef OLD_ARM_ABI
r_type = arm_real_reloc_type (globals, r_type);
@@ -3870,10 +3879,8 @@ elf32_arm_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
#ifndef OLD_ARM_ABI
case R_ARM_GOT_PREL:
#endif
- 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 -= 1;
}
@@ -3896,14 +3903,12 @@ elf32_arm_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
case R_ARM_THM_PC22:
/* Should the interworking branches be here also? */
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
+ if (h != NULL)
{
struct elf32_arm_link_hash_entry *eh;
struct elf32_arm_relocs_copied **pp;
struct elf32_arm_relocs_copied *p;
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
eh = (struct elf32_arm_link_hash_entry *) h;
if (h->plt.refcount > 0)
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index d043111b66..44cae03ede 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;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 4d43cb93ac..d1539be1b9 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -1,6 +1,6 @@
/* BFD back-end for HP PA-RISC ELF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Original code by
Center for Software Science
@@ -1537,6 +1537,9 @@ elf32_hppa_gc_sweep_hook (bfd *abfd,
struct elf32_hppa_dyn_reloc_entry *p;
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;
eh = (struct elf32_hppa_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index bca9f5fae7..4785552187 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1,6 +1,6 @@
/* Intel 80386/80486-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1248,6 +1248,9 @@ elf_i386_gc_sweep_hook (bfd *abfd,
struct elf_i386_dyn_relocs *p;
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;
eh = (struct elf_i386_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 3b1cf26572..c74980b431 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1,5 +1,5 @@
/* M32R-specific support for 32-bit ELF.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -4341,8 +4341,6 @@ m32r_elf_gc_sweep_hook (abfd, info, sec, relocs)
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
elf_section_data (sec)->local_dynrel = NULL;
@@ -4352,84 +4350,91 @@ m32r_elf_gc_sweep_hook (abfd, info, sec, relocs)
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_M32R_GOT16_HI_ULO:
- case R_M32R_GOT16_HI_SLO:
- case R_M32R_GOT16_LO:
- case R_M32R_GOTOFF:
- case R_M32R_GOTOFF_HI_ULO:
- case R_M32R_GOTOFF_HI_SLO:
- case R_M32R_GOTOFF_LO:
- case R_M32R_GOT24:
- case R_M32R_GOTPC_HI_ULO:
- case R_M32R_GOTPC_HI_SLO:
- case R_M32R_GOTPC_LO:
- case R_M32R_GOTPC24:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->got.refcount > 0)
- h->got.refcount--;
- }
- else
- {
- if (local_got_refcounts && local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx]--;
- }
- break;
+ {
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h = NULL;
- case R_M32R_16_RELA:
- case R_M32R_24_RELA:
- case R_M32R_32_RELA:
- case R_M32R_HI16_ULO_RELA:
- case R_M32R_HI16_SLO_RELA:
- case R_M32R_LO16_RELA:
- case R_M32R_SDA16_RELA:
- case R_M32R_18_PCREL_RELA:
- case R_M32R_26_PCREL_RELA:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_m32r_link_hash_entry *eh;
- struct elf_m32r_dyn_relocs **pp;
- struct elf_m32r_dyn_relocs *p;
+ 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;
+ }
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_M32R_GOT16_HI_ULO:
+ case R_M32R_GOT16_HI_SLO:
+ case R_M32R_GOT16_LO:
+ case R_M32R_GOTOFF:
+ case R_M32R_GOTOFF_HI_ULO:
+ case R_M32R_GOTOFF_HI_SLO:
+ case R_M32R_GOTOFF_LO:
+ case R_M32R_GOT24:
+ case R_M32R_GOTPC_HI_ULO:
+ case R_M32R_GOTPC_HI_SLO:
+ case R_M32R_GOTPC_LO:
+ case R_M32R_GOTPC24:
+ if (h != NULL)
+ {
+ if (h->got.refcount > 0)
+ h->got.refcount--;
+ }
+ else
+ {
+ if (local_got_refcounts && local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx]--;
+ }
+ break;
+
+ case R_M32R_16_RELA:
+ case R_M32R_24_RELA:
+ case R_M32R_32_RELA:
+ case R_M32R_HI16_ULO_RELA:
+ case R_M32R_HI16_SLO_RELA:
+ case R_M32R_LO16_RELA:
+ case R_M32R_SDA16_RELA:
+ case R_M32R_18_PCREL_RELA:
+ case R_M32R_26_PCREL_RELA:
+ if (h != NULL)
+ {
+ struct elf_m32r_link_hash_entry *eh;
+ struct elf_m32r_dyn_relocs **pp;
+ struct elf_m32r_dyn_relocs *p;
- if (!info->shared && h->plt.refcount > 0)
- h->plt.refcount -= 1;
+ if (!info->shared && h->plt.refcount > 0)
+ h->plt.refcount -= 1;
- eh = (struct elf_m32r_link_hash_entry *) h;
+ eh = (struct elf_m32r_link_hash_entry *) h;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
- || ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA)
- p->pc_count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
- break;
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
+ || ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA)
+ p->pc_count -= 1;
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ break;
+ }
+ }
+ break;
- case R_M32R_26_PLTREL:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;
+ case R_M32R_26_PLTREL:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
+ h->plt.refcount--;
+ }
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
+ }
return TRUE;
}
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 44863f2d5a..53ea5878ae 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -1,6 +1,6 @@
/* Motorola 68k series support for 32-bit ELF
Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004 Free Software Foundation, Inc.
+ 2004, 2005 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -835,7 +835,16 @@ elf_m68k_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))
{
@@ -845,10 +854,8 @@ elf_m68k_gc_sweep_hook (abfd, info, sec, relocs)
case R_68K_GOT8O:
case R_68K_GOT16O:
case R_68K_GOT32O:
- 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;
@@ -888,10 +895,8 @@ elf_m68k_gc_sweep_hook (abfd, info, sec, relocs)
case R_68K_8:
case R_68K_16:
case R_68K_32:
- 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->plt.refcount > 0)
--h->plt.refcount;
}
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 91953902c9..86fb760092 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -4075,6 +4075,9 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
struct ppc_elf_link_hash_entry *eh;
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;
eh = (struct ppc_elf_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 4bf34faeb7..d546a649ee 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -1,5 +1,6 @@
/* IBM S/390-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 Carl B. Pedersen and Martin Schwidefsky.
This file is part of BFD, the Binary File Descriptor library.
@@ -1437,6 +1438,9 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
struct elf_s390_dyn_relocs *p;
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;
eh = (struct elf_s390_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 80c0f811b1..b31ae9480e 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -1,5 +1,5 @@
/* Renesas / SuperH SH specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
@@ -6082,14 +6082,14 @@ sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
struct elf_sh_dyn_relocs *p;
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-#ifdef INCLUDE_SHMEDIA
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
{
+#ifdef INCLUDE_SHMEDIA
seen_stt_datalabel |= h->type == STT_DATALABEL;
+#endif
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}
-#endif
eh = (struct elf_sh_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
if (p->sec == sec)
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 18a2e49f65..1669aaa874 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1,6 +1,6 @@
/* SPARC-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1345,6 +1345,9 @@ elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
struct elf32_sparc_dyn_relocs *p;
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;
eh = (struct elf32_sparc_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
if (p->sec == sec)
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 6d5493b240..a98f96b01e 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1,6 +1,6 @@
/* VAX series support for 32-bit ELF
Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004 Free Software Foundation, Inc.
+ 2004, 2005 Free Software Foundation, Inc.
Contributed by Matt Thomas <matt@3am-software.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -904,18 +904,22 @@ elf_vax_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_VAX_GOT32:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->got.refcount > 0)
- --h->got.refcount;
- }
+ if (h != NULL && h->got.refcount > 0)
+ --h->got.refcount;
break;
case R_VAX_PLT32:
@@ -925,13 +929,8 @@ elf_vax_gc_sweep_hook (abfd, info, sec, relocs)
case R_VAX_8:
case R_VAX_16:
case R_VAX_32:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
- --h->plt.refcount;
- }
+ if (h != NULL && h->plt.refcount > 0)
+ --h->plt.refcount;
break;
default:
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index e6015e59f0..b6b3727253 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -1,5 +1,5 @@
/* Xtensa-specific support for 32-bit ELF.
- Copyright 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1039,7 +1039,12 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
- h = sym_hashes[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;
+ }
r_type = ELF32_R_TYPE (rel->r_info);
switch (r_type)
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 982c089403..2f30dd53d5 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -1,5 +1,5 @@
/* PowerPC64-specific support for 64-bit ELF.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Linus Nordberg, Swox AB <info@swox.com>,
based on elf32-ppc.c by Ian Lance Taylor.
@@ -4989,6 +4989,9 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
struct ppc_dyn_relocs *p;
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;
eh = (struct ppc_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index b428233e46..3424d622d2 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -1,5 +1,6 @@
/* IBM S/390-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -1402,6 +1403,9 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
struct elf_s390_dyn_relocs *p;
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;
eh = (struct elf_s390_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 00d6997222..d5b38d830b 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1,5 +1,6 @@
/* X86-64 specific support for 64-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 Jan Hubicka <jh@suse.cz>.
This file is part of BFD, the Binary File Descriptor library.
@@ -1043,6 +1044,9 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
struct elf64_x86_64_dyn_relocs *p;
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;
eh = (struct elf64_x86_64_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)