* Don't access elf tdata in dwarf.c without first checking for an ELF bfd
@ 2014-12-10 5:12 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2014-12-10 5:12 UTC (permalink / raw)
To: binutils
_bfd_dwarf2_find_nearest_line may be called on a COFF bfd. Applying
master and 2.25 branch.
* dwarf2.c (read_address): Check bfd_target_elf_flavour before
calling get_elf_backend_data.
(_bfd_dwarf2_find_nearest_line): Fix parens.
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)
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-10 5:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10 5:12 Don't access elf tdata in dwarf.c without first checking for an ELF bfd Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).