diff options
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 09af249dfe..04c74550be 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1645,23 +1645,10 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { - struct elf64_x86_64_link_hash_entry *eh; - struct elf_dyn_relocs **pp; - struct elf_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) - if (p->sec == sec) - { - /* Everything must go for SEC. */ - *pp = p->next; - break; - } } else { @@ -1682,7 +1669,24 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, } } - r_type = ELF64_R_TYPE (rel->r_info); + if (h) + { + struct elf64_x86_64_link_hash_entry *eh; + struct elf_dyn_relocs **pp; + struct elf_dyn_relocs *p; + + eh = (struct elf64_x86_64_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + /* Everything must go for SEC. */ + *pp = p->next; + break; + } + } + + r_type = ELF32_R_TYPE (rel->r_info); if (! elf64_x86_64_tls_transition (info, abfd, sec, NULL, symtab_hdr, sym_hashes, &r_type, GOT_UNKNOWN, @@ -1733,7 +1737,8 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, case R_X86_64_PC16: case R_X86_64_PC32: case R_X86_64_PC64: - if (info->shared) + if (info->shared + && (h == NULL || h->type != STT_GNU_IFUNC)) break; /* Fall thru */ |