* [PATCH] Ignore duplicated functions and those not associated with ELF symbols
@ 2021-01-23 16:42 Dodji Seketeli
0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2021-01-23 16:42 UTC (permalink / raw)
To: libabigail
[-- Attachment #1: Type: text/plain, Size: 13096 bytes --]
Hello,
While looking at several ABIXML files I noticed that several (member)
functions didn't have any associated ELF symbol and that in some cases,
there were even duplicated member functions. Those are the source of
some spurious changes sometimes reported by abidiff.
In DWARF the same function F can be represented several times. One
representation of F has some properties and other representations of F
might have properties that complement the properties carried by the
former representations. It's the unions of the properties of all
representations of F that constitute the properties of F.
An example of that "linked" nature is how DWARF represents inlined
functions. A function F can be inlined somewhere else. That inlined
version is called F', for instance. The DWARF representation of F'
will carry a DW_AT_abstract_origin attribute that points back to F to
signify that F' is the concrete inlined version of the abstract F.
F' will carry properties that are specific to its "inlined nature"
whereas F will carry properties that are more generic and independent
from all its various potential inlined forms.
So when Libabigail sees the DWARF representation of F, if it's
associated with an ELF symbol, then it must wait to encounter an F'
representation that is associated with an ELF symbol before adding an
internal representation (IR) of F into the final IR graph. Otherwise
the IR of F can be unnecessarily duplicated, with some instances
having an associated ELF symbol and others not.
This is what this patch does, in essence. While working on this, I
encountered some tangential issues that needed to be fixed altogether
for the whole to function. A lot of regression tests output had to be
adjusted.
In the end, a number of spurious change reports could be fixed;
notably reports about removal of destructors like STR::~STR(int).
Note how that destructor has a parameter; it's a GCC-specific
implementation detail that should not appear at this level, I believe.
* include/abg-ir.h (class_or_union::string_mem_fn_sptr_map_type):
Add a typedef for unordered_map<string, method_decl_sptr>.
(class_or_union::find_member_function_sptr): Declare new function.
* src/abg-ir.cc (class_or_union::priv::mem_fns_map_): Change the
type of this to string_mem_fn_sptr_map_type, so that shared
pointers to functions can be stored in the map, instead of bare
pointers to functions. This is useful to implement
class_or_union::find_member_function_sptr which returns a shared
pointer to function.
(class_or_union::find_member_function_sptr): Define new function.
(class_or_union::find_member_function): Adjust.
(method_decl::set_linkage_name): Use a non-deleting shared pointer
to store the current instance of member function into
class_or_union::priv::mem_fns_map_.
(hash_as_canonical_type_or_constant): As we are seeing more
function types, it appears that some function types are not
canonicalized. I am not sure why exactly, but let's loosen the
assert here for now, I'll chase the root of this later.
* src/abg-dwarf-reader.cc (finish_member_function_reading):
Improve detection of member function 'static-ness' by handling
cases where a this pointer can be const. Also support
DW_AT_object_pointer when it's present. This fixes the occurrence
of spurious change reports about loss of 'static-ness' of member
functions.
(potential_member_fn_should_be_dropped): Define new static
function and ...
(build_ir_node_from_die): ... use it here. When a function DIE
has the same linkage name as an existing function IR, do not
create a new IR for it. Rather, re-use the existing one to
complete it with the properties found on the function DIE. If a
new function doesn't seem to have an associated ELF symbol and is
not meant to be a virtual member function then drop its IR on the
floor as well.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/test0.abi: Likewise.
* tests/data/test-annotate/test1.abi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-annotate/test6.so.abi: Likewise.
* tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise.
* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi: Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Likewise.
* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise.
* tests/data/test-diff-filter/test0-report.txt: Likewise.
* tests/data/test-diff-filter/test01-report.txt: Likewise.
* tests/data/test-diff-filter/test10-report.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt: Likewise.
* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
* tests/data/test-diff-filter/test9-report.txt: Likewise.
* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test31-report-1.txt: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test0.abi: Likewise.
* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
* tests/data/test-read-dwarf/test1.abi: Likewise.
* tests/data/test-read-dwarf/test1.hash.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
include/abg-ir.h | 4 +
src/abg-dwarf-reader.cc | 101 +-
src/abg-ir.cc | 37 +-
tests/data/test-annotate/libtest23.so.abi | 1850 +-
.../test-annotate/libtest24-drop-fns-2.so.abi | 2486 +-
.../test-annotate/libtest24-drop-fns.so.abi | 2486 +-
tests/data/test-annotate/test0.abi | 40 +-
tests/data/test-annotate/test1.abi | 30 +-
.../data/test-annotate/test14-pr18893.so.abi | 28761 +---
.../data/test-annotate/test15-pr18892.so.abi | 69515 ++++-----
.../data/test-annotate/test17-pr19027.so.abi | 69400 +++------
...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 31337 ++--
...19-pr19023-libtcmalloc_and_profiler.so.abi | 61858 +++-----
...st20-pr19025-libvtkParallelCore-6.1.so.abi | 67121 +++------
.../data/test-annotate/test21-pr19092.so.abi | 6368 +-
tests/data/test-annotate/test6.so.abi | 8 +-
.../test8-qualified-this-pointer.so.abi | 10 +-
.../PR25409-librte_bus_dpaa.so.20.0.abi | 2 +-
.../test0-pr19026-libvtkIOSQL-6.1.so.1.abi | 27698 +---
tests/data/test-diff-dwarf/test0-report.txt | 32 +-
.../test28-vtable-changes-report-0.txt | 6 +-
.../test42-PR21296-clanggcc-report0.txt | 16 +-
tests/data/test-diff-filter/test0-report.txt | 36 +-
tests/data/test-diff-filter/test01-report.txt | 36 +-
tests/data/test-diff-filter/test10-report.txt | 11 +-
.../test30-pr18904-rvalueref-report0.txt | 338 +-
.../test30-pr18904-rvalueref-report1.txt | 344 +-
.../test30-pr18904-rvalueref-report2.txt | 344 +-
.../test31-pr18535-libstdc++-report-0.txt | 35 +-
.../test31-pr18535-libstdc++-report-1.txt | 35 +-
.../test35-pr18754-no-added-syms-report-0.txt | 236 +-
.../test35-pr18754-no-added-syms-report-1.txt | 6 +-
.../data/test-diff-filter/test41-report-0.txt | 124 +-
tests/data/test-diff-filter/test9-report.txt | 11 +-
...-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt | 130 +-
...bb-4.3-3.20141204.fc23.x86_64-report-0.txt | 371 +-
...bb-4.3-3.20141204.fc23.x86_64-report-1.txt | 121 +-
.../test24-soname-report-1.txt | 13 +-
.../test24-soname-report-10.txt | 13 +-
.../test24-soname-report-12.txt | 13 +-
.../test24-soname-report-14.txt | 13 +-
.../test24-soname-report-16.txt | 13 +-
.../test24-soname-report-4.txt | 13 +-
.../data/test-diff-suppr/test31-report-1.txt | 11 +-
.../PR22015-libboost_iostreams.so.abi | 1238 +-
.../test-read-dwarf/PR22122-libftdc.so.abi | 4775 +-
tests/data/test-read-dwarf/libtest23.so.abi | 1100 +-
.../libtest24-drop-fns-2.so.abi | 1670 +-
.../test-read-dwarf/libtest24-drop-fns.so.abi | 97 -
.../test-read-dwarf/test-libandroid.so.abi | 110299 ++++-----------
tests/data/test-read-dwarf/test0.abi | 27 +-
tests/data/test-read-dwarf/test0.hash.abi | 17 +-
tests/data/test-read-dwarf/test1.abi | 23 +-
tests/data/test-read-dwarf/test1.hash.abi | 13 +-
.../test-read-dwarf/test10-pr18818-gcc.so.abi | 8887 +-
.../test-read-dwarf/test11-pr18828.so.abi | 41037 ++----
.../test-read-dwarf/test12-pr18844.so.abi | 53485 +++----
.../test-read-dwarf/test14-pr18893.so.abi | 17581 +--
.../test-read-dwarf/test15-pr18892.so.abi | 40420 +++---
.../test-read-dwarf/test16-pr18904.so.abi | 55404 +++-----
.../test-read-dwarf/test17-pr19027.so.abi | 46028 ++----
...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 17768 +--
...19-pr19023-libtcmalloc_and_profiler.so.abi | 39449 ++----
...st20-pr19025-libvtkParallelCore-6.1.so.abi | 40483 ++----
.../test-read-dwarf/test21-pr19092.so.abi | 5777 +-
.../test22-pr19097-libstdc++.so.6.0.17.so.abi | 60245 ++++----
tests/data/test-read-dwarf/test6.so.abi | 5 +-
tests/data/test-read-dwarf/test6.so.hash.abi | 3 +-
.../test8-qualified-this-pointer.so.abi | 7 +-
.../test8-qualified-this-pointer.so.hash.abi | 5 +-
.../test9-pr18818-clang.so.abi | 3714 +-
71 files changed, 276727 insertions(+), 644263 deletions(-)
The patch is big so I am attaching it here, gzipped.
Cheers,
[-- Attachment #2: gzipped patch --]
[-- Type: application/gzip, Size: 5159527 bytes --]
[-- Attachment #3: Type: text/plain, Size: 13 bytes --]
--
Dodji
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-23 16:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 16:42 [PATCH] Ignore duplicated functions and those not associated with ELF symbols Dodji Seketeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).