From 973a3492d553c8b18c8a3257b4874253c0efa68a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 20 Jun 2005 18:12:11 +0000 Subject: [PATCH] 2005-06-20 H.J. Lu 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. --- bfd/ChangeLog | 33 +++++++++++++++++++++++++++++++++ bfd/elf-m10300.c | 7 ++++++- bfd/elf32-arm.c | 7 ++++++- bfd/elf32-avr.c | 7 ++++++- bfd/elf32-cris.c | 7 ++++++- bfd/elf32-d10v.c | 7 ++++++- bfd/elf32-dlx.c | 7 ++++++- bfd/elf32-fr30.c | 7 ++++++- bfd/elf32-frv.c | 7 ++++++- bfd/elf32-i370.c | 7 ++++++- bfd/elf32-iq2000.c | 7 ++++++- bfd/elf32-m32r.c | 7 ++++++- bfd/elf32-m68hc1x.c | 7 ++++++- bfd/elf32-m68k.c | 7 ++++++- bfd/elf32-mcore.c | 7 ++++++- bfd/elf32-ms1.c | 7 ++++++- bfd/elf32-msp430.c | 7 ++++++- bfd/elf32-openrisc.c | 7 ++++++- bfd/elf32-ppc.c | 7 ++++++- bfd/elf32-s390.c | 7 ++++++- bfd/elf32-sh.c | 4 ++-- bfd/elf32-v850.c | 7 ++++++- bfd/elf32-vax.c | 7 ++++++- bfd/elf64-mmix.c | 7 ++++++- bfd/elf64-ppc.c | 7 ++++++- bfd/elf64-s390.c | 7 ++++++- bfd/elf64-sh64.c | 7 ++++++- bfd/elfxx-mips.c | 4 ++++ bfd/elfxx-sparc.c | 7 ++++++- 29 files changed, 195 insertions(+), 28 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2b6ddabcdb..3ce3aefc31 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,36 @@ +2005-06-20 H.J. Lu + + 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 PR 1022 diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index c78f04069e..09d746ba27 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 162b1be4d5..af26109180 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 34f8955432..11b5d4f726 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 368e4c752d..db750315d8 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 916378975d..6d5c5d270d 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 ca6a24c9ce..220a49b853 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 3a4fb0615c..e172079608 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 5ff7791a8d..5d60432827 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 ddbe48f9f2..2982474cf9 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 ce73afc3ef..146dcaaeca 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 d74b9f96d7..a95a5c104b 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 23d58bc407..bf34694f24 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 2c6e29b883..b6a4595bbf 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 d178748539..29a4e8ac06 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 3a04fd5f33..51841e5124 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 90a76f5c83..da4278267c 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 fae2d18d31..6220df3c07 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 c9119239c6..1d86b48306 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 62ed07a113..dc4e5b0fbd 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 9b57f35938..8a3b80aaf1 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 e229682016..47d87d21b4 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 2faa75922c..aced5c81bd 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 3c5336b7d2..84db270200 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 bd122cf587..51b6cc9b64 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 9142d2ad76..c88b0a2981 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 c2679e3d1b..2b4630dc55 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 9bae5d5837..10ce7d19de 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 8f6ff7db65..c34b8bec8d 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. */ -- 2.34.1