]> sourceware.org Git - libabigail.git/log
libabigail.git
3 years agoRevert "Fix declaratons of conditionally defined functions"
Dodji Seketeli [Mon, 8 Mar 2021 12:04:13 +0000 (13:04 +0100)]
Revert "Fix declaratons of conditionally defined functions"

I forgot to edit the commit message of this commit to make it comply
with the rules in https://sourceware.org/git/?p=libabigail.git;a=blob;f=COMMIT-LOG-GUIDELINES.

So I am reverting commit cd2af9e5f5f973759ade0595a32694f9e0230647

3 years agoFix declaratons of conditionally defined functions
Ben Woodard via Libabigail [Tue, 2 Mar 2021 22:11:12 +0000 (14:11 -0800)]
Fix declaratons of conditionally defined functions

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>
3 years agotests/catch.hpp: Add SPDX header back
Dodji Seketeli [Mon, 8 Mar 2021 10:32:05 +0000 (11:32 +0100)]
tests/catch.hpp: Add SPDX header back

* tests/lib/catch.hpp: Add SPDX header back.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
3 years agodwarf-reader: Keep stable order when de-duplicating class definitions
Dodji Seketeli [Thu, 25 Feb 2021 11:44:13 +0000 (12:44 +0100)]
dwarf-reader: Keep stable order when de-duplicating class definitions

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>
3 years agoBetter sorting of (anonymous) types in ABIXML files
Dodji Seketeli [Wed, 24 Feb 2021 11:51:27 +0000 (12:51 +0100)]
Better sorting of (anonymous) types in ABIXML files

I am still seeing in some cases, some instability in type sorting in
ABIXML.

It looks related to anonymous types sorting, so this patch tries
harder to have anonymous types have names more suitable for internal
matters this.

* src/abg-writer.cc (type_ptr_cmp::operator()): Use the internal
pretty representation of types, for comparison.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Adjust.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
3 years agotests: Update to catch.hpp v2.13.4 and fix #2178 libabigail-1.8.2
Dodji Seketeli [Tue, 23 Feb 2021 16:00:19 +0000 (17:00 +0100)]
tests: Update to catch.hpp v2.13.4 and fix #2178

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>
3 years agoDon't consider type name when comparing typedefs
Dodji Seketeli [Thu, 11 Feb 2021 14:04:55 +0000 (15:04 +0100)]
Don't consider type name when comparing typedefs

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>
3 years agoUse generic internal type name to canonicalize anonymous enums
Dodji Seketeli [Wed, 10 Feb 2021 17:43:52 +0000 (18:43 +0100)]
Use generic internal type name to canonicalize anonymous enums

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>
3 years agoabg-dwarf-reader: Fix typo in compare_dies_string_attribute_value
Giuliano Procida [Mon, 8 Feb 2021 17:31:46 +0000 (17:31 +0000)]
abg-dwarf-reader: Fix typo in compare_dies_string_attribute_value

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>
3 years agoabidiff: do not qualify member names in diff report
Giuliano Procida [Wed, 27 Jan 2021 12:08:43 +0000 (12:08 +0000)]
abidiff: do not qualify member names in diff report

Bug 26012 - abidiff: do not emit qualified name for data members

The enclosing struct (or union or class) is given by the surrounding
diff context. This change eliminates a lot of repetition in the diff
report.

* src/abg-reporter-priv.cc (represent_data_member): Do not
qualify member names. (represent): Do not qualify member names.
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Refresh.
* tests/data/test-abicompat/test0-fn-changed-report-2.txt: Refresh.
* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Refresh.
* tests/data/test-abicompat/test5-fn-changed-report-1.txt: Refresh.
* tests/data/test-abicompat/test6-var-changed-report-0.txt: Refresh.
* tests/data/test-abicompat/test6-var-changed-report-1.txt: Refresh.
* tests/data/test-abicompat/test7-fn-changed-report-0.txt: Refresh.
* tests/data/test-abicompat/test7-fn-changed-report-1.txt: Refresh.
* tests/data/test-abicompat/test7-fn-changed-report-2.txt: Refresh.
* tests/data/test-abicompat/test8-fn-changed-report-0.txt: Refresh.
* tests/data/test-abicompat/test9-fn-changed-report-0.txt: Refresh.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
Refresh.
* tests/data/test-abidiff-exit/test-fun-param-report.txt: Refresh.
* tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-2.txt:
Refresh.
* tests/data/test-abidiff-exit/test-leaf-cxx-members-report.txt:
Refresh.
* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt: Refresh.
* tests/data/test-abidiff-exit/test-leaf-redundant-report.txt: Refresh.
* tests/data/test-abidiff-exit/test-member-size-report0.txt: Refresh.
* tests/data/test-abidiff-exit/test-member-size-report1.txt: Refresh.
* tests/data/test-abidiff-exit/test-net-change-report0.txt: Refresh.
* tests/data/test-abidiff/test-PR18791-report0.txt: Refresh.
* tests/data/test-abidiff/test-qual-type0-report.txt: Refresh.
* tests/data/test-abidiff/test-struct0-report.txt: Refresh.
* tests/data/test-abidiff/test-struct1-report.txt: Refresh.
* tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt:
Refresh.
* tests/data/test-diff-dwarf/test0-report.txt: Refresh.
* tests/data/test-diff-dwarf/test1-report.txt: Refresh.
* tests/data/test-diff-dwarf/test10-report.txt: Refresh.
* tests/data/test-diff-dwarf/test11-report.txt: Refresh.
* tests/data/test-diff-dwarf/test13-report.txt: Refresh.
* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Refresh.
* tests/data/test-diff-dwarf/test27-local-base-diff-report.txt:
Refresh.
* tests/data/test-diff-dwarf/test3-report.txt: Refresh.
* tests/data/test-diff-dwarf/test32-fnptr-changes-report-0.txt:
Refresh.
* tests/data/test-diff-dwarf/test33-fnref-changes-report-0.txt:
Refresh.
* tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt:
Refresh.
* tests/data/test-diff-dwarf/test37-union-report-0.txt: Refresh.
* tests/data/test-diff-dwarf/test38-union-report-0.txt: Refresh.
* tests/data/test-diff-dwarf/test39-union-report-0.txt: Refresh.
* tests/data/test-diff-dwarf/test4-report.txt: Refresh.
* tests/data/test-diff-dwarf/test40-report-0.txt: Refresh.
* tests/data/test-diff-dwarf/test44-anon-struct-union-report-0.txt:
Refresh.
* tests/data/test-diff-dwarf/test45-anon-dm-change-report-0.txt:
Refresh.
* tests/data/test-diff-dwarf/test46-rust-report-0.txt: Refresh.
* tests/data/test-diff-dwarf/test5-report.txt: Refresh.
* tests/data/test-diff-dwarf/test8-report.txt: Refresh.
* tests/data/test-diff-filter/libtest45-basic-type-change-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test-PR26739-2-report-0.txt: Refresh.
* tests/data/test-diff-filter/test0-report.txt: Refresh.
* tests/data/test-diff-filter/test01-report.txt: Refresh.
* tests/data/test-diff-filter/test1-report.txt: Refresh.
* tests/data/test-diff-filter/test10-report.txt: Refresh.
* tests/data/test-diff-filter/test11-report.txt: Refresh.
* tests/data/test-diff-filter/test13-report.txt: Refresh.
* tests/data/test-diff-filter/test14-0-report.txt: Refresh.
* tests/data/test-diff-filter/test14-1-report.txt: Refresh.
* tests/data/test-diff-filter/test15-0-report.txt: Refresh.
* tests/data/test-diff-filter/test15-1-report.txt: Refresh.
* tests/data/test-diff-filter/test16-report-2.txt: Refresh.
* tests/data/test-diff-filter/test16-report.txt: Refresh.
* tests/data/test-diff-filter/test17-0-report.txt: Refresh.
* tests/data/test-diff-filter/test17-1-report.txt: Refresh.
* tests/data/test-diff-filter/test18-report.txt: Refresh.
* tests/data/test-diff-filter/test2-report.txt: Refresh.
* tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Refresh.
* tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Refresh.
* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt:
Refresh.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt:
Refresh.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt:
Refresh.
* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt:
Refresh.
* tests/data/test-diff-filter/test29-finer-redundancy-marking-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test3-report.txt: Refresh.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
Refresh.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
Refresh.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
Refresh.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
Refresh.
* tests/data/test-diff-filter/test32-ppc64le-struct-change-report0.txt:
Refresh.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test36-report-0.txt: Refresh.
* tests/data/test-diff-filter/test37-report-0.txt: Refresh.
* tests/data/test-diff-filter/test39/test39-report-0.txt: Refresh.
* tests/data/test-diff-filter/test42-leaf-report-output-0.txt: Refresh.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-0.txt:
Refresh.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-1.txt:
Refresh.
* tests/data/test-diff-filter/test9-report.txt: Refresh.
* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt:
Refresh.
* tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Refresh.
* tests/data/test-diff-pkg/dirpkg-1-report-1.txt: Refresh.
* tests/data/test-diff-pkg/dirpkg-3-report-1.txt: Refresh.
* tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Refresh.
* 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:
Refresh.
* tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt:
Refresh.
* 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:
Refresh.
* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt:
Refresh.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
Refresh.
* tests/data/test-diff-pkg/symlink-dir-test1-report0.txt: Refresh.
* tests/data/test-diff-pkg/tarpkg-0-report-0.txt: Refresh.
* tests/data/test-diff-pkg/tarpkg-1-report-0.txt: Refresh.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
Refresh.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
Refresh.
* tests/data/test-diff-suppr/libtest48-soname-abixml-report-1.txt:
Refresh.
* tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Refresh.
* tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Refresh.
* tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Refresh.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Refresh.
* tests/data/test-diff-suppr/test11-add-data-member-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test12-add-data-member-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test12-add-data-member-report-2.txt:
Refresh.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-1.txt:
Refresh.
* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-1.txt:
Refresh.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-1.txt:
Refresh.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-5.txt:
Refresh.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-2.txt:
Refresh.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt:
Refresh.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-2.txt:
Refresh.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-5.txt:
Refresh.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-2.txt:
Refresh.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-5.txt:
Refresh.
* tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Refresh.
* tests/data/test-diff-suppr/test24-soname-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test24-soname-report-10.txt: Refresh.
* tests/data/test-diff-suppr/test24-soname-report-12.txt: Refresh.
* tests/data/test-diff-suppr/test24-soname-report-14.txt: Refresh.
* tests/data/test-diff-suppr/test24-soname-report-16.txt: Refresh.
* tests/data/test-diff-suppr/test24-soname-report-4.txt: Refresh.
* tests/data/test-diff-suppr/test25-typedef-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test26-loc-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test26-loc-suppr-report-3.txt: Refresh.
* tests/data/test-diff-suppr/test29-soname-report-3.txt: Refresh.
* tests/data/test-diff-suppr/test29-soname-report-6.txt: Refresh.
* tests/data/test-diff-suppr/test29-soname-report-8.txt: Refresh.
* tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Refresh.
* tests/data/test-diff-suppr/test30-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test31-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test33-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test35-leaf-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test42-negative-suppr-type-report-0.txt:
Refresh.
* tests/data/test-diff-suppr/test42-negative-suppr-type-report-1.txt:
Refresh.
* tests/data/test-diff-suppr/test46-PR25128-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test46-PR25128-report-2.txt: Refresh.
* tests/data/test-diff-suppr/test47-non-reachable-types-report-1.txt:
Refresh.
* tests/data/test-diff-suppr/test47-non-reachable-types-report-2.txt:
Refresh.
* tests/data/test-diff-suppr/test47-non-reachable-types-report-4.txt:
Refresh.
* tests/data/test-diff-suppr/test47-non-reachable-types-report-7.txt:
Refresh.
* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Refresh.
* tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Refresh.
* tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Refresh.
* tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Refresh.
* tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Refresh.
* tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Refresh.
* tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Refresh.
* tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: Refresh.
* tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Refresh.
* tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Refresh.
* tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Refresh.
* tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Refresh.
* tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Refresh.
* tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Refresh.
* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Refresh.
* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Refresh.

Signed-off-by: Giuliano Procida <gprocida@google.com>
3 years agodwarf-reader: Use DW_FORM_line_strp only if it's present
Dodji Seketeli [Mon, 8 Feb 2021 11:03:19 +0000 (12:03 +0100)]
dwarf-reader: Use DW_FORM_line_strp only if it's present

