aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-09-23 16:31:14 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2021-01-23 20:19:03 +0200
commite3cef0b6fc2e0f4def5178e448caa720217b2825 (patch)
treee1c9b43ffba826fddcb8ffab2412b5970702264c
parentelf: Set rel_from_abs to 1 for __ehdr_start (diff)
downloadbinutils-gdb-e3cef0b6fc2e0f4def5178e448caa720217b2825.tar.gz
binutils-gdb-e3cef0b6fc2e0f4def5178e448caa720217b2825.tar.bz2
binutils-gdb-e3cef0b6fc2e0f4def5178e448caa720217b2825.zip
binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial.
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. (cherry picked from commit ec47b32a85294af959457ad19bd98dd13f6389fd) (cherry picked from commit c9ebbcc99b94820f4462308942ea0cab70c4b427)
-rw-r--r--binutils/ChangeLog10
-rw-r--r--binutils/dwarf.c5
2 files changed, 13 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 76ba6d9840..255fe9510a 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,13 @@
+2020-11-15 Mark Wielaard <mark@klomp.org>
+
+ Backport from the mainline:
+ 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-19 Nick Clifton <nickc@redhat.com>
This is the 2.35.1 point release.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index cc13fe067f..ca6758cd0d 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 > 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 "