]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial.
authorMark Wielaard <mark@klomp.org>
Wed, 23 Sep 2020 14:31:14 +0000 (16:31 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 24 Sep 2020 20:52:57 +0000 (22:52 +0200)
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
binutils/dwarf.c

index c871e17b3dce721e3fb25f5e0328e429a3d2ff2f..8cd0fe0820f983dfab9ac198fbba5dab26095ef6 100644 (file)
@@ -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-24  Nick Clifton  <nickc@redhat.com>
 
        PR 26662
index 603169226d4d53880c7226740f5d45d53a1213b7..9e98794ad66c08f5fd3b9086247f0dcec0488029 100644 (file)
@@ -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 > 2)
        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: DW_FORM_ref_addr is not supported in DWARF version 1.\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 "