* 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>
3 years agoBug 27267 - Better support for opaque enum types
Dodji Seketeli [Thu, 4 Feb 2021 08:26:05 +0000 (09:26 +0100)]
Bug 27267 - Better support for opaque enum types

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>
3 years agoBug 27331 - Data member offset change not considered local
Dodji Seketeli [Wed, 3 Feb 2021 12:47:46 +0000 (13:47 +0100)]
Bug 27331 - Data member offset change not considered local

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>
3 years agoBug 27165 - Better support multi-language binaries
Dodji Seketeli [Tue, 2 Feb 2021 11:35:54 +0000 (12:35 +0100)]
Bug 27165 - Better support multi-language binaries

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>
3 years agoBump ABIXML format version to 2.0
Dodji Seketeli [Thu, 22 Oct 2020 14:04:08 +0000 (16:04 +0200)]
Bump ABIXML format version to 2.0

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>
3 years agoBug 26684 - Support DW_AT_data_bit_offset attribute
Dodji Seketeli [Tue, 20 Oct 2020 09:36:42 +0000 (11:36 +0200)]
Bug 26684 - Support DW_AT_data_bit_offset attribute

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>
3 years agoBug 27255 - fedabipkgdiff fails on nfs-utils on Fedora 33
Dodji Seketeli [Wed, 27 Jan 2021 10:20:48 +0000 (11:20 +0100)]
Bug 27255 - fedabipkgdiff fails on nfs-utils on Fedora 33

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>
3 years agodwarf-reader: Support fast DW_FORM_line_strp string comparison
Dodji Seketeli [Tue, 26 Jan 2021 18:19:01 +0000 (19:19 +0100)]
dwarf-reader: Support fast DW_FORM_line_strp string comparison

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>
3 years agoBug 27232 - fedabipkgdiff fails on gawk from Fedora 33
Dodji Seketeli [Tue, 26 Jan 2021 05:35:29 +0000 (06:35 +0100)]
Bug 27232 - fedabipkgdiff fails on gawk from Fedora 33

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>
3 years agoabipkgdiff: Address operator precedence warning
Matthias Maennich [Tue, 26 Jan 2021 09:56:56 +0000 (09:56 +0000)]
abipkgdiff: Address operator precedence warning

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>
3 years agoBug 27233 - fedabipkgdiff fails on package gnupg2 from Fedora 33
Dodji Seketeli [Tue, 26 Jan 2021 13:05:19 +0000 (14:05 +0100)]
Bug 27233 - fedabipkgdiff fails on package gnupg2 from Fedora 33

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>
3 years agoBug 27236 - Pointer comparison wrongly fails because of typedef change
Dodji Seketeli [Mon, 25 Jan 2021 17:40:13 +0000 (18:40 +0100)]
Bug 27236 - Pointer comparison wrongly fails because of typedef change

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>
3 years agoIgnore duplicated functions and those not associated with ELF symbols
Dodji Seketeli [Fri, 22 Jan 2021 10:24:43 +0000 (11:24 +0100)]
Ignore duplicated functions and those not associated with ELF symbols

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>
3 years agoBug 27204 - potential loss of some aliased ELF function symbols
Dodji Seketeli [Wed, 20 Jan 2021 05:03:59 +0000 (06:03 +0100)]
Bug 27204 -  potential loss of some aliased ELF function symbols

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>
3 years agoabg-ir: Optimize calls to std::string::find() for a single char.
Matthias Maennich [Tue, 15 Dec 2020 21:45:19 +0000 (21:45 +0000)]
abg-ir: Optimize calls to std::string::find() for a single char.

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>
3 years agoBug 26992 - Try harder to resolve declaration-only classes
Dodji Seketeli [Fri, 15 Jan 2021 14:38:44 +0000 (15:38 +0100)]
Bug 26992 - Try harder to resolve declaration-only classes

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>
3 years agomainpage: Update web page for 1.8 release
Dodji Seketeli [Mon, 11 Jan 2021 14:10:19 +0000 (15:10 +0100)]
mainpage: Update web page for 1.8 release

* doc/website/mainpage.txt: Update web page for 1.8 release

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoUpdate catch2 testing framework: v1.12.2 -> v2.13.3
Matthias Maennich [Mon, 14 Dec 2020 23:05:57 +0000 (23:05 +0000)]
Update catch2 testing framework: v1.12.2 -> v2.13.3

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>
4 years agoclang-format: define C++ standard to improve formatting
Matthias Maennich [Mon, 14 Dec 2020 23:02:12 +0000 (23:02 +0000)]
clang-format: define C++ standard to improve formatting

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>
4 years agoRefresh ABI cross check test files
Giuliano Procida [Fri, 11 Dec 2020 15:03:24 +0000 (15:03 +0000)]
Refresh ABI cross check test files

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>
4 years agoDrop unneccessary includes of abg-cxx-compat.h
Matthias Maennich [Mon, 14 Dec 2020 23:08:56 +0000 (23:08 +0000)]
Drop unneccessary includes of abg-cxx-compat.h

Remove the unneccessary includes of abg-cxx-compat.h as users have been
migrated to use the corresponding standard includes.

* include/abg-comparison.h: Remove include of abg-cxx-compat.h.
* include/abg-diff-utils.h: Likewise.
* include/abg-fwd.h: Likewise.
* include/abg-ini.h: Likewise.
* include/abg-interned-str.h: Likewise.
* include/abg-ir.h: Likewise.
* include/abg-libxml-utils.h: Likewise.
* include/abg-libzip-utils.h: Likewise.
* include/abg-regex.h: Likewise.
* include/abg-reporter.h: Likewise.
* include/abg-sptr-utils.h: Likewise.
* include/abg-suppression.h: Likewise.
* include/abg-tools-utils.h: Likewise.
* include/abg-workers.h: Likewise.
* src/abg-comp-filter.cc: Likewise.
* src/abg-comparison-priv.h: Likewise.
* src/abg-corpus.cc: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* src/abg-hash.cc: Likewise.
* src/abg-ir.cc: Likewise.
* src/abg-reader.cc: Likewise.
* src/abg-suppression.cc: Likewise.
* src/abg-tools-utils.cc: Likewise.
* src/abg-writer.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* tools/abicompat.cc: Likewise.
* tools/abidw.cc: Likewise.
* tools/abilint.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
4 years agoRemove <unordered_set> usages from abg_compat
Matthias Maennich [Mon, 14 Dec 2020 23:08:55 +0000 (23:08 +0000)]
Remove <unordered_set> usages from abg_compat

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>
4 years agoRemove <unordered_map> usages from abg_compat
Matthias Maennich [Mon, 14 Dec 2020 23:08:54 +0000 (23:08 +0000)]
Remove <unordered_map> usages from abg_compat

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>
4 years agoRemove <memory> usages from abg_compat
Matthias Maennich [Mon, 14 Dec 2020 23:08:53 +0000 (23:08 +0000)]
Remove <memory> usages from abg_compat

std::shared_ptr, std::weak_ptr, std::dynamic_pointer_cast,
std::static_pointer_cast are now provided through the language standard,
hence remove the compatibility code for <memory> and adjust all users
accordingly.

* include/abg-cxx-compat.h: Drop compatibility layer for <memory>.
* include/abg-diff-utils.h: migrate abg_compat use to std.
* include/abg-fwd.h: Likewise.
* include/abg-ini.h: Likewise.
* include/abg-interned-str.h: Likewise.
* include/abg-libxml-utils.h: Likewise.
* include/abg-libzip-utils.h: Likewise.
* include/abg-regex.h: Likewise.
* include/abg-reporter.h: Likewise.
* include/abg-sptr-utils.h: Likewise.
* include/abg-tools-utils.h: Likewise.
* include/abg-workers.h: Likewise.
* src/abg-comp-filter.cc: Likewise.
* src/abg-comparison-priv.h: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* src/abg-ir.cc: Likewise.
* src/abg-reader.cc: Likewise.
* src/abg-suppression.cc: Likewise.
* src/abg-tools-utils.cc: Likewise.
* src/abg-writer.cc: Likewise.
* tests/test-diff-filter.cc: Likewise.
* tests/test-diff-pkg.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tests/test-read-dwarf.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* tests/test-types-stability.cc: Likewise.
* tests/test-write-read-archive.cc: Likewise.
* tools/abicompat.cc: Likewise.
* tools/abidiff.cc: Likewise.
* tools/abidw.cc: Likewise.
* tools/abilint.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
4 years agoRemove <functional> usages from abg_compat
Matthias Maennich [Mon, 14 Dec 2020 23:08:52 +0000 (23:08 +0000)]
Remove <functional> usages from abg_compat

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>
4 years agoDrop C++03 compatibility layer
Matthias Maennich [Mon, 14 Dec 2020 23:08:51 +0000 (23:08 +0000)]
Drop C++03 compatibility layer

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>
4 years agoAdd qualifier / typedef / array / pointer test
Giuliano Procida [Fri, 4 Dec 2020 16:55:24 +0000 (16:55 +0000)]
Add qualifier / typedef / array / pointer test

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>
4 years agoir: Arrays are indirect types for type structure similarity purposes
Giuliano Procida [Thu, 3 Dec 2020 15:09:16 +0000 (15:09 +0000)]
ir: Arrays are indirect types for type structure similarity purposes

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>
4 years agoir: Add better comments to types_have_similar_structure
Dodji Seketeli [Fri, 4 Dec 2020 10:27:00 +0000 (11:27 +0100)]
ir: Add better comments to types_have_similar_structure

* 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>
4 years agoabidiff: support --dump-diff-tree with --leaf-changes-only
Giuliano Procida [Thu, 3 Dec 2020 15:09:00 +0000 (15:09 +0000)]
abidiff: support --dump-diff-tree with --leaf-changes-only

* 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>
4 years agoUse C++11 for the code base
Dodji Seketeli [Thu, 3 Dec 2020 09:53:08 +0000 (10:53 +0100)]
Use C++11 for the code base

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>
4 years agoCONTRIBUTING: Update instructions about regression tests
Dodji Seketeli [Thu, 3 Dec 2020 09:25:31 +0000 (10:25 +0100)]
CONTRIBUTING: Update instructions about regression tests

* CONTRIBUTING: Update instructions about how to launch regression
tests.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoTeach Automake that COPYING* files are gone from sources
Dodji Seketeli [Wed, 2 Dec 2020 16:19:40 +0000 (17:19 +0100)]
Teach Automake that COPYING* files are gone from sources

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>
4 years agoAdd a license-change-2020.txt file
Dodji Seketeli [Tue, 9 Jun 2020 15:35:55 +0000 (17:35 +0200)]
Add a license-change-2020.txt file

Add a license-change-2020.txt file which contains text explaining that
we went through a licence change in 2020 from LGPLv3+ to Apache-v2
with LLVM exception.

     * license-change-2020.txt: New file.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoDelete COPYING* files
Dodji Seketeli [Tue, 9 Jun 2020 14:53:33 +0000 (16:53 +0200)]
Delete COPYING* files

* COPYING: Delete.
* COPYING-GPLV3: Likewise.
* COPYING-LGPLV2: Likewise.
* COPYING-LGPLV3: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoAdd the LICENSE.txt file
Dodji Seketeli [Tue, 9 Jun 2020 14:06:42 +0000 (16:06 +0200)]
Add the LICENSE.txt file

* LICENSE.txt: New file coming from
http://llvm.org/foundation/relicensing/LICENSE.txt.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoRe-license the project to Apache v2 With LLVM Exception
Dodji Seketeli [Fri, 29 May 2020 14:26:04 +0000 (16:26 +0200)]
Re-license the project to Apache v2 With LLVM Exception

Thanks to the previous work done, changing the license is just a
matter of changing the SPDX identifer from "LGPL-3.0-or-later" to
"Apache-2.0 WITH LLVM-exception".  Note that for the abigail.m4,
tests/test-dot.cc and tests/test-svg.cc the change was from
"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
LLVM-exception".  include/abg-cxx-compat.h was changed from
"LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception".  Source code
of programs (as opposed to source code of the library) where generally
licensed under GPL-3.0-or-later; they are also now licensed
"Apache-2.0 WITH LLVM-exception".

This is what this patch does.

* abigail.m4: Change the SPDX identifier from "GPL-3.0-or-later
WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception"
* include/abg-cxx-compat.h: Change the SPDX identifier from
"LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception".
* .clang-format: Change the SPDX identifier from
  "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception".
