GCC 15 (rightfully) complains about a new
{ctf,dwarf}::reader::initialize method that shadows existing
elf_base_reader::initialize methods with a different parameters set.
This patch fixes that issue by renaming that dwarf::reader::initialize
method into dwarf::reader::reset.
* src/abg-ctf-reader.cc (ctf::reader::initialize): Adjust.
(ctf::reader::reset): Rename ctf::reader::initialize into this.
* src/abg-dwarf-reader.cc (reader::initialize): Adjust.
(dwarf::reader::reset): Rename dwarf::reader::initialize into
this.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Updated the big-tests sub-module to add the commit below:
2afebc4 test-diff-pkg: Add new kernel packages sets to test set comparison.
This is to test the commit:
233d6bb3 bug PR32476 - abipkgdiff: Support comparing sets of packages
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds options --set{1,2} to abipkgdiff so that it can
compare the ABI of binaries coming from a set of packages against the
ABI of binaries coming from another set of packages.
To do so, the internals of the tools have been changed so that it
primarily considers package sets now instead of packages.
A package set is a union of constituent packages that are all
extracted under the same temporary directory. The package set is
potentially associated with ancillary devel, debug or KABI definition
packages.
This patch implements the feature request filed at
https://sourceware.org/bugzilla/show_bug.cgi?id=32476.
* doc/manuals/abipkgdiff.rst: Add documentation for the new
--set{1,2} options. Update the documentation to describe
abipkgdiff as a tool to compare sets of packages.
* tools/abipkgdiff.cc (options::{package_set_paths1,
package_set_paths2, pkg_set1, pkg_set2}): New data members.
(options::{package1, package2, pkg1, pkg2}): Remove these data
members.
(get_interesting_files_under): Rename
get_interesting_files_under_dir into this. Add a new overload
that takes a package_set instead of a directory path.
(package::package): Make this destructor virtual, so that we can
RTTI to the package class.
(package::load_elf_file_paths): Adjust to calling
get_interesting_files_under.
(class package_set): Define new class.
(package_set_sptr): Define new typedef.
(class pkg_set_prepare_task): Rename pkg_prepare_task into this.
(pkg_set_prepare_task_sptr): Renamed pkg_prepare_task_sptr into
this.
(create_maps_of_package_set_content): Renamed
create_maps_of_package_content into this and adjust to make it
take a package_set_sptr.
(extract_package_set_and_map_its_content): Renamed
extract_package_and_map_its_content into this and adjust to make
it take a package_set_sptr.
(prepare_package_sets): Renamed prepare_packages into this and
adjust to make it take a package_set_sptr.
(compare_prepared_userspace_package_sets): Renamed
compare_prepared_userspace_packages into this and adjust to make
it take a package_set_sptr.
(self_compare_prepared_userspace_package_set)
(self_compare_prepared_package_set): Renamed
self_compare_prepared_userspace_package and
self_compare_prepared_package into these* and adjust to make it
take a package_set_sptr.
(compare_prepared_linux_kernel_package_sets): Renamed
compare_prepared_linux_kernel_packages into this and adjust to
make it take a package_set_sptr.
(compare_prepared_package_set): Renamed compare_prepared_package
into this and adjust to make it take a package_set_sptr.
(pkg_set_prepare_task::perform): Adjust.
(is_kernel_package, get_core_kernel_package, is_package_set):
Define new static functions.
(extract_package, maybe_erase_temp_dirs): Take a package_sptr
rather than a reference to a package.
(extract_package_set_and_map_its_content)
(erase_created_temporary_directories)
(create_private_types_suppressions)
(maybe_create_public_dso_sonames_set)
(must_compare_public_dso_only, maybe_handle_kabi_stablelist_pkg)
(compare, compare_to_self): Make these functions take a
package_set_sptr rather than a reference to a package.
(compare_to_self): Adjust.
(parse_command_line): Make this take --set{1,2} options and adjust
accordingly. Fix detection of non-existent file input by using
options::wrong_arg instead options::wrong_option.
(main): Adjust to using options::wrong_args to detect non-existing
or wrong input files. Adjust to consider only package sets to be
compared now.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When running on EL8, I am seeing a number of issues in the
abidb-related tests. As I haven't tested abidb on EL8, I am disabling
it on those systems for now.
* configure.ac: Disable abidb on systems that have python version
less than 3.9.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
A whitelist is now called a stablelist. This patch enacts that
naming change in the code. It's practically a s/whitelist/stablelist
throughout the code base of the abipkgdiff program.
* tools/abipkgdiff.cc (options::kabi_stablelist_{packages,paths}):
Renamed kabi_whitelist_* into these.
(package::KIND_KABI_STABLELIST): Renamed the KIND_KABI_WHITELIST
enumerator into this.
(package::kabi_stablelist_package_): Renamed
kabi_whitelist_package_ into this.
(package::kabi_stablelist_package): Likewise for the getter/setter
pair.
(package::erase_extraction_directories): Renamed whitelist into
stablelist here.
(maybe_check_suppression_files, maybe_collect_kabi_stablelists)
(get_kabi_stablelists_from_arch_under_dir)
(maybe_handle_kabi_stablelist_pkg)
(extract_package_and_map_its_content)
(compare_prepared_linux_kernel_packages): Likewise.
(parse_command_line): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In preparation for an upcoming patch about comparing sets of packages
(especially kernel packages that can contain xz-compressed kernel
modules) this patch adds support for detecting the content of an input
file compressed with the XZ tool.
Note that the various libabigail tools need to know the kind of input
file they are given in order to know what front-end to instantiate to
handle the input file. The determination of the kind of file is done
by the function tools::utils::guess_file_type either by looking at the
suffix of the file name (for certain special files like tar files) or
by opening the file and looking at its magic bytes.
This patch uses liblzma to de-compress xz-ed files. The decompressing
is done by a custom-written std::streambuf class. That decompressor
streambuf is then instantiated with the input compressed ifstream.
Then, an istream is constructed using that decompressor and so readers
of that istream can just transparently just read from it, without
knowing anything about the upstream decompressor streambuf.
The existing code of guess_file_type has been adapted to instantiate
the right decompressor streambuf. Once it has it and constructed the
(decompressed) istream, the rest of the code remains unchanged and
uses the istream as before.
A new function tools_utils::get_decompressed_streambuf is introduced
to get the right streambuf decompressor for the given input file.
That function must be amended to support new compression schemes to
come.
With this patch, libabigail now can transparently read xz-ed ABIXML
files as well as xz'ed ELF files. Note that both elfutils and libxml2
know how to read xz'ed binaries so I haven't had to do anything for
them to handle the xz'ed input files. Pretty neat.
The patch also adds regression tests handling input ABIXML files and
ELF files.
* configure.ac: Detect the liblzma library.
* include/abg-tools-utils.h (enum file_type): Add a new
FILE_TYPE_XZ enumerator.
(class xz_decompressor_type): Declare a new custom std::streambuf
class.
* src/abg-elf-helpers.h: Include elfutils/libdwelf.h.
* src/abg-elf-reader.cc (get_type_of_elf_file): Use
dwelf_elf_begin instead of elf_begin to transparently handle
compressed input file.
* src/abg-tools-util*s.cc (struct xz_decompressor_type::priv):
Define private type.
(xz_decompressor_type::{xz_decompressor_type,
~xz_decompressor_type, underflow}): Define new methods for
xz_decompressor_type.
(operator<<(ostream&, file_type)): Add
support for the new FILE_TYPE_XZ enumerator.
(enum compression_kind): Define new enum.
(is_compressed_file_type, get_decompressed_streambuf): Define new
static functions.
(guess_file_type): In the overload for std::istream, detect the XZ file
type. In the overload for std::string, use the new
is_compressed_file_type and get_decompressed_streambuf to
decompress a compressed file on the fly and handing the resulting
decompressed istream to the overload for std::istream.
* tests/data/test-read-dwarf/test0.xz: New input binary test.
* tests/data/test-read-dwarf/test0.xzbinary: Likewise.
* tests/data/test-read-write/test28.xml.xz: Likewise.
* tests/data/test-read-write/test28.xml.xzed: Likewise.
* tests/data/Makefile.am: Add the new test input to source
distribution.
* tests/test-read-dwarf.cc (in_out_specs): Add the new test input
to this test harness.
* tests/test-read-write.cc (in_out_specs): Likewise.
* tools/abicompat.cc (read_corpus): Add support for the new
abigail::tools_utils::FILE_TYPE_XZ.
* tools/abidiff.cc (main): Likewise.
* tools/abilint.cc (main): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I realized that $ELF_CFLAGS and
$DW_CFLAGS are missing from DEPS_CPPFLAGS.
Fixed thus.
* configure.ac: Add $ELF_CFLAGS and $DW_CFLAGS to DEPS_CPPFLAGS.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I realized that the xxhash
detection/configuration code in the configure machinery doesn't
substitute (in the Makefiles) the XXHASH_CFLAGS and XXHASH_LIBS
variables that it computed. It doesn't include those values in the
DEPS_CPPFLAGS and DEPS_LIBS variables either.
Fixed thus.
* configure.ac: Substitute XXHASH_CFLAGS and XXHASH_LIBS in the
Makefiles. Add XXHASH_CFLAGS to DEPS_CPPFLAGS and XXHASH_LIBS to
DEPS_LIBS.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
A Kernel ABI "whitelist" is now called a Kernel ABI stablelist. The
file containing the stablist in the kernel stablelist package has also
changed.
This patch makes abipkgdiff recognize that otherwise, no stablelist is
found and then analyzing a Linux Kernel becomes super slow.
* tools/abipkgdiff.cc (maybe_collect_kabi_whitelists): Recognize
files with prefix "kabi_stablelist_" as being a stablelist file,
in addition to the old kabi_whitelist_ prefix.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch sorts the description of the options of the abipkgdiff tool
alphabetically.
* abipkgdiff.rst: Sort the options alphabetically.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When trying to know where abipkgdiff spends time, it can be useful to
see timed logs of the actual diffing process, including the computing
of the diff and the categorization of the diff nodes.
This patch adds the new --verbose-diff option which does just that.
* doc/manuals/abipkgdiff.rst: Document the new --verbose-diff
option.
* tools/abipkgdiff.cc (options::verbose_diff): New data member.
(options::options): Initialize the new data member.
(set_diff_context_from_opts): Activate logging of the diffing
process when the user issues the --verbose-diff option.
(parse_command_line): Parse --verbose-diff. Activate --verbose
when --verbose-diff is given.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I felt the need for more logs when
using the --verbose option with abipkgdiff, especially with respect to
building corpora for Linux kernel binaries and gathering their kabi
stable lists.
* src/abg-tools-utils.cc (load_vmlinux_corpus): Log stable list
loading.
* tools/abipkgdiff.cc (compare_prepared_linux_kernel_packages):
Log building of corpora for Linux kernels and diffing them.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When looking at something else, I noticed that abipkgidiff --help
would display a text in which the spacing of some parts was not
right. Fixed thus.
* tools/abipkgdiff.cc (display_usage): Fix spacing.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
I noticed that the configure.ac is missing a preamble containing
copyright information. Fixed thus.
* configure.ac: Add missing preamble.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
DWARF 5 introduced new language enumerators. Libabigail needs to
recognize some of them, especially those related to C, C++, and Ada.
But while looking into it, I thought I'd made it recognize more than
just those languages, to prepare for the future.
* configure.ac: Detect the presence of DW_LANG_* language
enumerators that were not supported before and for new ones that
got introduced in DWARF 5.
* include/abg-ir.h (translation_unit::LANG_{C17, C23,
C_plus_plus_17, C_plus_plus_20, C_plus_plus_23, OCaml, D, Go,
Rust, Zig, Metal, Fortran18, Fortran23, Ada2005, Ada2012, Kotlin,
C_sharp, Ruby, Assembly, Crystal, HIP, Mojo, GLSL, GLSL_ES, HLSL,
OpenCL_CPP, CPP_for_OpenCL, SYCL, Odin, P4, Move, Hylo}): Add new
languages enumerators.
* src/abg-dwarf-reader.cc (dwarf_language_to_tu_language)
(get_default_array_lower_bound): Recognize & support the new
languages enumerators above.
* src/abg-ir.cc (translation_unit_language_to_string): Likewise.
(is_c_language): Recognize translation_unit::LANG_C{17,23}.
(is_cplus_plus_language): Recognize
translation_unit::LANG_C_plus_plus_{20,23}.
(is_ada_language): Recognize
translation_unit::LANG_Ada{95,2005,2012}.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It should be possible to build and install a custom elfutils (e.g,
from its source repository) under a particular prefix and have
libabigail use that custom elfutils.
This patch adds that capability by adding these two new options:
--with-libelf=/path/to/libelf/prefix and
--with-libdw=/path/to/libdw/prefix.
* configure.ac: Add support for --with-libdw and --with-libelf.
Use pkg-config to detect the presence of libdw and libelf either
on the system or below the prefixes specified by the new
aforementionned options.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds an option to make fedabipkgdiff compare shared
libraries that are private to the packages being considered.
It allows us to compare the private libxul.so shared library when
considering the firefox package, for instance.
* doc/manuals/fedabipkgdiff.rst: Add documentation for the new
--private-dso option.
* tools/fedabipkgdiff (abipkgdiff): Pass the --private-dso option
to abipkgdiff when asked by the user.
(build_commandline_args_parser): Support the new --private-dso
option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I realized that the documentation
bullet points of the command line options are not alphabetically
sorted in doc/manuals/fedabipkgdiff.rst. This makes it hard to look
for a particular option.
Fixed thus.
* doc/manuals/fedabipkgdiff.rst: Sort the documentation of options
alphabetically.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Let's have a policy to handle security issues reported against
libabigail.
This security policy text is derived from the elfutils project one at
https://sourceware.org/cgit/elfutils/tree/SECURITY.
* SECURITY: New security policy text file.
* Makefile.am: Add the new SECURITY file to the distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Reviewed-by: Frank Ch. Eigler <fche@redhat.com>
Recent patches since libabigail 2.5 change a lot of ABI and API of the
library, especially to add features like type hashing before the
canonicalization phase. Thus the LIBABIGAIL_SO_CURRENT version number
has to be bumped from 4 to 5.
* configure.ac: Set LIBABIGAIL_SO_CURRENT to 5.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The commit below introduced the fact that we now always use canonical
types for comparisons (when possible) in try_canonical_compare even
when there is only one type that is canonicalized.
That hasn't been done for when the code has been configured with
--enable-debug-type-canonicalization, leading to binutils failing
comparison in fc36 on aarch64 in that case.
Fixed thus.
Here is the commit I am talking about:
commit 8b3b3d89b3
Author: Dodji Seketeli <dodji@redhat.com>
Date: Fri Sep 27 12:14:23 2024 +0200
ir: Always use canonical types in comparison when possible
After staring at DWARF and ABIXML dumps for a while, I realized that
in the current (non-perfect) state of things, comparing type A and
type B can be slightly different from comparing canonical_type_of(A)
against type B, for instance. This is essentially because comparing
canonical_type_of(A) against B rather than A against B changes the
order in which the nodes of the graph of types are visited. Because
that graph has cycles, the order of visiting would essentially change
the value of the hashes that we compute during those visits.
This in turn changes the value of the comparisons depending on the
order of the comparisons.
So, to avoid those subtle changes, this patch ensures that whenever a
type has a canonical type, then it's that canonical type that is
always used in comparison. This ensures that types coming from ABIXML
(as they are all canonical types) are compared in the same order as
types coming from the ELF binaries.
This fixes the self-comparison of the infinipath-psm package from
fc36, referenced in bug https://sourceware.org/bugzilla/show_bug.cgi?id=29413.
* src/abg-ir.cc (try_canonical_compare): When
--enable-debug-type-canonicalization is activated use canonical
types for structural comparison.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When the canonical type of the scope type T of a member type MT
doesn't contain MT, then emitting T (obviously) doesn't emit MT. The
ABIXML writer detects that MT wasn't emitted, but then mistakenly
emits MT in the global scope, making MT lose its T scope.
When the ABIXML is read back again, MT mistakenly becomes a
non-qualified type, leading to a self-comparison error.
This issue appears when self-comparing gcc-gnat on fc36 on armv7hl at
least.
This patch fixes the issue by making write_decl_in_scope detect that
emitting T hasn't emitted MT. In that case, the function still needs
to emit the tags of the scope of MT and then emit MT.
* src/abg-writer.cc (write_decl_in_scope): Detect that emitting a
scope type T doesn't emit a particular member type MT that we are
looking at. In that case, the function still needs to emit the
tags of the scope of MT and then emit MT even though T was just
emitted.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When write_context::record_corpus_as_emitted is invoked on an ABI
corpus that has no associated path, it crashes as that violates an
assert.
This patch loosens the assert, allowing ABI corpora with no associated
paths to be handled.
* src/abg-writer.cc (write_context::record_corpus_as_emitted):
Allow corpus without path.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Up until now, when hashing an artifact through the virtual
type_or_decl_base::hash_value the given artifact is hashed by its
specific hashing function, that would be, for e.g, a pointer,
pointer_type_def:#️⃣:operator(). But then, the sub-types of the
pointer would be hashed using do_hash_value, which is a function
template that invokes type_base:#️⃣:operator(). That means, all
sub-types are hashed only using type_base:#️⃣:operator(), not their
virtual type_or_decl_base::hash_value. That
type_base:#️⃣:operator() hashes types only based on their size. No
other property of the artifact is taken into account. I call that
"partial" hashing, in lieu of the full hashing that would have
happened if the virtual type_or_decl_base::hash_value was invoked
leading to the invocation of the full <type>:#️⃣:operator() that
would hash the artifact based on all its properties, not just its
type size.
This patch implements a hash for complex types which is less likely to
have collisions.
* include/abg-hash.h (enum hashing_state): Add better comments for
the enumerators.
(hashing_state::HASHING_SUBTYPE_STATE): Add new enumerator.
* src/abg-hash.cc
(MAYBE_RETURN_EARLY_FROM_HASHING_TO_AVOID_CYCLES): Consider the
new state hashing::HASHING_SUBTYPE_STATE when detecting cycles.
({typedef_decl, qualified_type_def, pointer_type_def,
reference_type_def, array_type_def, ptr_to_mbr_type,
enum_type_decl, function_type, method_type, class_decl::base_spec,
class_or_union, class_decl, union_decl}:#️⃣:operator()): Invoke
type_or_decl_base::hash_decl on sub-types to compute their hash.
Prior to invoke that hashing function, set the state of the
artifact to the new hashing:HASHING_SUBTYPE_STATE so that
type_or_decl_base::hash_decl does *not* set the computed hash on
the sub-type.
* src/abg-ir-priv.h (type_or_decl_base::priv::set_hash_value): An
ABI artifact can now be in the hashing::HASHING_SUBTYPE_STATE
state.
* tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi:
Adjust.
* tests/data/test-annotate/libtest23.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/test-anonymous-members-0.o.abi:
Likewise.
* tests/data/test-annotate/test-pointer-to-member-1.o.annotated.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/test4.so.abi: Likewise.
* tests/data/test-annotate/test6.so.abi: Likewise.
* tests/data/test-annotate/test7.so.abi: Likewise.
* tests/data/test-annotate/test8-qualified-this-pointer.so.abi:
Likewise.
* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi:
Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Likewise.
* tests/data/test-read-btf/test0.o.abi: Likewise.
* tests/data/test-read-ctf/PR27700/test-PR27700.abi: Likewise.
* tests/data/test-read-ctf/test-PR26568-1.o.abi: Likewise.
* tests/data/test-read-ctf/test-PR26568-2.o.abi: Likewise.
* tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi:
Likewise.
* tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi:
Likewise.
* tests/data/test-read-ctf/test-anonymous-fields.o.abi: Likewise.
* tests/data/test-read-ctf/test-array-mdimension.abi: Likewise.
* tests/data/test-read-ctf/test-array-of-pointers.abi: Likewise.
* tests/data/test-read-ctf/test-array-size.abi: Likewise.
* tests/data/test-read-ctf/test-bitfield-enum.abi: Likewise.
* tests/data/test-read-ctf/test-bitfield.abi: Likewise.
* tests/data/test-read-ctf/test-callback.abi: Likewise.
* tests/data/test-read-ctf/test-callback2.abi: Likewise.
* tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi:
Likewise.
* tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi:
Likewise.
* tests/data/test-read-ctf/test-const-array.abi: Likewise.
* tests/data/test-read-ctf/test-dynamic-array.o.abi: Likewise.
* tests/data/test-read-ctf/test-enum-many.o.hash.abi: Likewise.
* tests/data/test-read-ctf/test-enum-symbol.o.hash.abi: Likewise.
* tests/data/test-read-ctf/test-enum.o.abi: Likewise.
* tests/data/test-read-ctf/test-forward-type-decl.abi: Likewise.
* tests/data/test-read-ctf/test-functions-declaration.abi:
Likewise.
* tests/data/test-read-ctf/test-linux-module.abi: Likewise.
* tests/data/test-read-ctf/test-list-struct.abi: Likewise.
* tests/data/test-read-ctf/test0.abi: Likewise.
* tests/data/test-read-ctf/test0.hash.abi: Likewise.
* tests/data/test-read-ctf/test1.so.abi: Likewise.
* tests/data/test-read-ctf/test1.so.hash.abi: Likewise.
* tests/data/test-read-ctf/test2.so.abi: Likewise.
* tests/data/test-read-ctf/test2.so.hash.abi: Likewise.
* tests/data/test-read-ctf/test4.so.abi: Likewise.
* tests/data/test-read-ctf/test4.so.hash.abi: Likewise.
* tests/data/test-read-ctf/test5.o.abi: Likewise.
* tests/data/test-read-ctf/test7.o.abi: Likewise.
* tests/data/test-read-ctf/test9.o.abi: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/PR24378-fn-is-not-scope.abi:
Likewise.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
Likewise.
* tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise.
* tests/data/test-read-dwarf/PR27700/test-PR27700.abi: Likewise.
* tests/data/test-read-dwarf/PR29443-missing-xx.o.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-pointer-to-member-1.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/test4.so.abi: Likewise.
* tests/data/test-read-dwarf/test4.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test7.so.abi: Likewise.
* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi:
Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-read-write/test28-without-std-fns-ref.xml:
Likewise.
* tests/data/test-read-write/test28-without-std-vars-ref.xml:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When the default minor ABIXML version is bumped, make it so that the
reader drops the hash values embedded in the ABIXML file. In that
case, a new hash value is computed before type canonicalization. This
ensures that we can easily change the format of the hash when needed.
* src/abg-reader.cc (reader::m_drop_hash_value): Define new data
member.
(reader::maybe_drop_hash_values): Define new function.
(reader::read_hash_and_stash): Make the static function
read_hash_and_stash a member function of reader. Make it so that
if m_drop_hash_value is define, then no hash value is read from
the XML node.
(read_type_hash_and_cti): Move declaration of static function
before the new reader::read_hash_and_stash.
(reader::read_corpus): Call the new maybe_drop_hash_values.
(build_function_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_ptr_to_mbr_type, build_function_type, build_subrange_type)
(build_array_type_def, build_enum_type_decl, build_typedef_decl)
(build_class_decl, build_union_decl): Adjust call to
read_hash_and_stash to reader::read_hash_and_stash.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This updates the libabigail-test.git sub-module level to commit:
commit 4b12e5e53f2a204a427927f09c894202defd0ebc
Author: Dodji Seketeli <dodji@redhat.com>
Date: Fri Sep 27 16:44:26 2024 +0200
test-diff-pkg: Add new test harness
Add a test harness to compare packages. This is adapted from
tests/test-diff-pkg.cc from libabigail.
Basically, big-tests now perform package diffs.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Now that comparison potentially involving a canonicalized type is
always done using the canonicalized type even if the other type being
compared is not canonicalized, it turns out we don't need to strip
typedefs when comparing pointer and reference types.
This essentially undoes what was done by the patch below:
commit 4cea6708d6
Author: Dodji Seketeli <dodji@redhat.com>
Date: Thu Sep 5 13:42:28 2024 +0200
ir: Strip typedefs from pointed-to-types during comparison
When comparing two pointers, a pointer to type T is considered
different from a pointer to typedef-of-T. This can lead to spurious
self-comparison errors and doesn't provide any practical benefit.
More-over, the hash value of type typedef-of-T is the same as the hash
value of type T. So today, a pointer to type T and pointer to
typedef-of-T have the same hash value.
This patch strips typedefs from the pointed-to type of pointers and
references before comparing them. It thus fixes the self-comparison
issue exhibited by the command:
$ fedabipkgdiff --self-compare -a --from fc36 binutils
* src/abg-ir.cc (equals): In the overload for pointer_type_def and
reference_type_def, do not peel typedefs from the pointed-to types
before comparing them.
* 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/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-annotate/test21-pr19092.so.abi: Adjust.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Adjust.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
After staring at DWARF and ABIXML dumps for a while, I realized that
in the current (non-perfect) state of things, comparing type A and
type B can be slightly different from comparing canonical_type_of(A)
against type B, for instance. This is essentially because comparing
canonical_type_of(A) against B rather than A against B changes the
order in which the nodes of the graph of types are visited. Because
that graph has cycles, the order of visiting would essentially change
the value of the hashes that we compute during those visits.
This in turn changes the value of the comparisons depending on the
order of the comparisons.
So, to avoid those subtle changes, this patch ensures that whenever a
type has a canonical type, then it's that canonical type that is
always used in comparison. This ensures that types coming from ABIXML
(as they are all canonical types) are compared in the same order as
types coming from the ELF binaries.
This fixes the self-comparison of the infinipath-psm package from
fc36, referenced in bug https://sourceware.org/bugzilla/show_bug.cgi?id=29413.
* src/abg-ir.cc (maybe_get_canonical_type): Define new function
template.
(try_canonical_compare): Use the above function to always use
canonical types in comparison.
* tests/data/test-diff-pkg/infinipath-psm-3.3-26_g604758e_open.6.fc36.5.x86_64-self-check-report.txt:
New test reference output.
* tests/data/test-diff-pkg/infinipath-psm-3.3-26_g604758e_open.6.fc36.5.x86_64.rpm:
Add new binary input.
* tests/data/test-diff-pkg/infinipath-psm-debuginfo-3.3-26_g604758e_open.6.fc36.5.x86_64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
XXH_INLINE_ALL: Make all functions inline, implementation is directly
included within xxhash.h. This makes it so that there is no runtime
dependency on libxxhash.so and could result in faster code.
* configure: Don't AC_SUBST XXHASH_{VERSION,LIBS,CFLAGS}.
Remove XXHASH_LIBS from DEPS_LIBS. Add -DXXH_INLINE_ALL=1
to CFLAGS and CXXFLAGS.
Signed-off-by: Mark Wielaard <mark@klomp.org>
When the type of a function parameter is a declaration-only type and
if it has a definition, then this patch uses that definition in the
representation of the function type name.
Note that the ABIXML writer always emits definitions of
declaration-only types when they are available so if we don't use
those definitions in the function type representations, there might be
subtle self-comparison errors down the road.
This patch fixes the self-comparison of the OpenMolcas package in
Fedora 36 which was failing for the command:
$ fedabipkgdiff --self-compare -a --from fc36 OpenMolcas
* src/abg-ir.cc (stream_pretty_representation_of_fn_parms): Use
the definition of decl-only function parameter types in the
representation.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The libQt6Network.so.6.3.1 exhibits some interesting debug info where
two variables with slightly different qualified name have the same ELF
symbol.
Consider the DIE for this variable:
[ 1aab3] variable abbrev: 118
name (GNU_strp_alt) "backendMutex"
decl_file (implicit_const) qsslsocket_p.h (42)
decl_line (data1) 196
decl_column (data1) 26
linkage_name (GNU_strp_alt) "_ZN17QSslSocketPrivate12backendMutexE"
type (ref_udata) [ 1aa35]
external (flag_present) yes
declaration (flag_present) yes
inline (implicit_const) declared_inlined (3)
location (exprloc)
[ 0] addr +0x1e3050 <_ZN17QSslSocketPrivate12backendMutexE>
This DIE designates a variable named backendMutex in the global
namespace. It's associated to the ELF symbol
_ZN17QSslSocketPrivate12backendMutexE.
Then, later, there is this DIE:
[d05d3e] class_type abbrev: 260
name (GNU_strp_alt) "QSslSocketPrivate"
declaration (flag_present) yes
sibling (ref_udata) [d05d70]
[...]
[d05d70] variable abbrev: 642
name (GNU_strp_alt) "backendMutex"
decl_file (implicit_const) qsslsocket_p.h (54)
decl_line (data1) 196
decl_column (data1) 26
linkage_name (GNU_strp_alt) "_ZN17QSslSocketPrivate12backendMutexE"
type (ref_addr) [ fdc5]
external (flag_present) yes
declaration (flag_present) yes
inline (implicit_const) declared_inlined (3)
location (exprloc)
[ 0] addr +0x1e3050 <_ZN17QSslSocketPrivate12backendMutexE>
Here, this DIE represents a static data member named
QSslSocketPrivate::backendMutex, as it's member of the
QSslSocketPrivate class. Note how it's also associated with the ELF
symbol _ZN17QSslSocketPrivate12backendMutexE.
So both variables are associated with the same ELF symbol and should
thus be exported from the ABI corpus.
Today, only one of these variables is represented as exported in the
corpus. Depending on the order in which the variables are analyzed,
the variable that is represented as exported might be either one or
the other, leading to some spurious self-comparison errors.
This patch fixes the issue by allowing the corpus to represent more
than one variable having a given ELF symbol to be exported. This is
similar to what is already for functions.
This fixes the self comparison of the qt6-qtbase package, which can be
witnessed by issuing the command:
$ fedabipkgdiff --self-compare -a --from fc36 qt6-qtbase
* include/abg-corpus.h (corpus::lookup_variables): Replace
corpus::lookup_variable with this one which returns the set of
variables associated with a given ID of variable.
* src/abg-corpus-priv.h (istr_var_ptr_set_map_type): Define new
typedef.
(corpus::exported_decls_builder::priv::id_vars_map_): Replace
id_var_map_ with this new data member of type
istr_var_ptr_set_map_type.
(corpus::exported_decls_builder::priv::id_fns_map): Fix comment.
(corpus::exported_decls_builder::priv::id_vars_map): Replace
previous id_var_map with this member function.
(corpus::exported_decls_builder::priv::var_id_is_in_id_vars_map):
Replace the var_id_is_in_id_var_map member function.
(corpus::exported_decls_builder::priv::var_is_in_vars): Define new
static member function.
(corpus::exported_decls_builder::priv::{var_is_in_id_vars_map, add_var_to_id_vars_map}):
Define new member functions.
(corpus::exported_decls_builder::priv::add_var_to_map): Remove.
(corpus::exported_decls_builder::priv::add_var_to_exported):
Adjust by using the new var_is_in_id_vars_map and
add_var_to_id_vars_map.
* src/abg-corpus.cc
(corpus::exported_decls_builder::maybe_add_var_to_exported_vars):
Adjust, use the new
corpus::exported_decls_builder::priv::var_is_in_id_vars_map.
(corpus::lookup_variables): Replace corpus::lookup_variable with
this one which returns the set of variables associated with a
given ID of variable.
* tools/abicompat.cc
(compare_expected_against_provided_variables): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I noticed that in some rare cases we
might omit to map the XML node representing a pointer to its decl.
* src/abg-reader.cc (build_pointer_type_def): Unconditionally map
a pointer type XML node to its decl.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The abidw --debug-tc option (enabled by the
--enable-debug-type-canonicalization configure option) performs every
type comparison twice; once structurally and once canonically.
This patch improves that checking mode by disabling comparison result
caching. It makes things slower but it makes the checking more
reliable.
* src/abg-ir.cc (compare_types_during_canonicalization): Disable
type comparison result caching during type canonicalization
debugging.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When comparing two pointers, a pointer to type T is considered
different from a pointer to typedef-of-T. This can lead to spurious
self-comparison errors and doesn't provide any practical benefit.
More-over, the hash value of type typedef-of-T is the same as the hash
value of type T. So today, a pointer to type T and pointer to
typedef-of-T have the same hash value.
This patch strips typedefs from the pointed-to type of pointers and
references before comparing them. It thus fixes the self-comparison
issue exhibited by the command:
$ fedabipkgdiff --self-compare -a --from fc36 binutils
* src/abg-ir.cc (equals): In the overload for pointers and
reference types, strip typedefs off of pointed-to types before
comparing them.
* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.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/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/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/test9-pr18818-clang.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>