diff options
author | Alan Modra <amodra@gmail.com> | 2014-12-10 14:06:42 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-12-10 15:30:54 +1030 |
commit | fa15f18deaf6f48e0b415ad3e8864de0b1cf6a39 (patch) | |
tree | a7dd56d73cad3ba8b65517a83d77d054a2fc99dc /bfd | |
parent | 4673aa7850ee7a8a806a9e61f531c8dd88f70325 (diff) | |
download | fsf-binutils-gdb-fa15f18deaf6f48e0b415ad3e8864de0b1cf6a39.zip fsf-binutils-gdb-fa15f18deaf6f48e0b415ad3e8864de0b1cf6a39.tar.gz fsf-binutils-gdb-fa15f18deaf6f48e0b415ad3e8864de0b1cf6a39.tar.bz2 |
Don't access elf tdata in dwarf.c without first checking for an ELF bfd
_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.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/dwarf2.c | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f0abc59..52c6cd3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 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 * elf-bfd.h (struct elf_backend_data): Add sort_relocs_p. * elfxx-target.h (elf_backend_sort_relocs_p): Define. diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 8375da4..93236a6 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -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) |