* Makefile.am: Likewise.
* bash-completion/Makefile.am: Likewise.
* bash-completion/abicompat: Likewise.
* bash-completion/abidiff: Likewise.
* bash-completion/abidw: Likewise.
* bash-completion/abilint: Likewise.
* bash-completion/abinilint: Likewise.
* bash-completion/abipkgdiff: Likewise.
* bash-completion/abisym: Likewise.
* bash-completion/fedabipkgdiff: Likewise.
* configure.ac: Likewise.
* default.abignore: Likewise.
* doc/Makefile.am: Likewise.
* doc/api/libabigail.doxy: Likewise.
* doc/manuals/Makefile.am: Likewise.
* doc/website/libabigail-website.doxy: Likewise.
* include/Makefile.am: Likewise.
* include/abg-comp-filter.h: Likewise.
* include/abg-comparison.h: Likewise.
* include/abg-config.h: Likewise.
* include/abg-corpus.h: Likewise.
* include/abg-diff-utils.h: Likewise.
* include/abg-dwarf-reader.h: Likewise.
* include/abg-fwd.h: Likewise.
* include/abg-hash.h: Likewise.
* include/abg-ini.h: Likewise.
* include/abg-interned-str.h: Likewise.
* include/abg-ir.h: Likewise.
* include/abg-libxml-utils.h: Likewise.
* include/abg-libzip-utils.h: Likewise.
* include/abg-reader.h: Likewise.
* include/abg-regex.h: Likewise.
* include/abg-reporter.h: Likewise.
* include/abg-sptr-utils.h: Likewise.
* include/abg-suppression.h: Likewise.
* include/abg-tools-utils.h: Likewise.
* include/abg-traverse.h: Likewise.
* include/abg-version.h.in: Likewise.
* include/abg-viz-common.h: Likewise.
* include/abg-viz-dot.h: Likewise.
* include/abg-viz-svg.h: Likewise.
* include/abg-workers.h: Likewise.
* include/abg-writer.h: Likewise.
* scripts/dot_to_png.sh: Likewise.
* scripts/dot_to_svg.sh: Likewise.
* scripts/make-verbose.sh: Likewise.
* scripts/svg_to_plain_svg.sh: Likewise.
* scripts/svg_to_png_and_pdf.sh: Likewise.
* src/Makefile.am: Likewise.
* src/abg-comp-filter.cc: Likewise.
* src/abg-comparison-priv.h: Likewise.
* src/abg-comparison.cc: Likewise.
* src/abg-config.cc: Likewise.
* src/abg-corpus-priv.h: Likewise.
* src/abg-corpus.cc: Likewise.
* src/abg-default-reporter.cc: Likewise.
* src/abg-diff-utils.cc: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* src/abg-elf-helpers.cc: Likewise.
* src/abg-elf-helpers.h: Likewise.
* src/abg-hash.cc: Likewise.
* src/abg-ini.cc: Likewise.
* src/abg-internal.h: Likewise.
* src/abg-ir-priv.h: Likewise.
* src/abg-ir.cc: Likewise.
* src/abg-leaf-reporter.cc: Likewise.
* src/abg-libxml-utils.cc: Likewise.
* src/abg-libzip-utils.cc: Likewise.
* src/abg-reader.cc: Likewise.
* src/abg-regex.cc: Likewise.
* src/abg-reporter-priv.cc: Likewise.
* src/abg-reporter-priv.h: Likewise.
* src/abg-suppression-priv.h: Likewise.
* src/abg-suppression.cc: Likewise.
* src/abg-tools-utils.cc: Likewise.
* src/abg-traverse.cc: Likewise.
* src/abg-viz-common.cc: Likewise.
* src/abg-viz-dot.cc: Likewise.
* src/abg-viz-svg.cc: Likewise.
* src/abg-workers.cc: Likewise.
* src/abg-writer.cc: Likewise.
* tests/Makefile.am: Likewise.
* tests/data/Makefile.am: Likewise.
* tests/lib/catch.cc: Likewise.
* tests/mockfedabipkgdiff.in: Likewise.
* tests/print-diff-tree.cc: Likewise.
* tests/runtestcanonicalizetypes.sh.in: Likewise.
* tests/runtestdefaultsupprs.py.in: Likewise.
* tests/runtestdefaultsupprspy3.sh.in: Likewise.
* tests/runtestfedabipkgdiff.py.in: Likewise.
* tests/runtestfedabipkgdiffpy3.sh.in: Likewise.
* tests/test-abicompat.cc: Likewise.
* tests/test-abidiff-exit.cc: Likewise.
* tests/test-abidiff.cc: Likewise.
* tests/test-alt-dwarf-file.cc: Likewise.
* tests/test-annotate.cc: Likewise.
* tests/test-core-diff.cc: Likewise.
* tests/test-cxx-compat.cc: Likewise.
* tests/test-diff-dwarf-abixml.cc: Likewise.
* tests/test-diff-dwarf.cc: Likewise.
* tests/test-diff-filter.cc: Likewise.
* tests/test-diff-pkg.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tests/test-diff2.cc: Likewise.
* tests/test-dot.cc: Change the SPDX identifier from
"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
LLVM-exception"
* tests/test-elf-helpers.cc: Change the SPDX identifier from
"LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception"
* tests/test-ini.cc: Likewise.
* tests/test-ir-walker.cc: Likewise.
* tests/test-kmi-whitelist.cc: Likewise.
* tests/test-lookup-syms.cc: Likewise.
* tests/test-read-dwarf.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* tests/test-svg.cc: Change the SPDX identifier from
"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
LLVM-exception".
* tests/test-symtab.cc: Change the SPDX identifier from
"LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception"
* tests/test-tools-utils.cc: Likewise.
* tests/test-types-stability.cc: Likewise.
* tests/test-utils.cc: Likewise.
* tests/test-utils.h: Likewise.
* tests/test-write-read-archive.cc: Likewise.
* tests/update-test-output.py: Likewise.
* tools/Makefile.am: Likewise.
* tools/abiar.cc: Likewise.
* tools/abicompat.cc: Likewise.
* tools/abidiff.cc: Likewise.
* tools/abidw.cc: Likewise.
* tools/abilint.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
* tools/abisym.cc: Likewise.
* tools/binilint.cc: Likewise.
* tools/fedabipkgdiff: Likewise.
* tools/kmidiff.cc: Likewise.
* update-copyright.sh: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoAdd helper files to perform the re-licensing
Dodji Seketeli [Fri, 29 May 2020 14:34:37 +0000 (16:34 +0200)]
Add helper files to perform the re-licensing

* relicensing-scripts/file-licenses.orig.txt: New file that
contains the raw set of files with SPDX identifiers denoting
LGPLv3+ files.  It's the result of a simple command based on
"find" and "grep".
* relicensing-scripts/files-with-lgplv3.txt: New file
containing the same data as the file above, but massaged to be
easily useable by the script below.
* relicensing-scripts/do-relicensing.sh: This is a simple command
which performs the re-licensing on the files listed in the file
above.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoAdd replace-spdx-license.sh script
Dodji Seketeli [Fri, 29 May 2020 08:45:34 +0000 (10:45 +0200)]
Add replace-spdx-license.sh script

This script is to replace an SPDX license ID by another one.
I.e, it's to perform an actual re-licensing of a given file.

A way to use the script is this:

    replace-spdx-license.sh  --from LGPL-3.0-or-later \
      --to  "Apache-2.0 WITH LLVM-exception" \
      some-file-to-relicense.cc

* relicensing-scripts/replace-spdx-license.sh: New script.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoAdd has-spdx-header.sh script
Dodji Seketeli [Wed, 27 May 2020 16:40:17 +0000 (18:40 +0200)]
Add has-spdx-header.sh script

Add a script to detect if a file has a SPDX header and what the
advertised license is.

   * relicensing-scripts/has-spdx-header.sh: New script.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoAdd missing SPDX headers to source files not specifying any license
Dodji Seketeli [Fri, 29 May 2020 13:50:16 +0000 (15:50 +0200)]
Add missing SPDX headers to source files not specifying any license

Default to the project's defautl - LGPLv3+ - for those.

* Makefile.am: Add a LGPL-3.0-or-later SPDX header prefixed
with '##' so that that the header doesn't get emitted in the
resulting Makefile.in file.  Note that the license of Makefile.in
files is "FSF All Permissible License", which virtually compatible
with anything.
* bash-completion/Makefile.am: Likewise.
* doc/Makefile.am: Likewise
* doc/manuals/Makefile.am: Likewise
* include/Makefile.am: Likewise
* src/Makefile.am: Likewise
* tests/Makefile.am: Likewise
* tests/data/Makefile.am: Likewise
* tools/Makefile.am: Likewise
* .clang-format: Add a LGPL-3.0-or-later SPDX header.
* bash-completion/abicompat: Likewise.
* bash-completion/abidiff: Likewise.
* bash-completion/abidw: Likewise.
* bash-completion/abilint: Likewise.
* bash-completion/abinilint: Likewise.
* bash-completion/abipkgdiff: Likewise.
* bash-completion/abisym: Likewise.
* bash-completion/fedabipkgdiff: Likewise.
* configure.ac: Likewise.
* default.abignore: Likewise.
* doc/api/libabigail.doxy: Likewise.
* doc/website/libabigail-website.doxy: Likewise.
* include/abg-version.h.in: Likewise.
* scripts/dot_to_png.sh: Likewise.
* scripts/dot_to_svg.sh: Likewise.
* scripts/make-verbose.sh: Likewise.
* scripts/svg_to_plain_svg.sh: Likewise.
* scripts/svg_to_png_and_pdf.sh: Likewise.
* tests/runtestcanonicalizetypes.sh.in: Likewise.
* tests/runtestdefaultsupprs.py.in: Likewise.
* tests/runtestdefaultsupprspy3.sh.in: Likewise.
* tests/runtestfedabipkgdiffpy3.sh.in: Likewise.
* tests/update-test-output.py: Likewise.
* update-copyright.sh: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoReplace individual license references with SPDX Identifiers
Matthias Maennich [Sat, 7 Mar 2020 23:46:31 +0000 (23:46 +0000)]
Replace individual license references with SPDX Identifiers

This patch replaces license headers with SPDX identifiers in all files
containing license headers.  For each file, the SPDX identifier
formally represents its current license.  Note that the list of SPDX
identifiers is available on the SPDX web site at
https://spdx.org/licenses.

For autoconf-archive/ax_prog_python_version.m4 however, there is a
little catch.  Dodji Seketeli wrote this ax_check_python_modules.m4.
Just like the other autoconf-archive macros, it makes sense to have it
under the FSF All Permissive license.  Actually, the terms of that
license was already in the file but then the license header was
wrongly set to GPLv2 with autoconf exception.  So I fixed that in this
commit by setting the SPDX identifier to FSFAP.

* abigail.m4: Replace the license header with the SPDX identifier
GPL-3.0-or-later WITH GCC-exception-3.1
* autoconf-archive/ax_check_python_modules.m4: Correctly set the
SPDX identifier to FSFAP.
* autoconf-archive/ax_compare_version.m4: Replace the license
header with the SPDX identifier FSFAP.
* autoconf-archive/ax_prog_python_version.m4: Likewise.
header with the SPDX identifier FSFAP.
* autoconf-archive/ax_valgrind_check.m4: Likewise.
* gen-changelog.py: Replace the license header with the SPDX
identifier LGPL-2.0-or-later.
* include/abg-comp-filter.h: Replace the license header with the
SPDX identifier LGPL-3.0-or-later.
* include/abg-comparison.h: Likewise.
* include/abg-config.h: Likewise.
* include/abg-corpus.h: Likewise.
* include/abg-cxx-compat.h: Replace the license header with the
SPDX identifier LGPL-2.0-or-later.
* include/abg-diff-utils.h: Replace the license header with the
SPDX identifier LGPL-3.0-or-later
* include/abg-dwarf-reader.h: Likewise.
* include/abg-fwd.h: Likewise.
* include/abg-hash.h: Likewise.
* include/abg-ini.h: Likewise.
* include/abg-interned-str.h: Likewise.
* include/abg-ir.h: Likewise.
* include/abg-libxml-utils.h: Likewise.
* include/abg-libzip-utils.h: Likewise.
* include/abg-reader.h: Likewise.
* include/abg-regex.h: Likewise.
* include/abg-reporter.h: Likewise.
* include/abg-sptr-utils.h: Likewise.
* include/abg-suppression.h: Likewise.
* include/abg-tools-utils.h: Likewise.
* include/abg-traverse.h: Likewise.
* include/abg-viz-common.h: Likewise.
* include/abg-viz-dot.h: Likewise.
* include/abg-viz-svg.h: Likewise.
* include/abg-workers.h: Likewise.
* include/abg-writer.h: Likewise.
* install-sh: Replace the license header with the SPDX identifier MIT.
* ltmain.sh: Replace the license header with the SPDX identifier
GPL-2.0-or-later.  Note that this file has the libtool special
exception which allows us to redistribute it under the general
license of the project.
* src/abg-comp-filter.cc: Replace the license header with the SPDX
* src/abg-comparison-priv.h: Likewise.
* src/abg-comparison.cc: Likewise.
* src/abg-config.cc: Likewise.
* src/abg-corpus-priv.h: Likewise.
* src/abg-corpus.cc: Likewise.
* src/abg-default-reporter.cc: Likewise.
* src/abg-diff-utils.cc: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* src/abg-elf-helpers.cc: Likewise.
* src/abg-elf-helpers.h: Likewise.
* src/abg-regex.cc: Likewise.
* src/abg-hash.cc: Likewise.
* src/abg-ini.cc: Likewise.
* src/abg-internal.h: Likewise.
* src/abg-ir-priv.h: Likewise.
* src/abg-ir.cc: Likewise.
* src/abg-leaf-reporter.cc: Likewise.
* src/abg-libxml-utils.cc: Likewise.
* src/abg-libzip-utils.cc: Likewise.
* src/abg-reader.cc: Likewise.
* src/abg-reporter-priv.cc: Likewise.
* src/abg-reporter-priv.h: Likewise.
* src/abg-sptr-utils.cc: Likewise.
* src/abg-suppression-priv.h: Likewise.
* src/abg-suppression.cc: Likewise.
* src/abg-tools-utils.cc: Likewise.
* src/abg-traverse.cc: Likewise.
* src/abg-viz-common.cc: Likewise.
* src/abg-viz-dot.cc: Likewise.
* src/abg-viz-svg.cc: Likewise.
* src/abg-workers.cc: Likewise.
* src/abg-writer.cc: Likewise.
* tests/lib/catch.cc: Likewise.
* tests/lib/catch.hpp: Add an SPDX identifier BSL-1.0.
* tests/mockfedabipkgdiff.in: Replace the license header with the
SPDX identifier GPL-3.0-or-later.
* tests/print-diff-tree.cc: Likewise.
* tests/runtestfedabipkgdiff.py.in: Replaace the license header
with the SPDW identifier GPL-3.0-or-later.
* tests/test-abicompat.cc: Replace the license header with the
SPDX identifier LGPL-3.0-or-later.
* tests/test-abidiff-exit.cc: Likewise.
* tests/test-abidiff.cc: Likewise.
* tests/test-alt-dwarf-file.cc: Likewise.
* tests/test-annotate.cc: Likewise.
* tests/test-cxx-compat.cc: Likewise.
* tests/test-core-diff.cc: Likewise.
* tests/test-diff-dwarf-abixml.cc: Likewise.
* tests/test-diff-dwarf.cc: Likewise.
* tests/test-diff-filter.cc: Likewise.
* tests/test-diff-pkg.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tests/test-diff2.cc: Likewise.
* tests/test-dot.cc: Replace the license header with the
SPDX identifier GPL-3.0-with-GCC-exception.
* tests/test-elf-helpers.cc: Replace the license header with the
SPDX identifier LGPL-3.0-or-later.
* tests/test-ini.cc: Likewise.
* tests/test-ir-walker.cc: Likewise.
* tests/test-kmi-whitelist.cc: Likewise.
* tests/test-lookup-syms.cc: Likewise.
* tests/test-read-dwarf.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* tests/test-svg.cc: Replace the license header with the SPDX
identifier GPL-3.0-with-GCC-exception.
* tests/test-symtab.cc: Replace the license header with the SPDX
identifier LGPL-3.0-or-later.
* tests/test-tools-utils.cc: Likewise.
* tests/test-types-stability.cc: Likewise.
* tests/test-utils.cc: Likewise.
* tests/test-utils.h: Likewise.
* tests/test-write-read-archive.cc: Likewise.
* tools/abiar.cc: Likewise.
* tools/abicompat.cc: Likewise.
* tools/abidiff.cc: Likewise.
* tools/abidw.cc: Likewise.
* tools/abilint.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
* tools/abisym.cc: Likewise.
* tools/binilint.cc: Likewise.
* tools/fedabipkgdiff: Replace the license header with the
SPDX identifier GPL-3.0-or-later.
* tools/kmidiff.cc: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
4 years agoBump version number to 2.0
Dodji Seketeli [Tue, 1 Dec 2020 20:42:08 +0000 (21:42 +0100)]
Bump version number to 2.0

* configure.ac: Bump number version to 2.0

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoUpdate NEWS file for 1.8
Dodji Seketeli [Tue, 1 Dec 2020 14:17:25 +0000 (15:17 +0100)]
Update NEWS file for 1.8

* NEWS: Update for 1.8

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoUpdate the Changelog for 1.8
Dodji Seketeli [Tue, 1 Dec 2020 14:13:57 +0000 (15:13 +0100)]
Update the Changelog for 1.8

       * Changelog: Update automatically with "make update-changelog'

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoAdd check-self-compare to release regression testing
Dodji Seketeli [Tue, 1 Dec 2020 14:11:50 +0000 (15:11 +0100)]
Add check-self-compare to release regression testing

* Makefile.am: Make 'make tarball-and-all' run the
'check-self-compare' target as part of the release process.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoconfigure: add --enable-rpm415 option
Dodji Seketeli [Tue, 1 Dec 2020 10:26:27 +0000 (11:26 +0100)]
configure: add --enable-rpm415 option

It's useful to be able to force the build system into avoiding the use
of rpm 4.15 version or higher.  That version of RPM is the one that
supports RPMs from Fedora 31 or higher.  Those RPMs use the zstd
compression scheme.  Prior to Fedora 31, RPM were not using the zstd
compression scheme.  So, systems with rpm version lower than 4.15
cannot deal with RPMs coming from Fedora 31 or higher.  So on those
systems, some regression tests of libabigail who use RPMs from Fedora
33 will fail.

With this patch, one can use the --disable-rpm415 option of the
configure script to prevent those tests from running on those pre 4.15
rpm systems.

* configure: Introduce the --{en, dis}able-rpm415 option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agodwarf-reader: Bug 26908 - don't crash on empty DW_TAG_partial_unit libabigail-1.8
Dodji Seketeli [Mon, 30 Nov 2020 04:53:11 +0000 (05:53 +0100)]
dwarf-reader: Bug 26908 - don't crash on empty DW_TAG_partial_unit

Sometimes a DW_TAG_partial_unit (imported via a DW_TAG_imported_unit)
has no children node.  That means the the DW_TAG_partial_unit has no
sub-tree.

In those cases, the dwarf-reader crashes when
ctxt.build_die_parent_relations_under tries to record the point at
which the sub-tree (which is non-existent here) of the partial unit is
imported by the DW_TAG_imported_unit DIE.

This patch avoids crashing in those cases.  As this problem is
reported on libclang-cpp.so (on Fedora 33) which takes "abidw --abidiff"
five hours and ~ 20GB of ram to complete at this point (on a power7 box)
this patch doesn't have a regression test attached.

* src/abg-dwarf-reader.cc (die_has_children): Define new static
function.
(read_context::build_die_parent_relations_under): Do not try to
instantiate an imported_unit_point type for an imported unit with
no children node.
(imported_unit_point::imported_unit_point): Assert that the
imported die has a sub-tree.
(imported_unit_point::imported_unit_point): Remove useless spaces.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoreader: Fix off-by-one error in assert
Dodji Seketeli [Fri, 27 Nov 2020 20:11:59 +0000 (21:11 +0100)]
reader: Fix off-by-one error in assert

* src/abg-reader.cc (build_subrange_type): Fix off-by-one error.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agowriter: fix off-by-one error in assertion
Dodji Seketeli [Fri, 27 Nov 2020 19:51:45 +0000 (20:51 +0100)]
writer: fix off-by-one error in assertion

* src/abg-writer.cc (write_array_subrange_type): Fix off-by-one
error in assertion.
* src/abg-dwarf-reader.cc (build_subrange_type): Assert the length
of the array complies with its bounds.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoabipkgdiff: make --self-check to fail on any change against own ABIXML
Dodji Seketeli [Fri, 27 Nov 2020 12:03:38 +0000 (13:03 +0100)]
abipkgdiff: make --self-check to fail on any change against own ABIXML

Now that several subtle causes of spurious ABI change report when
comparing a binary against its own ABIXML have been addressed, this
patch makes 'abipkgdiff --self-check' to fail on any ABI change
reported.  That is, harmless changes are not ignored anymore.

* tools/abipkgdiff.cc (compare_to_self): Report *any* ABI change.
Not just the "net" changes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoabidw: make --abidiff report any change against own ABIXML
Dodji Seketeli [Thu, 26 Nov 2020 12:23:03 +0000 (13:23 +0100)]
abidw: make --abidiff report any change against own ABIXML

Sometimes, "abidw --abidiff <binary>" would pass while
"abidw <binary> > abi; abidiff <binary> abi" would fail.

This is because "abidw --abidiff" emits an error only when the
comparison between the binary and its ABIXML representation yields and
incompatible change.

Now that many subtle causes of spurious ABI change report emitted when
comparing a binary against its own ABIXML have been fixed, this patch
makes it so that *any* change would make abidw --abidiff to emit an
error.

* tools/abidw.cc (load_corpus_and_write_abixml): Emit an error
when comparing the binary to its ABIXML representation yields any
change.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agodwarf-reader: Avoid having several functions with the same symbol
Dodji Seketeli [Fri, 27 Nov 2020 11:13:26 +0000 (12:13 +0100)]
dwarf-reader: Avoid having several functions with the same symbol

In the DWARF debug info, a C++ class can be represented by pieces
throughout a given binary.

In this picture, a given virtual member function can be represented
several times; each time in one different piece of the C++ class.  In
a given piece of the class, a virtual member function can be
represented with its ELF symbol set.  In another one, the same virtual
member function can be represented without that ELF symbol set.  And
there can also be pieces of the class that don't have a given virtual
function.

To handle this, the DWARF reader constructs one class from all its
pieces scattered around.  It adds each virtual member function to the
class as it comes across them while scanning the DWARF.

Then there is a pass at the end of the process that sets ELF symbols
to the (virtual) member functions that need it.

The problem with that pass is that it sometimes sets the same ELF
symbol to more than one virtual member function.  Those virtual member
functions all have the same mangled name that correspond to the ELF
symbol; but only one of them is meant to be associated with the ELF
symbol.  In essence, that one is the one that is exported by the ELF
binary.

This patch teaches the pass that sets the ELF symbols of function to
avoid setting the same ELF symbol to more than one function.

The patch also avoids build_function_decl to set symbol to a function
if that symbol was already set to an existing function.

This patch thus fixes a class of issues what arise when comparing a
binary against its own ABIXML representation.  Those several functions
having the same ELF symbol would cause spurious changes in that
context.

* src/abg-dwarf-reader.cc
(read_context::symbol_already_belongs_to_a_function): Define new
member function.
(read_context::fixup_functions_with_no_symbols): Use the new
symbol_already_belongs_to_a_function function to avoid setting a
symbol that already belongs to a function.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoreader: Don't lose anonymous-ness of decl-only classes
Dodji Seketeli [Fri, 27 Nov 2020 10:54:13 +0000 (11:54 +0100)]
reader: Don't lose anonymous-ness of decl-only classes

When reading an anonymous declaration-only class from ABIXML
libabigail forgets to set the is-anonymous class.  This leads to
spurious change reports when comparing a binary against its ABIXML
representation.  Fixed thus.

Note that this doesn't yet impact any regression test but is useful
for a coming patch that will make abidw --abidiff to emit an error for
all ABI changes, not just the hard incompatible ones.  Without this
change, that coming patch will make runtestreaddwarf to fail.

* src/abg-reader.cc (build_class_decl): Set the is-anonymous flag
when reading a decl-only class.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoir: Introduce internal pretty representation for anonymous classes
Dodji Seketeli [Fri, 27 Nov 2020 06:06:48 +0000 (07:06 +0100)]
ir: Introduce internal pretty representation for anonymous classes

There are two views for internal pretty representation of anonymous
classes.

1/ When we look at the anonymous class itself, we use its 'flat
representation' i.e:

    'class {int blah; char bleh;}'

2/ When we look at a pointer or a reference to the anonymous class we
use its generic anonymous internal name, i.e:

   '__anonymous_struct__*'

As a general rule, libabigail always use the keyword 'class' to prefix
the name of classes for internal purposes, independent from the fact
that the type is a struct or a class.  That is a pre-requisite to be
able to canonicalize classes and structs together.  In other words, if
a class and a struct are structurally equal, they are going to be
considered equivalent by the canonicalization process.

Currently however, in the view 1/ of the pretty representation of
anonymous classes, a struct and a class will have different
representations.  For instance, and empty anonymous struct would be
represented as 'struct {}', whereas an empty anonymous class would be
represented as 'class {}'.  This prevents these two be considered
equivalent by the canonicalization process.  This leads to spurious
change reports later down the road.

In the view 2/ we have a similar but different problem: the qualified
names of the anonymous classes are not taken into account when
representing pointer or references to said anonymous classes.  Only
their unqualified generic anonymous internal names are taken into
account in the representation.  This leads to pointers/references to
anonymous classes being wrongly considered equivalent even when they
belong to different namespaces.

This patch corrects the issues related to both views 1/ and 2/.  It
should make libabigail correctly consider some anonymous classes as
equivalent (view 1) and correctly consider pointers/references to
anonymous classes as different when they belong to different
namespaces (view 2).

A number of reference tests are adjusted accordingly.

* include/abg-fwd.h (get_class_or_union_flat_representation):
Introduce an "internal" parameter.
* src/abg-ir.cc (get_class_or_union_flat_representation):
Introduce an "internal" parameter.  In the flat representation of
a class for internal purposes, always use the prefix "class" even
if this is a struct.
(get_type_name): To build an internal name for a
reference or pointer to an anonymous type, consider the namespace
name of said type.
(equals): In the overload for decl_base, take the namespace name
of anonymous decls into account when comparing them.
({var_decl, union_decl}::get_pretty_representation): Adjust calls
to get_class_or_union_flat_representation to pass a proper
"internal" argument.
* src/abg-default-reporter.cc (default_reporter::report): Adjust
the call to get_class_or_union_flat_representation to pass an
"internal" argument set to 'false'.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agowriter: Emit definitions of declarations when they are present
Dodji Seketeli [Thu, 26 Nov 2020 13:58:31 +0000 (14:58 +0100)]
writer: Emit definitions of declarations when they are present

Libabigail goes a long way to resolve declaration-only classes
to their definitions when it's possible.

The ABIXML writer however sometimes forgets to emit the definition of
such declarations that have been "resolved".

Later, when the binary is compared to its own ABIXML representation,
the reporting engine thus reports that the definition is lost.

This patch fixes that.

* src/abg-writer.cc (write_class_decl, write_union_decl): Get the
definition of the declaration if it exists and emit that.
* tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoBug 26780 - Fix array subrange bounds (de)serialization
Dodji Seketeli [Thu, 26 Nov 2020 12:39:12 +0000 (13:39 +0100)]
Bug 26780 - Fix array subrange bounds (de)serialization

When serializing subrange bounds to ABIXML today the writer omits the
lower and upper bounds.  Only the length is emitted.  The reader thus
assumes that the lower bound of an array subrange is always 0.  In
Fortran however, that is not true, as the lower bound is 1.

This patch instructs the writer to emits the lower bound whenever it's
different from zero.  It also emits the upper bound in that case.  The
reader is updated accordingly to take the lower and upper bounds into
account whenever they are present.  It they are not, then the
lower bound is assumed to be zero and the upper bound is deduced from
the length, as was already the case until now.

* src/abg-reader.cc (build_subrange_type): Read lower-bound
attribute if present.  Then try to read upper-bound attribute as
well.  If this is not an infinite subrange assert that the length
must be equal to the difference between the bounds.
* src/abg-writer.cc (write_array_subrange_type): Write the
lower-bound if it's present and not zero.  In that case, write the
upper-bound as well.
* tests/data/test-diff-pkg/hdf5-1.10.6-2.fc33.x86_64.rpm: Add new
binary test input.
* tests/data/test-diff-pkg/hdf5-debuginfo-1.10.6-2.fc33.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/hdf5-1.10.6-2.fc33.x86_64.self-check-report-0.txt:
Add new reference output.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add the binary test input
to the set of --self-check tests.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoreader: Read array subrange length into an uint64_t
Dodji Seketeli [Thu, 26 Nov 2020 12:33:39 +0000 (13:33 +0100)]
reader: Read array subrange length into an uint64_t

We read subrange length like an integer of type 'int" today.  We
should read it as an uint64_t.  Fixed thus.

* src/abg-reader.cc (build_subrange_type): Change the type of
length to uint64_t and read it using strtoull.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoabipkgdiff: Avoid uncertainty when sorting worker tasks
Dodji Seketeli [Wed, 25 Nov 2020 11:57:47 +0000 (12:57 +0100)]
abipkgdiff: Avoid uncertainty when sorting worker tasks

Worker tasks that have compared the binaries of two packages are
sorted according to the sizes of the binaries they compared.  The
tasks that compared bigger binaries come first.  So the output of
these tasks is always sorted the same.

When two tasks have sorted binaries of the same size, let's sort them
by taking into account the lexicographic order of the binaries names.

* elf_size_is_greater: Take the name of the binaries into account
when their size is equal.  Also, assert that all comparison tasks
have compared binaries.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agotests/data/test-fedabipkgdiff: Update reference output
Dodji Seketeli [Wed, 25 Nov 2020 12:02:40 +0000 (13:02 +0100)]
tests/data/test-fedabipkgdiff: Update reference output

Instances of self_compare_task don't wrongly shadow task comparison
arguments anymore.  Instead, they properly use the task comparison
arguments of the parent class compare_task.

So in the sorting function elf_size_is_greater, we now always have
proper elf binaries size.  It follows that the sorting can now yield a
consistent result, always.

It thus appears that the reference output recorded for the
"self-comparison" test of runtestfedabipkgdiffpy3.sh was wrong.  This
patch updates it.

* tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt:
Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoabipkgdiff: minor cleanups
Matthias Maennich [Tue, 24 Nov 2020 21:14:43 +0000 (21:14 +0000)]
abipkgdiff: minor cleanups

The recent changes to abipkgdiff triggered some minor clang-tidy
diagnostics that I address in this patch.

 - removed unused using statements
 - cleaned up some mismatches between commented and actual parameter names
 - removed shadowing data members from self_compare_task and construct
   with base class constructor instead.

* tools/abipkgdiff.cc: remove unused using statements
(self_compare_task): remove shadowing members and delegate
construction to base class.

Signed-off-by: Matthias Maennich <maennich@google.com>
4 years agodwarf-reader: support artificially generated translation units
Dodji Seketeli [Mon, 23 Nov 2020 09:48:01 +0000 (10:48 +0100)]
dwarf-reader: support artificially generated translation units

When GCC 10 artificially generates a translation unit, the path/name
of the translation unit as given by the DW_AT_name attribute of the
translation unit DIE is the string "<artificial>".

Libabigail expects that translation units have unique file paths so
having several artificially generated translation units like this one
with the same name makes hell break loose down the road.

This patch suffixes the name of artificial DIE with their die offset
number to have a unique path name for artificially generated
translation units.

* configure.ac: Detect if we are running on RPM >= 4.15.  If yes,
then define the preprocessor macro RPM_4_15.  If that macro is
defined then test-diff-pkg.cc can support RPMs from Fedora >= 31
as those are compressed with zstd.  Earlier RPM versions don't
support that compression scheme.
* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir):
Suffix the offset of the translation unit to its name when that
name is "<artificial>".
* tests/data/test-diff-pkg/mesa-libGLU-9.0.1-3.fc33.x86_64.rpm:
New binary test input.
* tests/data/test-diff-pkg/mesa-libGLU-debuginfo-9.0.1-3.fc33.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/mesa-libGLU-9.0.1-3.fc33.x86_64.self-check-report-0.txt:
New reference output for the binary test input above.
* tests/data/Makefile.am: Add the new test inputs above to source
distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add the binary test
inputs above to source distribution if we are running on an RPM
version >= 4.15.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agofedabipkgdiff: make --self-compare use abipkgdiff --self-check
Dodji Seketeli [Fri, 20 Nov 2020 12:23:03 +0000 (13:23 +0100)]
fedabipkgdiff: make --self-compare use abipkgdiff --self-check

Now that the abipkgdiff program supports the --self-check option to
make it compare the binaries in an RPM against their own ABIXML
representation, make the --self-compare option of fedabipkgdiff use
the abipkgdiff --self-check.

* tools/fedabipkgdiff (abipkgdiff): If the user provides the
--self-compare options, generate the abipkgdiff command by using
the --self-check option.
(run_abipkgdiff): Each return value of the abipkgidiff runs can be
negative because they are unsigned values in essence, but as
python doesn't seem to have a unsigned integer type.  So we need
to consider the max of the absolute value of the return codes
here.
* tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt:
Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoabipkgdiff: Add a new --self-check option
Dodji Seketeli [Thu, 19 Nov 2020 16:52:08 +0000 (17:52 +0100)]
abipkgdiff: Add a new --self-check option

After the report of
https://sourceware.org/bugzilla/show_bug.cgi?id=26769 it became
apparent that we want to be able compare a binary against its ABIXML
representation, including for cases where the binaries are embedded in
RPM packages.

This patches thus introduces the --self-check option to abipkgdiff so
that it can be invoked like this:

    $ abipkgdiff --self-check --d1 libstdc++-debuginfo-10.2.1-8.fc34.x86_64.rpm --d1 gcc-debuginfo-10.2.1-8.fc34.x86_64.rpm libstdc++-10.2.1-8.fc34.x86_64.rpm

    ==== SELF CHECK SUCCEEDED for 'libstdc++.so.6.0.28'====
    $

With this option, libabigail compares each binary in the RPM against
its own ABIXML representation.

This should hopefully help to write regression tests which have as
sole inputs the links to download the RPMs.  It's also useful to ease
the process of reproducing the issue raised.

This option can now be used, for instance, by the libabigail-selfcheck
program over at https://pagure.io/libabigail-selfcheck.

* tools/abipkgdiff.cc (options::self_check): Define new data
member.
(options::options): Initialize it.
(display_usage): Add help string for the --self-check option.
(parse_command): Parse the new --self-check option.
(extract_deb): Add missing newline.
(compare): Remove useless white space.
(compare_to_self, self_compare_prepared_userspace_package)
(self_compare_prepared_package, compare_to_self): Add new static
functions.
(class self_compare_task): Add new class.
(prepare_package): Add a new overload that takes just one
parameter.
(elf_size_is_greater): Don't crash if the args are empty.
(main): If the --self-check option is given, make sure we have
just one package in argument.  Use the new compare_to_self
function to handle the --self-check option.
* doc/manuals/abipkgdiff.rst: Add documentation for the new
--self-check option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoBug 26769 - Fix missing types in abixml output
Dodji Seketeli [Mon, 16 Nov 2020 11:22:05 +0000 (12:22 +0100)]
Bug 26769 - Fix missing types in abixml output

The symptom of the issue at hand is that sometimes there can be types
missing from the abixml output.  This happens when analysing some C++
code bases.

The core of the issue is the following.  Support we have a type
"struct S" defined somewhere as:

    struct S // #0
    {
      int  dm1;
      char dm2;
    };

    S s;

Suppose that in another translation unit, we have the class 'S' being
extended to add a member type to it:

    struct S // #1
    {
      typedef int dm1_type;
    };

    typedef S::dm1_type Integer;
    Integer something;

When emitting the abixml for the codebase, the definition of the
typedef S::dm1_type can be missing.

Note that in location #1, struct S is considered declaration-only.
It's definition is in another translation unit, in location #0.

So the abixml writer emits the 'struct S' defined in location #0, but
forgets to emit the 'struct S' in #1, which is indirectly used for the
sole purpose of using its member type S::dm1_type.

This patch emits the S::dm1_type type that is mistakenly forgotten
today.

Now that the "struct S" of #1 is also emitted, a tangent problem is
uncovered: S in #0 can be wrongly thought to be equivalent to S in #1,
for ABI purposes
This is because of an ODR-based optimization that is used for C++.
That is, the two struct S can be wrongly considered equivalent just
because they have the same name.  Note that ODR means "One Definition Rule[1]"

This patch removes the ODR-based optimization and thus fixes many of
the issues uncovered by the previous changes.

The patch also uncovered that some non-static variables were sometimes wrongly
being added to the set of exported variables, while libabigail reads
corpora from abixml.  The patch fixes this as well.

[1]: One Definition Rule: https://en.wikipedia.org/wiki/One_Definition_Rule

