This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/3] bfd: DW_AT_high_pc can be relative to DW_AT_low_pc.
- From: Mark Wielaard <mjw at redhat dot com>
- To: binutils at sourceware dot org
- Cc: jakub at redhat dot com, Mark Wielaard <mjw at redhat dot com>, "Nick Clifton" <nickc at redhat dot com>, "H.J. Lu" <hjl at lucon dot org>, "Kazu Hirata" <kazu at codesourcery dot com>, "Fred Fish" <fnf at specifix dot com>, "Hans-Peter Nilsson" <hp at axis dot com>, "Richard Henderson" <rth at redhat dot com>, "Alan Modra" <amodra at bigpond dot net dot au>
- Date: Fri, 27 Apr 2012 14:15:19 +0200
- Subject: [PATCH 1/3] bfd: DW_AT_high_pc can be relative to DW_AT_low_pc.
- References: <1335528921-11582-1-git-send-email-mjw@redhat.com>
* dwarf2.c (scan_unit_for_symbols): Account for DW_AT_high_pc
possibly being relative to DW_AT_low_pc.
(parse_comp_unit): Likewise.
---
bfd/ChangeLog | 6 ++++++
bfd/dwarf2.c | 11 +++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b46eb9c..0978890 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2012-04-26 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf2.c (scan_unit_for_symbols): Account for DW_AT_high_pc
+ possibly being relative to DW_AT_low_pc.
+ (parse_comp_unit): Likewise.
+
2012-04-24 Hans-Peter Nilsson <hp@axis.com>
PR ld/13990
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 66fd16f..4098d70 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2092,6 +2092,7 @@ scan_unit_for_symbols (struct comp_unit *unit)
struct varinfo *var;
bfd_vma low_pc = 0;
bfd_vma high_pc = 0;
+ int high_pc_relative = 0;
abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
@@ -2197,6 +2198,8 @@ scan_unit_for_symbols (struct comp_unit *unit)
case DW_AT_high_pc:
high_pc = attr.u.val;
+ if (attr.form != DW_FORM_addr)
+ high_pc_relative = 1;
break;
case DW_AT_ranges:
@@ -2275,6 +2278,9 @@ scan_unit_for_symbols (struct comp_unit *unit)
}
}
+ if (high_pc_relative == 1)
+ high_pc += low_pc;
+
if (func && high_pc != 0)
{
if (!arange_add (unit->abfd, &func->arange, low_pc, high_pc))
@@ -2338,6 +2344,7 @@ parse_comp_unit (struct dwarf2_debug *stash,
bfd_vma low_pc = 0;
bfd_vma high_pc = 0;
bfd *abfd = stash->bfd_ptr;
+ int high_pc_relative = 0;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
@@ -2440,6 +2447,8 @@ parse_comp_unit (struct dwarf2_debug *stash,
case DW_AT_high_pc:
high_pc = attr.u.val;
+ if (attr.form != DW_FORM_addr)
+ high_pc_relative = 1;
break;
case DW_AT_ranges:
@@ -2467,6 +2476,8 @@ parse_comp_unit (struct dwarf2_debug *stash,
break;
}
}
+ if (high_pc_relative == 1)
+ high_pc += low_pc;
if (high_pc != 0)
{
if (!arange_add (unit->abfd, &unit->arange, low_pc, high_pc))
--
1.7.7.6