From d69f0b8bf066408416807b0ce595185aa3c8ff0a Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 25 Jul 2023 13:24:54 +0100 Subject: [PATCH] Extend support for DWARF-5 offset tables as generated by Clang++. Resolves: #2222697 --- binutils-DW_FORM_strx.patch | 66 +++++++++++++++++++++++++++++++++++++ binutils.spec | 5 ++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/binutils-DW_FORM_strx.patch b/binutils-DW_FORM_strx.patch index b4826ff..892c8f9 100644 --- a/binutils-DW_FORM_strx.patch +++ b/binutils-DW_FORM_strx.patch @@ -734,3 +734,69 @@ diff -rup binutils.orig/gold/x86_64.cc binutils-2.30/gold/x86_64.cc { case elfcpp::GNU_PROPERTY_X86_ISA_1_USED: this->isa_1_used_ |= val; +--- binutils.orig/bfd/dwarf2.c 2023-07-25 11:22:17.043088690 +0100 ++++ binutils-2.30/bfd/dwarf2.c 2023-07-25 11:58:03.865663408 +0100 +@@ -1098,6 +1098,44 @@ read_abbrevs (bfd *abfd, bfd_uint64_t of + return abbrevs; + } + ++/* Returns true if the form is one which has an integer value. */ ++ ++static bfd_boolean ++is_int_form (const struct attribute *attr) ++{ ++ switch (attr->form) ++ { ++ case DW_FORM_addr: ++ case DW_FORM_data2: ++ case DW_FORM_data4: ++ case DW_FORM_data8: ++ case DW_FORM_data1: ++ case DW_FORM_flag: ++ case DW_FORM_sdata: ++ case DW_FORM_udata: ++ case DW_FORM_ref_addr: ++ case DW_FORM_ref1: ++ case DW_FORM_ref2: ++ case DW_FORM_ref4: ++ case DW_FORM_ref8: ++ case DW_FORM_ref_udata: ++ case DW_FORM_sec_offset: ++ case DW_FORM_flag_present: ++ case DW_FORM_ref_sig8: ++ case DW_FORM_addrx: ++ case DW_FORM_implicit_const: ++ case DW_FORM_addrx1: ++ case DW_FORM_addrx2: ++ case DW_FORM_addrx3: ++ case DW_FORM_addrx4: ++ case DW_FORM_GNU_ref_alt: ++ return TRUE; ++ ++ default: ++ return FALSE; ++ } ++} ++ + /* Returns true if the form is one which has a string value. */ + + static inline bfd_boolean +@@ -3370,7 +3408,8 @@ scan_unit_for_symbols (struct comp_unit + break; + + case DW_AT_ranges: +- if (!read_rangelist (unit, &func->arange, attr.u.val)) ++ if (is_int_form (&attr) ++ && !read_rangelist (unit, &func->arange, attr.u.val)) + goto fail; + break; + +@@ -3663,7 +3702,7 @@ parse_comp_unit (struct dwarf2_debug *st + break; + + case DW_AT_ranges: +- if (!read_rangelist (unit, &unit->arange, attr.u.val)) ++ if (is_int_form (&attr) && !read_rangelist (unit, &unit->arange, attr.u.val)) + return NULL; + break; + diff --git a/binutils.spec b/binutils.spec index c7bb595..f2ef9e1 100644 --- a/binutils.spec +++ b/binutils.spec @@ -43,7 +43,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?name_cross}%{?_with_debug:-debug} Version: 2.30 -Release: 122%{?dist} +Release: 123%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -1328,6 +1328,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Tue Jul 25 2023 Nick Clifton - 2.30-123 +- Extend support for DWARF-5 offset tables as generated by Clang++. (#2222697) + * Tue Jul 18 2023 Nick Clifton - 2.30-122 - Add support for DWARF-5 offset tables as generated by Clang++. (#2222697)