mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-09 01:57:10 +00:00
When the DWARF reader encounters a function DIE 'f' that has a DW_AT_specification that points to a member function, the current implementation creates a function IR for the member function. The problem is that the member function has no ELF symbol associated to it. The ELF symbol is associated to 'f', not to the member function. The DWARF reader then wrongly drops the member function on the floor because it has no ELF symbol function associated. So that member function specification never gets its concrete function represented in the IR. This patch fixes the issue by detecting that the member function is the "specification" for 'f' and that the ELF symbol associated to it might not be there. In that case, if the ELF symbol is on the 'f' DIE itself, we get it from there. The patch makes more member functions to be represented so it uncovers a latent issue which is explained below. Today, some compilers can emit redundant DWARF constructs like "const reference" or "const void". A reference is always const so the const is superfluous. A similar thing can be said about "const void". maybe_strip_qualification detects those constructs and rewrites the IR into a "no-op qualified reference", or a "no-op qualified void". The no-op was needed in the previous incarnations of the DWARF reader because it was expecting a 'qualified type' IR to be associated to a qualified type DIE. Note, however, that that expectation has been generally relaxed since then. The problem is that the comparison engine, when building the diff IR needs to strip those no-op qualified types off, to avoid having spurious change diagnostics. That stripping introduces some challenges because the tree is more or less un-mutable at that point (after type canonicalization) so the stripping can only be partial. This patch removes the no-op qualified types altogether, rather than trying harder to handle them down the line. In other words, a const reference is now represented as a reference and a const void as a void. This makes things much simpler. The problem however is that the in-memory IR (and thus the emitted ABIXML) doesn't have any no-op qualified type anymore. So comparing an old ABIXML that contains those no-op qualified types against its origin ELF corpus can yield some spurious diagnostics. To fix it, one needs to re-generate the ABIXML file. This patch bumps the ABIXML version to 2.1 and introduces a new ABIXML-FORMAT-VERSIONS file that documents the format changes. * ABIXML-FORMAT-VERSIONS: New file that documents the version changes of the ABIXML-FORMAT-VERSIONS. * include/abg-fwd.h (look_through_no_op_qualified_type): Remove this function declaration. (strip_useless_const_qualification): Declare new function declaration. * src/abg-comparison.cc (compute_diff_for_types): Avoid stripping off no-op-qualified types as these beasts don't exist anymore. (redundancy_marking_visitor::visit_end): Allow a variable which type has local changes to be considered redundant if its type is itself redundant. * src/abg-config.cc (config::config): Bump the abixml version from 2.0 to 2.1. * src/abg-dwarf-reader.cc (maybe_strip_qualification): Factorize out the new strip_useless_const_qualification function from here. (build_or_get_fn_decl_if_not_suppressed): If the function is created but doesn't have an ELF symbol associated to it, then update it so that the ELF symbol can be associated. Otherwise, potential_member_fn_should_be_dropped might later drop that function on the floor because it doesn't have any ELF symbol associated. * src/abg-ir.cc (strip_useless_const_qualification): Define this, which is has been factorized out of maybe_strip_qualification. (look_through_no_op_qualified_type): Remove this definition. (equals): In the overload for reference_type_def, do not peel typedefs off from the reference before comparison. This is now useless as the comparison infrastructure got a lot better. In the overload for references, stop using look_through_no_op_qualified_type as this function doesn't exist anymore. * src/abg-tools-utils.cc (abidiff_status_has_error): Detect when there is a usage error as well. * tests/data/test-types-stability/PR28450-libepetra.so.13.0: Add new testing binary to the repository. * tests/data/Makefile.am: Add the new testing binary above to source distribution. * tests/test-types-stability.cc (elf_paths): Add the new test to this test harness. * tests/test-diff-dwarf-abixml.cc (main): Add better error messages. * tests/data/test-abidiff-exit/test-member-size-report0.txt: Adjust. * tests/data/test-annotate/libtest23.so.abi: Likewise. * 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/test-anonymous-members-0.o.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.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/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.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-libaaudio.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/test2.so.abi: Likewise. * tests/data/test-read-dwarf/test2.so.hash.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/test3-alias-1.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3-alias-2.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3-alias-3.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3-alias-4.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3.so.abi: Likewise. * tests/data/test-read-dwarf/test3.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test4.so.abi: Likewise. * tests/data/test-read-dwarf/test4.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test5.o.abi: Likewise. * tests/data/test-read-dwarf/test5.o.hash.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/test7.so.abi: Likewise. * tests/data/test-read-dwarf/test7.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. * tests/data/test-read-write/test-crc.xml: Likewise. * tests/data/test-read-write/test26.xml: Likewise. * tests/data/test-read-write/test27.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
119 lines
7.6 KiB
Plaintext
119 lines
7.6 KiB
Plaintext
<abi-corpus version='2.1' architecture='elf-amd-x86_64'>
|
|
<elf-needed>
|
|
<dependency name='libstdc++.so.6'/>
|
|
<dependency name='libm.so.6'/>
|
|
<dependency name='libgcc_s.so.1'/>
|
|
<dependency name='libc.so.6'/>
|
|
</elf-needed>
|
|
<elf-function-symbols>
|
|
<!-- first_type::first_type() -->
|
|
<elf-symbol name='_ZN10first_typeC1Ev' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- first_type::first_type() -->
|
|
<elf-symbol name='_ZN10first_typeC2Ev' type='func-type' binding='global-binding' visibility='default-visibility' alias='_ZN10first_typeC1Ev' is-defined='yes'/>
|
|
<!-- second_type::second_type() -->
|
|
<elf-symbol name='_ZN11second_typeC1Ev' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- second_type::second_type() -->
|
|
<elf-symbol name='_ZN11second_typeC2Ev' type='func-type' binding='global-binding' visibility='default-visibility' alias='_ZN11second_typeC1Ev' is-defined='yes'/>
|
|
<!-- a::build_first_type() -->
|
|
<elf-symbol name='_ZN1a16build_first_typeEv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- a::build_second_type() -->
|
|
<elf-symbol name='_ZN1a17build_second_typeEv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- _fini -->
|
|
<elf-symbol name='_fini' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- _init -->
|
|
<elf-symbol name='_init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
</elf-function-symbols>
|
|
<abi-instr address-size='64' path='test2-0.cc' comp-dir-path='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf' language='LANG_C_plus_plus'>
|
|
<!-- int -->
|
|
<type-decl name='int' size-in-bits='32' id='type-id-1'/>
|
|
<!-- typedef unsigned char character -->
|
|
<typedef-decl name='character' type-id='type-id-2' id='type-id-3'/>
|
|
<!-- typedef int integer -->
|
|
<typedef-decl name='integer' type-id='type-id-1' id='type-id-4'/>
|
|
<!-- unsigned char -->
|
|
<type-decl name='unsigned char' size-in-bits='8' id='type-id-2'/>
|
|
<!-- struct first_type -->
|
|
<class-decl name='first_type' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='4' column='1' id='type-id-5'>
|
|
<data-member access='public' layout-offset-in-bits='0'>
|
|
<!-- integer first_type::member0 -->
|
|
<var-decl name='member0' type-id='type-id-4' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='6' column='1'/>
|
|
</data-member>
|
|
<data-member access='public' layout-offset-in-bits='32'>
|
|
<!-- character first_type::member1 -->
|
|
<var-decl name='member1' type-id='type-id-3' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='7' column='1'/>
|
|
</data-member>
|
|
<member-function access='public' constructor='yes'>
|
|
<!-- first_type::first_type() -->
|
|
<function-decl name='first_type' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64'>
|
|
<!-- implicit parameter of type 'first_type*' -->
|
|
<parameter type-id='type-id-6' is-artificial='yes'/>
|
|
<!-- void -->
|
|
<return type-id='type-id-7'/>
|
|
</function-decl>
|
|
</member-function>
|
|
<member-function access='public' constructor='yes'>
|
|
<!-- first_type::first_type() -->
|
|
<function-decl name='first_type' mangled-name='_ZN10first_typeC2Ev' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_ZN10first_typeC2Ev'>
|
|
<!-- implicit parameter of type 'first_type*' -->
|
|
<parameter type-id='type-id-6' is-artificial='yes'/>
|
|
<!-- void -->
|
|
<return type-id='type-id-7'/>
|
|
</function-decl>
|
|
</member-function>
|
|
</class-decl>
|
|
<!-- first_type* -->
|
|
<pointer-type-def type-id='type-id-5' size-in-bits='64' id='type-id-6'/>
|
|
<!-- namespace a -->
|
|
<namespace-decl name='a'>
|
|
<!-- first_type* a::build_first_type() -->
|
|
<function-decl name='build_first_type' mangled-name='_ZN1a16build_first_typeEv' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2-0.cc' line='13' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_ZN1a16build_first_typeEv'>
|
|
<!-- first_type* -->
|
|
<return type-id='type-id-6'/>
|
|
</function-decl>
|
|
</namespace-decl>
|
|
<!-- void -->
|
|
<type-decl name='void' id='type-id-7'/>
|
|
</abi-instr>
|
|
<abi-instr address-size='64' path='test2-1.cc' comp-dir-path='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf' language='LANG_C_plus_plus'>
|
|
<!-- struct second_type -->
|
|
<class-decl name='second_type' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='12' column='1' id='type-id-8'>
|
|
<data-member access='public' layout-offset-in-bits='0'>
|
|
<!-- integer second_type::member0 -->
|
|
<var-decl name='member0' type-id='type-id-4' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='14' column='1'/>
|
|
</data-member>
|
|
<data-member access='public' layout-offset-in-bits='32'>
|
|
<!-- character second_type::member1 -->
|
|
<var-decl name='member1' type-id='type-id-3' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='15' column='1'/>
|
|
</data-member>
|
|
<member-function access='public' constructor='yes'>
|
|
<!-- second_type::second_type() -->
|
|
<function-decl name='second_type' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
|
|
<!-- implicit parameter of type 'second_type*' -->
|
|
<parameter type-id='type-id-9' is-artificial='yes'/>
|
|
<!-- void -->
|
|
<return type-id='type-id-7'/>
|
|
</function-decl>
|
|
</member-function>
|
|
<member-function access='public' constructor='yes'>
|
|
<!-- second_type::second_type() -->
|
|
<function-decl name='second_type' mangled-name='_ZN11second_typeC2Ev' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_ZN11second_typeC2Ev'>
|
|
<!-- implicit parameter of type 'second_type*' -->
|
|
<parameter type-id='type-id-9' is-artificial='yes'/>
|
|
<!-- void -->
|
|
<return type-id='type-id-7'/>
|
|
</function-decl>
|
|
</member-function>
|
|
</class-decl>
|
|
<!-- second_type* -->
|
|
<pointer-type-def type-id='type-id-8' size-in-bits='64' id='type-id-9'/>
|
|
<!-- namespace a -->
|
|
<namespace-decl name='a'>
|
|
<!-- second_type* a::build_second_type() -->
|
|
<function-decl name='build_second_type' mangled-name='_ZN1a17build_second_typeEv' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test2-1.cc' line='13' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_ZN1a17build_second_typeEv'>
|
|
<!-- second_type* -->
|
|
<return type-id='type-id-9'/>
|
|
</function-decl>
|
|
</namespace-decl>
|
|
</abi-instr>
|
|
</abi-corpus>
|