]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add NULL bfd test to elf_symbol_from
authorAlan Modra <amodra@gmail.com>
Mon, 20 Nov 2017 23:34:05 +0000 (10:04 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 21 Nov 2017 00:50:24 +0000 (11:20 +1030)
A followup to PR22443.

* elf-bfd.h (elf_symbol_from): Check for NULL symbol bfd.
* elfcode.h (elf_slurp_reloc_table_from_section): Add FIXME comment.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elfcode.h

index 5bf4f1a9524fd703daaafc7690b0f5cd9e57b1f2..696b2d8ae907bd4b558aa237f5dd85a9808356a4 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-21  Alan Modra  <amodra@gmail.com>
+
+       * elf-bfd.h (elf_symbol_from): Check for NULL symbol bfd.
+       * elfcode.h (elf_slurp_reloc_table_from_section): Add FIXME comment.
+
 2017-11-20  Nick Clifton  <nickc@redhat.com>
 
        PR 22450
index 99e13e00f35a27f1dffae6a4fb215d8a61df9adb..954105e26e285df9838c03f15b1f4d0abfc47425 100644 (file)
@@ -731,10 +731,11 @@ struct elf_size_info {
 };
 
 #define elf_symbol_from(ABFD,S) \
-       (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
-         && (S)->the_bfd->tdata.elf_obj_data != 0) \
-        ? (elf_symbol_type *) (S) \
-        : 0)
+  (((S)->the_bfd != NULL                                       \
+    && (S)->the_bfd->xvec->flavour == bfd_target_elf_flavour   \
+    && (S)->the_bfd->tdata.elf_obj_data != 0)                  \
+   ? (elf_symbol_type *) (S)                                   \
+   : 0)
 
 enum elf_reloc_type_class {
   reloc_class_normal,
index 6114b11e66fa5522ae2e0bbd20662391b6ca8712..80b26aa803a50457c9c03bcf49cd4f62754c604e 100644 (file)
@@ -1440,6 +1440,8 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
        relent->address = rela.r_offset - asect->vma;
 
       if (ELF_R_SYM (rela.r_info) == STN_UNDEF)
+       /* FIXME: This and the error case below mean that we have a
+          symbol on relocs that is not elf_symbol_type.  */
        relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
       else if (ELF_R_SYM (rela.r_info) > symcount)
        {