diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-06-14 09:21:00 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-06-14 10:10:45 -0700 |
commit | 897463b12ba936df7d2070755eaac94f87fcedfb (patch) | |
tree | 9faa557d621ab3250dfba6a4bc8b4e8088d62c3a /bfd | |
parent | 28215275a6bbb7c4b4c2d683a1d94fead7dacc35 (diff) | |
download | gdb-897463b12ba936df7d2070755eaac94f87fcedfb.zip gdb-897463b12ba936df7d2070755eaac94f87fcedfb.tar.gz gdb-897463b12ba936df7d2070755eaac94f87fcedfb.tar.bz2 |
Fix elf_x86_64_reloc_type_class
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf64-x86-64.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 46f723c..f8a7ca3 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -6001,21 +6001,27 @@ elf_x86_64_reloc_type_class (const struct bfd_link_info *info, const struct elf_backend_data *bed = get_elf_backend_data (abfd); struct elf_x86_64_link_hash_table *htab = elf_x86_64_hash_table (info); + if ((int) ELF32_R_TYPE (rela->r_info) == R_X86_64_IRELATIVE) + return reloc_class_ifunc; + if (htab->elf.dynsym != NULL && htab->elf.dynsym->contents != NULL) { /* Check relocation against STT_GNU_IFUNC symbol if there are dynamic symbols. */ unsigned long r_symndx = htab->r_sym (rela->r_info); - Elf_Internal_Sym sym; - if (!bed->s->swap_symbol_in (abfd, - (htab->elf.dynsym->contents - + r_symndx * bed->s->sizeof_sym), - 0, &sym)) - abort (); + if (r_symndx != STN_UNDEF) + { + Elf_Internal_Sym sym; + if (!bed->s->swap_symbol_in (abfd, + (htab->elf.dynsym->contents + + r_symndx * bed->s->sizeof_sym), + 0, &sym)) + abort (); - if (ELF_ST_TYPE (sym.st_info) == STT_GNU_IFUNC) - return reloc_class_ifunc; + if (ELF_ST_TYPE (sym.st_info) == STT_GNU_IFUNC) + return reloc_class_ifunc; + } } switch ((int) ELF32_R_TYPE (rela->r_info)) |