[PATCH 9/9] Accept the DW_FORM_ref8 type when parsing DWARF types.

Mark Wielaard mark@klomp.org
Sun Nov 15 16:55:47 GMT 2020


From: Nick Clifton <nickc@redhat.com>

	* dwarf.c (skip_attr_bytes): Correctly handle DW_FORM_ref8.
	(get_type_abbrev_from_form): Accept DW_FORM_ref8.

(cherry picked from commit 1f57314183549008c065ad2240598d2b0f0ff56b
 and commit ed1afd86668781159a131dc9c9c4a54a3b0a1e3a)
---
 binutils/ChangeLog |  8 ++++++++
 binutils/dwarf.c   | 16 ++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 995cc0c3db9..f7eaee24ec7 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-15  Mark Wielaard  <mark@klomp.org>
+
+	Backport from the mainline:
+	2020-11-10  Nick Clifton  <nickc@redhat.com>
+
+	* dwarf.c (skip_attr_bytes): Correctly handle DW_FORM_ref8.
+	(get_type_abbrev_from_form): Accept DW_FORM_ref8.
+
 2020-11-15  Mark Wielaard  <mark@klomp.org>
 
 	Backport from the mainline:
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 2b5fac1c3f8..32510fc1773 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2021,6 +2021,21 @@ skip_attr_bytes (unsigned long          form,
       break;
 
     case DW_FORM_ref8:
+      {
+	dwarf_vma high_bits;
+
+	SAFE_BYTE_GET64 (data, &high_bits, &uvalue, end);
+	data += 8;
+	if (sizeof (uvalue) > 4)
+	  uvalue += high_bits << 32;
+	else if (high_bits != 0)
+	  {
+	    /* FIXME: What to do ?  */
+	    return NULL;
+	  }
+	break;
+      }
+
     case DW_FORM_data8:
     case DW_FORM_ref_sig8:
       data += 8;
@@ -2111,6 +2126,7 @@ get_type_abbrev_from_form (unsigned long                 form,
     case DW_FORM_ref1:
     case DW_FORM_ref2:
     case DW_FORM_ref4:
+    case DW_FORM_ref8:
     case DW_FORM_ref_udata:
       if (uvalue + cu_offset > section->size)
 	{
-- 
2.18.4



More information about the Binutils mailing list