* include/abg-corpus.h (corpus::{record_canonical_type,
lookup_canonical_type}): Remove function declarations.
* src/abg-corpus-priv.h (corpus::priv::canonical_types_): Remove
data member.
* src/abg-corpus.cc (corpus::{record_canonical_type,
lookup_canonical_type}): Remove functions.
* src/abg-ir.cc (type_eligible_for_odr_based_comparison): Remove
static function.
(type_base::get_canonical_type_for): Don't perform the ODR-based
optimization for C++ anymore.
* src/abg-reader.cc
(read_context&::maybe_add_var_to_exported_decls): Don't add a
variable that hasn't been added to its scope.  Otherwise, it means
we added a variable that wasn't yet properly constructed.  Also
add a new overload for var_decl_sptr&.
(build_var_decl): Do not add the var to its the set of exported
declaration before we are sure it has been fully constructed and
added to the scope it belongs.
(build_class_decl): Only add *static* data members to the list of
exported declarations.
(handle_var_decl): A var decl seen here is a global variable
declaration.  Add it to the list of exported declarations.
* src/abg-writer.cc (write_context::decl_only_type_is_emitted):
Constify parameter.
(write_translation_unit): Do not forget to emit referenced types
that were maybe not canonicalized.  Also, avoid using noop_deleter
when it's not necessary.
(write_namespace_decl): Do not forget to emit canonicalized types
that are present in namespaces other than the global namespace.
* tests/runtestslowselfcompare.sh.in: New test that compares
libabigail.so against its own ABIXML representation.
* tests/Makefile.am: Add the new test runtestslowselfcompare.sh to
source distribution.  This test is too slow to be run during the
course of 'make check'.  It takes more than 5 minutes on my slow
box here.  Rather, it can be run using 'make check-self-compare'.
I plan to run this before releases now.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/test0.abi: Likewise.
* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.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/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/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/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.
* tests/data/test-read-write/test6.xml: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoMake sure to canonicalize all types but decl-only classes
Dodji Seketeli [Fri, 13 Nov 2020 15:11:48 +0000 (16:11 +0100)]
Make sure to canonicalize all types but decl-only classes

While looking at the remaining potential sources of instability in the
generation of type ids at abixml generation time, it occurred to me
that we still had several non canonicalized types in the system.

When a given type T is not canonicalized,
hash_as_canonical_type_or_constant later hashes it as an arbitrary
constant.  So in the ID hash map of the abixml writer, all the
non-canonicalized types will tend to end-up in the same hash map
bucket, so to speak.  More precisely, if T is equivalent to another
type T' which is canonicalized, then T and T' will end-up in different
buckets (in the same hash map) because they will have different hash
values as returned by hash_as_canonical_type_or_constant.  They will
thus end-up having different type-ids because they are in different
buckets.

The solution is to make sure that T is *also* canonicalized.  That
way, if T and T' are equivalent, they'll end-up in the same bucket and
they will have the same type-id.

In other words, all types should be canonicalized now.

The only exception to that rule is declaration-only classes and
unions.  The reason why a declaration-only type 'struct foo' needs to
stay non-canonicalized is that it must equal all the definitions of
'struct foo' that can be found elsewhere.

This patch thus canonicalizes all types that were not still not being
canonicalized.  It also adds an assert in
hash_as_canonical_type_or_constant to ensure that only
declaration-only class_or_union types are not canonicalized.

* include/abg-fwd.h (is_declaration_only_class_or_union_type):
Declare new ...
* src/abg-ir.cc (is_declaration_only_class_or_union_type):
... function.
(clone_array): Add the cloned array subrange to
its scope so that it can later be canonicalized.
(synthesize_type_from_translation_unit)
(synthesize_function_type_from_translation_unit): Canonicalize the
synthesized types.
(hash_as_canonical_type_or_constant): Ensure that all types are
canonicalized.
* src/abg-dwarf-reader.cc (maybe_canonicalize_type): Remove
useless overload.
(build_ir_node_for_variadic_parameter_type)
(schedule_array_tree_for_late_canonicalization): Define new static
functions.
(maybe_strip_qualification): Schedule type canonicalization for
types cloned prior to editing.
(build_function_type): Use the new
build_ir_node_for_variadic_parameter_type.  It takes care of
canonicalizing variadic parameter types.
(build_function_decl): Canonicalize the function type that is
created here.
(build_ir_node_from_die): Use the overload of
maybe_canonicalize_type which canonicalizes class_or_union nodes
directly, rather than the one which handles DIE offsets.  The
latter was used as an optimization to reduce the size of the array
of types scheduled for canonicalization, as DIE offsets take less
space than pointers to IR types.  Now that we have DIE
de-duplication, my bet is that we can do away with the former.
And that also ensures that we miss no type for canonicalization
purposes.
* src/abg-reader.cc (build_array_type_def): Canonicalize the
subrange types of the array.
(build_type): Canonicalize all types.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/test0.abi: Likewise.
* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-diff-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/test35-pr18754-no-added-syms-report-0.txt:
Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
Likewise.
* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi:
Likewise.
* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-read-dwarf/test-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/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/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoir: Add equality op to array_type_def::subrange_type::bound_value
Dodji Seketeli [Fri, 13 Nov 2020 08:10:51 +0000 (09:10 +0100)]
ir: Add equality op to array_type_def::subrange_type::bound_value

* include/abg-ir.h
(array_type_def::subrange_type::bound_value::operator==): Declare
new ...
* src/abg-ir.cc
(array_type_def::subrange_type::bound_value::operator==):
... equality operator.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agowriter: Sort decls and fix topological sorting for types
Dodji Seketeli [Thu, 12 Nov 2020 13:24:14 +0000 (14:24 +0100)]
writer: Sort decls and fix topological sorting for types

When emitting the declarations of a given translation unit, those
declarations are not sorted.  Ooops.  This patch adds topological
sorting for those declarations, making the decls defined first to be
emitted first.  When the decls are defined at the same location then
the pretty representation is used for lexicographic sorting instead.

It turns out that during the topological sorting for types there was
some uncertainty when the declarations of the types had the same
definition location.  This patch re-uses the declaration sorting above
for the declarations of these types.

* include/abg-ir.h (scope_decl::get_sorted_member_decls): Declare
new member function.
* src/abg-ir.cc (struct decl_topo_comp): New sorting functor.
(type_topo_comp::operator()): Re-use the decl_topo_comp to sort
type declarations.
(scope_decl::priv::sorted_members_): Add new data member.
(scope_decl::get_sorted_member_decls): Define new member function.
* src/abg-writer.cc (write_translation_unit): Use the new
scope_decl::get_sorted_member_decls.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/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-write/test2.xml: Likewise.
* tests/data/test-read-write/test28-without-std-fns-ref.xml:
Likewise.
* tests/data/test-read-write/test28-without-std-vars-ref.xml:
Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoBug PR26739 - Handle qualified typedef array types
Dodji Seketeli [Tue, 27 Oct 2020 16:12:58 +0000 (17:12 +0100)]
Bug PR26739 - Handle qualified typedef array types

CV-qualifiers of a typedef of an array type apply to the elements of
the array.  So this can be transformed into a typedef of array type
which element type is similarly CV-qualified.

That transformation helps avoiding spurious changes that might occur
when comparing the latter form against the former even though both are
equivalent.

This patch performs that transformation, just like we already do for
CV-qualified array types which are transformed into an array of
similarly CV-qualified elements.

Performing that transformation amounts to editing the type of the
array elements.  As those types might be used by other parts of the
type graph (type node sharing), the patch "clones" the type sub-tree
of interest and edits the cloned version.  That way, the shared type
nodes are not edited.  It appears that in the existing version of
maybe_strip_qualification, the transformation of CV-qualified arrays
into arrays of CV-qualified elements was unfortunately editing shared
type nodes.  The patch fixes that and re-works the logic of*
maybe_strip_qualification to make it handle this new case and the
previous one in a somewhat generic manner.

* include/abg-fwd.h (is_typedef_of_array, clone_array)
(clone_typedef, clone_qualified_type, clone_array_tree): Declare
new functions.
(peel_qualified_or_typedef_type): Declare new overload.
(is_array_of_qualified_element): Constify the parameter.
* include/abg-ir.h ({qualified_type,
typedef}_def::set_underlying_type): Add new member functions.
(array_type_def::subrange_type::subrange_type): Make constify the
reference to the underlying type parameter.
* src/abg-ir.cc (is_array_of_qualified_element): Constify the
parameter.
(peel_qualified_or_typedef_type): Define new
overload for type_base_sptr.
(clone_typedef_array_qualified_type): Define static function.
(clone_array clone_typedef, clone_qualified_type)
(clone_array_tree, is_typedef_of_array): Define new functions.
(qualified_type_def::get_underlying_type): Rename the return type
shared_ptr<type_base> into type_base_sptr.
({typedef, qualified_type}_def::set_underlying_type): Define new
member function.
(array_type_def::subrange_type::priv::priv): Initialize the
'infinite_' data member.
* src/abg-dwarf-reader.cc (maybe_strip_qualification): Handle
qualified typedef of arrays.  Merge this with the handling of
qualified arrays.  Note that before editing the elements of the
array to make the array (or typedef) qualifier apply to the
element the sub-tree is cloned to make its type nodes be
'un-shared'.  This prevents us from editing type nodes that are
shared by other type expressions.
* tests/data/test-diff-filter/test-PR26739-report-0.txt: New
reference test output.
* tests/data/test-diff-filter/test-PR26739-2-report-0.txt: Likewise.
* tests/data/test-diff-filter/test-PR26739-v{0,1}.c: Source code
of new binary test input.
* tests/data/test-diff-filter/test-PR26739-2-v{0,1}.c: Likewise.
* tests/data/test-diff-filter/test-PR26739-v{0,1}.o: New binary
test inputs.
* tests/data/test-diff-filter/test-PR26739-2-v{0,1}.o: Likewise.
* 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 harness.
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoUpdate test-libandroid.so.abi
Dodji Seketeli [Tue, 3 Nov 2020 07:47:26 +0000 (08:47 +0100)]
Update test-libandroid.so.abi

Update this test reference output as per the commit below:

  b7ad7f2b Bug 26770 - Spurious declaration-only-ness induces spurious type changes

* tests/data/test-read-dwarf/test-libandroid.so.abi: Update.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agodwarf-reader: Ignore zero length location expressions from DW_AT_location
Matthias Maennich [Thu, 29 Oct 2020 12:21:00 +0000 (12:21 +0000)]
dwarf-reader: Ignore zero length location expressions from DW_AT_location

Location expressions might occasionally be of length 0. E.g. a reason
for that are thread local variables that do not exactly have a
location to refer to. Compilers/Linkers may choose an empty location
description. E.g.  see the dwarfdump output for the added testcase
based on libandroid.so (from AOSP).

$ dwarfdump libandroid.so|egrep -B9 "gChoreographerE$"

LOCAL_SYMBOLS:
< 1><0x00000022> DW_TAG_namespace
                   DW_AT_name           android
< 2><0x00000027>   DW_TAG_variable
                     DW_AT_name           gChoreographer
                     DW_AT_type           <0x00000b65>
                     DW_AT_decl_file      0x00000003 .../choreographer.cpp
                     DW_AT_decl_line      0x00000059
                     DW_AT_location       len 0x0000: :
                     DW_AT_linkage_name   _ZN7androidL14gChoreographerE

The DW_AT_location is properly read by elfutils' dwarf_location(), but
is not useful for us to proceed with. Hence early exit on this.

* src/abg-dwarf-reader.cc (die_location_expr): Ignore zero
  length location expressions.
* tests/data/Makefile.am: Add new test files.
* tests/data/test-read-dwarf/test-libandroid.so: New test file.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/test-read-dwarf.cc: Add new test case.

Reported-by: Dan Albert <danalbert@google.com>
Reviewed-by: Giuliano Procida <gprocida@google.com>
Cc: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoImprove enum synthetic type names
Giuliano Procida [Thu, 29 Oct 2020 12:20:59 +0000 (12:20 +0000)]
Improve enum synthetic type names

The ordering of canonical types (in an abi-instr XML element) appears
to be sensitive to the particular C++ library used and the presence of
other threads doing heap allocation. This patch forces distinct
synthetic enum-underlying types to have distinct names, which ensures
deterministic XML output order.

