mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-22 16:56:57 +00:00
The Git repository of the Libabigail Project
In some C++ binaries, DWARF can represent a member variable using a global variable /definition/ DIE not having a reference attribute pointing back to the member variable declaration DIE. The only way we know that the global variable is a definition DIE for a member variable is because its linkage name demangles to "foo::bar::var_name", with foo::bar being a class name. So, for each translation unit, when the DWARF reader reads a global variable DIE, it builds a variable IR node for it and stashes it on the side. Then, when the translation unit is built, the DWARF reader looks at all the stashed global variables, detects those that are actually member variables and adds them to their class. But then, before adding a (former global) variable to its class, the reader has first to remove it from its global scope. This removal is done by the function remove_decl_from_scope, which calls scope_decl::remove_member_decl. The issue here is that remove_decl_from_scope forgets to unset the translation unit property of the global variable. Then, in the particular case of this problem report, when scope_decl::add_member_decl is called to add the variable to its class, it detects that the variable belongs to /another/ translation unit and (rightfully) aborts. Ooops. This patch fixes the issue by making remove_decl_from_scope remove the variable from its translation unit too, not just from its scope. The patch actually delegates the scope & translation unit resetting to scope_decl::remove_member_decl because it appears to me that this is where these ought to be handled. To ensure that the issue is fixed, one needs to unpack the package webkit2gtk3-2.40.5-1.el9_3.1.x86_64.rpm and run abidw on the binary $prefix/usr/lib64/libwebkit2gtk-4.0.so.37 like: $ abidw --noout $prefix/usr/lib64/libwebkit2gtk-4.0.so.37 Given the size of the library, this takes three hours and a half as well as ~50GB of ram to complete on my system using a non-optimized debug build of libabigail. We definitely need to invest in more speed optimizations to handle webkit. That would be for another day, I guess. * src/abg-ir.cc (scope_decl::remove_member_decl): Reset the translation unit and the scope of the removed decl. (remove_decl_from_scope): Do not reset the scope of the removed decl here as it's now done above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.github | ||
autoconf-archive | ||
bash-completion | ||
doc | ||
docker | ||
include | ||
m4 | ||
relicensing-scripts | ||
scripts | ||
src | ||
tests | ||
tools | ||
.clang-format | ||
.gitignore | ||
.mailmap | ||
abigail.m4 | ||
ABIXML-FORMAT-VERSIONS | ||
AUTHORS | ||
ChangeLog | ||
COMMIT-LOG-GUIDELINES | ||
COMPILING | ||
configure.ac | ||
CONTRIBUTING | ||
default.abignore | ||
gen-changelog.py | ||
install-sh | ||
libabigail.pc.in | ||
license-change-2020.txt | ||
LICENSE.txt | ||
ltmain.sh | ||
Makefile.am | ||
NEWS | ||
README | ||
README-DOCKER.md | ||
release-text-template.txt | ||
update-copyright.sh | ||
VISIBILITY |
This is the Application Binary Interface Generic Analysis and Instrumentation Library. It aims at constructing, manipulating, serializing and de-serializing ABI-relevant artifacts. The set of artifacts that we are intersted is made of quantities like types, variable, functions and declarations of a given library or program. For a given library or program this set of quantities is called an ABI corpus. This library aims at (among other things) providing a way to compare two ABI Corpora (apparently the plural of corpus is copora, heh, that's cool), provide detailed information about their differences, and help build tools to infer interesting conclusions about these differences. You are welcome to contribute to this project after reading the files CONTRIBUTING and COMMIT-LOG-GUIDELINES files in the source tree. Communicating with the maintainers of this project -- including sending patches to be include to the source code -- happens via email at libabigail@sourceware.org.