From 603b2a5a768151675655924a2c5bbf6598af8445 Mon Sep 17 00:00:00 2001 From: Xiaole He Date: Fri, 9 Dec 2022 17:13:03 +0800 Subject: [PATCH] Bug 29829 - dwarf-reader: Allow DIEs to be in a lexical block Backport from libabigail upstream git repository for fix bug that cause coredump. Link: https://sourceware.org/git/?p=libabigail.git;a=commit;h=1f51b9e85dc42dc71caf7fe79436d64c6a3d03f3 And the original discussion for this bug can be found at: Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29829 Signed-off-by: Xiaole He --- ...reader-Allow-DIEs-to-be-in-a-lexical.patch | 36 +++++++++++++++++++ libabigail.spec | 6 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 0006-Bug-29829-dwarf-reader-Allow-DIEs-to-be-in-a-lexical.patch diff --git a/0006-Bug-29829-dwarf-reader-Allow-DIEs-to-be-in-a-lexical.patch b/0006-Bug-29829-dwarf-reader-Allow-DIEs-to-be-in-a-lexical.patch new file mode 100644 index 0000000..da13586 --- /dev/null +++ b/0006-Bug-29829-dwarf-reader-Allow-DIEs-to-be-in-a-lexical.patch @@ -0,0 +1,36 @@ +From 08ed347ebfd108c9c1de0ba65f9a947fda1617ab Mon Sep 17 00:00:00 2001 +From: Dodji Seketeli +Date: Fri, 2 Dec 2022 15:59:13 +0000 +Subject: [PATCH] Bug 29829 - dwarf-reader: Allow DIEs to be in a lexical block + +Normally, ABI-relevant DWARF DIEs (types and decls) should be at +namespace level. There are real-life cases where such a DIE might be +defined in a lexical block. + +This patch teaches the DWARF reader to handle such cases. + + * src/abg-dwarf-reader.cc (get_scope_for_die): Support + DW_TAG_lexical_block as DIE scope. + +Signed-off-by: Dodji Seketeli +--- + src/abg-dwarf-reader.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc +index 1d6ad24..895a55d 100644 +--- a/src/abg-dwarf-reader.cc ++++ b/src/abg-dwarf-reader.cc +@@ -10961,7 +10961,8 @@ get_scope_for_die(read_context& ctxt, + scope_decl_sptr s; + type_or_decl_base_sptr d; + if (dwarf_tag(&parent_die) == DW_TAG_subprogram +- || dwarf_tag(&parent_die) == DW_TAG_array_type) ++ || dwarf_tag(&parent_die) == DW_TAG_array_type ++ || dwarf_tag(&parent_die) == DW_TAG_lexical_block) + // this is an entity defined in a scope that is a function. + // Normally, I would say that this should be dropped. But I have + // seen a case where a typedef DIE needed by a function parameter +-- +2.27.0 + diff --git a/libabigail.spec b/libabigail.spec index 2b89529..ab3e17a 100644 --- a/libabigail.spec +++ b/libabigail.spec @@ -1,6 +1,6 @@ Name: libabigail Version: 2.0 -Release: 3 +Release: 4 Summary: ABI generic analysis and instrumentation library License: LGPLv3+ URL: https://sourceware.org/libabigail/ @@ -10,6 +10,7 @@ Patch0001: 0002-abg-reader-fix-comment-of-function.patch Patch0002: 0003-abg-ir-add-missing-else.patch Patch0003: 0004-abg-reader-optimize-if-construction.patch Patch0004: 0005-abg-diff-utils-fix-typo-in-comments.patch +Patch0005: 0006-Bug-29829-dwarf-reader-Allow-DIEs-to-be-in-a-lexical.patch BuildRequires: gcc-c++ libtool elfutils-devel libxml2-devel doxygen BuildRequires: python3-sphinx texinfo dos2unix dpkg python3-devel python3-rpm BuildRequires: python3-mock python3-unittest2 python3-pyxdg wget mailcap @@ -95,6 +96,9 @@ fi %doc doc/manuals/html/* README AUTHORS ChangeLog %changelog +* Fri Dec 9 2022 Xiaole He - 2.0-4 +- backport patch:0006 to fix coredump of libxul.so from thunderbird rpm + * Tue Oct 18 2022 Xiaole He - 2.0-3 - backport patch:0003 to add missing else - backport patch:0004 to optimize if construction