mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-05 06:07:49 +00:00
a92a2b9bc7
2512 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
|
b56065ae0e |
ctf-reader: looks for debug information in out-of-tree modules
The archive `vmlinux.ctfa' contain CTF debug information for all the types used by more than one module, CTF for the core kernel and CTF for each module compiled in Linux tree directory. CTF information for out-of-tree module is not present in `vmlinux.ctfa' file, even so, the compiler can emit the `.ctf' section into the out-of-tree modules and it can be extracted by the libabigail tools. * src/abg-ctf-reader.cc (process_ctf_archive, read_corpus slurp_elf_info): Avoid looking for `vmlinux.ctfa' when we aren't processing a `cur_corpus_group_'. So CTF info is embedded in the `.ko' file. * tests/data/Makefile.am: Add test inputs and expected files. * tests/data/test-read-ctf/test-linux-module.{ko,c,abi}: Add new test input and reference kABI. * tests/test-read-ctf.cc: Add new testcase. Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
d6440e7b39 |
dwarf-reader: Better handle the absence of a die->parent map
When analysing the ld.so binary, the DWARF reader drops the description of the rtld_global_ro global variable on the floor. This is because it fails to get the decl that the rtld_global_ro variable belongs to. So it doesn't know where the put the description of rtld_global_ro, in the IR. The root cause is that the DWARF partial_unit that contains the description of the type of the rtld_global_ro variable doesn't contain any description of the language its types originate from. The DWARF reader needs to know the type, to know if it needs to construct a map that associates each type/decl DIE to their parent DIE. This is useful to determine which namespace a given DIE belongs to. But then this is needed only for languages that support naming organising devices like namespaces, namely, C++, Ada, Java etc. For C, the DWARF reader knows that by default, all decls/types belong to the global namespace. But then in this particular case, the partial_unit doesn't carry any language information, so libabigail just drops the ball on the floor, so there is no information for the rtld_global_ro variable. The fix is thus to consider the absence of a DIE->PARENT map as implying that all decls are defined in the global namespace. * src/abg-dwarf-reader.cc (get_scope_for_die): Consider that in the absence of the DIE->PARENT map, all decls are in the global. namespace. * tests/data/test-abidiff-exit/ld-2.28-210.so: New test. * tests/data/test-abidiff-exit/ld-2.28-211.so: Likewise. * tests/data/test-abidiff-exit/test-ld-2.28-210.so--ld-2.28-211.so.txt: New reference test output. * tests/test-abidiff-exit.cc (in_out_specs): Add the test above to the harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
adbd8b8020 |
Update test-read-ctf reference output
It seems like some recent changes have changed the reference expected
output of the test-read-ctf tests. I believe it's this change that is the culprit:
|
||
|
640601164a |
ir: Don't consider different int types of same kind and size as equivalent
This patch is a revert of my previous patch referenced below:
commit
|
||
|
df28c22097 |
writer: Make sorting referenced typedefs types stable in abixml
After the latest commits, it apears that sorting typedefs referenced
by by other types that are emitted in the abixml file is not stable
when the underlying types are integral types.
This happens after the commit:
commit
|
||
|
7cd83740bf |
ir: Consider integral types of same kind and size as equivalent
On some platforms, "long int" and "long long int" can have the same size. In that case, we want those two types to be equivalent from ABI standpoint. Otherwise, through the use of typedefs and pointers, two structs "C" defined in different translation units where one uses "long int" in a translation unit and "long long int" in another should be considered ABI compatible if long int and long long int have the same size on that platform. Otherwise, that causes spurious type changes that lead to self comparison change down the road. For instance, the following command fails: $ tools/fedabipkgdiff --debug --self-compare -a --from fc36 btrfs-progs This patch thus changes the comparison engine of the IR so that the "short, long and long long" modifiers don't change the result of comparing integral types that share the same base type when they have the same size. * include/abg-fwd.h (is_integral_type): Declare new function. * include/abg-ir.h (type_decl::get_qualified_name): Add a declaration of an implementation of the virtual interface get_qualified_name. * src/abg-ir-priv.h (integral_type::set_modifiers): Define a new setter. (integral_type::to_string): Add an "internal" flag. * src/abg-ir.cc (operator~, operator&=): Declare new operators. (get_internal_integral_type_name): Define new static function. (decl_base::priv::{temporary_internal_qualified_name_, internal_qualified_name_}): Define two new data members. (get_type_name): For internal name of integral types, use the new get_internal_integral_type_name function. (is_integral_type): Define new function. (integral_type::set_modifiers): Define new member function. (operator|, operator&): Fix some indentation. (operator~, operator&=): Define new operators. (parse_integral_type): Fix the logic of this function. Namely, it wasn't handling parsing "long long" correctly. (integral_type::to_string): Add an "internal" flag. (equals): In the overload for type_decl, do not take the short, long and long long into account when comparing integral types of the same size. (type_decl::get_qualified_name): Define new method. (type_decl::get_pretty_representation): For internal name of integral types, use the new get_internal_integral_type_name function. ({decl,type}_topo_comp::operator()): Use the non-internal pretty representation of decls/types for sorting purpose. * src/abg-reader.cc (build_type_decl): We don't expect the integral type name from abixml to the same as the name of the parsed integral type, as the abixml file can be old and have an old format. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Adjust. * tests/data/test-annotate/test0.abi: Adjust. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Adjust. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-annotate/test21-pr19092.so.abi: Adjust. * tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt: Adjust. * tests/data/test-diff-filter/test41-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Adjust. * tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt: Adjust. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Adjust. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Adjust. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Adjust. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Adjust. * tests/data/test-read-dwarf/test-PR26568-1.o.abi: Adjust. * tests/data/test-read-dwarf/test-PR26568-2.o.abi: Adjust. * tests/data/test-read-dwarf/test-libaaudio.so.abi: Adjust. * tests/data/test-read-dwarf/test-libandroid.so.abi: Adjust. * tests/data/test-read-dwarf/test0.abi: Adjust. * tests/data/test-read-dwarf/test0.hash.abi: Adjust. * tests/data/test-read-dwarf/test1.hash.abi: Adjust. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * tests/data/test-read-write/test22.xml: Adjust. * tests/data/test-read-write/test23.xml: Adjust. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Adjust. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
37e49c60d1 |
dwarf-reader: Remove redundant qualifiers from qualified types
While looking at something else, I noticed that there are some qualified types built from the DWARF debug info that read: const volatile const int m[5] That's a tree of (chained) qualified types that end up having some redundant qualifiers. That IR tree might look like: [C] --> [C|V] --> [int] We want to edit that IR tree to make it look like: [C] --> [V] --> [int] And that would serialize as const volatile int m[5] This patch introduces the editing of the qualified type IR tree to remove the redundant qualifiers, right after the IR is built from DWARF. * include/abg-fwd.h (strip_redundant_quals_from_underyling_types): Declare new function. * include/abg-ir.h (operator&=): Declare new binary operator for qualified_type_def::CV and ... * src/abg-ir.cc (+operator&=): ... define it here. (strip_redundant_quals_from_underyling_types): Define new function and ... * src/abg-dwarf-reader.cc (maybe_strip_qualification): ... Use it here. * tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
c496019a38 |
ir: Disambiguate sorting of array element types
When using non-internal pretty representation of array types (e.g, for sorting of types in a given scope for the purpose of serialization), some array element types might have the same name, even though they don't have the same qualified name. In those cases, the serialized abixml output is not stable. This patches uses qualified names for array element names for type sorting purposes. However, this patch uncovers a problem that shows up in the tests outputs for test-abidiff-exit and test-diff-filter, where emitting qualified names of qualified types shows that there can be redundant qualifiers in the serialized output. This issue will be fixed separately in a later commit. For now, the output of these tests is temporarily updated to have the tests pass. * src/abg-ir.cc (get_type_representation): In the overload for array_type_def, use qualified names for element types. * tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt: Adjust. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Adjust. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-diff-filter/test-PR26739-2-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
8b358c57bb |
ir: Make pointers name stable wrt decl-only-ness of pointed-to types
When emitting the pretty representation of pointers from the IR, it can so happen that the pointed type is a decl-only type which has been resolved to a definition. In that case, the decl-only type might be anonymous while the definition has a naming typedef, effectively giving it a name. Then, using the decl-only type to construct the name of the type might yield a different type name, more precisely, the internal "anonymous" name of that type. This can lead to several types having the same anonymous name, leading to instability with respect to sorting. The patch just looks through the decl-only pointed-to types before using their name to construct the name of the pointer type. The patch does that for reference types as well. * src/abg-ir.cc (look_through_decl_only): New overload for type_base. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
f001c14eee |
tests-diff-{filter,pkg,pkg-ctf}: Fix tests broken by the previous commit
* tests/data/test-diff-filter/test41-report-0.txt: Adjust. * tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
5b3516a5e7 |
dwarf-reader: Support DWARF incomplete class types
The problem this patch addresses is visible when doing: $ fedabidiff --debug --self-compare -a --from fc36 wildmagic5 More specifically: tools/abidw --noout -d usr/lib/debug/ usr/lib64/libWm5Mathematics.so.5.17 This is reported at https://sourceware.org/bugzilla/show_bug.cgi?id=29302#c2: Functions changes summary: 0 Removed, 9 Changed, 0 Added functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 9 functions with some indirect sub-type change: [C] 'method virtual Wm5::ConvexHull<double>::~ConvexHull(int)' at Wm5ConvexHull.h:24:1 has some indirect sub-type changes: implicit parameter 0 of type 'Wm5::ConvexHull<double>*' has sub-type changes: in pointed to type 'class Wm5::ConvexHull<double>': type size changed from 384 to 0 (in bits) 1 member function deletion: 'method virtual Wm5::ConvexHull<double>::~ConvexHull(int)' at Wm5ConvexHull.cpp:32:1 no member function changes (2 filtered); [C] 'method virtual Wm5::ConvexHull<float>::~ConvexHull(int)' at Wm5ConvexHull.h:24:1 has some indirect sub-type changes: implicit parameter 0 of type 'Wm5::ConvexHull<float>*' has sub-type changes: in pointed to type 'class Wm5::ConvexHull<float>': type size changed from 320 to 0 (in bits) 1 member function deletion: 'method virtual Wm5::ConvexHull<float>::~ConvexHull(int)' at Wm5ConvexHull.cpp:32:1 no member function changes (2 filtered); [...] It appears that some class type DIEs don't have any size information and are marked as being declarations. These have an incomplete set of data member / virtual member functions compared to DIEs for the SAME types described elsewhere in the DWARF. About these, the specification says: 5.7.1 Structure, Union and Class Type Entries [...] An incomplete structure, union or class type is represented by a structure, union or class entry that does not have a byte size attribute and that has a DW_AT_declaration attribute. But then the DWARF reader doesn't know about these so it creates several types from these incomplete DIEs. Those types are thus incorrect. And that leads to spurious self comparison changes down the road. This patch thus detects that the DIEs is for an incomplete type and does not build an IR for its sub-types. It rather builds a declaration-only type. Then later, that declaration-only type is resolved to its corresponding definition using the existing read_context::resolve_declaration_only_classes function. The patch also removes the temporary speed hack that was introduced into read_context::resolve_declaration_only_classes() by the commit: |
||
|
2b8b8bc5a8 |
Better Handle naming typedefs on anonymous enums
While debugging a self comparison error, I realized that some types where comparing different during IR type canonicalization for no good reason. Looking deeper, I realized it's due to an anonymous enum comparing different to the same anonymous enum defined elsewhere. Both anonymous enums have naming typedefs. The discrepancy is due to the fact that one of these enums didn't have its naming typedef applied, by the DWARF reader. This is because the DWARF reader "re-uses" typedef types whenever it can, and thus re-uses naming typedefs too. Thinking deeply about this, I think naming typedefs should not be re-used, otherwise, some anonymous types would lack their naming typedefs. Oops. So the patch avoids typedefs to be re-used altogether. There doesn't seem to be any performance hit. With that fixed, another problem came up: Some typedefs of type foo are compared to said type foo and the comparison yields "false", wrongly. This is in the context of a type 'foo' used by type 'bar' defined in a translation unit, and the same type 'bar' uses a typedef of 'foo' in another translation unit. Both types 'bar' should compare equal, but don't, today. This is true especially for function types. The patch strips typedefs off of the types of function parameters when comparing function types. To make things consistent, typedefs are stripped off of function parameters when function types (and decls) are pretty printed for internal purposes, especially for type canonicalization. * src/abg-dwarf-reader.cc (build_typedef_type): Do not re-use typedefs. * src/abg-ir.cc (get_function_type_name, get_method_type_name) (function_decl::get_pretty_representation_of_declarator): Strip typedefs when the function name is computed for internal purposes. (equals): In the overload for function_decl::parameter, strip typedefs when comparing parameter types. * tests/data/test-annotate/libtest23.so.abi: Adjust. * 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-diff-dwarf/test2-report.txt: Likewise. * tests/data/test-diff-filter/test3-report.txt: Likewise. * tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/libtest23.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/test10-pr18818-gcc.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/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
0b87414ce1 |
dwarf-reader: Fix a thinko when building vars
While looking at something else, I noticed that we were getting out early when building the IR for vars. Fixed thus. * src/abg-dwarf-reader.cc (build_ir_node_from_die): Don't get out early when building vars. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
e4c3d18aaf |
Bug 29302 - Don't edit fn linkage name when not appropriate
In this bug report, some function linkage names are edited even though they are properly set in the DWARF. This was done because I was thinking that those cases could exist because of the fact that a given function with a linkage name could be associated to an *aliased* ELF symbol that would have a different name. But the proper way to represent that state of things is just to leave the linkage name of the function as it is represented in the DWARF and associate the function to the ELF aliased symbol. This fixes the self comparison of the xerces-c package in Fedora 36: $ time tools/fedabipkgdiff --debug --abipkgdiff build/tools/abipkgdiff --self-compare -a --from fc36 xerces-c Fixed thus. * src/abg-dwarf-reader.cc (build_function_decl): If the linkage name is properly set in the DWARF, do not change it. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
19a9b794ea |
ctf-reader: add support to looks for debug information to extract kABI
With this patch, the abidiff tool is now able to looks for CTF debug information to extract the kABI, it uses the standard `--debug-info-dir' option to locate `vmlinux.ctfa`, looking at first instance in the base directory where the ELF binary (vmlinux/module) is want to be processed. * src/abg-ctf-reader.cc (find_ctfa_file): Add new function meant to locate the Linux Kernel debug information file `vmlinux.ctfa'. (ctf_reader::read_corpus): Use `find_ctfa_file' function. Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
5a36bb779d |
Add regression tests for abipkgdiff using ctf info
This patch is meant to execute the testsuite for abipkgdiff tool using sources with CTF debug info. * doc/manuals/abipkgdiff.rst: Document the fact that abipkgdiff now supports the CTF format. * tests/data/test-diff-pkg-ctf/cracklib-2.9.6-15-ol8.x86_64-report-0.txt: New test input. * tests/data/test-diff-pkg-ctf/cracklib-2.9.6-15-ol8u0.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/cracklib-2.9.6-15-ol8u6.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-0-dir1/dir.abignore: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-0-dir1/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-0-dir1/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-0-dir2/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-0-dir2/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-0-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-1-dir1/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-1-dir1/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-1-dir2/dir.abignore: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-1-dir2/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-1-dir2/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-1-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-1-report-1.txt: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-2-dir1/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-2-dir1/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-2-dir2/.abignore: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-2-dir2/dir.abignore: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-2-dir2/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-2-dir2/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-2-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-dir1/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-dir1/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-dir2/.abignore: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-dir2/libobj-v0.so: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-dir2/obj-v0.c: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-report-1.txt: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3-report-2.txt: Likewise. * tests/data/test-diff-pkg-ctf/dirpkg-3.suppr: Likewise. * tests/data/test-diff-pkg-ctf/elfutils-libelf-0.186-1.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/elfutils-libelf-0.186-2.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/elfutils-libelf-0.186-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/elfutils-libelf-0.186-report-1.txt: Likewise. * tests/data/test-diff-pkg-ctf/gmp-6.1.2-8-ol8u0.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/gmp-6.2.0-10-ol9u0.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/isl-0.16.1-6.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/isl-0.16.1-7.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/isl-0.16.1-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/isl-debuginfo-0.16.1-6.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/isl-debuginfo-0.16.1-7.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/libdwarf-20180129-4-no-ctf.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/libdwarf-20180129-4.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/libdwarf-20180129-5-no-ctf.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/libdwarf-20180129-5.x86_64.rpm: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1-report0.txt: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir1/symlinks/foo.o: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir1/symlinks/libfoo.so: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir1/targets/foo.c: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir1/targets/foo.o: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir1/targets/libfoo.so: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir2/symlinks/foo.o: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir2/symlinks/libfoo.so: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir2/targets/foo.c: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir2/targets/foo.o: Likewise. * tests/data/test-diff-pkg-ctf/symlink-dir-test1/dir2/targets/libfoo.so: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir1.ta: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir1.tar: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir1.tar.bz2: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir1.tar.gz: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir2.ta: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir2.tar: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir2.tar.bz2: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-dir2.tar.gz: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-0-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-1-dir1.tar.gz: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-1-dir2.tar.gz: Likewise. * tests/data/test-diff-pkg-ctf/tarpkg-1-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/test-rpm-report-0.txt: Likewise. * tests/data/test-diff-pkg-ctf/test-rpm-report-1.txt: Likewise. * tests/data/test-diff-pkg-ctf/test-rpm-report-2.txt: Likewise. * tests/data/test-diff-pkg-ctf/test-rpm-report-3.txt: Likewise. * tests/data/test-diff-pkg-ctf/test-rpm-report-4.txt: Likewise. * tests/data/test-diff-pkg-ctf/test-rpm-report-5.txt: Likewise. * tests/data/Makefile.am: Add the test material above to source distribution. * tests/test-diff-pkg.cc (in_out_spec): Add the test inputs above to this harness. Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
d63203a068 |
tests: Update Catch2 library to v2.13.9
This updates catch2 to the latest released version. That also drops a
workaround for missing MINSIGSTKSZ in newer glibcs that we introduced in
|
||
|
68f369f218 |
kmidiff: Add CTF support to comparing Kernel trees
This patch adds a new --ctf option to kmidiff to make it support CTF type information when analysing Linux Kernel trees. * doc/manuals/kmidiff.rst: Add documentation for the new --ctf option. * tools/kmidiff.cc (options::use_ctf): Define new data member. (display_usage): Add a help string for the --ctf option. (main): Adjust call to pass build_corpus_group_from_kernel_dist_under with origin being corpus::CTF_ORIGIN when the user provides the --ctf option. Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
4cf16bdbef |
dwarf-reader,ir: Don't canonicalize enums too early & too naively
When looking at several self comparison failures[1], I notice that the DWARF reader was early-canonicalizing enum types. So, sometimes, when there are declaration-only enum types that need to be resolved (later) to their proper definition, by the time we reach read_context::resolve_declaration_only_enums, canonicalization is already done and so we fail to resolve the decl-only enum; in that case, the decl-only enum is later wrongly considered as different from its definition, leading to spurious errors down the road. This patch thus delays canonicalizing of enum types from the DWARF reader. Once that is done, the patch fixes the comparison of enum types to look through decl-only enum types and compare their definitions instead. The patch also look through decl-only enums during canonicalization. [1]: The self comparison failures could be reproduced by the commands: $ tools/fedabipkgdiff --debug --abipkgdiff build/tools/abipkgdiff --self-compare -a --from fc36 dovecot $ tools/fedabipkgdiff --debug --abipkgdiff build/tools/abipkgdiff --self-compare -a --from fc36 btrfs-progs * src/abg-dwarf-reader.cc (maybe_canonicalize_type): Delay enum type canonicalization. * src/abg-ir.cc (type_base::get_canonical_type_for): Look through all decl-only types, not just decl-only classes. (equals): In the overload for enums, look through decl-only enums. Also, fix redundant enumerators detection to make it more robust, otherwise, some regression tests break. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
7e18fc8ad8 |
add Linux kernel symbol namespace support
Bug 28954 - add Linux Kernel symbol namespace support Each Linux kernel symbol can be exported to a specified named namespace or left in the global (nameless) namespace. One complexity is that the symbol values which identify a string in the __ksymtab_strings section must be interpretated differently for vmlinux and .ko loadable modules as the former has a fixed load address but the latter are relocatable. For vmlinux, the section base address needs to be subtracted to obtain a section-relative offset. The global namespace is explicitly represented as the empty string, at least when it comes to the value of __kstrtabns_FOO symbols, but the common interpretation is that such symbols lack an export namespace. I would rather not have to make use of "empty implies missing" in many places, so the code here represents namespace as optional<string> and only the symtab reader cares about empty strings in __ksymtab_strings. * include/abg-ir.h (elf_symbol::elf_symbol): Add ns argument. (elf_symbol::create): Add ns argument. (elf_symbol::get_namespace): Declare new function. (elf_symbol::set_namespace): Declare new function. and set_namespace. * src/abg-comp-filter.cc (namespace_changed): Define new helper functions. (categorize_harmful_diff_node): Also call namespace_changed(). * src/abg-ir.cc (elf_symbol::priv): Add namespace_ member. (elf_symbol::priv::priv): Add namespace_ to initialisers. (elf_symbol::elf_symbol): Take new ns argument and pass it to priv constructor. (elf_symbol::create): Take new ns argument and pass it to elf_symbol constructor. (elf_symbol::get_namespace): Define new function. (elf_symbol::set_namespace): Define new function. * src/abg-reader.cc (build_elf_symbol): If namespace attribute is present, set symbol namespace. * src/abg-reporter-priv.cc (maybe_report_diff_for_symbol): If symbol namespaces differ, report this. * src/abg-symtab-reader.cc (symtab::load): Get ELF header to distinguish vmlinux from .ko. Try to get __ksymtab_strings metadata and data. Use these to look up __kstrtabns_FOO namespace entries. Set symbol namespace where found. * src/abg-writer.cc (write_elf_symbol): Emit namespace attribute, if symbol has a namespace. * tests/data/Makefile.am: Add new test files. * tests/data/test-abidiff/test-namespace-0.xml: New test file. * tests/data/test-abidiff/test-namespace-1.xml: Likewise * tests/data/test-abidiff/test-namespace-report.txt: Likewise. * tests/test-abidiff.cc: Add new test case. Reviewed-by: Matthias Maennich <maennich@google.com> Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
|
89e6854ca4 |
Linux symbol CRCs: support 0 and report presence changes
The CRC with value zero was used to mean "absent". This can be better modelled using optional. This commit makes this change and also tweaks reporting so that disappearing / appearing CRCs are noted. This should be essentially impossible unless CRCs are enabled / disabled altogether but would be very noteworthy otherwise. * include/abg-ir.h (elf_symbol::elf_symbol): Argument crc is now an optional defaulted to absent. (elf_symbol::create): Likewise. (elf_symbol::get_crc): Now returns an optional uint64_t. (elf_symbol::set_src): Now takes an optional uint64_t. * src/abg-comp-filter.cc (crc_changed): Simplify comparison. * src/abg-ir.cc (elf_symbol::priv): Member crc_ is now an optional uint64_t. (elf_symbol::priv::priv): Argument crc is now an optional uint64_t. (elf_symbol::elf_symbol): Likewise. (elf_symbol::create): Argument crc is now an optional uint64_t and defaults to absent. (textually_equals): Simplify comparison. (elf_symbol::get_crc): Now returns an optional uint64_t. (elf_symbol::set_crc): Now takes an optional uint64_t. * src/abg-reader.cc (build_elf_symbol): Treat CRC 0 the same as other CRC values. * src/abg-reporter-priv.cc (maybe_report_diff_for_symbol): Treat CRC 0 the same as other CRC values and also report changes to CRC presence. * src/abg-writer.cc (write_elf_symbol): Treat CRC 0 the same as other CRC values. * tests/data/Makefile: Remove test-abidiff/test-crc-report.txt and add test-abidiff/test-crc-report-{0-1,1-0,1-2}.txt. * tests/data/test-abidiff/test-crc-report-0-1.txt: Report showing additional of CRCs. * tests/data/test-abidiff/test-crc-report-1-0.txt: Report showing removal of CRCs. * tests/data/test-abidiff/test-crc-report-1-2.txt: Renamed from tests/data/test-abidiff/test-crc-report.txt. * tests/test-abidiff.cc: Update test cases that no longer generate empty reports. * tests/test-symtab.cc: Update KernelSymtabsWithCRC test. Reviewed-by: Matthias Maennich <maennich@google.com> Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
|
ce7bd9f595 |
optional: minor improvements
This change makes minor improvements to the optional class used with pre-C++17 compilers. - adds operator== and operator!= - adds various missing noexcept (but not constexpr) decorations - defines operator bool in terms of has_value Note that some constexpr decorations would require C++17 anyway. * include/abg-cxx-compat.h (optional): Add operator== and operator!=. Add noexcept decorations. Tweak operator bool. Reviewed-by: Matthias Maennich <maennich@google.com> Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
|
d15c30e319 |
crc_changed: eliminate copying of shared_ptr values
As pointed out in a review of similar code, it is possible to avoid copying a couple of shared pointers in this function, by taking references instead. This commit also splits declarations to one per line and removes the unnecessary parentheses around the return expression. * src/abg-comp-filter.cc (crc_changed): Take references to avoid std::shared_ptr copying. Split declarations into one per line. Remove unnecessary return expression parentheses. Reviewed-by: Matthias Maennich <maennich@google.com> Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
|
d21dbadddd |
ir: Add some debugging facilities for the comparison machinery
When looking at something else, I felt the need to write the debugging facilities below to dump the content of the set of types being compared, to better understand why some comparison take more or less time. * src/abg-ir-priv.h: Include iostream to access std::cerr. (environment::priv::{dump_classes_being_compared, dump_fn_types_being_compared}): Define new member functions. * src/abg-ir.cc (dump_classes_being_compared) (dump_fn_types_being_compared): Define new functions. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
69795d1bf8 |
Bug 29303 - Cache the result of structural aggregate comparison
When we are forced to structurally compare aggregate types (classes and function types), some sub-types pairs can be compared an innumerable number of times over and over again. This leads to having extremely slow comparison times for the portions of the code that are subject to structural comparison because canonical comparison has not yet been setup. For instance, this happens in the dwarf-reader in the function read_context::resolve_declaration_only_classes or, in the ir module in the function type_base::get_canonical_type_for when type canonicalization is being done. To overcome this, this patch caches the result of comparing two pairs of aggregate (class or function) type, ensuring that a pair of aggregate sub-type is compared at most once during the structural comparison of a given type. Note that this caching scheme is used only during declaration classes resolution and type canonicalization. This sped up things quite noticeably as self comparing both binutils and dovecot package sets in Fedora 36 was literally taking forever prior to the patch and is now completing with this patch. * src/abg-ir-priv.h (struct uint64_t_pair_hash): Define new type. (uint64_t_pair_type, uint64_t_pairs_set_type) (type_comparison_result_type): Define new typedefs. (environment::priv::{classes_being_compared_, fn_types_being_compared_}): Use the new uint64_t_pairs_set_type type for these. (environment::priv::{type_comparison_results_cache_, allow_type_comparison_results_caching_}): Define new data members. (environment::priv::priv): Initialize the new allow_type_comparison_results_caching_ scalar data member. (environment::priv::{allow_type_comparison_results_caching, cache_type_comparison_result, is_type_comparison_cached, clear_type_comparison_results_cache}): Define new member functions. (environment::priv::{mark_as_being_compared, unmark_as_being_compared, comparison_started}): Take a pair of types. (struct function_type::priv): Move this here, from ... * src/abg-ir.cc (struct function_type::priv): ... here. (is_comparison_cycle_detected, mark_types_as_being_compared) (unmark_types_as_being_compared): Adjust call to the new environment::priv::{comparison_started, mark_as_being_compared, unmark_as_being_compared}. (type_base::get_canonical_type_for): Use aggregate types comparison result caching when doing type comparison. (equals): In the overload for function_type, class_or_union and class_decl, cache the result of aggregate type comparison and re-use that cached result when it's available. * src/abg-dwarf-reader.cc (read_context::compare_before_canonicalisation): Use aggregate types comparison result caching when doing type comparison. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
7006c5f3c4 |
dwarf-reader: Don't consider top-level types as private
By default, the DWARF reader (wrongly) considers that any top-level decl/type (inside a namespace) that doesn't have the DW_AT_external attribute is a private decl/type. It thus considers that function/variable decls that have that attribute are public decls, and thus, the types they use are also public. Which what we want. But then, it also considers that top-level types (which never have a DW_AT_external) are not public. And that causes unwanted side effects like dropping some classes on the floor. As a result, some functions that have those classes as parameter type would end-up being considered as having no parameter of that type. Oops. This patch fixes that by considering that only function and variable DIEs ought to have the DW_AT_external flag to be considered as public decls. Non-anonymous namespace are also considered as public decls. This should fix the output of the command: tools/fedabipkgdiff --debug --abipkgdiff build/tools/abipkgdiff --self-compare -a --from fc36 libabigail * src/abg-dwarf-reader.cc (die_is_public_decl): Only function and variable decls having the DW_AT_external, as well as non-anonymous namespaces are considered public decls. The rest is considered private. (build_namespace_decl_and_add_to_ir): If the current namespace is private (anonymous), then its content is also private. Otherwise, use die_is_public_decl to know if its content is public or not. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b9af1f3540 |
dwarf-reader: Avoid long comparisons when resolving C++ decl-only classes
When resolving decl-only classes, it can happen that a decl-only class has several candidate classes definitions (in the same binary) to resolve to. In that case, read_context::resolve_declaration_only_classes compares the classes definitions (of the same name) against each other. The problem however is that at that point, we haven't done type canonicalization yet. So comparing these types can have a quadratic behaviour, i.e, take forever, especially in C++. So, if we are looking at C++ (or any language where the ODR rules) types, we can just do away with this comparison and assume the types are equal, as they have the same name. After canonicalization (which comes later), ODR violations can still be detected (if we ware about that at all) anyway. This patch does away with comparing aggregate types (struct/classes) for languages that support the ODR. In so doing, it avoids taking forever while loading the ABI corpus for the libdyninstAPI.so.12 library from Fedora 36. * src/abg-dwarf-reader.cc (read_context::resolve_declaration_only_classes): Don't compare same-name-types of a binary if the ODR is relevant. * tests/data/test-annotate/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
74bd98766a |
test-alt-dwarf: Add missing dwz alt-debug file
It seems I forgot to add a dwz alt-debug file to the test material included in the previous commit. Fixed thus. * tests/data/test-alt-dwarf-file/libstdc++/libstdc++-report-1.txt: New reference test output. * tests/data/test-alt-dwarf-file/libstdc++/usr/lib/debug/.dwz/gcc-12.1.1-1.fc37.x86_64: New dwz alt-debug info file. * tests/data/Makefile.am: Add the test material above to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
72b46b2600 |
ir: Make canonicalization stable wrt typedefs in fn return types
In the grand scheme of things, two function return types can be equal modulo typedefs. Because those two function textual representations are different, the two overall function types would end up having different canonical types and thus, the two functions would be considered as having different sub-types. The harmless change pass would then kick in and flag that change as harmless. But then, "abidw --abidiff" that is used for testing purposes would still be not happy. This patch strips typedefs off of return types of function types when the string representation is to be used for internal (e.g, type canonicalization) purposes. The fix for this change uncovered another issue: When setting the naming typedefs for an (anonymous) C++ class, the qualified name of the class was wrongly being set to the qualified name of the typedef. Only the name of the class should be affected, in essence. The qualified name would, ONLY as a result of the name change, be adjusted. This patch fixes those issues and adjusts the test suite accordingly. * src/abg-ir.cc (get_function_type_name, get_method_type_name): When the function type name is for internal purposes, strip potential typedefs off. (equal): In the overload for function_type, strip potential typedefs off of return types before comparing them. (decl_base::set_naming_typedef): Properly adjust the qualified name of the type to which a naming typedef is being set. * tests/data/test-alt-dwarf-file/libstdc++/libstdc++-report.txt: New reference test output. * tests/data/test-alt-dwarf-file/libstdc++/usr/lib/debug/usr/lib64/libstdc++.so.6.0.30-12.1.1-1.fc37.x86_64.debug: New binary test input. * tests/data/test-alt-dwarf-file/libstdc++/usr/lib64/libstdc++.so.6.0.30: New binary test input. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/PR25007-sdhci.ko.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/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/test21-pr19092.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
2d1e324727 |
Update year in copyright notice
* include/abg-comp-filter.h: Update year in copyright notice. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-ctf-reader.h: Likewise. * include/abg-cxx-compat.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-elf-reader-common.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-regex.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-ctf-reader.cc: Likewise. * src/abg-default-reporter.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-elf-helpers.cc: Likewise. * src/abg-elf-helpers.h: Likewise. * src/abg-elf-reader-common.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-regex.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-suppression-priv.h: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-symtab-reader.cc: Likewise. * src/abg-symtab-reader.h: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-workers.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-abicompat.cc: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-cxx-compat.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-elf-helpers.cc: Likewise. * tests/test-ini.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-kmi-whitelist.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-ctf.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-symtab-reader.cc: Likewise. * tests/test-symtab.cc: Likewise. * tests/test-tools-utils.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/kmidiff.cc: Likewise. * update-copyright.sh: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
aa1576b2f3 |
reporter-priv: Passing a string parm by reference
While looking at something else, I noticed the maybe_report_data_members_replaced_by_anon_dm function was passing a string parameter by value. Pass this by reference. * src/abg-reporter-priv.h (maybe_report_data_members_replaced_by_anon_dm): Pass the string parm by ... * src/abg-reporter-priv.cc (maybe_report_data_members_replaced_by_anon_dm): ... reference. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
0529e3b9ee |
dwarf-reader: Fix DWARF string comparison optimization
This fix has been triggered by a fix posted by Thomas Schwinge in the thread that started at https://sourceware.org/pipermail/libabigail/2022q1/004139.html. Thomas rightfully notes that compare_dies_string_attribute_value is wrong. In some cases, it wrongly considers only the first character of the two strings to compare. This patch fixes that and updates the regression tests accordingly. The fix suppresses several spurious changes (in runtestdifffilter) that were there and I never got the bottom of them. Now they are gone. * src/abg-dwarf-reader.cc (slowly_compare_strings) (die_char_str_attribute): Define new static functions. (compare_dies_string_attribute_value): Use the new slowly_compare_strings here. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
7ecef63617 |
Canonicalize DIEs w/o assuming ODR & handle typedefs transparently
When canonicalizing DIEs, if two type DIEs have the same textual representation and we are looking at a C++ DIE, then we assume the two DIEs are equivalent because of the "One Definition Rule" of C++. There are binaries however where there seem to be type DIEs that are slightly different and yet with the same textual representation. It seems that this leads to some heisenbugs depending on which of the two DIEs is "kept". That order would then depend on whatever the linker's output is at a particular moment when linking the binary. Those slight differences (i.e, modulo typedefs, for instance) are a pain to reproduce across binaries that are re-linked. So I am removing this optimization. As it doesn't seem to be so useful anymore, given all the areas of the pipeline that go improved recently, speed-wise. After doing that, it appeared the comparison engine was seeing more DIE kinds. So rather than aborting when seeing an unexpected DIE kind, we now assume the two DIEs we are seeing are different. They are thus not canonicalized. That's not a problem because the IR level type canonicalizer will pick that up and fully canonicalize the type at that level. So as that is in place, it appeared we were doing canonical DIE propagation even in cases where we should not. Namely, when a subset of the stack of aggregates being compared depends on a recursive (or redundant) sub-type, no canonical type DIE propagation should be performed. The patch thus detects that state of things and disables the canonical type DIE propagation in that case. Once this change in place, as the DIE canonicalizer started to look into more types, the IR started to get more types that were deemed equal to their decl-only counterpart before, and so were represented those decl-only counterpart by virtue of the ODR. That uncovered the long standing issue described below. Canonicalizing typedefs is done today by considering that two typedefs that have different names are different even if they have the same underlying types. That means we can have two types T and T' (in a binary) that are equivalent modulo a sub-type that is a typedef with different names in T and T', yet with equivalent underlying types. Today, libabigail would consider T and T' different, even though they are equivalent from an ABI standpoint. This can lead to spurious changes that we have to handle later by adding passes that would suppress those spurious changes. This patch thus changes the structural comparison for typedefs by not taking the typedef name into account anymore. Also, typedefs don't carry canonical types anymore. That way, to compare typedefs, libabigail always look into their underlying types. To adapt the precision of the abixml output, the patch now uses a special set (to track emitted non-canonicalized types) and a special map (to track type ID for non-canonicalized types) as those can't be put in the classical maps that track types using their canonical types. * include/abg-fwd.h (peel_typedef_pointer_or_reference_type): Declare new function. * src/abg-dwarf-reader.cc (read_context::{compute_canonical_die, get_canonical_die, get_or_compute_canonical_die}): Don't special-case ODR-relevant cases. (is_canon_type_to_be_propagated_tag): Rename is_canonicalizeable_type_tag into this. (erase_offset_pair): Make this return a bool, not void. (have_offset_pair_in_common, try_canonical_die_comparison) (notify_die_comparison_failed): Define new static functions. (ABG_RETURN, ABG_RETURN_FALSE): Define new macros. (compare_dies): Handle DW_TAG_{class,unspecified}_type DIES. Also if a comparing a DIE kind is not supported, assume the comparison yields "false" for the purpose of canonicalization. Add a new parameter for redundant aggregates being compared. Use the redundant aggregate set to detect if a redundant aggregate has been detected and is still being "explored"; if that's the case, then canonical DIE propagation is de-activated. This might incur a performance hit. Use the new ABG_RETURN and ABG_RETURN_FALSE macros. Use the new try_canonical_die_comparison to compare canonical DIEs rather than doing it by hand. (build_typedef_type): Don't try to rely on canonical typedefs DIEs. * src/abg-ir.cc (type_topo_comp::has_artificial_or_natural_location): Define new method. (type_topo_comp::operator(const type_base*, const type_base*)): In this topological comparison operator of types, when two types have the same textual representation, if they don't have any location, if they are pointer/reference/typedef types, use the textual representation of their ultimate underlying type for sorting order. (peel_typedef_pointer_or_reference_type): Define new function. (compare_types_during_canonicalization): Perform the structural canonical comparison first. (equals): In the overload for array_type_def::subrange_type&, remove unused code. In the overload for typedef_decl& don't compare typedef names. In the overload for class_or_union, make the RETURN macro *NOT* propagate canonical type because this equal function is used as a subroutine by overloads for class and union. That means that the class_or_union equal function can return true, and still, the caller (overload for class_decl or union_decl) can later return false; in that case, we don't want canonical type to be propagated. In the overload for class_decl::base_spec, use the ABG_RETURN macro when returning comparing decl-bases. In the overload for class_decl, use ABG_RETURN when returning the result of comparing class_or_union artifacts. (maybe_propagate_canonical_type): If we are using canonical type comparison, then do not propagate the type, if WITH_DEBUG_TYPE_CANONICALIZATION is defined. (is_non_canonicalized_type): Add typedefs to the set of non-canonicalized types. * src/abg-writer.cc (struct non_canonicalized_type_hash, struct non_canonicalized_type_equal): Define new functors. (typedef nc_type_ptr_set_type): Define a new non-canonicalized set type. (typedef nc_type_ptr_istr_map_type): Define a new map of non-canonicalized types/interned string map. (write_context::{m_nc_type_id_map, m_emitted_non_canonicalized_type_set, m_referenced_non_canonicalized_types_set}): New data members. (write_context::type_has_existing_id): Look for non-canonicalized types in the m_nc_type_id_map map. (write_context::get_id_for_type): Use m_nc_type_id_map for non-canonicalized types. (write_context::clear_type_id_map): Clear m_nc_type_id_map too. (write_context::get_referenced_non_canonicalized_types): Renamed write_context::get_referenced_non_canonical_types into this. Make it return the new write_context::m_referenced_non_canonicalized_types_set. (write_context::has_non_emitted_referenced_types): Just use write_context::type_is_emitted as it knows where to look up for non-canonicalized types. (write_context::record_type_as_referenced): Use m_referenced_non_canonicalized_types_set to store referenced non-canonicalized types. The other types are stored in m_emitted_set as previously. (write_context::type_is_emitted): Look into m_emitted_non_canonicalized_type_set for non-canonicalized types. Other types are still in m_emitted_type_set. (write_context::{record_decl_only_type_as_emitted, decl_only_type_is_emitted, get_emitted_decl_only_types_set}): Remove methods. (write_context::get_emitted_non_canonicalized_type_set): Define new method. (write_context::clear_referenced_types): Clear m_referenced_non_canonicalized_types_set too, as m_referenced_non_canonical_types_set is no more. (write_context::referenced_type_should_be_emitted): Use only write_context::type_is_emitted as it knows how to check it all now. (write_referenced_types): Use the more compact ranged-base for loops. (write_translation_unit): Write the non-canonicalized types that are not yet emitted. (write_class_decl, write_union_decl): Adjust recording type as emitted. (write_canonical_type_ids): Adjust. * tests/data/test-abidiff/test-PR18791-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: Adjust. * 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/test2.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/test3.so.abi: Likewise. * tests/data/test-annotate/test5.o.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/PR25058-liblttng-ctl-report-1.txt: Likewise. * tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.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/test41-report-0.txt: Likewise. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64: Likewise. * tests/data/test-diff-pkg/nmap-7.70-5.el8_testjcc.x86_64-self-check-report-0.txt: Likewise * tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.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/test39-opaque-type-report-0.txt: Likewise. * tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-functions-declaration.abi: Likewise. * tests/data/test-read-ctf/test1.so.abi: Likewise. * tests/data/test-read-ctf/test1.so.hash.abi: Likewise. * tests/data/test-read-ctf/test2.so.abi: Likewise. * tests/data/test-read-ctf/test2.so.hash.abi: Likewise. * tests/data/test-read-ctf/test5.o.abi: Likewise. * tests/data/test-read-ctf/test7.o.abi: 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/PR24378-fn-is-not-scope.abi: Likewise. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise. * tests/data/test-read-dwarf/PR27700/test-PR27700.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-PR26568-1.o.abi: Likewise. * tests/data/test-read-dwarf/test-PR26568-2.o.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/test-suppressed-alias.o.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/test13-pr18894.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/test5.o.abi: Likewise. * tests/data/test-read-dwarf/test5.o.hash.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test18.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> |
||
|
d09f77dfa0 |
dwarf-reader: compare_dies sometimes compares empty formal parms
compare_dies sometimes compares uninitialized DIE structs, which leads to junk down the road. Fixed thus. * src/abg-dwarf-reader.cc (compare_dies): Don't try to compare formal parameters if there is none. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b9c73978ed |
abidw, dwarf-reader: Add an option to debug DIE canonicalization
While looking at something else, it appeared that I needed an option to turn on checks to debug DIE canonicalization. That option would itself be enable only when the project is configured using the --enable-debug-type-canonicalization configure option. * include/abg-ir.h (environment::debug_die_canonicalization_is_on): Declare new methods. * src/abg-ir.cc (environment::debug_die_canonicalization_is_on): Define them. * src/abg-dwarf-reader.cc (compare_dies_during_canonicalization): Define new static function. (read_context::{debug_die_canonicalization_is_on_, use_canonical_die_comparison_}): Declare these data members. (read_context::read_context): Initialize them. (read_context::get_canonical_die): When ODR is considered, if DIE canonicalization debugging is on, use the new compare_dies_during_canonicalization for the type comparison to be done both structurally and canonically; both comparison should yield the same result. Also, make this method function non-const. * src/abg-ir-priv.h (environment::priv::debug_die_canonicalization_): Define new data member. (environment::priv::priv): Initialize it. * tools/abidw.cc (options::debug_die_canonicalization_): Define new data member. (options::options): Initialize it. (display_usage): Add a description for the --debug-dc option. (parse_command): Parse the new --debug-dc option. (load_corpus_and_write_abixml): Use the new environment::debug_die_canonicalization_is_on. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b822f213e4 |
test-read-dwarf: Use abidw rather than using the library
When this test fails, sometimes it's difficult to reproduce the problem using abidw. That's because this test is using the library directly, so the exact setup is not always straightforward to reproduce and eventually debug. This test changes tests/test-read-dwarf.cc to make it use abidw rather than using the library directly. * tests/test-read-dwarf.cc (set_suppressions) (set_suppressions_from_headers): Remove these static functions. (test_task_dwarf::perform): Use abidw rather than using the library. Remove the path and architecture from the abixml files. Also, when the test fails, display the actual command that failed. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
ed3eabbb6b |
Add better error messaging to several tests
When test-read-dwarf and test-diff-filter fail, it's important to know what exact command line failed. This patch makes these tests display the failing command. * tests/test-diff-filter.cc (test_task::perform): Display the failing command. * tests/test-read-common.cc (test_task::run_abidw): Likewise. * tests/test-read-common.h (test_task::run_diff): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
aecfa368a5 |
ir, test-read-ctf: Remove uncertainty in sorting anonymous types
For a reason, I am seeing changes in the test-read-ctf output. Those are related to sorting anonymous structs that have no (internal) name. The CTF reader emits such types. This patch thus considers the flat representation of an anonymous class/union when it doesn't have an internal name. The patch also updates the test-read-ctf output tests accordingly. * src/abg-ir.cc ({class_decl, union_decl}::get_pretty_representation): If the anonymous class has no internal name, use its flat representation as internal representation. * tests/data/test-read-ctf/test-PR26568-1.o.abi: Likewise. * tests/data/test-read-ctf/test-PR26568-2.o.abi: Likewise. * tests/data/test-read-ctf/test-anonymous-fields.o.abi: Likewise. * tests/data/test-read-ctf/test-anonymous-fields.o.abi: Likewise. * tests/data/test-read-ctf/test0.hash.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
8cbf9f46f2 |
limit repeated DIE comparisons
Exponential explosion of DIE comparison has been possible since the limit of at most 5 pending struct/union DIE comparison pairs was lifted. This commit adds two things to control this (with a negligible chance of falsely finding that two DIEs are equivalent when they are not). - DIE self-comparisons immediately return true - once a DIE pair has been compared 10000 times, always return true * src/abg-dwarf-reader.cc (read_context): Add mutable die_comparison_visits_ member. (compare_dies): Return true if this is a self-comparison. Return true if we have visited this comparison 10000 times. Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
|
e8a012b6e1 |
abicompat: Properly guard inclusion of abg-ctf-reader.h
A recent patch to add CTF support to abicompat included abg-ctf-reader.h without guarding it with #ifdef WITH_CTF. This patch fixes that. * tools/abicompat.cc: Guard inclusion of abg-ctf-reader.h with #ifdef WITH_CTF. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
c277fbc75d |
Bug 29144 - abidiff doesn't report base class re-ordering
Libabigail fails to report when a base class gets re-ordered, even though the comparison engine detects the change. This patch detects the base class re-ordering in class_diff::ensure_lookup_tables_populated by interpreting the edit script resulting of the comparison, populates a new class_diff::priv::moved_bases_ vector with the bases that "changed position" and adds a new class_diff::moved_bases() accessor for the "base classes that changed position". A new function maybe_report_base_class_reordering is defined to actually report a base class re-ordering if class_diff::moved_bases() returns a non-empty vector, meaning that class has some base classes that got re-ordered. That new function is thus called in the overload of {default_reporter, leaf_reporter}::report() for class_diff to emit a description of the change when necessary. * include/abg-comparison.h (class_diff::moved_bases): Declare new method. * src/abg-comparison-priv.h (class_diff::priv::moved_bases_): Define new data member. * src/abg-reporter-priv.h (maybe_report_base_class_reordering): Declare new function. * src/abg-reporter-priv.cc (maybe_report_base_class_reordering): Define new function. * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): Detect that a base class moved position and record it into class_diff::priv::moved_bases_ data member. * src/abg-default-reporter.cc (default_reporter::report): Use the new maybe_report_base_class_reordering. * src/abg-leaf-reporter.cc (leaf_reporter::report): Likewise. * tests/data/test-abidiff-exit/test-PR29144-report-2.txt: New testing input file. * tests/data/test-abidiff-exit/test-PR29144-report.txt: Likewise. * tests/data/test-abidiff-exit/test-PR29144-v0.cc: Likewise. * tests/data/test-abidiff-exit/test-PR29144-v0.o: Likewise. * tests/data/test-abidiff-exit/test-PR29144-v1.cc: Likewise. * tests/data/test-abidiff-exit/test-PR29144-v1.o: Likewise. * tests/data/Makefile.am: Add the new files to source distribution. * tests/test-abidiff-exit.cc (in_out_specs): Add the new tests to this harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
57a5ce73cf |
abicompat: Support reading CTF and abixml
While abidw generates abidw and abidiff can consume that abidw abicompat could only read from ELF objects with DWARF. To bring it in line with the capabilities of abidiff, this patch adds the ability for abicompat to read both abixml and CTF. The reason why being able to handle abixml as well as an ELF file with DWARF is that it allows someone to archive the abixml for an object and use it in place of having to keep the entire object when doing abi compatibility studies. The ability to handle CTF was also in the code that I copied over from abidiff and so I brought it over at the same time. This should be tested more extensively. The make check works and a trivial test using the same object seems to work but I do not have any CTF other binaries around to test against. Also a feature that I asked for a long time ago was to fail if the binaries don't have debug infomation which is needed for proper comparison. This was added to abidiff but it didn't get added to abicompat. Since the code was in the same area, I copied it over from abidiff at the same time. I do not think it makes sense to try to split these three features apart because they are just replicating pre-existing code in a different tool. * tools/abicompat.cc (options::{fail_no_debug_info, use_ctf}): New data members. (options::options): Initialize them. (display_usage): Add a help string for the new options --fail-no-debug-info and --ctf. (parse_command_line): Support parsing the new options --fail-no-debug-info and --ctf. (read_corpus): New static function. (main): Use the new read_corpus in lieu of using dwarf_reader::read_corpus_from_elf and/or ctf_reader::read_corpus and/or xml::reader::read_corpus_from_input. * doc/manuals/abicompat.rst: add documentation for new options. Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
ebf8f98f3d |
abidiff: Remove redundant code
While working on abicompat, I noticed that the following two blocks of code are redundant. They perform the same test as in the switch statement a few lines below. * tools/abidiff.cc (main): Remove redundant code. Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
72dadfdc34 |
XML writer: unify type emission tracking
Empirically, the tracking of declaration-only type emission no longer seems to make any difference. It is removed here. * src/abg-writer.cc (write_context): Remove the m_emitted_decl_only_set member. (write_context::has_non_emitted_referenced_types): Remove the calls to decl_only_type_is_emitted. (write_context::record_decl_only_type_as_emitted): Removed. (write_context::decl_only_type_is_emitted): Ditto. (write_context::get_emitted_decl_only_types_set): Ditto. (referenced_type_should_be_emitted): Remove the calls to decl_only_type_is_emitted. (write_class_decl): Just call record_type_as_emitted. (write_union_decl): Ditto. (write_enum_type_decl): Not changed, but now all 3 functions have the same behaviour. (write_canonical_type_ids): Remove the call to get_emitted_decl_only_types_set. Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
|
bb935f6219 |
abicompat: Add missing space
This is absolutely trivial but I noticed this missing space one day and fixed it and have been carrying the hunk of patch for months. * tools/abicompat.cc (main): Add missing space in expression. Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
4f40cbbe4e |
comparison: Fix leaf report summary
This patch is to address the problem reported at https://sourceware.org/bugzilla/show_bug.cgi?id=29047 where the leaf changes summary omits the number of (added/removed) ELF symbols that have no debug info. Fixed thus. * src/abg-comparison.cc (corpus_diff::priv::emit_diff_stats): In the "leaf change summary" section, add the number of removed/added symbols not described by debug info. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
431998a892 |
test-annotate.cc: ignore whitespace during diff
The LLVM C++ demangler is being updated to remove the extra space delimiter added between consecutive template closings. This change ensures tests pass with both old and new versions. * tests/test-annotate.cc (main): Pass diff -w option. Suggested-by: Bogdan Graur <bgraur@google.com> Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
815afe1de7 |
symtab-reader: Setup aliases before checking ppc64 opd function entries
The update_function_entry_address_symbol_map function checks whether the given symbol is an alias of another symbol or a special ppc64 ELFv1 function entry symbol. This requires the symbol aliases to already been setup. But the alias entries were only setup after calling update_function_entry_address_symbol_map. Make sure that the symbol aliases have been setup and only then call the special ppc64 update_function_entry_address_symbol_map function. But make sure the arm32 function symbol entry address cleanup is done before checking for aliases. This patch renames symtab::get_symbol_value into symtab::setup_symbol_lookup_tables to better reflect what it does. It is in that function that the call to update_function_entry_address_symbol_map is performed, the arm32 symbol address cleanup is done and the ppc64 ELFv1 function address plumbing is done. So arranging for update_function_entry_address_symbol_map to be called after symbol aliases are setup for ppc64 is also done in that function. That way, symtab::load_ only have to call symtab::setup_symbol_lookup_tables to have aliases setup. This fixes runtestslowselfcompare.sh on ppc64 (ELFv1) with ENABLE_SLOW_TEST=yes * src/abg-elf-helpers.h (architecture_is_ppc32): Declare new function. * src/abg-elf-helpers.cc (architecture_is_ppc32): Define it. * src/abg-symtab-reader.cc (symtab::setup_symbol_lookup_tables): Rename symtab::get_symbol_value into this. Setup symbol aliases before setting up function entry address maps for ppc{32,64} ELFv1 and after fixing up arm32/64 addresses. (symtab::load_): Invoke the new setup_symbol_lookup_tables. update_function_entry_address_symbol_map after setting up aliases. No need to setup symbol aliases anymore. (symtab::add_alternative_address_lookups): Invoke the new setup_symbol_lookup_tables. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
1ebd5ff0eb |
ctf-reader: add support to looking debug information in external path
When an ELF `stripped' file is used to get CTF debug information the ELF symbols used by ctf reader (`symtab_reader::symtab') is split in a separate file and even though CTF was designed to be in ELF file after be `stripped' this .ctf section can be 'loaded' from and external .debug file, for instance the script `find-debuginfo' used to generate RPM debug packages split debug information in .debug files. The location of such files is pass as a standard argument from libabigail tools and the name of the file is gathering from the `.gnu_debuglink' section. * include/abg-ctf-reader.h (ctf_reader::create_read_context): Add `debug_info_root_paths' argument. (ctf_reader::reset_read_context): Likewise. * src/abg-ctf-reader.cc: Add `read_context::elf_{handler,fd}_dbg', data members. (read_context::read_context): Add new `debug_info_root_paths' argument. (read_context::initialize): Likewise. (ctf_reader::create_read_context): Likewise. (ctf_reader::close_elf_handler): Release `read_context::elf_{handler,fd}_dbg' members. (ctf_reader::find_alt_debuginfo): Add new function. (ctf_reader::slurp_elf_info): Add new argument `status'. Use `find_alt_debuginfo' and `elf_helpers::find_section_by_name' to read the symtab and ctf information from an external .debug file, the `status' reference is updated. (ctf_reader::read_corpus): Verify `status' after `slurp_elf_info'. (ctf_reader::reset_read_context): Add new `debug_info_root_path' argument. * src/abg-elf-helpers.cc (elf_helpers::find_section_by_name): Update comment. * src/abg-tools-utils.cc (maybe_load_vmlinux_ctf_corpus): Adjust `ctf_reader::{create,reset}_read_context'. * tests/test-read-ctf.cc: Likewise. * tools/abidiff.cc (display_usage): Add `--ctf' command line option. (main): Adjust `ctf_reader::create_read_context'. Likewise. * tools/abidw.cc (load_corpus_and_write_abixml): Adjust `ctf_reader::create_read_context'. * tools/abilint.cc (main): Likewise. * tools/abipkgdiff.cc (compare, compare_to_self): Likewise. Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
16f5e95fde |
Adding missing newline to build-container workflow
Adding missing newline to build-container workflow. * .github/workflows/build-container.yaml: Add missing newline. Signed-off-by: Vanessa Sochat <sochat1@llnl.gov> Reviewed-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |