Commit Graph

2154 Commits

Author SHA1 Message Date
Dodji Seketeli
b918ec8f77 tests/catch.hpp: Add SPDX header back
* tests/lib/catch.hpp: Add SPDX header back.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-03-08 11:33:56 +01:00
Dodji Seketeli
e3aa28ac7b 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>
2021-03-01 10:34:38 +01:00
Dodji Seketeli
f022e3e993 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>
2021-03-01 10:34:26 +01:00
Dodji Seketeli
8ae8dcb8d5 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>
2021-02-24 09:12:06 +01:00
Dodji Seketeli
77bc4b7b15 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>
2021-02-11 17:23:42 +01:00
Dodji Seketeli
a8c0199df5 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>
2021-02-10 20:03:11 +01:00
Giuliano Procida
25904b3212 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>
2021-02-09 15:29:19 +01:00
Giuliano Procida
89de572d7b 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>
2021-02-08 16:29:13 +01:00
Dodji Seketeli
43c59daef5 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>
2021-02-08 12:15:52 +01:00
Dodji Seketeli
e5c7fd3400 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>
2021-02-04 09:26:05 +01:00
Dodji Seketeli
013a19c5fe 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>
2021-02-03 13:55:38 +01:00
Dodji Seketeli
271e3afaf6 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>
2021-02-02 16:15:29 +01:00
Dodji Seketeli
23046152e0 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>
2021-02-01 14:09:29 +01:00
Dodji Seketeli
6ef9dafdd9 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>
2021-01-29 18:28:25 +01:00
Dodji Seketeli
1d29610d51 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>
2021-01-27 11:20:48 +01:00
Dodji Seketeli
4dab7cd970 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>
2021-01-26 19:19:01 +01:00
Dodji Seketeli
40709acdd5 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>
2021-01-26 17:41:33 +01:00
Matthias Maennich
840eca4714 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>
2021-01-26 17:19:08 +01:00
Dodji Seketeli
3b734e42fe 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>
2021-01-26 15:04:39 +01:00
Dodji Seketeli
e9bcf8634f 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>
2021-01-26 04:48:20 +01:00
Dodji Seketeli
9a0c823df4 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>
2021-01-23 16:36:15 +01:00
Dodji Seketeli
1dcdd54d54 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>
2021-01-23 16:35:11 +01:00
Matthias Maennich
3a0fa5ec28 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>
2021-01-18 13:36:43 +01:00
Dodji Seketeli
625d0903c2 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>
2021-01-15 18:01:56 +01:00
Dodji Seketeli
6e5b4471f9 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>
2021-01-11 15:10:19 +01:00
Matthias Maennich
9fc16dbc7d 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>
2020-12-15 11:20:58 +01:00
Matthias Maennich
dfd2c2d562 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>
2020-12-15 11:04:14 +01:00
Giuliano Procida
1b62e39f53 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>
2020-12-15 09:49:13 +01:00
Matthias Maennich
c458e00db9 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>
2020-12-15 09:23:44 +01:00
Matthias Maennich
5d669e0126 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>
2020-12-15 09:21:38 +01:00
Matthias Maennich
af233cd001 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>
2020-12-15 09:17:01 +01:00
Matthias Maennich
de344c0122 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>
2020-12-15 09:08:52 +01:00
Matthias Maennich
ee3309472a 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>
2020-12-15 08:51:07 +01:00
Matthias Maennich
47a76acf76 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>
2020-12-15 08:40:10 +01:00
Giuliano Procida
04690d216a 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>
2020-12-10 10:04:17 +01:00
Giuliano Procida
d068f26701 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>
2020-12-05 11:04:01 +01:00
Dodji Seketeli
38effc902b 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>
2020-12-05 11:02:24 +01:00
Giuliano Procida
f10d1fc1dd 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>
2020-12-04 10:01:27 +01:00
Dodji Seketeli
4f8c9b170d 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>
2020-12-03 14:04:23 +01:00
Dodji Seketeli
b56e5aeb40 CONTRIBUTING: Update instructions about regression tests
* CONTRIBUTING: Update instructions about how to launch regression
	tests.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-12-03 14:04:23 +01:00
Dodji Seketeli
b167a7b7d2 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>
2020-12-02 17:42:47 +01:00
Dodji Seketeli
59701daaf8 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>
2020-12-02 11:50:22 +01:00
Dodji Seketeli
0f78e9a0fa 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>
2020-12-02 11:49:59 +01:00
Dodji Seketeli
3e18713f44 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>
2020-12-02 11:49:33 +01:00
Dodji Seketeli
c80f79271a 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>
2020-12-02 11:49:13 +01:00
Dodji Seketeli
fb5749b5ee 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>
2020-12-02 11:48:52 +01:00
Dodji Seketeli
964bf04158 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>
2020-12-02 11:48:33 +01:00
Dodji Seketeli
418ea85baf 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>
2020-12-02 11:45:10 +01:00
Dodji Seketeli
be6bf58308 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>
2020-12-02 11:44:56 +01:00
Matthias Maennich
58488c5f31 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>
2020-12-02 11:44:13 +01:00