From 0af4cd7c6076b20783883130b2d999d4f8bf4373 Mon Sep 17 00:00:00 2001 From: Paul Koning Date: Fri, 8 Jul 2005 21:42:33 +0000 Subject: 2005-07-08 Paul Koning * dwarf2.c (read_address): Check sign_extend_vma to handle targets where addresses are sign extended. --- bfd/dwarf2.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'bfd/dwarf2.c') diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index d65fb68..40883dd 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -347,16 +347,35 @@ read_indirect_string (struct comp_unit* unit, static bfd_uint64_t read_address (struct comp_unit *unit, bfd_byte *buf) { - switch (unit->addr_size) + int signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma; + + if (signed_vma) { - case 8: - return bfd_get_64 (unit->abfd, buf); - case 4: - return bfd_get_32 (unit->abfd, buf); - case 2: - return bfd_get_16 (unit->abfd, buf); - default: - abort (); + switch (unit->addr_size) + { + case 8: + return bfd_get_signed_64 (unit->abfd, buf); + case 4: + return bfd_get_signed_32 (unit->abfd, buf); + case 2: + return bfd_get_signed_16 (unit->abfd, buf); + default: + abort (); + } + } + else + { + switch (unit->addr_size) + { + case 8: + return bfd_get_64 (unit->abfd, buf); + case 4: + return bfd_get_32 (unit->abfd, buf); + case 2: + return bfd_get_16 (unit->abfd, buf); + default: + abort (); + } } } -- cgit v1.1