mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-16 15:04:46 +00:00
Bug 27086 - Consider all C++ virtual destructors when there are many
The complete and deleting C++ destructors have the same signature. Because the dwarf-reader re-uses the IR of functions that have the same signature, it can happen that one of the two destructors of a class is missed and thus not represented in the IR. When these destructors are virtual, that can have an impact on class comparison, because virtual member functions are take part in class comparison, just like data member and unlike non-virtual member functions. This patch fixes the build_or_get_fn_decl_if_not_suppressed to avoid "reusing" virtual destructors, based on their signature when several are present. Instead an IR is built for all virtual destructors that are seen. * src/abg-dwarf-reader.c (build_or_get_fn_decl_if_not_suppressed): Do not try to re-use a virtual destructor of a class, based on its signature. Several different of these can have the same signature, inside a given class. * tests/data/test-types-stability/PR27086-libstdc++.so.6.0.26: Add new binary test input. * tests/data/Makefile.am: Add the new test input to source distribution. * tests/test-types-stability.cc (elf_paths): Add the test input above to this harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
9ddfe1d860
commit
c00add2a21
@ -13861,7 +13861,27 @@ build_or_get_fn_decl_if_not_suppressed(read_context& ctxt,
|
||||
if (function_is_suppressed(ctxt, scope, fn_die, is_declaration_only))
|
||||
return fn;
|
||||
|
||||
if (!result)
|
||||
string name = die_name(fn_die);
|
||||
string linkage_name = die_linkage_name(fn_die);
|
||||
bool is_dtor = !name.empty() && name[0]== '~';
|
||||
bool is_virtual = false;
|
||||
if (is_dtor)
|
||||
{
|
||||
Dwarf_Attribute attr;
|
||||
if (dwarf_attr_integrate(const_cast<Dwarf_Die*>(fn_die),
|
||||
DW_AT_vtable_elem_location,
|
||||
&attr))
|
||||
is_virtual = true;
|
||||
}
|
||||
|
||||
|
||||
// If we've already built an IR for a function with the same
|
||||
// signature (from another DIE), reuse it, unless that function is a
|
||||
// virtual C++ destructor. Several virtual C++ destructors with the
|
||||
// same signature can be implemented by several different ELF
|
||||
// symbols. So re-using C++ destructors like that can lead to us
|
||||
// missing some destructors.
|
||||
if (!result && (!(is_dtor && is_virtual)))
|
||||
if ((fn = is_function_decl(ctxt.lookup_artifact_from_die(fn_die))))
|
||||
{
|
||||
fn = maybe_finish_function_decl_reading(ctxt, fn_die, where_offset, fn);
|
||||
|
@ -617,6 +617,7 @@ test-types-stability/pr19204-libtcmalloc.so.4.2.6-xlc \
|
||||
test-types-stability/PR27165-libzmq.so.5.2.3 \
|
||||
test-types-stability/PR27165-libzmq.so.5.2.3.debug \
|
||||
test-types-stability/pr27980-libc.so \
|
||||
test-types-stability/PR27086-libstdc++.so.6.0.26 \
|
||||
\
|
||||
test-diff-filter/test0-v0.cc \
|
||||
test-diff-filter/test0-v1.cc \
|
||||
|
BIN
tests/data/test-types-stability/PR27086-libstdc++.so.6.0.26
Normal file
BIN
tests/data/test-types-stability/PR27086-libstdc++.so.6.0.26
Normal file
Binary file not shown.
@ -50,6 +50,7 @@ const char* elf_paths[] =
|
||||
"data/test-types-stability/pr19204-libtcmalloc.so.4.2.6-xlc",
|
||||
"data/test-types-stability/PR27165-libzmq.so.5.2.3",
|
||||
"data/test-types-stability/pr27980-libc.so",
|
||||
"data/test-types-stability/PR27086-libstdc++.so.6.0.26",
|
||||
// The below should always be the last element of array.
|
||||
0
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user