public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial.
@ 2020-09-23 14:51 Mark Wielaard
  2020-09-23 14:51 ` [PATCH 2/3] Sync libiberty and include with GCC for get_DW_UT_name Mark Wielaard
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Mark Wielaard @ 2020-09-23 14:51 UTC (permalink / raw)
  To: binutils; +Cc: Mark Wielaard

dwz in DWARF5 mode might produce DW_UT_partial unit types, which are
the same as DW_UT_compile unit types (but start with a DW_TAG_partial_unit)
and it might produce DW_FORM_ref_addr to create a reference between
units. Accept both constructs.

binutils/ChangeLog:

	* dwarf.c (read_and_display_attr_value): Handle DW_FORM_ref_addr
	for dwarf_version 5 just as version 3 and 4 (only 2 is different).
	(process_debug_info): Allow DW_UT_partial.
---
 binutils/ChangeLog | 7 +++++++
 binutils/dwarf.c   | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 5e8eb987371..21162ad5e6c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2020-09-23  Mark Wielaard  <mark@klomp.org>
+
+	* dwarf.c (read_and_display_attr_value): Handle DW_FORM_ref_addr
+	for dwarf_version 5 just as version 3 and 4 (only 2 is
+	different).
+	(process_debug_info): Allow DW_UT_partial.
+
 2020-09-21  Ludovic Courtès  <ludo@gnu.org>
 
 	* doc/binutils.texi (objcopy, strip): Say that
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 603169226d4..bb177d1f175 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2202,10 +2202,10 @@ read_and_display_attr_value (unsigned long           attribute,
     case DW_FORM_ref_addr:
       if (dwarf_version == 2)
 	SAFE_BYTE_GET_AND_INC (uvalue, data, pointer_size, end);
-      else if (dwarf_version == 3 || dwarf_version == 4)
+      else if (dwarf_version == 3 || dwarf_version == 4 || dwarf_version == 5)
 	SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
       else
-	error (_("Internal error: DWARF version is not 2, 3 or 4.\n"));
+	error (_("Internal error: DWARF version is not 2, 3, 4 or 5.\n"));
 
       break;
 
@@ -3419,6 +3419,7 @@ process_debug_info (struct dwarf_section *           section,
 	}
 
       if (compunit.cu_unit_type != DW_UT_compile
+	  && compunit.cu_unit_type != DW_UT_partial
 	  && compunit.cu_unit_type != DW_UT_type)
 	{
 	  warn (_("CU at offset %s contains corrupt or "
-- 
2.18.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-25  9:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 14:51 [PATCH 1/3] binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial Mark Wielaard
2020-09-23 14:51 ` [PATCH 2/3] Sync libiberty and include with GCC for get_DW_UT_name Mark Wielaard
2020-09-24 10:26   ` Nick Clifton
2020-09-24 21:12     ` Mark Wielaard
2020-09-25  2:23       ` Alan Modra
2020-09-25  9:38         ` Mark Wielaard
2020-09-23 14:51 ` [PATCH 3/3] readelf: Show Unit Type for DWARF5 Mark Wielaard
2020-09-24 10:27   ` Nick Clifton
2020-09-24 10:23 ` [PATCH 1/3] binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial Nick Clifton
2020-09-24 20:55   ` Mark Wielaard

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).