[PATCH] libdw: DW_FORM_GNU_ref_alt is always offset_size.

Mark Wielaard mjw at redhat.com
Wed Apr 10 14:03:33 UTC 2013


Unlike DW_FORM_ref_addr, a DW_FORM_GNU_ref_alt is always of offset size,
even in DWARF version 2.

Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
 libdw/ChangeLog           | 6 ++++++
 libdw/dwarf_formref_die.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 12df9bb..ae266d4 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,9 @@
+2013-04-10  Mark Wielaard  <mjw at redhat.com>
+
+	* dwarf_formref_die.c (dwarf_formref_die): Reference size is only
+	equal to address size when we have a DW_FORM_ref_addr for DWARF
+	version 2.
+
 2013-03-25  Mark Wielaard  <mjw at redhat.com>
 
 	* dwarf_getsrclines.c (dwarf_getsrclines): Mark highest address as
diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c
index f070127..b1af2ab 100644
--- a/libdw/dwarf_formref_die.c
+++ b/libdw/dwarf_formref_die.c
@@ -50,7 +50,7 @@ dwarf_formref_die (attr, result)
     {
       /* This has an absolute offset.  */
 
-      uint8_t ref_size = (cu->version == 2
+      uint8_t ref_size = (cu->version == 2 && attr->form == DW_FORM_ref_addr
 			  ? cu->address_size
 			  : cu->offset_size);
 
-- 
1.8.1.4



More information about the elfutils-devel mailing list