From a1d8646f1176daa0afcd0d58648563711fed37fc Mon Sep 17 00:00:00 2001 From: linzhuorong Date: Tue, 29 Nov 2022 17:14:56 +0800 Subject: [PATCH] [Backport] readelf: Handle DW_LLE_GNU_view_pair Signed-off-by: linzhuorong --- ...-readelf-Handle-DW_LLE_GNU_view_pair.patch | 68 +++++++++++++++++++ elfutils.spec | 9 ++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 backport-readelf-Handle-DW_LLE_GNU_view_pair.patch diff --git a/backport-readelf-Handle-DW_LLE_GNU_view_pair.patch b/backport-readelf-Handle-DW_LLE_GNU_view_pair.patch new file mode 100644 index 0000000..669597b --- /dev/null +++ b/backport-readelf-Handle-DW_LLE_GNU_view_pair.patch @@ -0,0 +1,68 @@ +From 85f4c22f60c87bd2f67b241974f1b5f0f355a29b Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 20 Oct 2022 00:02:39 +0200 +Subject: [PATCH] readelf: Handle DW_LLE_GNU_view_pair + +DW_LLE_GNU_view_pair is used by gcc -gvariable-location-views=incompat5. +As described in http://www.fsfla.org/~lxoliva/papers/sfn/dwarf6-sfn-lvu.txt +and proposed for DWARF6 https://dwarfstd.org/ShowIssue.php?issue=170427.1 + +Conflict: + libdw/ChangeLog + src/ChangeLog +Reference: +https://sourceware.org/git/?p=elfutils.git;a=commit;h=85f4c22f60c87bd2f67b241974f1b5f0f355a29b + +Signed-off-by: Mark Wielaard +--- + libdw/dwarf.h | 6 +++++- + src/readelf.c | 12 ++++++++++++ + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/libdw/dwarf.h b/libdw/dwarf.h +--- a/libdw/dwarf.h ++++ b/libdw/dwarf.h +@@ -927,7 +927,11 @@ enum + DW_LLE_GNU_end_of_list_entry = 0x0, + DW_LLE_GNU_base_address_selection_entry = 0x1, + DW_LLE_GNU_start_end_entry = 0x2, +- DW_LLE_GNU_start_length_entry = 0x3 ++ DW_LLE_GNU_start_length_entry = 0x3, ++ ++ // http://www.fsfla.org/~lxoliva/papers/sfn/dwarf6-sfn-lvu.txt ++ // https://dwarfstd.org/ShowIssue.php?issue=170427.1 ++ DW_LLE_GNU_view_pair = 0x9 + }; + +diff --git a/src/readelf.c b/src/readelf.c +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -4120,6 +4120,8 @@ dwarf_loc_list_encoding_string (unsigned int kind) + #define DWARF_ONE_KNOWN_DW_LLE(NAME, CODE) case CODE: return #NAME; + DWARF_ALL_KNOWN_DW_LLE + #undef DWARF_ONE_KNOWN_DW_LLE ++ /* DW_LLE_GNU_view_pair is special/incompatible with default codes. */ ++ case DW_LLE_GNU_view_pair: return "GNU_view_pair"; + default: + return NULL; + } +@@ -9513,6 +9516,16 @@ print_debug_loclists_section (Dwfl_Module *dwflmod, + readp += len; + break; + ++ case DW_LLE_GNU_view_pair: ++ if ((uint64_t) (nexthdr - readp) < 1) ++ goto invalid_entry; ++ get_uleb128 (op1, readp, nexthdr); ++ if ((uint64_t) (nexthdr - readp) < 1) ++ goto invalid_entry; ++ get_uleb128 (op2, readp, nexthdr); ++ printf (" %" PRIx64 ", %" PRIx64 "\n", op1, op2); ++ break; ++ + default: + goto invalid_entry; + } +-- +2.27.0 + diff --git a/elfutils.spec b/elfutils.spec index ecd7d3b..0ecd0cc 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,7 +1,7 @@ # -*- rpm-spec from http://elfutils.org/ -*- Name: elfutils Version: 0.185 -Release: 14 +Release: 15 Summary: A collection of utilities and DSOs to handle ELF files and DWARF data URL: http://elfutils.org/ License: GPLv3+ and (GPLv2+ or LGPLv3+) @@ -12,6 +12,7 @@ Patch1: Fix-segfault-in-eu-ar-m.patch Patch2: Fix-error-of-parsing-object-file-perms.patch Patch3: Fix-issue-of-moving-files-by-ar-or-br.patch Patch4: Get-instance-correctly-for-eu-ar-N-option.patch +Patch5: backport-readelf-Handle-DW_LLE_GNU_view_pair.patch Provides: elfutils-libelf elfutils-default-yama-scope default-yama-scope elfutils-libs Obsoletes: elfutils-libelf < %{version}-%{release} elfutils-default-yama-scope < %{version}-%{release} elfutils-libs < %{version}-%{release} @@ -254,6 +255,12 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Tue Nov 29 2022 linzhuorong - 0.185-15 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:readelf: Handle DW_LLE_GNU_view_pair + * Fri Sep 30 2022 hubin - 0.185-14 - Type:bugfix - ID:NA -- Gitee