aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog33
-rw-r--r--bfd/elf-m10300.c7
-rw-r--r--bfd/elf32-arm.c7
-rw-r--r--bfd/elf32-avr.c7
-rw-r--r--bfd/elf32-cris.c7
-rw-r--r--bfd/elf32-d10v.c7
-rw-r--r--bfd/elf32-dlx.c7
-rw-r--r--bfd/elf32-fr30.c7
-rw-r--r--bfd/elf32-frv.c7
-rw-r--r--bfd/elf32-i370.c7
-rw-r--r--bfd/elf32-iq2000.c7
-rw-r--r--bfd/elf32-m32r.c7
-rw-r--r--bfd/elf32-m68hc1x.c7
-rw-r--r--bfd/elf32-m68k.c7
-rw-r--r--bfd/elf32-mcore.c7
-rw-r--r--bfd/elf32-ms1.c7
-rw-r--r--bfd/elf32-msp430.c7
-rw-r--r--bfd/elf32-openrisc.c7
-rw-r--r--bfd/elf32-ppc.c7
-rw-r--r--bfd/elf32-s390.c7
-rw-r--r--bfd/elf32-sh.c4
-rw-r--r--bfd/elf32-v850.c7
-rw-r--r--bfd/elf32-vax.c7
-rw-r--r--bfd/elf64-mmix.c7
-rw-r--r--bfd/elf64-ppc.c7
-rw-r--r--bfd/elf64-s390.c7
-rw-r--r--bfd/elf64-sh64.c7
-rw-r--r--bfd/elfxx-mips.c4
-rw-r--r--bfd/elfxx-sparc.c7
29 files changed, 195 insertions, 28 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2b6ddab..3ce3aef 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,38 @@
2005-06-20 H.J. Lu <hongjiu.lu@intel.com>
+ PR 1025
+ * elf-m10300.c (mn10300_elf_check_relocs): Handle indirect
+ symbol.
+ * elf32-arm.c (elf32_arm_check_relocs): Likewise.
+ * elf32-avr.c (elf32_avr_check_relocs): Likewise.
+ * elf32-cris.c (cris_elf_check_relocs): Likewise.
+ * elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
+ * elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
+ * elf32-fr30.c (fr30_elf_check_relocs): Likewise.
+ * elf32-frv.c (elf32_frv_check_relocs): Likewise.
+ * elf32-i370.c (i370_elf_check_relocs): Likewise.
+ * elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
+ * elf32-m32r.c (m32r_elf_check_relocs): Likewise.
+ * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
+ * elf32-m68k.c (elf_m68k_check_relocs): Likewise.
+ * elf32-mcore.c (mcore_elf_check_relocs): Likewise.
+ * elf32-ms1.c (ms1_elf_check_relocs): Likewise.
+ * elf32-msp430.c (elf32_msp430_check_relocs): Likewise.
+ * elf32-openrisc.c (openrisc_elf_check_relocs): Likewise.
+ * elf32-ppc.c (ppc_elf_check_relocs): Likewise.
+ * elf32-s390.c (elf_s390_check_relocs): Likewise.
+ * elf32-sh.c (sh_elf_check_relocs): Likewise.
+ * elf32-v850.c (v850_elf_check_relocs): Likewise.
+ * elf32-vax.c (elf_vax_check_relocs): Likewise.
+ * elf64-mmix.c (mmix_elf_check_relocs): Likewise.
+ * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
+ * elf64-s390.c (elf_s390_check_relocs): Likewise.
+ * elf64-sh64.c (sh_elf64_check_relocs): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
+
+2005-06-20 H.J. Lu <hongjiu.lu@intel.com>
+
PR 1022
* elf32-hppa.c (elf32_hppa_check_relocs): Handle indirect
symbol.
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index c78f040..09d746b 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -717,7 +717,12 @@ mn10300_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
/* Some relocs require a global offset table. */
if (dynobj == NULL)
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 162b1be..af26109 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -4912,7 +4912,12 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
eh = (struct elf32_arm_link_hash_entry *) h;
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 34f8955..11b5d4f 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -523,7 +523,12 @@ elf32_avr_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
}
return TRUE;
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 368e4c7..db75031 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -2479,7 +2479,12 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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);
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index 9163789..6d5c5d2 100644
--- a/bfd/elf32-d10v.c
+++ b/bfd/elf32-d10v.c
@@ -327,7 +327,12 @@ elf32_d10v_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c
index ca6a24c..220a49b 100644
--- a/bfd/elf32-dlx.c
+++ b/bfd/elf32-dlx.c
@@ -477,7 +477,12 @@ elf32_dlx_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index 3a4fb06..e172079 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -707,7 +707,12 @@ fr30_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 5ff7791..5d60432 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -6127,7 +6127,12 @@ elf32_frv_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index ddbe48f..2982474 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -901,7 +901,12 @@ i370_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
if (info->shared)
{
diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c
index ce73afc..146dcaa 100644
--- a/bfd/elf32-iq2000.c
+++ b/bfd/elf32-iq2000.c
@@ -427,7 +427,12 @@ iq2000_elf_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index d74b9f9..a95a5c1 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -3947,7 +3947,12 @@ m32r_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
/* Some relocs require a global offset table. */
if (htab->sgot == NULL)
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 23d58bc..bf34694 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -885,7 +885,12 @@ elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 2c6e29b..b6a4595 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -481,7 +481,12 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index d178748..29a4e8a 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -639,7 +639,12 @@ mcore_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-ms1.c b/bfd/elf32-ms1.c
index 3a04fd5..51841e5 100644
--- a/bfd/elf32-ms1.c
+++ b/bfd/elf32-ms1.c
@@ -481,7 +481,12 @@ ms1_elf_check_relocs
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
}
return TRUE;
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index 90a76f5..da42782 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -288,7 +288,12 @@ elf32_msp430_check_relocs (bfd * abfd, struct bfd_link_info * info,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
}
return TRUE;
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index fae2d18..6220df3 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -528,7 +528,12 @@ openrisc_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index c911923..1d86b48 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2909,7 +2909,12 @@ ppc_elf_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
/* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
This shows up in particular in an R_PPC_ADDR32 in the eabi
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 62ed07a..dc4e5b0 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -991,7 +991,12 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
/* Create got section and local_got_refcounts array if they
are needed. */
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 9b57f35..8a3b80a 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -6201,14 +6201,14 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
else
{
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
}
r_type = sh_elf_optimized_tls_reloc (info, r_type, h == NULL);
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index e229682..47d87d2 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -689,7 +689,12 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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 = (enum v850_reloc_type) ELF32_R_TYPE (rel->r_info);
switch (r_type)
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 2faa759..aced5c8 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -579,7 +579,12 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF32_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 3c5336b..84db270 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -2014,7 +2014,12 @@ mmix_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
switch (ELF64_R_TYPE (rel->r_info))
{
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index bd122cf..51b6cc9 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -4365,7 +4365,12 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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 = ELF64_R_TYPE (rel->r_info);
switch (r_type)
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 9142d2a..c88b0a2 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -945,7 +945,12 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
/* Create got section and local_got_refcounts array if they
are needed. */
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index c2679e3..2b4630d 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -2456,7 +2456,12 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
/* Some relocs require a global offset table. */
if (dynobj == NULL)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 9bae5d5..10ce7d1 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -5850,6 +5850,10 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
h = ((struct mips_elf_link_hash_entry *)
sym_hashes[r_symndx - extsymoff]);
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+
/* H is the symbol this stub is for. */
h->fn_stub = sec;
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 8f6ff7d..c34b8be 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -1019,7 +1019,12 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- 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;
+ }
/* Compatibility with old R_SPARC_REV32 reloc conflicting
with R_SPARC_TLS_GD_HI22. */