[PATCH] bfd: Handle DW_FORM_data16 for .debug_line tables containing MD5
Mark Wielaard
mark@klomp.org
Mon Aug 24 12:09:30 GMT 2020
When building with gas using -gdwarf-5 the .debug_line table will
contain an MD5 checksum which bdf/dwarf2 failed to process. Also
there was an off-by-one in the line table when processing DWARF5
.debug_line. To make the line table standalone it contains as zero
entry to comp dir and line. This is redundant information when
reading the line table as part of a debug_info CU, so those entries
must be skipped.
Both issues caused the binutils objdump -S testcases to fail.
bfd/ChangeLog:
* dwarf2.c (read_attribute_value): Handle DW_FORM_data16.
(read_formatted_entries): Likewise. And skip zero entry.
---
bfd/ChangeLog | 5 +++++
bfd/dwarf2.c | 21 +++++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 511cee96337..d68bb36a581 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-24 Mark Wielaard <mark@klomp.org>
+
+ * dwarf2.c (read_attribute_value): Handle DW_FORM_data16.
+ (read_formatted_entries): Likewise. And skip zero entry.
+
2020-08-21 Mark Wielaard <mark@klomp.org>
* dwarf2.c (struct dwarf2_debug_file): Add dwarf_rnglists_buffer
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index b8daa13c374..b8f0008a10d 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1337,6 +1337,17 @@ read_attribute_value (struct attribute * attr,
attr->form = DW_FORM_sdata;
attr->u.sval = implicit_const;
break;
+ case DW_FORM_data16:
+ /* This is really a "constant", but there is no way to store that
+ so pretend it is a 16 byte block instead. */
+ amt = sizeof (struct dwarf_block);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
+ if (blk == NULL)
+ return NULL;
+ blk->size = 16;
+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk);
+ attr->u.blk = blk;
+ break;
default:
_bfd_error_handler (_("DWARF error: invalid or unhandled FORM value: %#x"),
form);
@@ -2077,11 +2088,17 @@ read_formatted_entries (struct comp_unit *unit, bfd_byte **bufp,
case DW_FORM_udata:
*uintp = attr.u.val;
break;
+
+ case DW_FORM_data16:
+ /* MD5 data is in the attr.blk, but we are ignoring those. */
+ break;
}
}
- if (!callback (table, fe.name, fe.dir, fe.time, fe.size))
- return FALSE;
+ /* Skip the first "zero entry", which is the compilation dir/file. */
+ if (datai != 0)
+ if (!callback (table, fe.name, fe.dir, fe.time, fe.size))
+ return FALSE;
}
*bufp = buf;
--
2.18.4
More information about the Binutils
mailing list