summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2005-06-20 18:12:11 +0000
committerH.J. Lu <hjl@lucon.org>2005-06-20 18:12:11 +0000
commit4b8a536c7baca205d259c184538e55d3ee5e4ab9 (patch)
tree1115aa578455bd5d6e84e65c7819da9bbdcd6598
parent729305e5a00f439e30351ea6671161598b19b5c7 (diff)
downloadgdb-4b8a536c7baca205d259c184538e55d3ee5e4ab9.tar.gz
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.
-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 2b6ddabcdb9..3ce3aefc312 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 c78f04069ec..09d746ba278 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 162b1be4d5d..af26109180e 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 34f89554320..11b5d4f7263 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 368e4c752d6..db750315d8a 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 916378975d3..6d5c5d270d7 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 ca6a24c9ceb..220a49b853f 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 3a4fb0615c3..e1720796087 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 5ff7791a8d0..5d604328270 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 ddbe48f9f24..2982474cf99 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 ce73afc3ef7..146dcaaecaf 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 d74b9f96d74..a95a5c104bb 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 23d58bc407e..bf34694f24b 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 2c6e29b883b..b6a4595bbf2 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 d1787485390..29a4e8ac068 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 3a04fd5f330..51841e51245 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 90a76f5c83a..da4278267c3 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 fae2d18d31c..6220df3c073 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 c9119239c6a..1d86b483061 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 62ed07a1135..dc4e5b0fbd4 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 9b57f35938a..8a3b80aaf1a 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 e229682016f..47d87d21b4e 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 2faa75922c3..aced5c81bdb 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 3c5336b7d28..84db270200b 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 bd122cf5874..51b6cc9b643 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 9142d2ad761..c88b0a29811 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 c2679e3d1b9..2b4630dc556 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 9bae5d58378..10ce7d19def 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 8f6ff7db65d..c34b8bec8d3 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. */