Don't access elf tdata in dwarf.c without first checking for an ELF bfd
authorAlan Modra <amodra@gmail.com>
Wed, 10 Dec 2014 03:36:42 +0000 (14:06 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 10 Dec 2014 05:00:54 +0000 (15:30 +1030)
_bfd_dwarf2_find_nearest_line may be called on a COFF bfd.

* dwarf2.c (read_address): Check bfd_target_elf_flavour before
calling get_elf_backend_data.
(_bfd_dwarf2_find_nearest_line): Fix parens.

bfd/ChangeLog
bfd/dwarf2.c

index f0abc595f89e5ca282c84b189646d770c4a9d64a..52c6cd3dcec8928b44d984a8ccea720e29a63827 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-10  Alan Modra  <amodra@gmail.com>
+
+       * dwarf2.c (read_address): Check bfd_target_elf_flavour before
+       calling get_elf_backend_data.
+       (_bfd_dwarf2_find_nearest_line): Fix parens.
+
 2014-12-10  Alan Modra  <amodra@gmail.com>
 
        PR 17666
index 8375da43ac5e6267992c9876cf1d979ee10aec49..93236a699b8d0a0b6f34e418e0e06554c2b595be 100644 (file)
@@ -745,7 +745,10 @@ read_alt_indirect_ref (struct comp_unit * unit,
 static bfd_uint64_t
 read_address (struct comp_unit *unit, bfd_byte *buf)
 {
-  int signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma;
+  int signed_vma = 0;
+
+  if (bfd_get_flavour (unit->abfd) == bfd_target_elf_flavour)
+    signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma;
 
   if (signed_vma)
     {
@@ -3849,7 +3852,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
                                                     functionname_ptr,
                                                     linenumber_ptr,
                                                     discriminator_ptr,
-                                                    stash)) > 0;
+                                                    stash) != 0);
 
          if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
              == stash->sec->size)