Dodji Seketeli [Thu, 25 Jan 2024 11:06:57 +0000 (12:06 +0100)]
Bug 31279 - Acknowledge that opaque types are always decl-only
When handling a decl-only base class, add_or_update_class_type asserts
that we need to try to resolve the decl-only base class to its
definition. That makes sense in most cases.
However, in cases where the base class is actually an opaque class
resulting from the use of the --header-dir{1,2} option of abidiff, the
opaque type is by definition a decl-only class artificially created
from a fully defined class.
When the opaque class is anonymous (later named by a typedef),
maybe_schedule_declaration_only_class_for_resolution schedules a
decl-only class named by the empty string for resolution to its
definition. Later when add_or_update_class_type handles the decl-only
base class (now named by a typedef),
reader::is_decl_only_class_scheduled_for_resolution looks for the
typedef name; as the class scheduled for resolution by
maybe_schedule_declaration_only_class_for_resolution was then
anonymous, reader::is_decl_only_class_scheduled_for_resolution returns
false and the assert in add_or_update_class_type fails. It's the
problem reported in this issue. Oops.
When the opaqued decl-only type is anonymous,
maybe_schedule_declaration_only_{class,enum}_for_resolution must NOT
schedule it for resolution to its definition because the scheduled
types for resolution are designated by name. This patch now enforces
that.
It just doesn't make sense to schedule an anonymous type for
resolution to its definition. When the type is later named by a
typedef however, then it's scheduled for resolution to its definition,
as it's no more anonymous at that point. The patch enforces that as
well.
The patch ends up making sure that add_or_update_class_type does /not/
assert that an /anonymous/ decl-only base class is scheduled for
resolution to its definition.
These changes should fix the problem reported at
https://sourceware.org/bugzilla/show_bug.cgi?id=31279.
* src/abg-dwarf-reader.cc
(reader::maybe_schedule_declaration_only_{class,enum}_for_resolution):
Do not schedule anonymous decl-only types for resolution to their
definition.
(build_typedef_type): When an anonymous decl-only type has just
been named by a typedef, schedule it for resolution to its
definition.
(add_or_update_class_type): Do not assert that /anonymous/
decl-only types are scheduled for resolution to their definition.
Dodji Seketeli [Mon, 15 Jan 2024 10:10:42 +0000 (11:10 +0100)]
Bug 31236 - Fix removing a member declaration from its scope
In some C++ binaries, DWARF can represent a member variable using a
global variable /definition/ DIE not having a reference attribute
pointing back to the member variable declaration DIE. The only way we
know that the global variable is a definition DIE for a member
variable is because its linkage name demangles to
"foo::bar::var_name", with foo::bar being a class name.
So, for each translation unit, when the DWARF reader reads a global
variable DIE, it builds a variable IR node for it and stashes it on
the side.
Then, when the translation unit is built, the DWARF reader looks at
all the stashed global variables, detects those that are actually
member variables and adds them to their class. But then, before
adding a (former global) variable to its class, the reader has first
to remove it from its global scope. This removal is done by the
function remove_decl_from_scope, which calls
scope_decl::remove_member_decl.
The issue here is that remove_decl_from_scope forgets to unset the
translation unit property of the global variable.
Then, in the particular case of this problem report, when
scope_decl::add_member_decl is called to add the variable to its
class, it detects that the variable belongs to /another/ translation
unit and (rightfully) aborts. Ooops.
This patch fixes the issue by making remove_decl_from_scope remove the
variable from its translation unit too, not just from its scope. The
patch actually delegates the scope & translation unit resetting to
scope_decl::remove_member_decl because it appears to me that this is
where these ought to be handled.
To ensure that the issue is fixed, one needs to unpack the package
webkit2gtk3-2.40.5-1.el9_3.1.x86_64.rpm and run abidw on the binary
$prefix/usr/lib64/libwebkit2gtk-4.0.so.37 like:
Given the size of the library, this takes three hours and a half as
well as ~50GB of ram to complete on my system using a non-optimized
debug build of libabigail. We definitely need to invest in more speed
optimizations to handle webkit. That would be for another day, I
guess.
* src/abg-ir.cc (scope_decl::remove_member_decl): Reset the
translation unit and the scope of the removed decl.
(remove_decl_from_scope): Do not reset the scope of the removed
decl here as it's now done above.
Mark Wielaard [Fri, 29 Dec 2023 00:40:50 +0000 (01:40 +0100)]
Recognize EM_RISCV in e_machine_to_string
Check that EM_RISCV is defined in elf.h and if it is then recognize
it in e_machine_to_string, producing "elf-riscv".
* configure.ac: Defining HAVE_EM_RISCV_MACRO if EM_RISCV
is defined in elf.h.
* src/abg-dwarf-reader.cc (e_machine_to_string): Handle
EM_RISCV if HAVE_EM_RISCV_MACRO is defined.
Dodji Seketeli [Wed, 29 Nov 2023 13:35:47 +0000 (14:35 +0100)]
Bump LIBABIGAIL_SO_CURRENT version to 4
Recent patches change the ABI of the library, namely, by adding
parameters to functions like is_pointer_type or adding virtual member
functions to classes in the IR. Thus the LIBABIGAIL_SO_CURRENT
version has to be bumped from 3 to 4.
Dodji Seketeli [Fri, 1 Dec 2023 10:37:49 +0000 (11:37 +0100)]
Bump abixml version to 2.3
An older version of libabigail won't be able to grok new abixml files
containing the recently added support for pointer-to-member types.
It's thus needed to bump the minor version number of the abixml
format. The new version is thus 2.3. As a result, this patch also
updates the version numbers shown in the various abixml files of the
test suite.
[C] 'void (X::* pmf)(int)' was changed to 'void (X::* pmf)(int, char)' at test-ptr-to-mbr-v1.cc:8:1:
type of variable changed:
pointer-to-member type changed from: 'void (X::*)(int) to: 'void (X::*)(int, char)'
in containing type 'struct X' of pointed-to-member type 'void (X::*)(int)' at test-ptr-to-mbr-v1.cc:1:1:
type size changed from 32 to 8 (in bits)
1 data member change:
type of 'int a' changed:
type name changed from 'int' to 'char'
type size changed from 32 to 8 (in bits)
[C] 'int X::* pmi' was changed to 'char X::* pmi' at test-ptr-to-mbr-v1.cc:7:1:
type of variable changed:
pointer-to-member type changed from: 'int X::* to: 'char X::*'
in data member type 'int' of pointed-to-member type 'int X::*':
type name changed from 'int' to 'char'
type size changed from 32 to 8 (in bits)
containing type of pointer-to-member 'struct X' changed at test-ptr-to-mbr-v0.cc:1:1, as reported earlier
$
* include/abg-comparison.h (class ptr_to_mbr_diff): Declare new
class.
(ptr_to_mbr_diff_sptr): Declare new typedef.
(compute_diff): Declare new overload for ptr_to_mbr_diff.
(ptr_to_mbr_type_sptr): Declare new typedef.
* src/abg-comparison-priv.h (struct ptr_to_mbr_diff::priv): Define
* src/abg-comparison.cc (compute_diff_for_types): Support new
ptr_to_mbr_type type.
(ptr_to_mbr_diff::{ptr_to_mbr_diff, first_ptr_to_mbr_type,
second_ptr_to_mbr_type, member_type_diff, containing_type_diff,
has_changes, has_local_changes, get_pretty_representation, report,
chain_into_hierarchy, ~ptr_to_mbr_diff}): Define member functions
of class ptr_to_mbr_diff.
(compute_diff): Define overload for ptr_to_mbr_type_sptr.
* include/abg-fwd.h (ptr_to_mbr_type_sptr): Declare new typedef.
(is_ptr_to_mbr_type, is_pointer_to_ptr_to_mbr_type)
(is_typedef_of_maybe_qualified_class_or_union_type): Declare new
functions.
* include/abg-ir.h (type_maps::ptr_to_mbr_types): Declare new
accessor.
(POINTER_TO_MEMBER_TYPE): Add new enumerator to enum
type_or_decl_base::type_or_decl_kind.
(class ptr_to_mbr_type): Declare new class.
(equals): Declare new overload for ptr_to_mbr_type.
(ir_node_visitor::visit_{begin,end}): Declare new member
functions.
* src/abg-ir.cc (ptr_to_mbr_declaration_name)
(ptr_to_mbr_declaration_name, add_outer_ptr_to_mbr_type_expr)
(add_outer_pointer_to_ptr_to_mbr_type_expr): Define new static
functions.
(type_maps::priv::ptr_to_mbr_types_): Define new
data member.
(type_maps::ptr_to_mbr_types): Define new accessor.
(is_ptr_to_mbr_type, is_pointer_to_ptr_to_mbr_type)
(is_typedef_of_maybe_qualified_class_or_union_type): Define new
functions.
(maybe_update_types_lookup_map, equals): Define new overloads for
ptr_to_mbr_type_sptr.
(is_npaf_type): Use is_ptr_to_mbr_type.
(maybe_update_types_lookup_map): In the overload for
decl_base_sptr, call the new overload for ptr_to_mbr_type_sptr
above.
(struct ptr_to_mbr_type::priv): Define new struct.
(ptr_to_mbr_type::{ptr_to_mbr_type, get_member_type,
get_containing_type, operator==, get_qualified_name, traverse,
~ptr_to_mbr_type}): Define member functions of ptr_to_mbr_type.
(types_have_similar_structure): Support the new ptr_to_mbr_type
type.
(ir_node_visitor::visit_{begin,end}): Add new member functions.
(var_decl::get_pretty_representation): Support pretty-printing
pointer-to-member types.
(pointer_declaration_name, array_declaration_name): Likewise.
* include/abg-reporter.h ({reporter_base, default_reporter,
leaf_reporter}::report): Add an overload for ptr_to_mbr_diff.
(default_reporter::report_local_ptr_to_mbr_type_changes): Declare
a member function.
private data class of ptr_to_mbr_diff.
* src/abg-default-reporter.cc
(default_reporter::report_local_ptr_to_mbr_type_changes): Define
member functions.
(default_reporter::report): Define an overload for
ptr_to_mbr_diff.
* src/abg-leaf-reporter.cc (leaf_reporter::report): Likewise.
* src/abg-dwarf-reader.cc (build_ptr_to_mbr_type): Define new
function.
(build_ir_node_from_die): Use the new build_ptr_to_mbr_type
function.
* src/abg-reader.cc (build_ptr_to_mbr_type): Define new function.
(build_type): Use the new build_ptr_to_mbr_type above.
* src/abg-writer.cc (write_ptr_to_mbr_type): Define new function.
(write_type, write_decl, write_member_type): Use the new
write_ptr_to_mbr_type above.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr1-output-1.txt:
Add new test material.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr1-v0.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr1-v0.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr1-v1.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr1-v1.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr2-output-1.txt:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr2-v0.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr2-v0.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr2-v1.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr2-v1.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr3-output-1.txt:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr3-v0.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr3-v0.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr3-v1.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr3-v1.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr4-output-1.txt:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr4-v0.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr4-v0.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr4-v1.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr4-v1.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr5-output-1.txt:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr5-v0.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr5-v0.o:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr5-v1.cc:
Likewise.
* tests/data/test-abidiff-exit/pointer-to-member/test-ptr-to-mbr5-v1.o:
Likewise.
* tests/data/test-read-dwarf/test-pointer-to-member-1.cc:
Likewise.
* tests/data/test-read-dwarf/test-pointer-to-member-1.o: Likewise.
* tests/data/test-read-dwarf/test-pointer-to-member-1.o.abi:
Likewise.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the test material
above to this test harness.
* tests/test-annotate.cc (in_out_specs): Likewise.
* tests/test-read-dwarf.cc: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Adjust.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
Dodji Seketeli [Thu, 30 Nov 2023 15:46:34 +0000 (16:46 +0100)]
Improve type naming
There are a number of glitches when pretty-printing type names.
This is particularly true for derived types like pointer to functions,
array of pointer to functions and the likes.
For instance, we can see in
tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt that a
function N that takes no parameter and returns a pointer to an array
of 7 int is pretty-printed as:
int[7]* N()
That obviously doesn't respect the type naming rules of C or C++.
With this patch, function N is declared as:
int(*N(void))[7]
To learn more about the impact of the patch on how types are
pretty-printed, you can look at the parts of the patch that are
adjustments to the expected output of the regression tests.
For instance, here is how the expected output of type pretty-printing
in tests/data/test-abidiff-exit/PR30048-test-2 is modified by this
patch:
- [C] 'function int[7]* N()' at PR30048-test-2-v0.cc:62:1 has some indirect sub-type changes:
+ [C] 'function int(*N(void))[7]' at PR30048-test-2-v0.cc:62:1 has some indirect sub-type changes:
return type changed:
- entity changed from 'int[7]*' to 'int'
+ entity changed from 'int(*)[7]' to 'int'
type size changed from 64 to 32 (in bits)
- [C] 'function int* O()' at PR30048-test-2-v0.cc:64:1 has some indirect sub-type changes:
+ [C] 'function int* O(void)' at PR30048-test-2-v0.cc:64:1 has some indirect sub-type changes:
return type changed:
entity changed from 'int*' to 'int'
type size changed from 64 to 32 (in bits)
- [C] 'function int ()* P()' at PR30048-test-2-v0.cc:67:1 has some indirect sub-type changes:
+ [C] 'function int (*P(void))(void)' at PR30048-test-2-v0.cc:67:1 has some indirect sub-type changes:
return type changed:
- entity changed from 'int ()*' to 'int'
+ entity changed from 'int (*)(void)' to 'int'
type size changed from 64 to 32 (in bits)
Note that the change to the CTF test
tests/data/test-read-ctf/test9.o.abi is triggered by a change in the
sorting of types because types are sorted alphabetically.
All in all, this is clearly an overdue improvement to the type name
pretty-printing.
* include/abg-fwd.h (is_npaf_type, is_pointer_to_function_type)
(is_pointer_to_array_type, is_pointer_to_npaf_type): Declare new
functions.
(is_pointer_type, is_reference_type, is_array_type): Take a
boolean parameter to look through qualifiers.
* include/abg-ir.h (is_pointer_type): Do not make this function a
friend of the type_or_decl_base class anymore.
* src/abg-ir.cc (pointer_declaration_name, array_declaration_name)
(stream_pretty_representation_of_fn_parms)
(add_outer_pointer_to_fn_type_expr)
(add_outer_pointer_to_array_type_expr): Define new static
functions.
(is_npaf_type, is_pointer_to_function_type)
(is_pointer_to_array_type, is_pointer_to_npaf_type): Define new
functions.
(get_type_representation): Remove the overload for array_type_def.
(get_function_type_name, get_method_type_name)
(function_decl::get_pretty_representation_of_declarator): Use the
new stream_pretty_representation_of_fn_parms. This actually
factorizes parameters pretty-printing by reusing
stream_pretty_representation_of_fn_parms.
(is_pointer_type, is_reference_type, is_array_type): Take a
boolean parameter to look through qualifiers.
(is_void_pointer_type): Use const where it's due.
(pointer_type_def::get_qualified_name): Use the new
pointer_declaration_name in lieu of the old and removed
get_name_of_pointer_to_type.
(array_type_def::{get_pretty_representation, get_qualified_name}):
Use the new array_declaration_name instead of the old and removed
get_type_representation.
(var_decl::get_pretty_representation): Use the new
array_declaration_name and pointer_declaration_name.
(function_decl::get_pretty_representation): Use the new
add_outer_pointer_to_array_type_expr, and
add_outer_pointer_to_array_type_expr function to support the
proper syntax for function returning pointers and arrays.
(function_decl::parameter::get_pretty_representation): Fix the
pretty-printing of each function parameter.
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
* tests/data/test-abicompat/test0-fn-changed-report-2.txt:
Likewise.
* tests/data/test-abicompat/test1-fn-removed-report-0.txt:
Likewise.
* tests/data/test-abicompat/test3-fn-removed-report-0.txt:
Likewise.
* tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt: Likewise.
* tests/data/test-abidiff-exit/PR30048-test-report-0.txt: Likewise.
* tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt: Likewise.
* tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt: Likewise.
* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-1.txt: Likewise.
* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-2.txt: Likewise.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
Likewise.
* tests/data/test-abidiff-exit/test-fun-param-report.txt:
Likewise.
* tests/data/test-abidiff-exit/test-ld-2.28-210.so--ld-2.28-211.so.txt:
Likewise.
* tests/data/test-abidiff-exit/test-leaf-fun-type-report.txt:
Likewise.
* tests/data/test-abidiff-exit/test-leaf-more-report.txt:
Likewise.
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
Likewise.
* tests/data/test-abidiff-exit/test-leaf-stats-report.txt:
Likewise.
* tests/data/test-abidiff-exit/test-net-change-report0.txt:
Likewise.
* tests/data/test-abidiff-exit/test-net-change-report2.txt:
Likewise.
* tests/data/test-abidiff-exit/test2-filtered-removed-fns-report0.txt:
Likewise.
* tests/data/test-abidiff/test-PR18791-report0.txt: Likewise.
* tests/data/test-abidiff/test-crc-report-0-1.txt: Likewise.
* tests/data/test-abidiff/test-crc-report-1-0.txt: Likewise.
* tests/data/test-abidiff/test-crc-report-1-2.txt: 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/test21-pr19092.so.abi: Likewise.
* tests/data/test-annotate/test7.so.abi: Likewise.
* tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt:
Likewise.
* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test24-added-fn-parms-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test32-fnptr-changes-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test33-fnref-changes-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test5-report.txt: Likewise.
* tests/data/test-diff-filter/test-PR26739-2-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.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/test6-report.txt: Likewise.
* tests/data/test-diff-filter/test7-report.txt: Likewise.
* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt:
Likewise.
* tests/data/test-diff-pkg/PR24690/PR24690-report-0.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/libxcrypt-4.1.1-6.el8.x86_64--libxcrypt-compat-4.4.18-3.el9.x86_64-report-1.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/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.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-pkg-ctf/gmp-6.x.x86_64-report-0.txt:
Likewise.
* tests/data/test-diff-pkg-ctf/test-rpm-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-3.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-5.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-7.txt:
Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-2.txt:
Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-5.txt:
Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-3.txt:
Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt:
Likewise.
* tests/data/test-diff-suppr/test27-add-aliased-function-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test27-add-aliased-function-report-3.txt:
Likewise.
* tests/data/test-diff-suppr/test27-add-aliased-function-report-4.txt:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-report-2.txt:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-report-4.txt:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-report-5.txt:
Likewise.
* tests/data/test-diff-suppr/test30-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test32-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test32-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp-report-1.txt:
Likewise.
* tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt:
Likewise.
* tests/data/test-read-ctf/test9.o.abi: 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/test-libaaudio.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.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/test19-pr19023-libtcmalloc_and_profiler.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/test7.so.abi: Likewise.
* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise.
Dodji Seketeli [Thu, 30 Nov 2023 16:57:21 +0000 (17:57 +0100)]
abilint: Alphabetically sort programs options
It's a mess to find an option you are looking for both in the manual
or when doing abilint --help. So how about sorting the options of the
various libabigail programs, starting from abilint? Here we go.
* doc/manuals/abilint.rst: Alphabetically sort options in the
manual.
* tools/abilint.cc (display_usage): Likewise for the help strings.
Dodji Seketeli [Tue, 31 Oct 2023 17:11:52 +0000 (18:11 +0100)]
abilint: Support --annotate
It turns out abilint doesn't support the "--annotate" option like
abidw does. Annoying. Added thus.
* tools/abilint.cc (options::annotate): Define new data member.
(options::options): Initialize.
(display_usage): Add help string.
(parse_command): Support the --annotate command options.
(main): Set the annotate option on the context.
In the past, it was common to have a "fake flex array" at the end of a
structure. Like this:
Nowadays, with improved compiler support, it's more common to use a real
flex array. As this is a common change which changes ABI representation
in a compatible way, we should have a suppression for it.
For example, if you have a change like this:
struct foo
{
int x;
int flex[1];
};
...
struct foo
{
int x;
int flex[];
};
abidiff reports:
[C] 'struct foo' changed:
type size changed from 64 to 32 (in bits)
1 data member change:
type of 'int flex[1]' changed:
type name changed from 'int[1]' to 'int[]'
array type size changed from 32 to 'unknown'
array type subrange 1 changed length from 1 to 'unknown'
With a new has_strict_flexible_array_data_member_conversion property,
users can specify a suppression which stops abidiff from emitting
this diff for any "fake" flex arrays being converted to real ones:
* include/abg-comp-filter.h (has_strict_fam_conversion): Declare
new functions.
* include/abg-fwd.h
(ir::has_fake_flexible_array_data_member): Declare new accessor
functions.
* include/abg-suppression.h
(type_suppression::{,set_}has_strict_fam_conversion): Declare new
accessor functions.
* src/abg-comp-filter.cc (has_strict_fam_conversion): Define new
functions.
* src/abg-ir.cc
(ir::has_fake_flexible_array_data_member): Define new accessor
functions.
* src/abg-suppression-priv.h
(type_suppression::priv::has_strict_fam_conv_): Define new
data member.
* src/abg-suppression.cc
(type_suppression::{,set_}has_strict_fam_conversion): Define new
accessor functions.
(type_suppression::suppresses_diff): For a type suppression to
match a fake flex array conversion, either the size of the type
hasn't change or has_size_change must be true and then the type
must change from a fake flex array to a real flex array.
(read_type_suppression): Parse the new
'has_strict_flexible_array_data_member_conversion' property to
set the type_suppression::set_has_strict_fam_conversion property.
* doc/manuals/libabigail-concepts.rst: Add an entry for the new
'has_strict_flexible_array_data_member_conversion' property.
* tests/data/test-diff-suppr/test-has-strict-flexible-array-data-member-conversion-{1,2}.suppr:
Add new test suppression files.
* tests/data/test-diff-suppr/test-has-strict-flexible-array-data-member-conversion-report-{1,2}.txt:
Add new test reference output files.
* tests/data/test-diff-suppr/test-has-strict-flexible-array-data-member-conversion-v{0,1}.c:
Add source code for new binary test input files.
* tests/data/test-diff-suppr/test-has-strict-flexible-array-data-member-conversion-v{0,1}.o:
Add new binary test input files.
* tests/data/Makefile.am: Add the new test files to the source
distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
files to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com> Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Dodji Seketeli [Wed, 8 Nov 2023 13:46:04 +0000 (14:46 +0100)]
Bug 31045 - Don't try setting translation unit for unique types
Unique types (void, pointer to void and variadic parameter types)
should not have their translation unit set whenever they are being
added to a scope. This is because they are supposed to be created
independently from any translation unit, even if technically, they are
set to the translation unit they are referenced from, for the first
time.
To handle this, a new function maybe_set_translation_unit is created
to handle the setting of the translation unit for decls added to a
scope by scope_decl::{add,insert}_member_decl. That new function
asserts that unique types should have their translation unit be set.
* src/abg-ir.cc (maybe_set_translation_unit): Define new static
function.
(scope_decl::{add,insert}_member_decl): Use it.
* tests/data/test-abidiff-exit/PR31045/zfs-abigail-2.4/libnvpair.{abi,so,suppr}:
New test input files.
* tests/data/test-abidiff-exit/PR31045/zfs-abigail-2.4/test-PR31045-report-1.txt:
New reference test output.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the input above
to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com> Tested-by: Paolo Pisati <paolo.pisati@canonical.com>
Dodji Seketeli [Fri, 20 Oct 2023 16:19:48 +0000 (18:19 +0200)]
gen-changelog.py: Fix a long standing typo
While looking at something else, I stumbled upon a long standing
copy-paste typo where we refer to original GNET (from gstreamer) in
lieu of libabigail. Fixed thus.
* gen-changelog.py (get_rel_tags): It's libabigail, not GNET.
Dodji Seketeli [Wed, 18 Oct 2023 09:57:56 +0000 (11:57 +0200)]
suppression: Make the "end" data member offset selector be named boundary
Now that we have what is called a "named boundary", introduced by
commit [1], this patch re-writes the handling of the "end" data member
offset selector (used in expressions like: offset_of(end) in
suppression specifications) in terms of the new "named boundary"
infrastructure. In other words, the "end" keyword is now a named
boundary constant, just like the
"offset_of_flexible_array_data_member" is a named boundary constant.
[1]: The patch that introduced the concept of "named boundary" is this
one:
Support suppressing data member insertion before a flexible array member
* src/abg-suppression.cc (END_STRING): Define new static string
constant accessor.
(type_suppression::insertion_range::eval_boundary): Eval the "end"
named boundary as having a numerical value of
std::numeric_limits<uint64_t>::max().
(read_type_suppression): Parse the "end" token as a named
boundary.
[C] 'function void foo(foo*)' at test-v0.c:8:1 has some indirect sub-type changes:
parameter 1 of type 'foo*' has sub-type changes:
in pointed to type 'struct foo' at test-v1.c:1:1:
type size changed from 32 to 64 (in bits)
1 data member insertion:
'char member1', at offset 32 (in bits) at test-v1.c:4:1
1 data member change:
'char pad[]' offset changed from 32 to 40 (in bits) (by +8 bits)
returned value: 4
$
This patch allows users to suppress this change report using a new
property value to the "has_data_member_inserted_at" property of the
[suppress_type] directive. The resulting suppression specification
reads:
The patch adds new test cases and updates the documentation to add a
mention to the new offset_of_flexible_array_data_member named
boundary.
* doc/manuals/libabigail-concepts.rst: Add documentation for the
new "offset_of_flexible_array_data_member" named boundary.
* include/abg-fwd.h (has_flexible_array_data_member): Declare new
function.
* src/abg-ir.cc (has_flexible_array_data_member): Define it.
* include/abg-suppression.h
(type_suppression::insertion_range::named_boundary_sptr): Define
new typedef.
(type_suppression::insertion_range::create_named_boundary): Declare
new static function member function.
(is_named_boundary): Declare new function.
(class type_suppression::insertion_range::named_boundary): Declare
new type.
* src/abg-suppression.cc
(struct type_suppression::insertion_range::named_boundary::priv):
Define new private type.
(OFFSET_OF_FLEXIBLE_ARRAY_DATA_MEMBER_STRING): Define new static
constant string getter function.
(type_suppression::insertion_range::create_named_boundary): Define
new static member function.
(is_named_boundary): Define new function.
(read_type_suppression): Parse the new
"offset_of_flexible_array_data_member" named boundary.
(type_suppression::insertion_range::eval_boundary): Evaluate the
new "offset_of_flexible_array_data_member" named boundary.
* tests/data/test-abidiff-exit/test-fam1-report-[1-5].txt: New
reference test output.
* tests/data/test-abidiff-exit/test-fam2-report-1.txt: Likewise.
* tests/data/test-abidiff-exit/test-fam1-suppr-[1-4].abignore: New test
suppression specification.
* tests/data/test-abidiff-exit/test-fam{1,2}-v{0,1}.o: New test input
binaries.
* tests/data/test-abidiff-exit/test-fam{1,2}-v{0,1}.c: Source code of
the test input binaries.
* tests/data/Makefile.am: Add the new test material to the source
distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the new test
input to this harness.
Following the changes to represent changed anonymous unreachable enums,
this patch does the same for anonymous unreachable unions, classes and
structs.
Basically, without this patch, this change:
union
{
int a;
int b;
};
------
union
{
int a;
int b;
int c;
};
yields:
1 removed type unreachable from any public interface:
[D] 'union {int a; int b;}' at test_1.c:1:1
1 added type unreachable from any public interface:
[A] 'union {int a; int b; int c;}' at test_2.c:1:1
But with the patch, it does yield:
1 changed type unreachable from any public interface:
[C] 'union {int a; int b;}' changed:
type size hasn't changed
1 data member insertion:
'int c' at test-anon-union-v1.c:5:1
type changed from:
union {int a; int b;}
to:
union {int a; int b; int c;}
* include/abg-fwd.h (class_or_union_types_of_same_kind)
(is_data_member_of_anonymous_class_or_union): Declare new
functions.
* include/abg-ir.h (lookup_data_member): Likewise, declare a new overload.
* src/abg-ir.cc (class_or_union_types_of_same_kind)
(lookup_data_member, is_data_member_of_anonymous_class_or_union):
Define news functions & overloads.
* src/abg-reporter-priv.cc (represent): When representing a change
in the name of a data member, if the context is an anonymous type,
use the non-qualified name of the data member, not its qualified
name.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Handle
deleted/added anonymous enums, unions, classes and structs
similarly. That is, if an anonymous type was removed and another
one got added, if they both have data members (or enumerators) in
common, then we are probably looking at an anonymous type that was
changed. This is because these anonymous types are named using
their flat representation.
* tests/data/test-abidiff-exit/test-anon-types-report-1.txt: New
reference test comparison output.
* tests/data/test-abidiff-exit/test-anon-types-v{0,1}.o: New
binary tests input files.
* tests/data/test-abidiff-exit/test-anon-types-v{0,1}.c: Source
code of new binary test input.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the test inputs
above to this test harness.
Now that added/removed non-reachable anonymous enums is supported, we
want to represent changing an anonymous enum.
Strictly speaking, adding or removing an enumerator from an anonymous
enum is represented as deleting of the anonymous enum in the old
state and the addition of an anonymous enum in the new state.
This patch analyses the added/removed anonymous enums and if the old
enum has enumerators contained in the new one, then it assumes we are
looking at anonymous enum change.
* include/abg-ir.h (is_enumerator_present_in_enum): Declare new
public function.
* src/abg-ir.cc (is_enumerator_present_in_enum): Turn this
static function into a public one.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Detect that
an removed/added anonymous enum is actually a changed anonymous
enum and represent it as such.
* tests/data/test-abidiff-exit/test-anonymous-enums-change-report-v{0,1}.txt:
New reference test output files.
* tests/data/test-abidiff-exit/test-anonymous-enums-change-v{0,1}.c:
Source code for the some input test binary.
* tests/data/test-abidiff-exit/test-anonymous-enums-change-v{0,1}.o:
New test input binaries.
* tests/data/Makefile.am: Add the new test materials above to
source distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the new test
input to the harness.
ir,comparison,corpus: Better support anonymous enums comparison
Anonymous enums are designated using their internal names which are
automatically generated. The problem however is that whenever a new
anonymous enum gets inserted in the translation unit, that can
randomly change the name of existing anonymous enums. This makes
reporting of changes in anonymous enums essentially useless.
To address this issue, this patch uses flat representation for
anonymous enums, for the purpose of designating them outside of the
context of type canonicalization. This is like what is done already
for anonymous classes and unions.
* include/abg-fwd.h (get_enum_flat_representation)
(get_class_or_enum_flat_representation): Declare new functions.
* include/abg-ir.h (enum_type_decl::get_sorted_enumerators):
Declare new member functions.
* src/abg-comparison.cc
(corpus_diff::priv::{ensure_lookup_tables_populated,
added_unreachable_type_is_suppressed,
deleted_unreachable_type_is_suppressed,
record_type_as_reachable_from_public_interfaces}): Use
non-internal pretty representation to designate ABI artifacts so
that anonymous enums get designated by their flat representation.
* src/abg-corpus.cc (corpus::type_is_reachable_from_public_interfaces):
Likewise.
* src/abg-ir.cc (get_type_name): The type name of an anonymous
enum or class should is now the flat representation if we are not
in the context of type canonicalization.
(enum_type_decl::get_pretty_representation): If we are not in the
context of type canonicalization, the pretty representation of an
enum is its flat representation.
(get_enum_flat_representation)
(get_class_or_enum_flat_representation): Define new functions.
(enum_type_decl::get_sorted_enumerators): Likewise.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/test-anonymous-members-0.o.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.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-diff-dwarf/test43-PR22913-report-0.txt:
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/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
default-reporter,reporter-priv: Do not report names of anonymous enums
When reporting changes of anonymous enums, do not try to report their
qualified name as that doesn't make any sense -- they are anonymous.
Similarly, in report_name_size_and_alignment_changes do not try to
report about changes in the name of an anonymous enum.
* src/abg-default-reporter.cc (default_reporter::report): In the
overload for enum_diff, do not get the qualified name of anonymous
enums.
* src/abg-reporter-priv.cc
(report_name_size_and_alignment_changes): Do not report about name
changes for anonymous enums.
Currently, users are able to suppress changes to enumerator variants
matching names specified in "changed_enumerators", but can't specify
regular expressions.
A common pattern when using enums is to have the final enum variant
labeled as "*_MAX" or "*_LAST" so that users of the enum can have a
way to determine how many variants there are. In these cases, when
expanding an enum, the last variant will change, but that's an
expected result that users may not want to flag as an ABI-breaking
change.
For example, if you have a change like this:
enum foo {
FOO,
BAR,
FOOBAR_MAX,
};
...
enum foo {
FOO,
BAR,
BAZ,
FOOBAR_MAX,
};
abidiff reports:
1 changed type unreachable from any public interface:
[C] 'enum foo' changed:
type size hasn't changed
1 enumerator insertion:
'foo::BAZ' value '2'
1 enumerator change:
'foo::FOOBAR_MAX' from value '2' to '3' at test_2.c:1:1
With a new changed_enumerators_regexp property, users can specify a
suppression which stops abidiff from emitting this diff for any
members which match the regular expressions in the list:
* include/abg-suppression.h
(type_suppression::{g,s}et_changed_enumerators_regexp): Declare new
accessor functions.
* src/abg-suppression-priv.h
(type_suppression::priv::changed_enumerators_regexp_): Define new
data member.
* src/abg-suppression.cc
(type_suppression::{g,s}et_changed_enumerators_regexp): Define new
accessor function.
(type_suppression::suppresses_diff): For a type suppression to
match an enum_diff, the names of all changed enumerators must
match either the names returned by
type_suppression::get_changed_enumerator_names or one of the
regexps returned by the new member function
type_suppression::get_changed_enumerators_regexp.
(read_type_suppression): Parse the new
'changed_enumerators_regexp' property to set the
type_suppression::get_changed_enumerators_regexp property.
* doc/manuals/libabigail-concepts.rst: Add an entry for the new
'changed_enumerators_regexp' property.
* tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-[1-5].suppr:
Add new test suppression files.
* tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-[0-5].txt:
Add new test reference output files.
* tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v{0,1}.c:
Add source code for new binary test input files.
* tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v{0,1}.o:
Add new binary test input files.
* tests/data/Makefile.am: Add the new test files to the source
distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
files to this test harness.
Signed-off-by: John Moon <quic_johmoo@quicinc.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Dodji Seketeli [Mon, 16 Oct 2023 12:10:50 +0000 (14:10 +0200)]
Bug 30971 - Wrong interpretation of "has_data_member_inserted_at"
Consider the following construct:
struct foo
{
long x;
long y;
};
Then change one of the types (but keep the size the same):
struct foo
{
long x;
unsigned long y;
};
If I abidiff this with no suppressions, I get:
[C] 'struct foo' changed:
type size hasn't changed
1 data member change:
type of 'long int y' changed:
type name changed from 'long int' to 'unsigned long int'
type size hasn't changed
However, it seems like if I add any struct suppression involving data member
insertions, it filters out the change. For example:
This is because during the evaluation of the
"has_data_member_inserted_at" property, we fail to take into account
that if no data member got inserted, evaluation of the
"has_data_member_inserted_at" predicate is falsified, and thus, the
type suppression is falsified.
While looking at this, I also realized that when a data member
replaces another one, we fail to consider that change as a data member
insertion and so the evaluation of the "has_data_member_inserted_at"
predicate is wrongly falsified.
This patch fixes these two related issues.
* include/abg-comparison.h
(class_or_union_diff::changed_data_members): Declare new accessor.
function.
* src/abg-comparison.cc
(class_or_union_diff::changed_data_members): Define new accessor.
function.
* src/abg-suppression.cc (type_suppression::suppresses_diff): If
the type suppression specification contains a
has_data_member_inserted_* property and yet the class contains no
data member inserted or replacing an existing one, then the type
suppression is falsified in the context of the current change.
Also, when a data member replaces an existing one, consider that
as an insertion for which the has_data_member_inserted_* predicate
should be evaluated. Stop considering deleted data members
because considering replaced data member is really what we meant.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-2-report.[1-3].txt:
New reference test output files.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-2-report.txt:
Likewise.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-{2,3}-v{0,1}.o:
New input test binaries.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-{2,3}-v{0,1}.c:
Source code of the new input test binaries.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-2.2.suppr:
New input test suppression specification.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-2.suppr: Likewise.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the test input
above to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com> Tested-by: John Moon <quic_johmoo@quicinc.com>
Dodji Seketeli [Thu, 12 Oct 2023 11:28:43 +0000 (13:28 +0200)]
ir: Remove redundant virtual member functions
G++ 13.2.1 complains that virtual member functions
{qualified_type_def,pointer_type_def,class_or_union}::operator!= are
redundant with type_base::operator!=, and rightfully so. This patch
removes those useless virtual member functions.
* include/abg-ir.h
({qualified_type_def,pointer_type_def,class_or_union}::operator!=):
Remove these redundant virtual data members.
The parser wrongly considers that in the regular expression
".*p[0-9]?$", the characters '[' and ']' should be escaped. Fixed
thus.
* src/abg-ini.cc (char_is_function_name_char): The only delimiters
should be the '(' and ')' characters.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-2.txt:
New reference test output.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1.2.suppr:
New suppression specification.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test
material above to this test harness.
Dodji Seketeli [Wed, 11 Oct 2023 10:51:47 +0000 (12:51 +0200)]
Bug 30959 - Crash on malformed fn call expression
The code fails to ignore a function call expression that is considered
malformed by the type suppression parser. Fixed thus.
* src/abg-suppression.cc
(type_suppression::insertion_range::eval_boundary): If the
function call expression is considered malformed, then do not
crash.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt:
New reference test output.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v{0,1}.c:
Source code of the new input binaries.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v{0,1}.o:
New input binaries.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr:
New test suppression specification.
* tests/data/Makefile.am: Add the new test material above to the
source distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new tests to
this harness.
abg-comparison[-priv]: Better detection of incompatible unreachable type changes
Whenever there is a change in unreachable type,
corpus_diff::has_incompatible_changes always reports that the
corresponding diff node carries an incompatible change. It does this
even if the change is known to be compatible.
To be able to say if a diff node for a unreachable type carries a
compatible (not incompatible) change,
corpus_diff::has_incompatible_changes must look at the change category
of that diff node, instead of saying that any change to an unreachable
type is incompatible.
While looking at this, I noted that
corpus_diff::priv::apply_filters_and_compute_diff_stats doesn't
categorize the diffs in
corpus_diff::priv::changed_unreachable_types_, so it's not possible to
look at the categories of the changes held by that data member to see
if they are incompatible or not.
This patch thus categorizes the diff nodes held by
corpus_diff::priv::changed_unreachable_types_ and makes
corpus_diff::has_incompatible_changes look at those diff nodes to
detect if they are incompatible.
Let's see the result of this patch.
Consider the change in the input test source code from included in
this patch, from test-enumerator-changes1-v0.c to test-enumerator-changes1-v1.c:
The enumerator E1_2 has been added to the 'foo' enum.
Now, let's see what abidiff prior to this patch would say about the
change between the two result binaries test-enumerator-changes1-v0.o
and test-enumerator-changes1-v1.o:
1 changed type unreachable from any public interface:
[C] 'enum foo' changed:
type size hasn't changed
1 enumerator insertion:
'foo::E1_2' value '2'
return value: 12
$
See the return value of 12, that is actually the bits
abigail::tools_utils::ABIDIFF_ABI_CHANGE (of value 4) and
abigail::tools_utils::ABIDIFF_ABI_INCOMPATIBLE_CHANGE (of value 8) being set.
Normally, only the bit abigail::tools_utils::ABIDIFF_ABI_CHANGE (of
value 4) should be set.
Now, let's look at what abidiff says with this patch:
1 changed type unreachable from any public interface:
[C] 'enum foo' changed:
type size hasn't changed
1 enumerator insertion:
'foo::E1_2' value '2'
return value: 4
$
Now the return value is 4, which is the bit
abigail::tools_utils::ABIDIFF_ABI_CHANGE being set, as we would expect
because that change is known to be not incompatible.
* Src/abg-comparison-priv.h
(corpus_diff::priv::changed_unreachable_types): Declare ...
* src/abg-comparison.cc
(corpus_diff::priv::changed_unreachable_types): ... new function.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Walk
the nodes returned by corpus_diff:priv::changed_unreachable_types
and apply the filters (including categorization filters) to them.
Also make the loop similarly applying filters to the nodes
returned by corpus_diff::priv::changed_unreachable_types_sorted be
a ranged-based one, for the sake of consistency.
(corpus_diff::has_incompatible_changes): Now that diff nodes
returned by corpus_diff::priv::changed_unreachable_types are
categorized, look at their change categories to see if they are
incompatible or not.
* tests/data/test-abidiff-exit/test-enumerator-changes1-report-1.txt:
New test output reference.
* tests/data/test-abidiff-exit/test-enumerator-changes1-v{0,1}.o:
New test input binaries.
* tests/data/test-abidiff-exit/test-enumerator-changes1-v{0,1}.c:
New source code for the new test input binaries.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the new test
input binaries to the test harness.
comparison: Always apply filters on the diff graph
When looking at something else, I noticed that
diff_context::maybe_apply_filters doesn't apply the filters (i.e, the
various passes) on the diff graph if all the categories of changes are
allowed, typically when --harmless is passed to abidiff.
This is wrong because even if all the categories are allowed, the
changes carried by nodes of the diff graph should still be
categorized. This was an early optimization dating back from the
times where the filtering was slow.
* src/abg-comparison.cc (diff_context::maybe_apply_filters): Do
not get out when all the categories of diff changes are allowed.
configure,test-diff-pkg.cc: Handle symlinks presence in dist tarball
Since the commit below, there are tests that require symbolic links.
Unfortunately, the tar command used to construct tarballs copies the
target of a symbolic link (and thus doesn't keep the symlink) for the
purpose of greater portability, as some platforms don't support
symbolic links.
This patch uses a tar command that keeps the symlinks in place for the
tests introduced by the commit below to keep working. On some
platforms however, symlinks are removed from the tarball no matter
what. In those case, the test that needs symlinks is disabled.
Here is the commit in question:
bad389f abipkgdiff: Avoid comparing binaries that are outside of the package
* configure.ac: Use "tar -cf" instead of "tar -chf" to construct
the tarball. Detect if the presence of the symlink in the
distribution and define the WITH_SYMLINKS_KEPT_IN_DIST
preprocessor macro accordingly.
* tests/test-diff-pkg.cc (in_out_specs): If symlinks are not
present in the tarball then the test that requires symlinks is
deactivated. Also, fix the
data/test-diff-pkg/symlink-dir-test1/dir1 test to make it point to
the target of the symlinks directly, to avoid considering a binary
twice, in cases where symlink targets are copied.
* src/abg-elf-reader.cc (reader::initialize): Use older-style
initialization to keep the old lady happy.
* src/abg-ir-priv.h (canonicalize_types): Avoid using type
deduction in this context to keep the old lady happy.
Dodji Seketeli [Tue, 15 Aug 2023 11:26:19 +0000 (13:26 +0200)]
dwarf-reader: Do not re-use typedefs in a scope
Sometimes, two typedefs of the same name can appear at the same scope
but point to different types, in DWARF. Unbelievable but true. In
those case, we do not want to re-use the typedef, obviously, as we can
possibly misrepresent the type graph in that case.
This fixes one self-comparison issue for the x86_64 sub-package of the
gcc-gnat package that is tested by doing:
$ fedabipkgdiff --self-compare -a --from fc37 gcc-gnat
* src/abg-dwarf-reader.cc (build_ir_node_from_die): Do not re-use
a typedef from a given scope.
* src/abg-reader.cc (build_typedef_type): Do not re-use typedefs
with the same ID.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Adjust.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
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-read-dwarf/PR22122-libftdc.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/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.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.
Dodji Seketeli [Tue, 15 Aug 2023 11:52:34 +0000 (13:52 +0200)]
ir: Fix qualification as non-confirmed propagated canonical types
While looking at something else, there are some types considered
having "non-confirmed propagated canonical type", even though those
types are not even canonical-type-propagated. This patch fixes that.
That doesn't have any visible impact, but it's definitely more
correct.
* src/abg-ir.cc (return_comparison_result): A type that doesn't
have propagated canonical type can't be considered having
"non-confirmed propagated canonical type".
Dodji Seketeli [Thu, 17 Aug 2023 13:37:02 +0000 (15:37 +0200)]
ir: Use non qualified typedef name for type canonicalization
While looking into fixing self-comparison errors for the gcc-gnat
package[1], I stumbled upon the fact that a typedef that is defined in
the global scope is different from a typedef defined in a scope, even
if they both point to the same underlying type. This is a spurious
difference that feeds a spurious explosion of the number of canonical
types, for no reason. It can lead to spurious self-comparison errors
down the road. Sadly, fixing this issue is not enough to fix the
self-comparison error in [1].
[1]: The command is:
$ fedabipkgdiff --self-compare -a --from fc37 gcc-gnat
* include/abg-ir.h (reference_type_def::{pointed_to_type_,
is_lvalue_}): Remove these data members.
(reference_type_def::priv_): Add a unique data member.
(typedef_decl::get_qualified_name): Add new virtual member
functions.
* src/abg-ir.cc (get_decl_name_for_comparison): If the decl we are
comparing is a typedef, only consider its non-qualified name.
(get_type_name): For internal purposes, the type name of a typedef
is its non-qualified name.
(pointer_type_def::get_qualified_name): For internal purposes, if
the pointed-to name is a typedef, use the non-qualified name of
the typedef.
(reference_type_def::priv): Define new data type.
(reference_type_def::reference_type_def): Initialize the new
reference_type_def::priv_ data member and adjust to the move of
the reference_type_def::pointed_to_type_ data member to
reference_type_def::priv::pointed_to_type_.
(reference_type_def::{s,g}et_pointed_to_type): Adjust.
(reference_type_def::is_lvalue): Likewise.
(reference_type_def::get_qualified_name): Support caching
qualified names for internal and non-internal purposes.
(typedef_decl::get_pretty_representation): For internal purposes,
use non-qualified typedef name.
(typedef_decl::get_qualified_name): Define the two overloads for
this virtual member function.
(function_decl::get_pretty_representation): Use the
'qualified_name' parameter. Also, rather than systematically
using the qualified name of the return type, use get_type_name
instead that knows when to use qualified names and when not to.
(qualified_name_setter::do_update):
* 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/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-diff-dwarf/test42-PR21296-clanggcc-report0.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.hash.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/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/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: 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.
Dodji Seketeli [Thu, 17 Aug 2023 14:51:35 +0000 (16:51 +0200)]
ir: Really avoid canonicalizing decl-only classes
is_non_canonicalized_type uses is_declaration_only_class_or_union_type
to detect decl-only classes, but it doesn't differentiate between
decl-only classes that are associated to a class definition and those
that are not.
We want to avoid canonicalizing decl-only classes that are not
associated to any class definition.
This patch fixes the invocation of
is_declaration_only_class_or_union_type to express the above
assertion.
This fix uncovered another self-comparison issue that was being
expressed when running the command below:
That one was due to an error in method_decl::set_linkage_name which
was making classes contain the wrong overloads of methods. The patch
fixes that error too.
* include/abg-fwd.h (is_pointer_to_decl_only_class_or_union_type)
(is_reference_to_decl_only_class_or_union_type)
(is_typedef_to_decl_only_class_or_union_type): Remove declarations.
(is_typedef_ptr_or_ref_to_decl_only_class_or_union_type): Declare
new function.
* src/abg-ir.cc (is_pointer_to_decl_only_class_or_union_type)
(is_reference_to_decl_only_class_or_union_type)
(is_typedef_to_decl_only_class_or_union_type): Remove definitions.
(is_typedef_ptr_or_ref_to_decl_only_class_or_union_type): Define
new function.
(is_non_canonicalized_type): Change the invocation of
is_declaration_only_class_or_union_type to make it look through
decl-only types. Use
is_typedef_ptr_or_ref_to_decl_only_class_or_union_type in lieu of
is_{pointer,reference,typedef}_to_decl_only_class_or_union_type
that got removed.
(method_decl::set_linkage_name): Remove the mapping between the
method and the old linkage name, only if the old name is different
from the new name. Duh.
* tests/data/test-annotate/libtest23.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/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.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/PR25007-sdhci.ko.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/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.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.
Dodji Seketeli [Tue, 15 Aug 2023 11:59:40 +0000 (13:59 +0200)]
ir: Avoid forgetting potential seemingly duplicated member functions
In some rare cases expressed in DWARF from C++, a member function can
belong to both a declaration-only class (having no data member) in one
translation unit, and to a fully defined class in another translation
unit. In those cases, the two classes are represented and considered
different.
But then, consider a destructor which mangled name is "D1". D1 is
represented in both the decl-only class and the fully-defined class.
In the former case, its "this pointer" points to a decl-only class,
while in the later case its "this pointer" points a fully-defined
class.
So, D1 coming from the former case will compare different from the D1
coming from the later case, because of the spurious difference
"decl-only class" versus "fully-defined class". This is in the
context of a self-comparison.
One way to fix this self-comparison subtle change is to give the
former D1 and the later D1 two different "function ID"s. Today, the
function ID is just the mangled name, D1. This patch is defining a
more involved ID which makes the difference between a member function
on a decl-only class and a member function on a fully-defined class.
Note that the only member functions that matter are virtual member
functions because they are the only member functions that are
considered when comparing two classes.
This fixes the self-comparison error found on the binary
gcc-gnat-12.3.1-1.fc37.x86_64/usr/libexec/gcc/x86_64-redhat-linux/12/gnat1
while running the self-comparison command below:
$ fedabipkgdiff --self-compare -a --from fc37 gcc-gnat
* src/abg-ir.cc (is_declaration_only_class_or_union_type): Add an
overload for type_base_sptr.
(function_decl::get_id): Virtual member functions that are defined
on decl-only classes have a special ID to avoid confusing them
with their counterparts defined on defined classes.
* src/abg-reader.cc (build_function_decl)
(build_function_decl_if_not_suppressed): Add a new
add_to_exported_decls parameter to avoid adding the function to
the set of exported decls to early. For the function to be
properly added to the set of exported decls, all its attributes
must be set, including virtualness. In some case, those
attributes are not yet known by the end of the call to
build_function_decl. The caller must then set those properties
and then add the function to the set of exported decls.
(build_{class,union}_decl): Build the function first, then add its
missing properties and *then* add it to the set of exported decls.
(handle_function_decl): Adjust.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust.
Dodji Seketeli [Tue, 15 Aug 2023 11:56:47 +0000 (13:56 +0200)]
ir: Fix forgetting canonicalizing some function types
It appears some function types are not canonicalized. Fixed thus.
* src/abg-ir.cc (maybe_adjust_canonical_type): Once a missing
member function has been copied from it's destination to the
freshly canonicalized type, make sure the type of the member
function is canonicalized as well.
(copy_member_function): Bind the lifetime of the new function type
to the lifetime of the current translation unit.
Dodji Seketeli [Tue, 15 Aug 2023 11:34:16 +0000 (13:34 +0200)]
ir: Add missing ABG_RETURN in the comparison engine
During structural type comparison, we want to be able to break on the
first occurrence of two sub-types comparing different. This is done
by setting a breakpoint into the notify_equality_failed function that
is called by the ABG_RETURN macro in the comparison functions.
The problem is that I stumbled upon some code paths that are missing
the ABG_RETURN macro. Fixed thus. This will help in debugging
sessions.
* src/abg-ir.cc (equals): In the overload for function_type,
class_decl and union_decl, add a missing ABG_RETURN.
abipkgdiff: Avoid comparing binaries that are outside of the package
Some symlinks in some RPMs resolve to binaries outside of the package. In
those cases, avoid considering them.
* src/abg-tools-utils.cc (maybe_get_symlink_target_file_path): Do
not require that the file path points to a symlink. A file path
can point to a file that is not a symlink and yet the whole path
can be in parent directory that is a symlink. In this case,
realpath will correctly resolve to the correct target file.
* tools/abipkgdiff.cc (maybe_update_package_content): A path to a
binary that is not inside the RPM (because a symlink resolved to a
file outside of the RPM) should not be added to the set of
binaries to be analyzed.
* tests/data/test-diff-pkg/symlink-dir-test1-report1.txt: Add new
test file.
* tests/data/test-diff-pkg-ctf/symlink-dir-test1-report1.txt:
Likewise.
* tests/data/Makefile.am: Add new test file to source
distribution.
* tests/test-diff-pkg.cc (in_out_specs): for the
data/test-diff-pkg/symlink-dir-test1/dir{1,2}/symlinks test, the
root dir of the package is
data/test-diff-pkg/symlink-dir-test1/dir{1,2}. Use that to test
that the symlinks are properly handled. Also, use the
data/test-diff-pkg/symlink-dir-test1/dir{1,2}/symlinks as a root
of an alternative package for which the symlinks resolve outside
the package, under
data/test-diff-pkg/symlink-dir-test1/dir{1,2}/targets. In this
later case, the symlinked files should be ignored in the
comparison. Likewise for
data/test-diff-pkg-ctf/symlink-dir-test1/dir1/symlinks.
{dwarf,elf}reader: Don't consider no symbol table as an error
Some binaries don't have any symbol table. Libabigail's ELF and DWARF
readers error out on those binaries, making fedabipkgdiff emitting an
error when performing the self-comparison of the package containing
those binaries.
This patch handles a binary having no symbol table almost as a binary
that has an empty symbol table, making abipkgdiff and fedabipkgdiff
not error out on those binaries anymore.
This makes the command below succeed:
$ fedabipkgdiff --self-compare -a --from fc34 glibc
* src/abg-dwarf-reader.cc (reader::read_corpus): Return an empty
corpus if no symbol was found. Do not crash when no symbol table
is found.
* src/abg-elf-reader.cc (reader::read_corpus): Consider a corpus
with no symbol table as being OK.
* src/abg-reader.cc (build_elf_symbol_from_reference): Do not
crash when no symbol table is present.
Dodji Seketeli [Wed, 30 Aug 2023 11:10:02 +0000 (13:10 +0200)]
abipkgdiff: Initialize libxml2 to use it in a multi-thread context
While running some test, I stumbled upon a transient deadlock
happening when using libxml2's text reader to create a reader from a
buffer. After reading the documentation at
https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Thread-safety, I
realized that users of the library need to initialize libxml2 before
using it in a multi-thread setting.
So this patch is providing the abigail::tools_utils::initialize()
function to be called prior to using the library. This is going to be
the place where to perform this kind of one-time initialization.
* include/abg-tools-utils.h (initialize): Declare ...
* src/abg-tools-utils.cc (initialize): ... new function.
* tools/abipkgdiff.cc (main): Invoke the new
abigail::tools_utils::initialize() here.
dwarf-reader,ir: Make logging a property of the middle end
Add a "do-log" property to the abigail::ir::environment::priv. That
way, we can log finer grain time stamps during type canonicalization.
This is useful for debugging.
* src/abg-dwarf-reader.cc (reader::read_debug_info_into_corpus):
Set the do_log property on the environment from the do_log
property of the reader.
* src/abg-ir-priv.h (environment::priv::do_log_): New data member.
(environment::priv::priv): Initialize it.
(environment::priv::do_log): Define new accessor method.
(canonicalize_types): Add logging.
* src/abg-ir.cc (canonicalize): Add logging to time the
canonicalization of each type.
Giuliano Procida [Thu, 31 Aug 2023 15:59:15 +0000 (16:59 +0100)]
operator!= fixes for C++-20
Without these changes, more recent versions of Clang will start to
emit diagnostics:
src/abg-ir.cc:15407:13: error: member 'operator!=' found in multiple base classes of different types
15407 | return *l == *r;
| ^
src/abg-ir.cc:14123:12: note: member found by ambiguous name lookup
14123 | type_base::operator!=(const type_base& other) const
| ^
src/abg-ir.cc:5162:12: note: member found by ambiguous name lookup
5162 | decl_base::operator!=(const decl_base& other) const
| ^
When looking at something else, I noticed that in
method_decl::set_linkage_name, we are unnecessarily testing if the
'this' pointer was equal to the pointer to the member function decl of
a member function looked up from the parent class.
This patch replaces that condition by an assert. If the 'this'
pointer is different from the pointer to any member function decl
looked up from the parent class, then something is terribly wrong
about the integrity of the IR.
* src/abg-ir.cc (method_decl::set_linkage_name): Assert that the
'this' pointer always equals the pointer to any member function
decl looked up from the parent class.
While looking at something else, I realized that member functions XML nodes
were not necessarily mapped to the right function declaration at
ABIXML parsing time. Woops.
Fixed thus.
* src/abg-reader.cc (build_class_decl): Map the XML node for the
member function to the member function decl, not to the class
decl.
Dodji Seketeli [Sat, 24 Jun 2023 13:51:34 +0000 (15:51 +0200)]
abidiff: Add --{follow,list}-dependencies & add-binaries{1,2} support
This patch implements comparing two sets of binaries constituted by the
binaries given in argument of the abidiff command, as well as their
respective dependencies (specified by the DT_NEEDED ELF property for
ELF binaries) or an arbitrary set of libraries found in the
directories determined by --added-binaries-dir{1,2}.
The detected dependencies can also be listed by the option
--list-dependencies.
* tools/abidiff.cc (options::{follow_dependencies,
list_dependencies, added_bins_dirs1, added_bins_dirs2,
added_bins1, added_bins2}): Add new data members.
(options::options): Initialize the new follow_dependencies and
list_dependencies boolean data members.
(display_usage): Add usage strings for --added-binaries-dir{1,2},
--add-binaries{1,2}, --follow-dependencies, --list-dependencies.
(parse_command_line): Parse the options --follow-dependencies,
--list-dependencies, --added-binaries-dir{1,2},
--add-binaries{1,2}.
(display_dependencies): Add new static function.
(main): Support the new --add-binaries{1,2},
--follow-dependencies, --list-dependencies.
* doc/manuals/abidiff.rst: Document the new options above.
* tests/data/test-abidiff-exit/test-PR30034/libabigail.abignore: Add test input.
* tests/data/test-abidiff-exit/test-PR30034/reference/include/rte_log.h:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_eal.so:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_eal.so.23:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_eal.so.23.1:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_kvargs.so:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_kvargs.so.23:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_kvargs.so.23.1:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_telemetry.so:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_telemetry.so.23:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_telemetry.so.23.1:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/include/rte_log.h:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_eal.so:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_eal.so.23:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_eal.so.23.2:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_kvargs.so:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_kvargs.so.23:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_kvargs.so.23.2:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_log.so:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_log.so.23:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_log.so.23.2:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_telemetry.so:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_telemetry.so.23:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_telemetry.so.23.2:
Likewise.
* tests/data/test-abidiff-exit/test-PR30034/test-PR30034-report-1.txt:
Likewise.
* tests/data/Makefile.am: Add the test inputs to source
distribution.
* tests/test-abidiff-exit.cc
(InOutSpec::in_elfv{0,1}_added_bins_dir): Add new data member.
(main): Add --added-binaries-dir{1,2} option to abidiff if the
InOutSpec::in_elfv{0,1}_added_bins_dir data members are non-empty.
(in_out_specs): Add test inputs to this test
harness.
Dodji Seketeli [Sat, 24 Jun 2023 14:10:40 +0000 (16:10 +0200)]
abidw: Add --{follow,list}-dependencies & --add-binaries support
This implements the --follow-dependencies , --list-dependencies,
--add-binaries <foo,bar,...> and --added-binaries-dir options for the
abidw command, as documented in the
README-ABIDIFF-BINARIES-SET-SUPPORT.md file.
* tools/abidw.cc (options::{added_bins_dirs, added_bins,
follow_dependencies, list_dependencies}): Add new data members.
(options::options): Initialize follow_dependencies and
list_dependencies.
(display_usage): Add usage strings for --add-binaries,
--follow-dependencies, --list-dependencies, --added-binaries-dir.
(parse_command_line): Parse options --add-binaries,
--follow-dependencies, --list-dependencies, --added-binaries-dir.
(load_corpus_and_write_abixml): Implement the --list-dependencies,
--follow-dependencies and --add-binaries sub-commands.
* doc/manuals/abidw.rst: Document the --add-binaries,
--follow-dependencies, --list-dependencies, --added-binaries-dir
options.
Dodji Seketeli [Sat, 24 Jun 2023 14:04:47 +0000 (16:04 +0200)]
corpus,tools-utils: Support loading a corpus, its deps & other binaries
In preparation of implementing the support for "Handling split
libraries", this patch implements the functions
tools_utils::{get_comma_separated_args_of_option,
find_file_under_dirs, add_binaries_into_corpus_group,
add_dependencies_into_corpus_group,
stick_corpus_and_binaries_into_corpus_group,
stick_corpus_and_dependencies_into_corpus_group, get_dependencies}.
Given an ABI corpus, these functions enable adding arbitrary binaries
and dependencies found in a set of directories to form a corpus group.
* include/abg-corpus.h (corpus_group::has_corpus): Declare new
member function.
* include/abg-tools-utils.h (get_comma_separated_args_of_option)
(find_file_under_dirs, get_dependencies)
(add_binaries_into_corpus_group)
(add_dependencies_into_corpus_group)
(stick_corpus_and_binaries_into_corpus_group)
(stick_corpus_and_dependencies_into_corpus_group): Declare new
functions.
* src/abg-corpus.cc (corpus_group::priv::corpora_path): Add new
data member.
(corpus_group::add_corpus): Do not add a corpus that was already
added to the group. Update the set of paths of added corpora so
that we can detect if a corpus has already been added.
* src/abg-tools-utils.cc (find_file_under_dir): If the file found
is a symbolic link, return it. Otherwise if the symbolic link is
not the file we were looking for, then skip it, rather than
following it, in case it's a directory.
(get_comma_separated_args_of_option, find_file_under_dirs)
(get_dependencies, add_binaries_into_corpus_group)
(add_dependencies_into_corpus_group)
(stick_corpus_and_binaries_into_corpus_group)
(stick_corpus_and_dependencies_into_corpus_group): New functions.
Dodji Seketeli [Sat, 24 Jun 2023 13:34:36 +0000 (15:34 +0200)]
Make fe_iface::initialize independent from the kind of interface
In the use case laid out by the "Library Splitting support" at
https://sourceware.org/bugzilla/show_bug.cgi?id=30034, tools might
want to be able to re-initialize a given front-end to load several
corpora in a row, independently from the kind of front-end (elf-based,
ABIXML, etc). So we need a fe_iface::initialize() interface that is
similar to the elf_based_reader::initialize() interface but, unlike
that one, it should not depend on parameters that only make sense in a
elf-based context. For instance, the fe_iface::initialize() interface
should not contain paths to debug-info as that information does not
make sense in an ABIXML context.
This patch thus renames fe_iface::reset() into fe_iface::initialize()
and makes it virtual. It adjusts the plumbing accordingly, basically
making the other ::initialize() methods of classes that inherit
fe_iface use fe_iface::initialize() when appropriate.
The patch also provides an elf_based_reader::initialize()
implementation of the fe_iface::initialize() interface, so that
invoking ::initialize on elf_based_reader through the fe_iface
interface does the right thing so that the initial use case presented
at the beginning of this comment is supported.
* include/abg-elf-based-reader.h (elf_based_reader::initialize):
Rename elf_based_reader::reset into this. Add a new virtual
overload that implements fe_iface::initialize.
* include/abg-elf-reader.h (reader::initialize): Rename
elf_reader::reset into this. Add a new virtual overload that
implements fe_iface::initialize.
* include/abg-fe-iface.h (fe_iface::initialize): Rename
fe_iface::reset into this and make it virtual.
* src/abg-btf-reader.cc (btf::reader::initialize): Adjust call to
elf_based_reader::reset to elf_based_reader::initialize.
* src/abg-ctf-reader.cc (ctf::reader::initialize): Likewise.
* src/abg-dwarf-reader.cc (dwarf::reader::initialize): Likewise.
* src/abg-elf-based-reader.cc (elf_based_reader::initialize):
Rename elf_based_reader::reset into this. Adjust call to
elf::reader::reset into elf::reader::initialize. Add a new
virtual overload that implements fe_iface::initialize.
* src/abg-elf-reader.cc (reader::initialize): Rename
elf::reader::reset into this. Adjust call to fe_iface::reset into
fe_iface::initialize. Add a new virtual overload that implements
fe_iface::initialize.
* src/abg-fe-iface.cc (fe_iface::priv::initialize): Reset the
corpus too.
(fe_iface::initialize): Rename fe_iface::reset into this. Invoke
priv::initialize and set the new corpus_path.
fedabipkgdiff: Don't choke Koji servers with self-signed SSL certs
When doing some tests on particular Koji instances, the
Brew::getPackage function was choking because its underlying http
client would could not verify the self-signed SSL certificate used by
the server.
This patch sets the default option of the client so that it avoids
verifying SSL certificates altogether.
* fedabipkgdiff (Brew::__init__): Se the "no_ssl_verify" option to
false by default.
Dodji Seketeli [Wed, 21 Jun 2023 07:53:01 +0000 (09:53 +0200)]
Bug 30461 - insight fails self-compare
This self-comparison issue is due to several different underlying
problems.
Class destructors are often implemented by the compiler using cloned
functions, even for virtual destructors. In DWARF, for a given class,
the cloned function implementing the virtual destructor might come way
after the point where the class and its member functions (including
the destructors) have been declared. So the DWARF reader needs to
match the "dangling" cloned function that implements the virtual
destructor with the destructor declared in the class declaration.
Note that it's the cloned definition that contains the address of the
ELF symbol for the destructor, not the declaration. So we really need
to see the cloned function to build a proper IR (that also represents
the ELF symbol) for the destructor.
As the destructor is implemented by a cloned function, we might see
(in the DWARF) other clones of that function that have the same
linkage name. In that case, if the IR of the class already has a
destructor with the same linkage name, then we not build another IR
for it, otherwise we'd wrongly duplicate the destructor. And this is
exactly the error we were doing in this issue. This patch addresses
that issue.
The ABIXML does unfortunately have classes with duplicated
destructors, due to this. So as the DWARF reader is now going to be
fixed, the ABIXML reader also needs to be fixed to avoid reading
duplicated member functions. The patch addresses that issue as well.
Then, when the above was fixed, I stumbled across an issue related to
type fundamentals of type canonicalization:
I think we will ultimately need to be able to canonicalize types in
the same order, if they come from DWARF or ABIXML. It now appears to
me that because of recursive types in the context of ODR-violations
(two different types being present in different translation units and
yet having the same name. For instance, the BFD type from binutils
and this insight package), type canonicalization is not a commutative
operation, unfortunately. That is why we need to either store some
type hash in ABIXML to avoid having to re-do type canonicalization
when reading ABIXML, or canonicalize types coming from ABIXML in the
same order as they were, when they came from their initial format
(DWARF or otherwise). This would be a project in it own right. Until
then, a workaround that seems to be enough in this case is to clear
the type comparison result cache after canonicalizing each type.
The rest of the patch adjusts the regression tests output as needed.
For the record, below is the command line that triggered the issue:
$ fedabipkgdiff --debug --self-compare -a --from fc38 insight
* src/abg-dwarf-reader.cc (build_ir_node_from_die): If we are
looking at a cloned function that's a member function to be added
to an existing class, make sure a member function with the same
linkage name doesn't already exist in the class before adding this
one. Otherwise, we'd be duplicating a member function inside the
class.
* src/abg-ir.cc (method_decl::set_linkage_name): When setting the
linkage name of a method to a new one, erase the old method that
had the old linkage name from the containing class.
(compare_canonical_type_against_candidate): Clear the comparison
type result cache after each type canonicalization to avoid
re-using cached result that should have been invalidated. This is
a work-around the more fundamental type canonicalization issue
outlined in the preamble of this commit log.
* src/abg-reader.cc (build_function_decl): Avoid loading
duplicated member functions. The key of the function being its
mangled name.
(build_class_decl): The XML node to map when looking a member
function is really the XML node for the member function.
* tests/data/test-abidiff/test-PR18791-report0.txt: Adjust.
* 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/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.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.
symtab reader: fix symtab iterator to support C++20
Inheriting from std::vector::iterator causes the type to advertise
itself as a contiguous iterator. This causes a compilation error in
newer versions of libc++ that try to use contiguous-iterator-specific
optimizations in those situations. Fixed thus by explicitly specifying
the interator_concept tag.
* abg-symtab-reader.h (symtab_iterator): Specify
iterator_concept as forward_iterator to support C++20 compilation.
Bug 28316 - Failure to represent typedef named anonymous enums
It seems like comparing a data member of a non-anonymous struct foo
against the same data member of an anonymous struct named by a typedef
foo wrongly leads yields a spurious difference.
This is because when looking at the data member,
get_decl_name_for_comparison doesn't return the same value in the two
cases (non anonymous struct foo vs anonymous struct named by a typedef
foo). Looking deeper, it's because get_decl_name_for_comparison
wronly uses scope_anonymous_or_typedef_named. Fixed thus.
* src/abg-ir.cc (get_decl_name_for_comparison): Do not use
scope_anonymous_or_typedef_named. Rather, use
decl_base::get_has_anonymous_parent instead.
(scope_anonymous_or_typedef_named): Remove this as it's not used
anymore.
* include/abg-fwd.h (scope_anonymous_or_typedef_named): Remove
this declaration as the definition has been removed.
* tests/data/test-abidiff-exit/PR30503/libsdl/1.2.60/lib64/libSDL-1.2.so.1.2.60:
New test input file.
* tests/data/test-abidiff-exit/PR30503/libsdl/1.2.60/lib64/libSDL-1.2.so.1.2.60.debug:
Likewise.
* tests/data/test-abidiff-exit/PR30503/libsdl/1.2.64/lib64/libSDL-1.2.so.1.2.64:
Likewise.
* tests/data/test-abidiff-exit/PR30503/libsdl/1.2.64/lib64/libSDL-1.2.so.1.2.64.debug:
Likewise.
* tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt:
Likewise.
* tests/data/Makefile.am: Add the new test inputs above to source
distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the new test
inputs above to this test harness.
* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
Dodji Seketeli [Mon, 5 Jun 2023 08:28:53 +0000 (10:28 +0200)]
Bug 30467 - enlightenment fails self check on f38
This is yet another instance of a latent canonical type propagation
issue. Basically, when reading back a type from ABIXML,
canonicalizing it (in an order that is different from the initial
order in which it has been canonicalized by the DWARF front-end)
yields a different canonical type from the original one computed by
the DWARF front-end, yielding spurious self-comparison changes.
By looking at it a bit closer, I realized the cache of the comparison
results wasn't being cleared upon canceling canonical type
propagation, whenever that canceling occurs. That leads to some
subsequent comparisons being wrong (albeit fast, heh) because they
rely on cached results that should have been invalidated.
This patch thus clears the type comparison result cache whenever
canonical type propagation canceling occurs.
* src/abg-ir-priv.h (environment::priv::cancel_ct_propagation):
Clear the type comparison results cache.
ir: Recognize "void* as being equal to all other pointers in C
a pointer to void is considered equal to all other pointers to avoid
emitting some spurious changes while self-comparing glibc from fc37.
As a void pointer can now equal several kinds of types, it could no
longer be canonicalized. But then, the 'exemplar pointer' based
optimization in the ABIXML writer (cf get_exemplar_type) makes it so
that two different void pointer IR nodes (that are structurally
equivalent) would result in two different nodes (with different
type-ids) being serialized out in ABIXML. Later at ABIXML reading
time, aggregates types using these two different void pointer nodes
might yield canonical types that are different from the original ones,
depending on the order in which ABIXML types are canonicalized as that
order might differ from the order in which they were initially
canonicalized. This difference leads to spurious self-comparison
errors.
To handle this, I am proposing that the void pointer type be a unique
IR type node in the system. That way, the exemplar type optimization
would still work and we get rid of the spurious self-comparison error
change. While doing this, I realized that the void type and the
variadic parameter type that are also unique types were not properly
enforced in all the front-ends as such. So this patch fixes that.
The patch also make typedefs and pointer to decl-only classes be
non-canonicalized types because decl-only classes are non-canonicalized
already. Pointers and typedefs to those types being canonicalized can
lead to different canonicalized type depending on the order of
canonicalization.
The rest of the patch is basically adjusting the other moving parts to
these core changes.
* include/abg-fwd.h (is_pointer_to_decl_only_class_or_union_type)
(is_reference_to_decl_only_class_or_union_type)
(is_typedef_to_decl_only_class_or_union_type)
(is_void_pointer_type_equivalent, is_unique_type): Declare new
functions.
(is_typedef, is_void_pointer_type): Declare new overloads.
(is_declaration_only_class_or_union_type): Add a new
look_through_decl_only flag as parameter.
* include/abg-ir.h (environment::{get_void_pointer_type,
is_void_pointer_type}): Define new member functions.
* src/abg-ir-priv.h (environment::priv::{void_pointer_type}): Add
new data member.
* src/abg-ir.cc (decl_topo_comp::operator()): For unique types,
use lexicographic sorting.
(environment::{get_void_pointer_type, is_void_pointer_type}):
Define new member function.
(is_typedef, is_pointer_to_decl_only_class_or_union_type)
(is_reference_to_decl_only_class_or_union_type)
(is_typedef_to_decl_only_class_or_union_type, is_unique_type):
Define new functions.
(is_declaration_only_class_or_union_type): Add a new
look_through_decl_only parameter. Some decl-only class or union
do have an associated definition; this function return false for
these types if look_through_decl_only is set to true.
(is_void_pointer_type_equivalent): Rename is_void_pointer_type
into this.
(is_void_pointer_type): Now that is_void_pointer_type equals is
old version of this is_void_poitner, make the new version test if
the type equals the unique void pointer type, or if it a pointer
to void type. It doesn't take typedefs into account, like what
is_void_pointer_type_equivalent does.
(equals): In the overload for pointer_type_def, use the new
is_void_pointer_type_equivalent instead of
is_void_pointer_type_equivalent.
(is_non_canonicalized_type): Re-organize this. Now, all unique
types are non-canonicalized. This was sort-of the case already
but was not clearly stated as such. The decl-only class-or-union
types were already non-canonicalized, but pointers and typedefs to
class-or-unions should also be non-canonicalized for the system to
work because a decl-only class-or-unions equals all defined types
in C++.
* src/abg-btf-reader.cc
(reader::build_ir_node_for_void_pointer_type): Define new member
function that return a unique type for void pointer types.
(reader::build_pointer_type): Use
build_ir_node_for_void_pointer_type to build void pointer types.
(reader::{build_ir_node_for_void_type,
build_ir_node_for_variadic_parameter_type}): Simplify.
* src/abg-ctf-reader.cc (build_ir_node_for_void_type)
(build_ir_node_for_void_pointer_type): Define new functions.
(process_ctf_function_type): Use build_ir_node_for_void_type for
void types.
(process_ctf_pointer_type): Use
build_ir_node_for_void_pointer_type for void pointer types.
* src/abg-dwarf-reader.cc (build_ir_node_for_void_pointer_type):
Define a new function that returns a unique type for void pointer
types.
(build_pointer_type_def): Use the new
build_ir_node_for_void_pointer_type to build void pointers.
(build_ir_node_for_variadic_parameter_type): Simplify.
* src/abg-reader.cc (read_type_id_string): Define this even
not debugging self-comparison.
(build_ir_node_for_void_type)
(build_ir_node_for_void_pointer_type): Define new functions.
(reader::{get_scope_for_node, get_scope_ptr_for_node}): New member
functions.
(reader::push_decl_to_current_scope): Remove this member function.
This was using the scope of the last IR node built as the current
scope. The problem is that the scope of a unique IR node is the
scope where it was used the first time; that has nothing to do
with the current scope. So this function is obsolete now that we
are using unique IR nodes for real.
(reader::push_decl_to_scope): New member function. This is the
one to use, now that push_decl_to_current_scope is no more.
(reader::push_and_key_type_decl): Pass the scope_decl to use.
Make this push the decl to the scope passed in parameter. Add an
overload that has the XML node to use to determine the scope to
push the decl to.
(reader::get_scope_for_node): Support template parameter type
composition nodes. Also, add an overload that takes just an XML
node.
(reader::get_scope_ptr_for_node): Define new member function.
(build_namespace_decl, build_function_decl, build_var_decl): Use
to reader::push_decl_to_scope, now that
reader::push_decl_to_current_scope is gone.
(build_type_decl): Use build_ir_node_for_void_type to build a void
type. Adjust the call to reader::push_and_key_type_decl.
(build_qualified_type_decl, build_reference_type_def)
(build_subrange_type, build_array_type_def, build_enum_type_decl)
(build_typedef_decl, build_class_decl, build_union_decl)
(build_function_tdecl, build_function_tdecl, build_class_tdecl)
(build_type_tparameter, build_type_composition)
(build_non_type_tparameter, build_template_tparameter): Adjust the
call to reader::push_and_key_type_decl.
(build_pointer_type_def): Likewise. Use
build_ir_node_for_void_pointer_type to build a void pointer IR
node. Also, build the pointed-to-type before the pointer type
itself; this is required to catch a void pointer type early and
use build_ir_node_for_void_pointer_type to build it.
* src/abg-comp-filter.cc (has_void_ptr_to_ptr_change): Use the new
is_void_pointer_type_equivalent in lieu of is_void_pointer_type.
This is because the former takes typedefs into account and so is
more accurate.
* src/abg-comparison.cc
(scope_diff::ensure_lookup_tables_populated): Do not consider
unique types when accounting for added/removed types.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/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/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-read-btf/test1.o.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/test8.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/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/test17.xml: Likewise.
* tests/data/test-read-write/test18.xml: Likewise.
* tests/data/test-read-write/test19.xml: Likewise.
* tests/data/test-read-write/test20.xml: Likewise.
* tests/data/test-read-write/test21.xml: Likewise.
* tests/data/test-read-write/test22.xml: Likewise.
* tests/data/test-read-write/test23.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.
Dodji Seketeli [Wed, 17 May 2023 11:44:58 +0000 (13:44 +0200)]
Bug 29693 - clang-libs from f37 fails self test
To reproduce the issue reported in the bug above, here is the relevant
command line:
$ tools/fedabipkgdiff --self-compare -a --from fc37 clang-libs
When the abixml reader encounters a decl-only class, it wrongly avoids
trying to read its members. This is wrong because a decl-only class
can still have member types. By doing so, the abixml might "forget"
some member types, leading to self comparison errors as the original
class from DWARF (for instance) might have those member types.
Fixed thus.
* src/abg-reader.cc (build_class_decl): Read member types even
when we are looking at a decl-only class.
Dodji Seketeli [Thu, 11 May 2023 16:00:46 +0000 (18:00 +0200)]
dwarf-reader: Don't compute canonical type while propagating one
When propagate_canonical_type sees that the source type doesn't have a
canonical type, it tries to compute one for it.
But then suppose we are into computing the canonical type of a type T
to begin with. At some point we want to try to propagate the
canonical type of a sub-type S of T. Suppose S recursively references
T.
When propagate_canonical_type is called from
maybe_propagate_canonical_type on S, it's going to try to compute a
canonical type for T (indirectly), as T doesn't yet have a canonical
type.
We then end up in a recursive calling loop that overflows the
execution stack.
* src/abg-dwarf-reader.cc (propagate_canonical_type): If the
source (right-hand-side) type has no canonical type, do not
compute it and thus, do not try to propagate its canonical type to
the destination (left-hand-side) type.
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
Dmitry V. Levin [Mon, 1 May 2023 20:20:07 +0000 (23:20 +0300)]
elf-helpers: make sure config.h is included first
Before this change, verify-elf used to complain on x86 and armv7:
verify-elf: ERROR: ./usr/lib/libabigail.so.2.0.0: uses non-LFS functions: open
Include config.h in abg-elf-helpers.cc before other headers so that
AC_SYS_LARGEFILE applies to this file. This fully enables LFS
in those of 32-bit systems that do not enable it by default.
* src/abg-elf-helpers.cc: Include "config.h" first.
Fixes: 7bd69830520f ("Make Front Ends first class citizens") Signed-off-by: Dmitry V. Levin <ldv@strace.io>
When the value of the 'name_regexp' property is incorrect, the ini
parser can crash.
Pancake, of Radare2 fame, reported this one by email.
Fixed thus.
* src/abg-ini.cc (read_context::read_property_value): Do not
dereference a null pointer to list property value.
* tests/data/test-ini/test02-buggy-property-value.abignore: New
test input.
* tests/data/test-ini/test02-buggy-property-value.abignore.expected:
Likewise.
* tests/data/Makefile.am: Add the two new test inputs to source
distribution.
* tests/test-ini.cc (in_out_spec): Add the new test input pair to
this test harness.
test-abidiff-exit: Fix the command line passed to abidiff
I noticed that the command line passed to abidiff in the
test-abidiff-exit.cc is getting bigger and bigger as the test runs.
This is because in the main loop that calls abidiff on each test, we
forget to reset the "headers directories" part of the command line
passed to abidiff.
Fixed thus.
* tests/test-abidiff-exit.cc (main): Reset the headers directories
passed to abidiff at each iteration.
Bug 30309 - Support absolute path to alt debug info file in DWARF
Until now, the path to the alternate DWARF file, given by the content
of the .gnu_debugaltlink section has generally been a relative path.
That is what the elf reader has grown to expect.
In bug https://sourceware.org/bugzilla/show_bug.cgi?id=30329 the
.gnu_debugaltlink section seems an absolute path:
'/usr/lib/debug/dwz/components/sqlite.bst/x86_64-unknown-linux-gnu'.
The elf-reader thus fails to find the alternate DWARF file as it's
looking for a relative path under the debug info root directory.
This path teaches the elf-reader to handle absolute alternate
debuginfo files too.
* src/abg-elf-reader.cc (find_alt_dwarf_debug_info_path): Trim the
"/usr/lib/debug" prefix from the alt dwarf file path, if it was
provided. The function is going to look for the alt dwarf file
under the debug info root file instead.
* src/abg-tools-utils.cc (entry_of_file_with_name): Add a
parameter for the path to the root directory under which the files
visit is taking place. Then, consider the file path being looked
for as being relative to the root directory under which the files
visit is taking place.
* tests/data/test-abidiff-exit/PR30329/new-image/usr/lib/debug/dwz/components/sqlite.bst/x86_64-unknown-linux-gnu:
New test input.
* tests/data/test-abidiff-exit/PR30329/new-image/usr/lib/debug/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6.debug:
Likewise.
* tests/data/test-abidiff-exit/PR30329/new-image/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6:
Likewise.
* tests/data/test-abidiff-exit/PR30329/old-image/usr/lib/debug/dwz/components/sqlite.bst/x86_64-unknown-linux-gnu:
Likewise.
* tests/data/test-abidiff-exit/PR30329/old-image/usr/lib/debug/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6.debug:
Likewise.
* tests/data/test-abidiff-exit/PR30329/old-image/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6:
Likewise.
* tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt:
Likewise.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-abidiff-exit.cc (InOutSpec::in_elfv{0,1}_debug_dir):
New data members. Carry the debuginfo root dirs for the input
binaries.
(in_out_specs): Update the existing to adjust for the new
InOutSpec::in_elfv{0,1}_debug_dir data members. Also, add a new
entry for this new test case.
(main): Pass the root debug info dirs to abidiff.
reader: Recognize variadic parameter type from abixml
When reading a variadic parameter type from the ABIXML, the reader
forget to recognize it as THE unique variadic parameter type as
returned by abigail::ir::environment::get_variadic_parameter_type().
That makes abigil::ir::environment::is_variadic_parameter_type() to
fail on the variadic type that is build from ABIXML.
Fixed thus.
* include/abg-ir.h (environment::get_variadic_parameter_type_name)
Declare ...
* src/abg-ir.cc (environment::get_variadic_parameter_type_name):
... a new static member function.
(environment::get_variadic_parameter_type): Use
the new environment::get_variadic_parameter_type_name rather than
using an open coded constant here.
* src/abg-dwarf-reader.cc
(die_return_and_parm_names_from_fn_type_die): Likewise.
* src/abg-reader.cc (build_type_decl): For a variadic parameter
type, return
abigail::ir::environment::get_variadic_parameter_type() rather
than building a new type.
* tests/data/test-read-ctf/test2.so.abi: Adjust.
* tests/data/test-read-ctf/test2.so.hash.abi: Likewise.
* tests/data/test-read-ctf/test8.o.abi: Likewise.
ir: fix canonical type propagation canceling error
This patch (with the help of the 9 patches that precede it) fixes the
self-comparison error that is seen when running the command line:
$ fedabipkgdiff --self-compare -a --from fc37 bpftrace
It turns out the root cause of the self-comparison error seen here is
that sometimes, when the speculatively computed canonical type (that
is called propagated canonical type) is known to be wrong, the code
forgets to cancel that speculation. And that leads to wrong
comparisons during subsequent type canonicalizations and later during
type comparisons.
This patch fixes the logic the of the cancellation of propagated
canonical type that must happen when it is known that the propagated
canonical type is invalid.
* src/abg-ir-priv.h
(environment::priv::{confirm_ct_propagation_for_types_dependant_on,
confirm_ct_propagation_for_types_dependant_on}): Asserting that
the type should be recursive is wrong because the recursive-ness
flag is set to false upon confirmation of the canonical type
propagation. So there can be some types that would make this
assertion fail before we reach the end of the set of types to
confirm the propagation for.
(environment::priv::cancel_ct_propagation): Cancel the canonical
type propagation for all types we are instructed to cancel, not
just for types that are recursive or depends on recursive types.
This is because the the recursive-ness flag is set to false upon
cancellation of the canonical type propagation. So there can be
some types that would make this condition fail before we reach the
end of the set of types to cancel the propagation for.
(environment::priv::cancel_all_non_confirmed_propagated_canonical_types):
Define new member function.
* src/abg-ir.cc (return_comparison_result): Confirm the
speculative canonical type propagation result when we are done
comparing the current type and the result of the comparison is
true. Let's not try to be smart here. Just be safe. This
optimization is fast enough as is. Otherwise, if the result of
the comparison is false, then all the speculatively propagated
canonical types of all the non-confirmed types should be canceled.
All of them. Again, let's not try to be smart. This is smart &
fast enough as is. And thing are going to be correct this way.
comparison: Fix index error when interpreting scope comparison
While looking at something else, I noticed a thinko in the
code in scope_diff::ensure_lookup_tables_populated that interprets the
result of the diffing algorithm on the decls of a given scope. Fixed
thus.
* src/abg-comparison.cc
(scope_diff::ensure_lookup_tables_populated): Use the proper index
to address the deleted decl. Also, use the range-based for syntax
in the enclosing for-loop for more clarity.
When starring at abixml I noticed that abixml --annotate would not
annotate pointer-type-def XML elements. This patch fixes that and
makes the code of write_pointer_type_def easier to debug.
* src/abg-writer.cc (write_pointer_type_def): Invoke annotate.
Add a temporary for the output of write_context::get_id_for_type.
It makes it easier to inspect in the debugger.
* 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/test1.abi: Adjust.
* tests/data/test-annotate/test13-pr18894.so.abi: Adjust.
* tests/data/test-annotate/test14-pr18893.so.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-annotate/test5.o.abi: Adjust.
This patch factorizes an interesting part of
type_base::get_canonical_type_for into a new function called
compare_canonical_type_against_candidate. The user can now invoke it
from the prompt of the debugger to compare a candidate canonical type
against an actual canonical to study why the comparison fails (by
setting a breakpoint in notify_equality_failed when the pre-processor
macro WITH_DEBUG_SELF_COMPARISON is defined.
This is priceless to debug why canonical type comparison that should
succeed actually fails.
* src/abg-ir.cc (compare_types_during_canonicalization): Adjust
this to make it take const type_base& rather than const
type_base_sptr.
(compare_canonical_type_against_candidate): Factorize this out of
...
(type_base::get_canonical_type_for): ... here.
When looking at debugging some self-comparison difference errors, I
felt the need to improve the debugging support for self-comparison
(triggered by 'abidw --debug-abidiff <binary>').
This patch fixes some typos in the existing diagnostics emitted by the
self-comparison debugging mode and improves the detection of a change
in a canonical type value between a type that is serialized to abixml,
and the same type that is de-serialized from abixml. This later check
is now performed during the process of handling canonical type
propagation when confirming/canceling (speculatively) propagated
canonical types. It's useful to find problems in that process of
confirming/canceling.
* include/abg-ir.h
(environment::{get_type_id_canonical_type_map}): Const-ify the
existing member function and add non-const overloads.
(environment::{get_type_id_from_pointer,
get_canonical_type_from_type_id}): Const-ify.
(environment::get_pointer_type_id_map): Add new member function.
* src/abg-ir-priv.h
(environment::priv::{confirm_ct_propagation_for_types_dependant_on,
confirm_ct_propagation}): Call
check_abixml_canonical_type_propagation_during_self_comp() here.
(environment::priv::{get_type_id_canonical_type_map,
get_pointer_type_id_map, get_type_id_from_pointer,
get_type_id_from_type, get_canonical_type_from_type_id,
check_abixml_canonical_type_propagation_during_self_comp}): Add
new member functions.
* src/abg-ir.cc (return_comparison_result): Call
check_abixml_canonical_type_propagation_during_self_comp on every
single type with non confirmed propagated canonical type.
(environment::{get_type_id_canonical_type_map,
get_pointer_type_id_map, get_type_id_from_pointer,
get_type_id_from_type, get_canonical_type_from_type_id}): Delegate
to the new implementations that are now member functions of
environment::priv.
(type_base::get_canonical_type_for): Fix typo in diagnostics when
debugging self-comparison. Add more context.
* src/abg-reader.cc
(abixml::reader::maybe_check_abixml_canonical_type_stability):
Likewise.
* src/abg-writer.cc (write_type_record): Do not try to get abixml
type-id for a type (originating from the DWARF) that has no
canonical type, otherwise, that /can/ introduce a gap in the
type-ids as those can turn out not being emitted in the abixml
after all.
tests/update-test-output.py: Adapt to some broken test output
Sometimes, the output of runtestreaddwarf or runtestannotate are
broken due the fact that they execute test units in parallel and each
unit might emit output that watch on each other toes.
This fixes tests/update-test-output.py to take that into account.
As this is a helper tool used to update updates, it won't have any
impact on libabigail's output.
* tests/update-test-output.py (process): Don't expect the start
pattern of the main diff hunk to begin at the end of a line
because that can be broken for runtestreaddwarf and co.
Mark Wielaard [Fri, 14 Apr 2023 14:52:09 +0000 (16:52 +0200)]
doc: Fix some typos and add some missing references
Building the docs point out a few issues:
abidiff.rst:238: WARNING: Unknown target name: "linux kernel".
abidiff.rst:249: WARNING: Unknown target name: "linux kernel".
abidiff.rst:263: WARNING: Unknown target name: "linux kernel".
abidiff.rst:274: WARNING: Unknown target name: "linux kernel".
abidw.rst:23: WARNING: Unknown target name: "btf`_formats, if present. finally, if no debug info in these formats is found, it only considers `elf".
abidw.rst:34: WARNING: duplicate label abidiff_invocation_label, other instance in doc/manuals/abidiff.rst
abipkgdiff.rst:298: WARNING: Unknown target name: "linux kernel".
abipkgdiff.rst:309: WARNING: Unknown target name: "linux kernel".
abipkgdiff.rst:323: WARNING: Unknown target name: "linux kernel".
abipkgdiff.rst:334: WARNING: Unknown target name: "linux kernel".
libabigail-concepts.rst:620: WARNING: Block quote ends without a blank line; unexpected unindent.
libabigail-overview.rst:1: WARNING: Title overline too short.
Fix those as follows:
* doc/manuals/abidiff.rst: Add Linux Kernel reference.
* doc/manuals/abipkgdiff.rst: Likewise.
* doc/manuals/abidw.rst: Add space between `BTF`_ and formats.
Rename _abidiff_invocation_label to _abidw_invocation_label.
* doc/manuals/libabigail-concepts.rst: Add empty line between
_suppr_has_size_change_property_label and has_size_change.
* doc/manuals/libabigail-overview.rst: Extend title overlines.
Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
ir: Recognize "void* as being equal to all other pointers in C
Today, the pointer-to-void type is naively considered as being
different to all other pointers by Libabigail. This indirectly leads
to spurious changes in code bases where we have this kind of pattern:
/* in foo.h */
typedef void* some_pointer_type;
struct foo
{
some_pointer_type member;
};
bool
test_some_pointer_type(some_pointer_type);
/* This header file is included by client code */
/*in foo.c */
typedef int* some_pointer_type;
struct foo
{
some_pointer_type member;
};
bool
test_some_pointer_type(some_pointer_type f)
{
/* The actual implementation. */
}
Another way to reproduce that spurious change is to run this command:
$ fedabipkgdiff --self-compare -a --from fc37 glibc
* include/abg-fwd.h (is_void_pointer_type): Declare new function.
* src/abg-ir.cc (is_void_pointer_type): Define new function.
(equals): In the overload for pointer_type_def, handle the special
case pointer to void, making it equal to all other pointer, for
the C language.
(is_non_canonicalized_type): pointer to void is no more
canonicalized as it can be equal to all other types.
* tests/data/test-annotate/libtest23.so.abi: Adjust
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/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/test21-pr19092.so.abi: Likewise.
* tests/data/test-annotate/test5.o.abi: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.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/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/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/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/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/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.
While debugging some issues, I felt the need to easily get the type-id
from a given ir::type_base* from within the debugger.
I have thus added this new environment::get_type_id_from_type member
function.
* include/abg-ir.h (environment::get_pointer_type_id_map): Declare
...
* src/abg-ir.cc (environment::get_pointer_type_id_map): ... this
new member function.
abidiff,reader: Fix compilation with --debug-self-comparison
While chasing self-comparison changes errors, I realized that
compilation is failing when the package is configured with
--debug-self-comparison.
Fixed thus.
* src/abg-reader.cc
(reader::{maybe_check_abixml_canonical_type_stability, read_corpus}):
get_environment() doesn't returns a pointer anymore. So adapt the
code.
(maybe_map_type_with_type_id): Adjust because the environment is
const.
(load_canonical_type_ids): The xml_reader namespace doesn't exist
anymore. It's now abixml.
* tools/abidiff.cc (options::options): Initialize the
do_debug_self_comparison data member before the use_btf one, as it
should be.