Bug 27552 - libabigail needs to interpret ARM32 symbol addresses specially
The previous commit omitted any code commentary. This adds a link to
the relevant reference. The code is shortened slightly as well.
* src/abg-dwarf-reader.cc
(read_context::load_symbol_maps_from_symtab_section): Add
descriptive comment to ARM32 address handling; shorten
the assignment using &=.
Signed-off-by: Giuliano Procida <gprocida@google.com>
abg-symtab-reader.{h,cc} shall contain the refactored symtab reader.
Create the stub files, an empty unit test and hook everything up in the
make system.
* src/abg-symtab-reader.h: New header file.
* src/abg-symtab-reader.cc: New source file.
* src/Makefile.am: Add new source files.
* tests/Makefile.am: Add new test case runtestsymtabreader.
* tests/test-symtab-reader.cc: New test source file.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Bug 27552 - libabigail needs to interpret ARM32 symbol addresses specially
The ARM32 ELF specification specifies that bit 0 of an ELF function
address is a flag specifying whether the instructions are Thumb or
ARM. So clear this bit before using the addresses for symbol mapping.
* src/abg-dwarf-reader.cc
(read_context::load_symbol_maps_from_symtab_section): Clear
bit zero of ARM32 function addresses.
* src/abg-elf-helpers.cc (architecture_is_arm32): Add new
function.
* src/abg-elf-helpers.h (architecture_is_arm32): Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Update.
Signed-off-by: Giuliano Procida <gprocida@google.com>
In the context of libabigail and a single library run (when reading from
dwarf or from xml), a symbol is either suppressed or it is not. While
one could argue that this is a property of the read_context, the
read_context might not be around anymore when the symbol still is.
Hence, persist the 'is_suppressed' state along with the symbol itself.
* include/abg-ir.h (elf_symbol::elf_symbol): Add is_suppressed
parameter.
(elf_symbol::create): Likewise.
(elf_symbol::is_suppressed): New getter declaration.
(elf_symbol::set_is_suppressed): New setter declaration.
* src/abg-ir.cc (elf_symbol::priv::priv): Add is_suppressed
parameter.
(elf_symbol::priv::is_suppressed_): New field.
(elf_symbol::elf_symbol): Add is_suppressed parameter.
(elf_symbol::create): Likewise.
(elf_symbol::is_suppressed): New getter implementation.
(elf_symbol::set_is_suppressed): New setter implementation.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Being exported through a ksymtab (in case of Linux Kernel binaries) is
actually a property of the Elf symbol itself and we can therefore track
it along with the symbol that we collect from symtab. While tracking is
currently done by keeping separate symbol lists and maps for symtab and
ksymtab symbols, they can be consolidated having a property to indicate
whether this symbol also appeared as a ksymtab entry.
Hence, and for future changes in this area, add this property and update
all references. The flag is false initially unless otherwise specified.
* include/abg-ir.h (elf_symbol::elf_symbol): Add is_in_ksymtab
parameter.
(elf_symbol::create): Likewise.
(elf_symbol::is_in_ksymtab): New getter declaration.
(elf_symbol::set_is_in_ksymtab): New setter declaration.
* src/abg-ir.cc (elf_symbol::priv::priv): Add is_in_ksymtab
parameter.
(elf_symbol::priv::is_in_ksymtab_): New field.
(elf_symbol::elf_symbol): Add is_in_ksymtab parameter.
(elf_symbol::create): Likewise.
(elf_symbol::is_in_ksymtab): New getter implementation.
(elf_symbol::set_is_in_ksymtab): New setter implementation.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In the absence (but desire) of std::optional<T>, add a simplified
version of it to abg_compat:: in case we are compiling with a pre-C++17
standard. Otherwise use std::optional from <optional> directly.
This is being used by a later patch and serves as a prerequisite.
It only serves the purpose of being a compatibility implementation and
does not claim to be complete at all. Just enough for the project's
needs.
* include/abg-cxx-compat.h (abg_compat::optional): Add new class.
* tests/tests-cxx-compat.cc: Add new test cases.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Functions relating to zip archives are declared but are never compiled
when --enable-zip-archive=no, the default.
This makes sure that they are not declared when they won't be defined
due to conditional compilation.
* include/abg-reader.h (read_corpus_from_file): Guard the
declaration of these overloads with #ifdef WITH_ZIP_ARCHIVE.
* tools/abilint.cc: Guard the use of
abigail::xml_reader::read_corpus_from_file with #ifdef
WITH_ZIP_ARCHIVE.
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Functions relating to zip archives are declared but are never compiled
when --enable-zip-archive=no, the default.
This makes sure that they are not declared when they won't be defined
due to conditional compilation.
Signed-off-by: Ben Woodard <woodard@redhat.com>
During de-duplication of class definition while resolving decl-only
classes to their definition, the order in which classes of the same
name are compared is not always the same. That results in an
instability of the particular class being kept. This can have an
impact when some classes have member types because member types are
not meaningful during comparison; so in the end that can lead to
spurious order instability during ABIXML serialization.
* src/abg-dwarf-reader.cc
(read_context::resolve_declaration_only_classes): Compare the
classes that have the same name across several TU, always in the
same order.
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch is about fixing a compilation error that we are seeing on
Fedora Rawhide with glibc 2.33.9000, which makes MINSIGSTKSZ not be a
constant value anymore. Thus, the sigStackSize variable that is
declared constexpr cannot use that MINSIGSTKSZ as initializer anymore.
So as suggested in the issue
https://github.com/catchorg/Catch2/issues/2178 filed against
'catchorg' for this purpose, I am hardwiring the initialization value
of sigStackSize for now.
* tests/lib/catch.hpp: Update to v2.13.4 and initialize
sigStackSize to 32768 for now, as suggested by
https://github.com/catchorg/Catch2/issues/2178.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is from a problem report originating from Red Hat bugzilla at
https://bugzilla.redhat.com/show_bug.cgi?id=1925876
I some C programs, the same type can be defined more than once in a
binary, as there is no "One Definition Rule[1]" in C.
[1]: https://en.wikipedia.org/wiki/One_Definition_Rule
The definition of those two types can be slightly different and yet be
equivalent.
For instance, the data member of a struct S might be defined once as
having a type which is a typedef Foo of, say, "long int" and that
struct S might be defined again elsewhere with a data member of type
typedef Bar of "long int" as well.
With the current code, because Foo and Bar have different names, they
are are going to compare different; so the two struct S are doing to
compare different even though they are equivalent.
Down the road, this is likely going to imply that the several 'struct
S' that are declaration-only will not be resolved as being
declarations of the definition of "struct S", because they is more
than one such definition, and those definitions are different.
This is going to lead to spurious (and hard to debug) type differences
that are going to be detected and reported by libabigail later down
the road.
This patch addresses the problem by not taking typedef names into
account when comparing typedefs before canonicalization. That allows
the comparison of classes and structs that happens during the
resolution of declaration-only classes to correctly deduce their
equivalence even in cases like the one exposed above. It thus reduces
the amount of declaration-only classes that are unnecessarily
considered to be different from the definition they ought to equal.
* include/abg-ir.h (maybe_compare_as_member_decls): Declare new
function. Make it a friend of class decl_base.
* src/abg-dwarf-reader.cc (maybe_canonicalize_type): Don't early
canonicalize typedefs because they can be "part" of a type that is
not yet completed, especially considering that class declaration
resolution is part of type building, stricto sensu.
* src/abg-ir.cc (maybe_compare_as_member_decls): Factorize this
out of ...
(equals): ... the overload for decl_base. Use it in the overload
for typedef_decl.
* tests/data/test-diff-pkg/nmap-7.70-5.el8_testjcc.x86_64-self-check-report-0.txt:
New test reference output.
* tests/data/test-diff-pkg/nmap-7.70-5.el8_testjcc.x86_64.rpm: New
binary input.
* tests/data/test-diff-pkg/nmap-debuginfo-7.70-5.el8_testjcc.x86_64.rpm: Likewise.
* tests/data/Makefile.am: Add these new testing material to source
distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add the new test input to
the harness.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt:
Adjust.
* tests/data/test-diff-suppr/test39-opaque-type-report-0.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is from the problem report in Red Hat bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=1924624
"comparing 'libpinyin.so.13.0.0' to itself wrongly yielded result"
During the canonicalization of an anonymous enum, the algorithm uses
its internal pretty representation to limit the number of types to
compare it to. That internal pretty representation is based on its
type name.
For anonymous types, the type name is not unique; it's constructed for
internal purposes that are different from the purpose of
canonicalization. So using that in the pretty representation might
negatively impact the accuracy of the canonicalization; it might make
it so that two anonymous in the same namespace types might wrongly be
considered canonically different.
To fix that, this change makes the internal pretty representation of
anonymous enum types essentially be "enum
<namespace-name>::__anonymous_enum__".
This is on part with what is done for unions and classes in commit:
005ab5c9 Use flat representation to canonicalize anonymous classes and unions
* src/abg-ir.cc (has_generic_anonymous_internal_type_name) :
Define new static function.
(get_generic_anonymous_internal_type_name): Use it here.
(decl_base::get_pretty_representation): For internal purposes,
build an anonymous name that is stable.
* tests/data/test-annotate/test21-pr19092.so.abi: Adjust.
* tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Adjust.
* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt: 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/test21-pr19092.so.abi: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
A recent commit to add DW_FORM_line_strp support had a small typo in
an assertion. This commit corrects that.
* src/abg-dwarf-reader.cc
(compare_dies_string_attribute_value): Typo fix.
Signed-off-by: Giuliano Procida <gprocida@google.com>
* configure.ac: Define if HAS_DW_FORM_line_strp if the
DW_FORM_line_strp enumerator is present.
* src/abg-dwarf-reader.cc (form_is_DW_FORM_line_strp): Define new
static function.
(compare_dies_string_attribute_value): Use it.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Upon a request to build the IR for a opaque enum type,
get_opaque_version_of_type wrongly returns a nil type even though the
code is in there to construct an opaque variant of the enum.
This patch cleans up that code to let it build an opaque enum type.
It also ensures the opaque enum type is properly added to its lexical
scope to ensure proper life cycle management.
* src/abg-dwarf-reader.cc (get_opaque_version_of_type): Do not
quit early for enum types, because the code that comes a bit later
can handle enums. Add the newly built enum to its scope for
proper life cycle management.
* tests/data/test-diff-suppr/PR27267/include-dir-v{0,1}/include.h: New
include files for the input test library.
* tests/data/test-diff-suppr/PR27267/libtestpr27267-v{0,1}.so: New
input test library.
* tests/data/test-diff-suppr/PR27267/report-1.txt: New reference
output for the comparison.
* tests/data/test-diff-suppr/PR27267/v{0,1}.c: Source code for the
new input test library.
* 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 input
above to the test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The comparison code fails to consider that a data member which offset
changed (and which type didn't change) constitutes a local change of
the enclosing class type.
Fixed thus.
* src/abg-ir.cc (equals): In the overload of class_or_union, when
a data member changes without having its type change, then
consider the data change as being local.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
Adjust.
* tests/data/test-diff-filter/test-PR27331-report-0.txt: New
reference output.
* tests/data/test-diff-filter/test-PR27331-v{0,1}.c: New test
source files.
* tests/data/test-diff-filter/test-PR27331-v{0,1}.o: New test
binary inputs.
* tests/data/Makefile.am: Add these new test material to source
distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the tests above to
the harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In some binaries, a DIE named I originating from a compilation unit
written in the C++ language can be an implementation of a DIE named S
(linked through the DW_AT_specification attribute on I) originating
from a compilation unit written in, say, the C language.
In that case, when are we looking at I and try to get the scope of S
(which the DWARF reader considers as the logical scope of I)
get_scope_for_die needs to look at the DW_AT_language attribute
carried by the compilation unit DIE of S. At the moment, we wrongly
look at the DW_AT_language carried by the compilation unit DIE of I
and we deduce the wrong language (C++ instead of C).
This patch fixes that.
* src/abg-dwarf-reader.cc (get_scope_for_die): Get the language of
the DIE from the compilation unit of the DIE itself.
* tests/data/test-types-stability/PR27165-libzmq.so.5.2.3: New
test input.
* tests/data/test-types-stability/PR27165-libzmq.so.5.2.3.debug:
Debug information for the new test input.
* tests/data/Makefile.am: Add the test inputs above to the source
distribution.
* tests/test-types-stability.cc (elf_paths): Add the new test
inputs to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
After fixing the interpretation of the DW_AT_bit_offset attribute for
offset of bit field data members, serialized abixml might now be
incompatible with versions of Libabigail that use the previous
interpretation.
That means that comparing an abixml file generated with previous
versions of Libabigail against a corpus resulting from an analysis
performed with the current version of libabigail might yield spurious
changes due to the differences in the way we now interpret the
DW_AT_bit_offset.
Hence, this patch bumps the version of abixml files emitted from now
on to "2.0". This version is deemed incompatible with the previous
"1.0" version.
Subsequently, an abixml file of the "1.0" format cannot be compared
against an abixml file of the "2.0" format, or against a binary
analyzed with a current version of Libabigail.
It's thus advised that abixml files of the "1.0" format version should
be re-generated with a current version of Libabigail, bumping their
format version number to the new "2.0".
* include/abg-corpus.h (corpus::init_format_version): Declare new
private method.
(corpus::set_environment): Make this non-const.
(corpus::{get,set}_format_{major,minor}_version_number): Declare
new accessors.
* src/abg-corpus.cc (corpus::init_format_version): Define new
method.
(corpus::set_environment): By default, initialize the format
version number of the corpus to the one supported by Libabigail.
(corpus::{get,set}_format_{major,minor}_version_number): Define
new accessors.
* include/abg-ir.h: Include abg-config.h to use the
abigail::config.
(environment::get_config): Declare new accessor.
* src/abg-ir.cc (environment::priv::config_): Add new data member.
(environment::get_config): Define new accessor.
* src/abg-config.cc (config::config): Bump the format
version number to "2.0".
* src/abg-corpus-priv.h
(corpus::priv::format_{major,minor}_version_number_): Add new data members.
* src/abg-reader.cc (handle_version_attribute): Define new static
function.
(read_corpus_from_input, read_corpus_group_from_input): Use it to
read the value of the "version" attribute and set the format
version number of the corpus and corpus group accordingly.
* src/abg-writer.cc (write_context::m_config): Remove the config
object because we can now get it from the environment.
(write_context::get_config): Get the config object from the
environment.
(write_translation_unit): Do not emit the version attribute on the
translation unit element anymore.
(write_version_info): Define static function.
(write_corpus, write_corpus_group): Use it to emit version
attribute on both the corpus and corpus group elements.
* tools/abidiff.cc
(emit_incomptatible_format_version_error_message): Define new
static function.
(main): Ensure that corpora and corpus groups being compared have
the same major version number.
* tests/update-test-output.py: Adjust syntax for python3.
* 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/test4.so.abi: Likewise.
* tests/data/test-annotate/test5.o.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-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Likewise.
* tests/data/test-diff-suppr/libtest48-soname-abixml-v0.so.abi:
Likewise.
* tests/data/test-diff-suppr/libtest48-soname-abixml-v1.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/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/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/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.so.abi: Likewise.
* tests/data/test-read-dwarf/test3.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test4.so.abi: Likewise.
* tests/data/test-read-dwarf/test4.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test5.o.abi: Likewise.
* tests/data/test-read-dwarf/test5.o.hash.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test7.so.abi: Likewise.
* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi:
Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-read-write/test0.xml: Likewise.
* tests/data/test-read-write/test1.xml: Likewise.
* tests/data/test-read-write/test10.xml: Likewise.
* tests/data/test-read-write/test11.xml: Likewise.
* tests/data/test-read-write/test12.xml: Likewise.
* tests/data/test-read-write/test13.xml: Likewise.
* tests/data/test-read-write/test14.xml: Likewise.
* tests/data/test-read-write/test15.xml: Likewise.
* tests/data/test-read-write/test16.xml: 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/test2.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/test24.xml: Likewise.
* tests/data/test-read-write/test25.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.
* tests/data/test-read-write/test3.xml: Likewise.
* tests/data/test-read-write/test4.xml: Likewise.
* tests/data/test-read-write/test5.xml: Likewise.
* tests/data/test-read-write/test6.xml: Likewise.
* tests/data/test-read-write/test7.xml: Likewise.
* tests/data/test-read-write/test8.xml: Likewise.
* tests/data/test-read-write/test9.xml: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds support for the DW_AT_data_bit_offset DWARF 5
attribute. Note that this attribute has been introduced in prior
versions of DWARF, but since the version 5, it supersedes the
DW_AT_bit_offset attribute.
Note that Libabigail was wrongly interpreting the DW_AT_bit_offset
attribute. It was considering it as the offset of the bit field data
member, starting from the least significant bit of the containing
structure. That is not the case on little endian machines,
unfortunately.
So this patch fixes that mistake.
So with this patch, we can now compare a binary using DW_AT_bit_offset
against a binary using DW_AT_data_bit_offset and expect things to work
correctly.
The problem is that abixml files generated with Libabigail versions
prior to this patch contain bit field data member offset values that
are not compatible with those contained in abixml files generated with
this version, onward.
So I guess a subsequent patch is needed to introduce a new abixml
version string (maybe "2.0") that would be deemed incompatible with
the previous "1.0" one. That way, we can prevent comparing 2.0 abixml
files against 1.0 ones in abidiff, for instance.
For now, the patch adjusts the various abixml files to make them
reflect the proper representation of DW_AT_bit_offset on little endian
machines.
* src/abg-dwarf-reader.cc (read_and_convert_DW_at_bit_offset):
Define new static function.
(die_member_offset): Primarily use DW_AT_data_bit_offset if its
present. Otherwise, look for DW_AT_bit_offset. Use the new
read_and_convert_DW_at_bit_offset function to properly interpret
DW_AT_bit_offset if its present. Update comment.
* tests/data/test-diff-filter/test-PR26684-dwarf{4,5}.o: New
binary test inputs.
* tests/data/test-diff-filter/test-PR26684.c: Source code of the
new binary test inputs above.
* tests/data/test-diff-filter/test-PR26684-report-0.txt: New
reference test output.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the test inputs
above to this test harness.
* tests/data/test-annotate/test13-pr18894.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-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi:
Adjust.
* tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt:
Adjust.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Adjust.
* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
Adjust.
* tests/data/test-read-dwarf/test13-pr18894.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.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When running fedabipkgdiff as:
fedabipkgdiff --self-compare -a --from fc33 nfs-utils
I am getting:
Error encountered while running fedabipkgdiff with error message:
Running it with the --verbose option yields more clue, though.
It turns out that fedabipkgdiff runs abipkgdiff on an RPM and gives it
the wrong associated -debuginfo RPM.
This is because the member function
RPMCollection.get_sibling_debuginfo() doesn't returns the "first"
debuginfo package that comes with a given RPM. In the case of the
package nfs-utils-2.5.2-1.rc4.fc33.aarch64.rpm, it was using the
package nfs-utils-coreos-debuginfo-2.5.2-1.rc4.fc33.aarch64.rpm
instead of the package nfs-utils-debuginfo-2.5.2-1.rc4.fc33.aarch64.rpm.
So, of course, abipkgdiff could not find the proper debuginfo for the
binaries carried by nfs-utils-2.5.2-1.rc4.fc33.aarch64.rpm.
This happens only in cases where there a several debuginfo packages
for a given RPM. In that case, we need to be more careful to select
the right debuginfo package and not just a random one.
This patch adds a RPMCollection.get_matching_debuginfo() member function
that does the right thing. It thus teaches
generate_comparison_halves() to use the new function.
* tools/fedabipkgdiff (RPMCollection::get_sibling_debuginfo):
Update comment.
(RPMCollection::get_matching_debuginfo): Define new function.
(generate_comparison_halves): Use
RPMCollection::get_matching_debuginfo instead of
RPMCollection::get_sibling_debuginfo.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When running Libabigail on Fedora 34 it appeared that we don't support
DW_FORM_line_strp in the fast string comparison scheme, during DIE
de-duplication.
This patch fixes that.
* src/abg-dwarf-reader.cc (compare_dies_string_attribute_value):
Support DW_FORM_line_strp.
* tests/data/test-diff-pkg/sshpass-1.07-1.fc34.x86_64-self-check-report-0.txt:
New reference test output.
* tests/data/test-diff-pkg/sshpass-1.07-1.fc34.x86_64.rpm: New
test input.
* tests/data/test-diff-pkg/sshpass-debuginfo-1.07-1.fc34.x86_64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new testing material above to
source distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add the test input above
to this harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When running fedabipkgdiff on the gawk-5.1.0-2.fc33.aarch64.rpm
package we get this error message:
Error encountered while running fedabipkgdiff with error message:
That is not a very useful error message to say the least.
The issue is that abipkgdiff returns with an "unknown error" which is
due to the fact that the gawk package contains a directory that is
owned by root. As abipkgdiff tries to write temporary files into that
directory, it fails to do so.
The patch now writes the temporary ABIXML file into a sub-directory
that is not owned the package where we should have write privileges.
It also improves error reporting.
* tools/abipkgdiff.cc (options::pkg{1,2}): Add new data members to
store the packages to compare and have them available for the
various functions that may need them down the road.
(package::create_abi_file_path): Add new function.
(compare_to_self): Use the new package::create_abi_file_path to
create the path to the ABI file in a directory not owned by the
package. That should increase our chances of having the rights to
write that one. Make sure to emit error message when the
comparison against self fails.
({compare_task, self_compare_task}::perform): During the process
of comparison if an internal error happens, report it. Cleanup
the existing reporting a little bit.
(pkg_extraction_task::perform): Fix comment.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When compiling with clang, it (rightfully) complains about an operator
precedence issue:
abipkgdiff.cc:1646:7: error: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
? string("Comparison against self SUCCEEDED\n")
^
Fix that by properly placing the parentheses. Also, drop the superfluous
string conversion.
* tools/abipkgdiff.cc (compare_to_self): address clang warning.
Signed-off-by: Matthias Maennich <maennich@google.com>
At the core of this issue, Libabigail is failing to canonicalize some
types in some cases. And that is triggering the assertion at the end
of hash_as_canonical_type_or_constant when emitting ABIXML.
It turns out read_context::canonicalize_types_scheduled in the dwarf
reader sometimes fails to canonicalize the types contained in
read_context::extra_types_to_canonicalize().
This patch fixes that.
Incidentally, this patch also fixes a previous issue where
hash_as_canonical_type_or_constant would hit that assert at its end
because of non-canonicalized function types. I am now removing the
band-aid I put in place at the time by loosening the assertion there.
* src/abg-dwarf-reader.cc
(read_context::canonicalize_types_scheduled): Don't forget to
canonicalize types stored in extra_types_to_canonicalize_.
* src/abg-ir.cc (type_base::get_canonical_type_for): Add better
comment.
(hash_as_canonical_type_or_constant): Remove crutch that is
useless now that we canonicalize almost all types in the system.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Support we have a type struct S and a type T defined as:
typedef struct S T;
Today, Libabigail considers that the two pointers "struct S*" and "T*"
are different.
The problem is that this can cause spurious change reports (as
reported by (abidw --abidiff) in binaries where we have the same type
defined more than once, each time using a different various around
this theme.
This patch make libabigail to now consider that "struct S*" and "T*"
are equal. It does the same for references and arrays.
* src/abg-ir.cc (equals): In the overloads for pointer_type_def,
reference_type_def and array_type_def, compare the pointed-to-type
modulo typedefs.
* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Adjust.
* tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt:
Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at several ABIXML files I noticed that several (member)
functions didn't have any associated ELF symbol and that in some cases,
there were even duplicated member functions. Those are the source of
some spurious changes sometimes reported by abidiff.
In DWARF the same function F can be represented several times. One
representation of F has some properties and other representations of F
might have properties that complement the properties carried by the
former representations. It's the unions of the properties of all
representations of F that constitute the properties of F.
An example of that "linked" nature is how DWARF represents inlined
functions. A function F can be inlined somewhere else. That inlined
version is called F', for instance. The DWARF representation of F'
will carry a DW_AT_abstract_origin attribute that points back to F to
signify that F' is the concrete inlined version of the abstract F.
F' will carry properties that are specific to its "inlined nature"
whereas F will carry properties that are more generic and independent
from all its various potential inlined forms.
So when Libabigail sees the DWARF representation of F, if it's
associated with an ELF symbol, then it must wait to encounter an F'
representation that is associated with an ELF symbol before adding an
internal representation (IR) of F into the final IR graph. Otherwise
the IR of F can be unnecessarily duplicated, with some instances
having an associated ELF symbol and others not.
This is what this patch does, in essence. While working on this, I
encountered some tangential issues that needed to be fixed altogether
for the whole to function. A lot of regression tests output had to be
adjusted.
In the end, a number of spurious change reports could be fixed;
notably reports about removal of destructors like STR::~STR(int).
Note how that destructor has a parameter; it's a GCC-specific
implementation detail that should not appear at this level, I believe.
* include/abg-ir.h (class_or_union::string_mem_fn_sptr_map_type):
Add a typedef for unordered_map<string, method_decl_sptr>.
(class_or_union::find_member_function_sptr): Declare new function.
* src/abg-ir.cc (class_or_union::priv::mem_fns_map_): Change the
type of this to string_mem_fn_sptr_map_type, so that shared
pointers to functions can be stored in the map, instead of bare
pointers to functions. This is useful to implement
class_or_union::find_member_function_sptr which returns a shared
pointer to function.
(class_or_union::find_member_function_sptr): Define new function.
(class_or_union::find_member_function): Adjust.
(method_decl::set_linkage_name): Use a non-deleting shared pointer
to store the current instance of member function into
class_or_union::priv::mem_fns_map_.
(hash_as_canonical_type_or_constant): As we are seeing more
function types, it appears that some function types are not
canonicalized. I am not sure why exactly, but let's loosen the
assert here for now, I'll chase the root of this later.
* src/abg-dwarf-reader.cc (finish_member_function_reading):
Improve detection of member function 'static-ness' by handling
cases where a this pointer can be const. Also support
DW_AT_object_pointer when it's present. This fixes the occurrence
of spurious change reports about loss of 'static-ness' of member
functions.
(potential_member_fn_should_be_dropped): Define new static
function and ...
(build_ir_node_from_die): ... use it here. When a function DIE
has the same linkage name as an existing function IR, do not
create a new IR for it. Rather, re-use the existing one to
complete it with the properties found on the function DIE. If a
new function doesn't seem to have an associated ELF symbol and is
not meant to be a virtual member function then drop its IR on the
floor as well.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/test0.abi: Likewise.
* tests/data/test-annotate/test1.abi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-annotate/test6.so.abi: Likewise.
* tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise.
* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi: Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Likewise.
* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise.
* tests/data/test-diff-filter/test0-report.txt: Likewise.
* tests/data/test-diff-filter/test01-report.txt: Likewise.
* tests/data/test-diff-filter/test10-report.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt: Likewise.
* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
* tests/data/test-diff-filter/test9-report.txt: Likewise.
* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test31-report-1.txt: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test0.abi: Likewise.
* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
* tests/data/test-read-dwarf/test1.abi: Likewise.
* tests/data/test-read-dwarf/test1.hash.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Sometimes when a symbol S' of a function F' aliases the symbol S of a function
F, the ABIXML reader might not add F' back into the set of exported
functions of the ABI corpus (as the DWARF reader has done initially).
That results in the apparent 'loss' of F' (and S') from the corpus.
This is due to the way F' is identified, using function_decl::get_id.
In the case where the symbol S' of F' has aliases,
function_decl::get_id (wrongly) uses the linkage name of F' as the
identifier. If F' and F happen to have the same linkage name and if F
is already in the set of exported functions of the corpus then F'
won't be added into that set.
To solve that problem, this patch makes function_decl::get_id
construct an ID that ensures that F and F' always have different IDs.
* src/abg-ir.cc (function_decl::get_id): If the elf symbol has
aliases, make the function name be part of the ID so that this ID
differs from the one of the other functions that share a symbol
alias with this one.
* tests/data/test-abidiff/test-PR18791-report0.txt: Adjust.
* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise.
* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-diff-pkg/glibc-2.32-3.fc33.aarch64-self-check-report-0.txt:
New test reference output.
* tests/data/test-diff-pkg/glibc-2.32-3.fc33.aarch64.rpm: New test
input RPM.
* tests/data/test-diff-pkg/glibc-debuginfo-2.32-3.fc33.aarch64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new test material to source
distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add the new test input
RPMs to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is a common micro optimization suggested by clang-tidy to improve
string::find performance. I have not done any measurements as to how it
impacts performance for that particular piece of code, but generally
this overload is to prefer here.
* src/abg-ir.cc (elf_symbol::get_name_and_version_from_id):
use character literal overload for single character string::find.
(parse_integral_type): Likewise.
Suggested-by: Chris Kennelly <ckennelly@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
When a declaration of a class, named H, matches more than one
definition (let's call them D) of H (in several other translation
units of the abi corpus) then H is left unresolved; that is, H is
considered as being a declaration-only class. Note that down the
road, H will compare different to all those Ds.
However when those Ds are all equal, it turns out that this can lead
to issues down the road. This is because conceptually, H equals D.
But then by not resolving H to D (and there are several Ds), we
artificially create a situation where H is different from D. We can
even create situations where those Ds are different among themselves.
So doing comparisons inevitably leads to spurious changes.
This is the root cause of the issue described in this bug at
https://sourceware.org/bugzilla/show_bug.cgi?id=26992.
To fix the issue, this patch thus resolves H to D when the different
Ds are all equal.
Note that a similar thing should be done for the process of resolving
declaration-only enums as well. But I don't have an issue reproducer
at hand involving enums at the moment, so I am adding a comment to
read_context::resolve_declaration_only_enums for now.
I have also filled the enhancement request
https://sourceware.org/bugzilla/show_bug.cgi?id=27189 to track a task
that would do away with read_context::resolve_declaration_only_enums
altogether by factorizing out the resolution of declaration-only
abigail::ir::decl_base.
* src/abg-dwarf-reader.cc
(read_context::compare_before_canonicalisation): Define new member
function.
(read_context::resolve_declaration_only_classes): When there are
more than one definition that can resolve a given declaration, if
all those definitions are equal, then resolve the declaration to
those definitions.
(read_context::resolve_declaration_only_enums): Add a comment to
update similarly update this function (or do away with it
completely) later.
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-diff-pkg/cogl-1.22.8-2.fc33.x86_64.rpm: Add new
test input.
* tests/data/test-diff-pkg/cogl-debuginfo-1.22.8-2.fc33.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/cogl-1.22.8-2.fc33.x86_64.self-check-report-0.txt:
Likewise.
* tests/test-diff-pkg.cc (in_out_specs): Add the new test inputs
to the test harness.
* tests/data/Makefile.am: Add the new test input files to source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
We can now use the latest upstream stable version since we bumped up our
minimum C++ standard version.
* tests/lib/catch.hpp: update to v2.13.3
* tests/test-symtab.cc (TEST_CASE("Symtab::SimpleSymtabs")): Use
the corpus variable to avoid unused variable warnings.
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is mostly seen for nested templates like
std::pair<int, std::vector<int> > vs. std::pair<int, std::vector<int>>
^^^ ^^
* .clang-format: Set C++11 standard for formatting.
Signed-off-by: Matthias Maennich <maennich@google.com>
The test file test0-pr19026-libvtkIOSQL-6.1.so.1 is intended to be
used to check that diffing a binary entity against its ABI
representation results in an empty diff. In this case, the ABI of the
library is also under revision control and so the test also functions
to a certain extent as check on whether the generated ABI is stable
between revisions of libabigail.
Recent changes have affected attributes and ordering of elements. The
result is that there is now a non-empty diff between the library and
the saved ABI, albeit all "harmless" changes.
This commit refreshes the revision-controlled ABI, eliminating the
differences.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Refreshed ABI.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt:
File now empty.
Signed-off-by: Giuliano Procida <gprocida@google.com>
std::unordered_set is now provided through the language standard, hence
remove the compatibility code for <unordered_set> and adjust all users
accordingly.
* include/abg-cxx-compat.h: Drop compatibility for <unordered_set>.
* include/abg-comparison.h: migrate abg_compat use to std.
* include/abg-interned-str.h: Likewise.
* include/abg-suppression.h: Likewise.
* src/abg-comparison-priv.h: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Matthias Maennich <maennich@google.com>
std::unordered_map is now provided through the language standard, hence
remove the compatibility code for <unordered_map> and adjust all users
accordingly.
* include/abg-cxx-compat.h: Drop compatibility layer for <unordered_map>.
* include/abg-comparison.h: migrate abg_compat use to std.
* include/abg-cxx-compat.h: Likewise.
* include/abg-fwd.h: Likewise.
* include/abg-ir.h: Likewise.
* src/abg-corpus.cc: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* src/abg-ir.cc: Likewise.
* src/abg-reader.cc: Likewise.
* src/abg-writer.cc: Likewise.
Signed-off-by: Matthias Maennich <maennich@google.com>
std::hash is now provided through the language standard, hence remove
the compatibility code for <functional> and adjust all users
accordingly.
* include/abg-cxx-compat.h: Drop compatibility layer for <functional>.
* include/abg-interned-str.h: migrate abg_compat use to std.
* include/abg-ir.h: Likewise.
* src/abg-hash.cc: Likewise.
* src/abg-ir.cc: Likewise.
Signed-off-by: Matthias Maennich <maennich@google.com>
Now with C++11 as minimum standard, we can drop the facilities required
to support earlier standards. Hence purge the use of std::tr1 from the
sources.
* include/abg-cxx-compat.h: remove compatibility with pre C++11.
* include/abg-ir.h: Remove mention of std::tr1 from comments.
* include/abg-sptr-utils.h: Likewise.
Signed-off-by: Matthias Maennich <maennich@google.com>
This change adds a test which exercises libabigail's handling of
qualified typedefs of arrays. The base type in the test case is an
array of pointers (chosen so we can also use restrict).
Various typedefs and (indirect) qualifications of this type are
created. In all cases, the resulting type should be an array of
qualified pointers.
However, abidiff reports things like
'const volatile void* const'
changed to
'restrict const volatile volatile void* const'
I've not attempted to check whether DWARF and ABI XML faithfully
reflect the source types. There may be trouble there as well.
For the record, these are the expected v0 types:
A = void *[7]
B = void *[7]
C = void *const[7]
D = void *const[7]
E = void *const volatile[7]
F = void *const volatile[7]
G = void *const volatile restrict[7]
H = void *const volatile restrict[7]
The v1 types should be these plus others with extra pointer
qualifiers.
* tests/data/Makefile.am: Add new test files
* tests/data/test-abidiff-exit/qualifier-typedef-array-v0.c:
New test file.
* tests/data/test-abidiff-exit/qualifier-typedef-array-v0.o:
New test file.
* tests/data/test-abidiff-exit/qualifier-typedef-array-v1.c:
New test file.
* tests/data/test-abidiff-exit/qualifier-typedef-array-v1.o:
New test file.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-0.txt:
Plain diff report.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
Harmless diff report.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-2.txt:
Leaf changes report.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-3.txt:
Harmless leaf changes report.
* tests/test-abidiff-exit.cc: Run new test.
Signed-off-by: Giuliano Procida <gprocida@google.com>
As described in the comments of types_have_similar_structure:
"Two indirect types have similar structure if their underlying
types are of the same kind and have the same name. [...] The size
of their underlying type does not matter"
Yet, the size of array elements (a.k.a the underlying type of an array
type) is wrongly considered to matter when assessing the "type
structure similarity" relationship for arrays.
This patch fixes that.
* src/abg-ir.cc (types_have_similar_structure): When examining
array types, always treat element types as being underlying types
of an indirect type.
* tests/data/Makefile.am: Add new test case files.
* tests/data/test-abidiff-exit/test-non-leaf-array-report.txt:
New test case showing correct --leaf-changes-only reporting.
* tests/data/test-abidiff-exit/test-non-leaf-array-v0.c:
Likewise.
* tests/data/test-abidiff-exit/test-non-leaf-array-v0.o:
Likewise.
* tests/data/test-abidiff-exit/test-non-leaf-array-v1.c:
Likewise.
* tests/data/test-abidiff-exit/test-non-leaf-array-v1.o:
Likewise.
* tests/test-abidiff-exit.cc: Run new test case.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-ir.cc (types_have_similar_structure): Arrays are also
indirect types, just like pointers and references, for the purpose
of the concept of "type similarity". Add that to the introductory
comment of the function. Add some more misc comments throughout
the code base.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
corpus_diff override, conclude by calling
maybe_dump_diff_tree.
Signed-off-by: Giuliano Procida <gprocida@google.com>
As the Enterprise Linux 6 platform has now essentially reached it's
end of life for what it's worth (the Fedora EPEL6 distribution is not
maintained anymore) nothing ties us to using C++03 only anymore.
So, I think it makes sense to move the code base to the C++11
standard.
Why C++11 and not, say, C++14 or more? Well, the more direct reason I
see is that we need to support long life cycle platforms, the older
one being Enterprise Linux 7 currently. This is the Fedora EPEL7
distribution, in concrete terms. And in that distribution, the
compiler is GCC 4.8.x. And it supports C++11.
In practise, nothing changes in the code that is already there.
The new code however can use C++11 constructs just fine.
I have updated the CONTRIBUTING file to write down some of the
unwritten cultural biases of the current code base. Hopefully these
few lines will help to shed some light on the choices made so far.
The update to that file also enacts the use of C++11 and sets some
limits to what we expects in terms of what the code base would look
like.
configure.ac is modified to unconditionally pass -std=c++11 to the
compiler and express that in the configuration text displayed at the
end of the configuration stage.
Some Makefile.am files are updated accordingly.
* CONTRIBUTING: Enact use of c++11. Also, we favor those who
read/debug/maintain the code as opposed to those who write it ;-)
* configure.ac: Switch to c++11 unconditionally.
* src/Makefile.am: Adjust.
* tests/Makefile.am: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The COPYING* files are not in the source distribution anymore.
Furthermore, LICENSE.txt and license-change-2020.txt files were newly
added. This patch updates Makefile.am accordingly.
* Makefile.am: Teach Automake that COPYING* files are gone and
that LICENSE.txt and license-change-2020.txt were added.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>