* src/abg-dwarf-reader.cc
(build_internal_underlying_enum_type_name): Add a size
argument (and don't default is_anonymous argument). Append
size of type to synthetic type name.
(build_enum_underlying_type): Pass type size to
build_internal_underlying_enum_type_name.
* tests/data/test-abidiff-exit/test-decl-enum-report-3.txt:
Update. Note that there may be an issue with leaf-mode
reporting of pointer type changes.
* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi:
Regenerate this (catching up with various abidw updates).
* tests/data/test-annotate/test-anonymous-members-0.o.abi:
Refresh with new type names.
* tests/data/test-annotate/test0.abi: Likewise.
* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
Likewise.
* tests/data/test-read-dwarf/test0.abi: Likewise.
* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
4 years agoImprove and stabilise sort of member functions
Giuliano Procida [Thu, 29 Oct 2020 12:20:58 +0000 (12:20 +0000)]
Improve and stabilise sort of member functions

The functor virtual_member_function_less_than did not take into
account linkage name which can be the only difference when multiple
destructors with differing mangled names are present.

This change adds a check for linkage names and also flattens the
control flow in the comparison method to make the logic clearer.

Lastly, this change also uses std::stable_sort, in case all that
remains is insertion order.

* src/abg-ir.cc
(virtual_member_function_less_than::operator()): Name
temporaries like offsets and symbols to reduce repetition;
test each pair of elements (including symbol presence) and
return immediately if there's a difference; add a comparison
of linkage name just after comparing symbol names.
(sort_virtual_member_functions): Use stable_sort instead of
sort.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Update with new ordering of member functions.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
4 years agoupdate-test-output.py: Update syntax
Dodji Seketeli [Sun, 1 Nov 2020 13:28:39 +0000 (14:28 +0100)]
update-test-output.py: Update syntax

* tests/update-test-output.py: Update syntax for python3.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoBug 26770 - Spurious declaration-only-ness induces spurious type changes
Dodji Seketeli [Sat, 31 Oct 2020 10:40:44 +0000 (11:40 +0100)]
Bug 26770 - Spurious declaration-only-ness induces spurious type changes

Sometimes when amending a C++ class to add new members or properties
to it as directed by the DWARF debug information, we can end-up with
discrepancies related to declaration-only-ness.  That is, an instances
of a given type Foo can be wrongly assigned declaration-only-ness that
should have been only carried by another instance Foo.  Then, later,
comparing two pointers to Foo might wrongly lead to spurious reported
changes due to the spurious differences of declaration-only-ness in
two instances of Foo.

By fixing the setting of the declaration-only-ness, especially when
amending a C++ class this patch fixes that spurious change detected.

* src/abg-dwarf-reader.cc (add_or_update_class_type): When
creating a class, set declaration-only-ness unconditionally.  When
updating the class however, only set the declaration-only-ness
when the current one is not consistent with the size of the class.
* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
* 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-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agodwarf-reader: fix lookup for repeated translation unit paths
Matthias Maennich [Wed, 21 Oct 2020 11:08:19 +0000 (12:08 +0100)]
dwarf-reader: fix lookup for repeated translation unit paths

When using relative compilation unit paths in DWARF, the lookup for an
existing one was done with an incorrect path. In particular, a '/' was
prefixed to the path regardless of whether the compilation_dir is set.
That led to the instantiation of an additional translation unit that and
failed when adding it to the corpus due to violating translation unit
uniqueness. Fix that by correcting the lookup.

* src/abg-dwarf-reader.cc(build_translation_unit_and_add_to_ir):
  Fix lookup for potentially already existing translation units.

Reported-by: Dan Albert <danalbert@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
4 years agoStabilise sort of canonical types
Giuliano Procida [Wed, 21 Oct 2020 11:08:14 +0000 (12:08 +0100)]
Stabilise sort of canonical types

Some types like unnamed-enum-underlying-type are not distinguished by
type_topo_comp. This can result in nondeterministic output and flakey
tests.

While a more complete ordering from type_topo_comp would be nice, the
nondeterminism can reduced by preserving the relative order of
identically-named types.

* src/abg-ir.cc (scope_decl::get_sorted_canonical_types): Sort
canonical types with std::stable_sort(..., type_topo_comp()).

Signed-off-by: Giuliano Procida <gprocida@google.com>
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoAssume subrange bounds types are unsigned if no underlying type is given.
Mark Wielaard [Tue, 27 Oct 2020 13:06:03 +0000 (14:06 +0100)]
Assume subrange bounds types are unsigned if no underlying type is given.

When running abidiff on test34-libjemalloc.so.2-intel-16.0.3 it would
crash in array_type_def::subrange_type::get_length on the ABG_ASSERT
get_upper_bound() >= get_lower_bound(). This was because that file
contained a subrange upper_bound value encoded with data1 or data2
without an underlying type. In that case we assumed the value was
encoded as a signed value which caused some of the upper bounds to
be negative (while the lower bound, which wasn't given, was assumed
to be zero).

* src/abg-dwarf-reader.cc (build_subrange_type): Default
is_signed to false.

Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agodwarf-reader: get subrange_type bounds signedness from underlying type
Mark Wielaard [Fri, 23 Oct 2020 09:14:38 +0000 (11:14 +0200)]
dwarf-reader: get subrange_type bounds signedness from underlying type

This patch was originally submitted by in a comment of a problem
report at https://sourceware.org/bugzilla/show_bug.cgi?id=26684#c10.

When reading the bounds of a subrange_type, we need to know if the
constant value of those bounds is signed or not.

For that, we used to just look at the form of those constant and infer
the signedness from there.

The problem is that the signedness is really determined by the value
of the DW_AT_encoding attribute present on the underlying type of the
subrange_type; the form of the bound is mere implementation detail
that is downstream of the information of carried by the DW_AT_encoding
attribute.

This patch thus does the right thing by looking at the underlying type
of the subrange_type and by doing away with the unnecessary messing
with attribute value forms.

* src/abg-dwarf-reader.cc (die_attribute_has_form)
(die_attribute_is_signed, die_attribute_is_unsigned)
(die_attribute_has_no_signedness): Remove static functions.
(die_constant_attribute): Add the 'is_signed' parameter.
(die_address_attribute): Adjust comment.
(build_subrange_type): Determine signedness of the bounds by
looking at the DW_AT_encoding attribute of the underlying type.

Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoabg-tools-utils: Fix comment
Dodji Seketeli [Fri, 23 Oct 2020 07:56:07 +0000 (09:56 +0200)]
abg-tools-utils: Fix comment

* include/abg-tools-utils.h (enum abidiff_status): Fix a comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoconfigure: Support ABIGAIL_NO_OPTIMIZATION_DEBUG environment variable
Dodji Seketeli [Tue, 13 Oct 2020 16:15:05 +0000 (18:15 +0200)]
configure: Support ABIGAIL_NO_OPTIMIZATION_DEBUG environment variable

When working in development environments with compiler versions that
might be very bleeding edge (like the Fedora Rawhide distribution) it
might be worthwhile to disable all compiler optimization to have a
better debugging experience.  In practice, I bumped into this need
again and again.

So I am adding this ABIGAIL_NO_OPTIMIZATION_DEBUG environment variable
to basically allow the "-g -O0" combination, if need be.

This patch obviously doesn't change any existing behaviour if the user
doesn't set this newly introduced environment variable.

* configure.ac: Set the CXXFLAGS and CFLAGS to "-g -O0 -Wall
-Wextra -Werror" if the ABIGAIL_NO_OPTIMIZATION_DEBUG is set.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoStructurally compare the few non-canonicalized types in general
Dodji Seketeli [Tue, 13 Oct 2020 08:20:42 +0000 (10:20 +0200)]
Structurally compare the few non-canonicalized types in general

In the abixml writer, we recently stopped using
type_base::dynamic_hash as a slow path to hash a non-canonicalized
type.  Rather, we use an arbitrary constant as a hash for those
non-canonicalized types.  This amounts to using structural comparison
for those types.  The function that implements this hashing scheme is
hash_as_canonical_type_or_constant.

A potential concern for that approach was the possible negative impact
on speed.  As it turns out since the change went in, there was no
noticeable speed impact raised after testing.

In insight, this is understandable as the number of non-canonicalized
types should be extremely reduced now that we canonicalize pretty much
all types.  As far as I understand it at this point, the only types
that would not be canonicalized are unresolved declaration-only
types.  And, all in all, structurally comparing unresolved
declaration-only types should be "fast enough".

If we ever stumble across any other non-canonicalized type, I think
that would be an artifact of a bug that ought to be fixed.

On that basis, I went ahead and used
hash_as_canonical_type_or_constant throughout the code base and did
away with the use of type_base::dynamic_hash for now, until it's
properly audited, regression tested and got ready for the use cases
where it might make sense.

This patch thus makes hash_type use
hash_as_canonical_type_or_constant.  The writer is then back to using
hash_type again, as it used to; but at the same time, it's still using
structural comparison for non-canonilized types.  So is
hash_type_or_decl, which now uses hash_type to hash types, rather than
using type_base::dynamic_hash.  Note that the comparison engine
heavily uses hash_type_or_decl to hash diff nodes.

So with this small patch the comparison engine is now using structural
comparison of non-canonicalized types (and diff nodes), just as the
abixml writer does.

* include/abg-fwd.h (hash_as_canonical_type_or_constant): Remove
public declaration of this function.
* src/abg-hash.cc (type_base::dynamic_hash::operator()): Add a
comment.
* src/abg-ir.cc (hash_as_canonical_type_or_constant): Make this
function static now.
(hash_type_or_decl): Use hash_type for types.
* src/abg-writer.cc (type_hasher::operator()): Use hash_type.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoFix redundancy detection in the diff graph
Dodji Seketeli [Mon, 12 Oct 2020 13:38:00 +0000 (15:38 +0200)]
Fix redundancy detection in the diff graph

A recent change[1] triggered a variation in the ABI changes reported,
depending on the platform.

It turned out the change made the redundancy detector walk more diff
nodes (like inserted/deleted virtual member functions and their
implicit parameter type) and that uncovered several underlying issues
that has been latent for a long time.

First, we were not walking the inserted/deleted virtual member
functions in a deterministic manner at reporting time.  Rather than
walking the unordered maps containing those functions, this patch now
walk them in lexicographic order.  The patch also does something
similar for the changed data members, but this time during the diff
graph analysis.  That order affects how we consider a given type
change to be redundant.

Second, when looking a diff node named N, if another diff node N'
equivalent to N has already been marked redundant (and thus filtered
out already), we were sometimes wrongly failing to detect and mark N
as redundant.  This patch fixes that.

I realized that some code was now unnecessary so I removed it.

A lot of reference output of tests are adjusted by this patch.
Mostly, these were cases we were failing to properly detect (and
filter out) as redundant reports.  So the change reports should
hopefully look more concise and to the point now.

[1] the recent change is this one:
    2f92777d Consider the implicit 'this' parameter when comparing methods

* src/abg-comparison-priv.h
(diff_context::priv::last_visited_diff_node_): Remove unnecessary
data member.
(class_or_union_diff::priv::sorted_{deleted,inserted}_member_functions_):
Add new data members.
(sort_string_member_function_sptr_map): Declare new function.
* src/abg-comparison.cc (sort_string_member_function_sptr_map):
Define new function.
(redundancy_marking_visitor::visit_begin): If the current diff
node is equivalent to another one that has been already marked
redundant, then consider the current diff node as redundant as
well.  Considering the fact an ancestor node has been filtered out
is now useless because if that's the case then the current
descendant node wouldn't even be walked at reporting time.  So
remove the call to diff_has_ancestor_filtered_out.
(categorize_redundancy): Remove useless call here as well.
(diff_has_ancestor_filtered_out, diff_has_ancestor_filtered_out)
(diff_context::{mark_last_diff_visited_per_class_of_equivalence,
clear_last_diffs_visited_per_class_of_equivalence,
get_last_visited_diff_of_class_of_equivalence}): Remove
unnecessary functions.
(redundancy_marking_visitor::visit_end): Add comment.
(class_diff::ensure_lookup_tables_populated): Lexicographically
sort inserted/deleted member functions.
(class_or_union_diff::chain_into_hierarchy): Chain changed data
members diff nodes in a sorted manner.
* src/abg-default-reporter.cc (default_reporter::report): Report
deleted/inserted member functions in lexicographic order.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
Adjust.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
Likewise.
* 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:
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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoConsider the implicit 'this' parameter when comparing methods
Dodji Seketeli [Thu, 8 Oct 2020 09:25:37 +0000 (11:25 +0200)]
Consider the implicit 'this' parameter when comparing methods

Since 2013 the implicit 'this' parameter has been excluded from the
function parameters taken into account while comparing class member
functions.  This was an early measure to avoid infinite recursion that
would then occur when comparing classes (and thus their member
functions that are referenced in their vtable).  But since then, we've
built descent infrastructure to prevent this kind of recursion in a
more generic manner.

This patch thus removes that restriction and should therefore lift the
concerns expressed in the bug
https://sourceware.org/bugzilla/show_bug.cgi?id=26672.

Namely, changes to (data members of) a class should now be detected
when comparing member functions of that class.

With this change, the reference output of several comparison
regression tests changed because, obviously, some impacted member
functions are now reported along with detecting changes in data
membrers of classes.  The patch thus adjusts those reference ouputs.

The patch also adjust the behaviour of the predicate:
  "accessed_through = pointer|reference|reference-or-pointer"
The idea is to make the predicate work on qualified version of a type.

* include/abg-ir.h (function_type::get_first_parm): Declare new
accessor.
* src/abg-ir.cc (function_type::get_first_parm): Define new
accessor.
(equals): In the overload for function_type,
always take the implicit "this" parameter into account in
parameter comparisons.
(function_type::get_first_non_implicit_parm): Adjust comment.
* src/abg-comp-filter.cc (function_name_changed_but_not_symbol):
Avoid potential NULL pointer dereferencing.
* src/abg-comparison.cc
(function_type_diff::ensure_lookup_tables_populated): Always take
the changes to the implicit 'this' parameter into account in the
function type diff.
(compute_diff): In the overload for function_type, Always compare
the implicit 'this' parameter when comparing function parameters.
* src/abg-default-reporter.cc (default_reporter::report): Refer to
"implicit parameter" when reporting changes on parameters
artificially generated by the compiler.
* src/abg-suppression.cc (type_suppression::suppresses_diff): Make
the 'access_through' predicate work on a qualified version of type
'S', even if it was meant to work on type 'S'.  This allows it to
work on 'const S', especially when S is accessed through 'pointer
to const S', which happens when we consider the implicit 'this'
parameter of a const member function.
* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Adjust.
* tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise.
* tests/data/test-abidiff-exit/test1-voffset-change-report0.txt:
Likewise.
* tests/data/test-abidiff/test-PR18791-report0.txt: Likewise.
* tests/data/test-abidiff/test-struct1-report.txt: Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt:
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/test29-vtable-changes-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test30-vtable-changes-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test31-vtable-changes-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise.
* tests/data/test-diff-dwarf/test5-report.txt: Likewise.
* tests/data/test-diff-dwarf/test8-report.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/test13-report.txt: Likewise.
* tests/data/test-diff-filter/test2-report.txt: Likewise.
* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test4-report.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-0.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-11.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-13.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-15.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-6.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-7.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-8.txt: Likewise.
* tests/data/test-diff-suppr/test24-soname-report-9.txt: Likewise.
* tests/data/test-diff-suppr/test31-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test33-report-0.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoFix two wrongs in test suppression regex
Giuliano Procida [Mon, 17 Aug 2020 09:38:14 +0000 (10:38 +0100)]
Fix two wrongs in test suppression regex

The suppression specification in test38-char-class-in-ini.abignore was
introduced in commit 1478d9cc1c74ca3a2be89cd09aac5afcbdf818c7.

Unfortunately it contains two errors. One causes the file name not to
match as the string is the full path, not the base name. The other is
a typo that causes the file name match not to even be attempted. The
two mistakes cancel in the test, but result in a suppression
specification that is broader than intended.

* tests/data/test-diff-suppr/test38-char-class-in-ini.abignore:
Don't anchor regex match to beginning of file name.
Change "filename_regexp" to "file_name_regexp".

Signed-off-by: Giuliano Procida <gprocida@google.com>
4 years agoAdd missing newlines to end of test files.
Giuliano Procida [Mon, 17 Aug 2020 09:38:13 +0000 (10:38 +0100)]
Add missing newlines to end of test files.

Various test files were missing terminal newlines.

* tests/data/test-diff-suppr/test0-type-suppr-2.suppr: Add
final new line.
* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-4.suppr:
Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-0.suppr:
Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-4.suppr:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-1.suppr:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-2.suppr:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-3.suppr:
Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-4.suppr:
Likewise.
* tests/data/test-diff-suppr/test41-enumerator-changes-0.suppr:
Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-7.suppr:
Likewise.
* tests/data/test-ini/test01-equal-in-property-string.abignore:
Likewise.

Signed-off-by: Giuliano Procida <gprocida@google.com>
4 years agoabg-corpus.cc: report architecture discrepancies
Giuliano Procida [Fri, 18 Sep 2020 10:00:54 +0000 (11:00 +0100)]
abg-corpus.cc: report architecture discrepancies

If there ever is a discrepancy between the architectures of the
corpuses of a corpus group, libabigail will just abort with an
assertion, if enabled. However, this is a case of invalid input and
the cause should be reported to the user.

* src/abg-corpus.cc (corpus_group::add_corpus): Report
architecture discrepancies.

Signed-off-by: Giuliano Procida <gprocida@google.com>
4 years agoBug 26568 - Union should support more than one anonymous member
Dodji Seketeli [Wed, 16 Sep 2020 15:49:53 +0000 (17:49 +0200)]
Bug 26568 - Union should support more than one anonymous member

When building a union type we try to ensure that each member is
present only once.  This is because the code to build the union is
also used to actually update a partially constructed union.  To do so,
before adding a member to the union, the member is looked up (among
the current members) by name to see if it's already present or not.

But then for anonymous members, the name of the member is empty.
After the first anonymous member is added to the union, subsequent
look-ups with an empty name all succeed.  So no more than one
anonymous member is added to the union.  Oops.

A way to fix this is to perform the lookup by taking into account the
type of the anonymous data member, not its (empty) name.  We already
do this for anonymous data members of classes/structs.

This patch thus uses that type-based anonymous data member lookup for
unions.

But then now that unions can have several anonymous members, another
issue was uncovered.

Array types whose elements are of anonymous type can be wrongly
considered different because of canonicalization issues.

Let's suppose we have these two arrays whose internal pretty
representation are:

    "__anonymous_struct_1__ foo[5]"

and

   "__anonymous_struct_2__ foo[5]"

These are arrays of 5 elements of type anonymous struct.  Suppose the
anonymous structs "__anonymous_struct_1__" and
"__anonymous_struct_2__" are structurally equivalent.  Because the
internal names of these array element types are different, the
internal pretty representations of the arrays are different.  And thus
the canonical types of the two arrays are different.  And that's
wrong.  In this particular case, they should have the same canonical
type and thus be considered equivalent.

This patch thus teaches 'get_type_name' to make the internal type
name of anonymous types of a given kind be the same.  Thus, making all
arrays of 5 anonymous struct have the same pretty representation:

    "__anonymous_struct__ foo[5]"

This gives the type canonicalizer a chance to detect that those arrays
having the same canonical type.

These two changes while being seemingly unrelated need to be bundled
together to fix a number of issues in the existing test reference
outputs because fixing the first one is needed to uncover the later
issue.

* src/abg-dwarf-reader.cc (add_or_update_union_type): Don't use
the empty name of anonymous members in the lookup to ensure that
all data members are unique.  Rather, use the whole anonymous
member itself for the lookup, just like is done to handle
anonymous data member in classes/structs.
* src/abg-reader.cc (build_union_decl): Likewise.
* src/abg-ir.cc (get_generic_anonymous_internal_type_name): Define
new static function.
(get_type_name): For internal purposes, make the type name of all
anonymous types of a given kind to be the same.  This allows the
internal representation of anonymous types which are based on type
names to all be the same, so that they can be compared among
themselves during type canonicalization.
* tests/data/test-read-dwarf/test-PR26568-{1,2}.c: Source code of
binary test input.
* tests/data/test-read-dwarf/test-PR26568-{1,2}.o: New binary test input.
* tests/data/test-read-dwarf/test-PR26568-{1,2}.o.abi: New
reference test ouput.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-read-dwarf.cc (in_out_specs): Add the new binary test
input above to this test harness.
* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi: Adjust.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoMake abidiff and abidw support several --headers-dir{1,2} options
Dodji Seketeli [Wed, 2 Sep 2020 06:25:07 +0000 (08:25 +0200)]
Make abidiff and abidw support several --headers-dir{1,2} options

When handling a binary with abidiff or abidw it can be useful to
provide several different header files directories, for the cases
where the header files of the binary are scathered in several
different directories.

It thus becomes possible to invoke abidiff like this:

    abidiff --headers-dir1 first-header-dir1   \
    --headers-dir1 second-header-dir1  \
    --headers-dir2 first-header-dir2   \
    --headers-dir2 second-header-dir2  \
    binary1 binary2

This patch adds support for that.  It also modifies the
tests/test-abidiff-exit.cc test harness to make it take header
directories.  With that modification done, a new test is added in that
harness to exercise this new feature.

This should close the feature request over at
https://sourceware.org/bugzilla/show_bug.cgi?id=26565.

* doc/manuals/abidiff.rst: Update documentation for the
--headers-dir{1,2} options.
* doc/manuals/abidw.rst: Likewise for the --header-dir option.
* include/abg-tools-utils.h (gen_suppr_spec_from_headers): Add new
overload that takes a vector of headers root dirs.
* src/abg-tools-utils.cc (gen_suppr_spec_from_headers_root_dir):
Define new function.
(gen_suppr_spec_from_headers): Define a new overload that takes a
vector of head_root_dir strings; it uses the new
gen_suppr_spec_from_headers function.  Use the new overload in the
previous one that takes just one head_root_dir string.
* tools/abidiff.cc (options::headers_dirs{1,2}): Rename
option::headers_dir{1,2} into this one and make it be a vector of
strings rather than just a string.
(parse_command_line): Support several --headers-dir{1,2} on the
command line.
(set_diff_context_from_opts, set_suppressions): Adjust.
* tools/abidw.cc (options::headers_dirs): Renamed
options::headers_dir into this and make it be a vector of strings
rather than just a string.
(parse_command_line): Support several --headers-dir on the command
line.
(set_suppressions): Adjust.
* tests/data/test-abidiff-exit/test-headers-dirs/headers-a/header-a-v{0,1}.h:
Header files of new binary test input.
* tests/data/test-abidiff-exit/test-headers-dirs/headers-b/header-b-v{0,1}.h:
Likewise.
* tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-v{0,1}.c:
Source code of new binary test input.
* tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-{1,2}.txt:
Reference output of new binary test input.
* tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-v{0,1}.o:
New binary test input.
* tests/data/Makefile.am: Add the new files above to source
distribution.
* tests/test-abidiff-exit.cc (InOutSpec::in_elfv{0,1}_path): Add
new data members.
(in_out_specs): Adjust the content of this array as its type
changed.  Also, add two new entries to run the test over the new
binary test inputs above.
(do_prefix_strings): Define new static function.
(main): Use it the new do_prefix_strings here.  Make abidiff
use the --header-dir{1,2} option whenever header directories are
specified in an entry of the in_out_specs array.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
4 years agoBug 26309 - Wrong leaf reporting of changes to typedef underlying type
Dodji Seketeli [Mon, 14 Sep 2020 08:42:40 +0000 (10:42 +0200)]
Bug 26309 - Wrong leaf reporting of changes to typedef underlying type

In leaf mode, libabigail fails to report changes to the underlying
type of a typedef.

At its core, this is due to the fact that changes to the underlying
type of a typedef are not considered local.  As the leaf reporter only
reports local changes (as opposed to non-local changes which are
changes to sub-types) it doesn't detect those non-local typedef
changes.

To handle this, this patch makes changes to the underlying type of a
typedef be considered as local changes.  This is like what we already
do for pointer and qualified types.

Now that we have another set of changes to report in the leaf
reporter, we need to handle how to propagate the category and
redundancy status of those changes.  The patch does this too.

Also, just like we do pointer and qualified type changes, the patch
avoids marking the diff node carrying the typedef change as being a
leaf change.  That way, only existing leaf changes carrying that
typedef diff node will be reported.  For instance, a function whose
parameter has a typedef change will be reported because that change to
the function is considered a leaf change.  Otherwise, reporting the
typedef (or the pointer or qualified) type change on its own is not
useful unless it impacts those leaf changes that we deem useful.

The patch adds the example given in problem report to the testsuite.

  * src/abg-ir.cc (equals): In the overload for typedef_decls,
report changes to the underlying type as being local of kind
LOCAL_TYPE_CHANGE_KIND.
* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Do not mark typedef
diff node as leaf node.
(suppression_categorization_visitor::visit_end): Propagate the
'suppressed' category of the underlying type to the parent typedef
unless the later has a local non-type change.
(redundancy_marking_visitor::visit_end): Likewise for the
'redundant' category.
* include/abg-reporter.h (report_non_type_typedef_changes): Rename ...
* src/abg-default-reporter.cc (report_non_type_typedef_changes):
... report_local_typedef_changes into this.
* src/abg-leaf-reporter.cc (leaf_reporter::report): Make the leaf
reporter invoke the reporting method of the default reporter for
typedefs as all typedef changes are now local.
* tests/data/test-diff-filter/test-PR26309-report-0.txt: Add new
test reference output.
* tests/data/test-diff-filter/test-PR26309-v{0,1}.o: Add new test
binary input.
* tests/data/test-diff-filter/test-PR26309-v{0,1}.c: Add source
code for new test binary input.
* tests/data/Makefile.am: Add the new text material above to
source distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the new test input
above to this test harness.
* 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This page took 0.137508 seconds and 5 git commands to generate.