Add / update .gitignore files for tests/ and tools to ignore
binaries, logs, traces typically produced during development.
* tests/.gitignore: exclude tests binaries and test results
* tools/.gitignore: update to ignore produced binaries
Signed-off-by: Matthias Maennich <maennich@google.com>
operator& was implemented in terms of itself, leading to infinite
recursion. Fix that by implementing it in terms of &='ing the const
value. That is consistent with all other ?= operators.
* src/abg-dwarf-reader.cc: fix expr_result::operator&
Signed-off-by: Matthias Maennich <maennich@google.com>
When compiling with clang, the following warning is emitted:
abg-comparison.cc:2674:17: warning: expression with side effects will be
evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression]
return typeid(*first.get()) != typeid(*second.get());
^
Mitigate that warning by moving potential side effects out of typeid.
* src/abg-comparison.cc: fix clang warning "potentially-evaluated-expression"
Signed-off-by: Matthias Maennich <maennich@google.com>
The data members environment_setter::artifact_ and
qualified_name_setter::node_ are not used and can therefore be dropped
along with all their references.
* src/abg-ir.cc: drop unused data members
Signed-off-by: Matthias Maennich <maennich@google.com>
Drop 'require_drop_property' as it is not used at all.
That fixes a clang warning.
* include/abg-suppression-priv.h: drop unused argument from type_is_suppressed
Signed-off-by: Matthias Maennich <maennich@google.com>
_M_canvas and _M_typo are unused within "dot". Remove them and all
references.
* include/abg-viz-dot.h: remove unused data members from 'dot'
Signed-off-by: Matthias Maennich <maennich@google.com>
Several virtual desctructors were missing. Even though there might not
have been actual leaks or similar bugs, it is worth fixing these
locations as they might lead to bugs in the future.
Clang also warns at these locations:
warning: delete called on non-final 'abigail::ir::corpus' that has virtual
functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
* include/abg-comparison.h: add virtual destructor for corpus_diff and diff_node_visitor
* include/abg-corpus.h: add virtual destructor for corpus
* include/abg-reporter.h: add virtual destructor for reporter_base
* include/abg-traverse.h: add virtual destructor for traversable_base
Signed-off-by: Matthias Maennich <maennich@google.com>
The postfix increment / decrement operators were implemented by calling
themselves recursively. Fix that by implementing these in terms of their
prefix counter parts.
* include/abg-diff-utils.h: fix postfix dec/inc operator
Signed-off-by: Matthias Maennich <maennich@google.com>
When compiling with clang, the following warning is emitted:
abg-reader.cc:1981:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
while (corp = read_corpus_from_input(ctxt))
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
That is certainly a common pitfall and can be mitigated by placing
parentheses around the assignment.
* src/abg-reader.cc: clarify boolean use of assignment
Signed-off-by: Matthias Maennich <maennich@google.com>
Returning bool literals from main can be misleading. Returning booleans
maps to (by convention):
return false -> converted to 0 -> rc=0 considered SUCCESS
return true -> converted to 1 -> rc=1 considered FAILURE
Compiling with clang also emits:
abilint.cc:258:7: warning: bool literal returned from 'main' [-Wmain]
return true;
^ ~~~~
The issues can be addressed by consistently returning integers as also
done in all other mains across the project.
Same issue applies to print-diff-tree.cc.
* tools/abilint.cc: return int in main rather than bool.
* tests/print-diff-tree.cc: Likewise.
Signed-off-by: Matthias Maennich <maennich@google.com>
ir_node_visitor is defined as `class` in include/abg-ir.h:4429 and
should therefore also be forward-declared as such.
* include/abg-fwd.h: forward-declare ir_node_visitor as class
Signed-off-by: Matthias Maennich <maennich@google.com>
Since the commit
7290d58095
of the kernel, the format of the ksymtab section changed, so the ELF
reader of Libabigail cannot get the list of kernel symbols that are
meaningful to analyze.
In the new format, each ksymtab entry is now 32 bits length,
independently of if the kernel was built in 32 or 64 bits mode. This
way, 64 bit kernels save 32 bits per entry, from the ksymtab section
alone.
Also, note that the symbol address in the ksymtab entry is stored in a
"place-relative address" format. That means for a given symbol value
'Sym_Addr', the value which is stored at a given offset 'Off' of the
ksymtab secthion which address is Ksymtab_Addr is:
Sym_Addr - Ksymtab_Addr - Off.
This is what is meant by storing Sym_Addr in a "place-relative" manner.
One advantage, of course, is to make Sym_Addr take 32 bits, even on a
64 bits arch. Another advantage is that the resulting value doesn't
need to be relocated! So we don't need any relocation section either!
So lots of space saving.
This patch teaches the ELF reader into this new format.
* src/abg-dwarf-reader.cc (enum kernel_symbol_table_kind): Move this
enum at the top.
(enum ksymtab_format): Define new enum.
(read_context::{ksymtab_format_, ksymtab_entry_size_,
nb_ksymtab_entries_, nb_ksymtab_gpl_entries_}): Define new data
members.
(read_context::initiliaze): Initialize the new data members above.
(read_context::{get_ksymtab_format, get_ksymtab_symbol_value_size,
get_ksymtab_entry_size, get_nb_ksymtab_entries,
get_nb_ksymtab_gpl_entries,
maybe_adjust_sym_address_from_v4_19_ksymtab}): Define new member
functions.
(read_context::load_kernel_symbol_table): Support loading from
both pre and post v4.19 linux kernels with their different ksymtab
formats. Add more comments.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In C and C++ the qualifiers of a qualified array type apply to the
element type of said array.
In this particular problem report, GCC and Clang emit DWARF that
represent the qualifiers either on the array type, or on the element
type. Quoting the test of the bug:
Given the following example:
struct test {
const char asdf[4];
};
void func(struct test arg) {}
abidiff says:
1 function with some indirect sub-type change:
[C]'function void func(test)' at test.c:5:1 has some indirect sub-type
changes:
parameter 1 of type 'struct test' has sub-type changes:
type size hasn't changed
1 data member change:
type of 'const char test::asdf[4]' changed:
entity changed from 'const char[4]' to 'const char[4] const'
This is because GCC represents the array as const array of const
signed char, whereas clang represents it as an array of const signed
char.
In this patch, libabigail's DWARF reader detects qualified array types
and appropriately qualifies the array element type, instead of
qualifying the array type. The patch accordingly adjusts the various
regression tests and adds a new test which comes from the problem
report.
* include/abg-fwd.h (is_array_of_qualified_element): Declare 2
overloads of this function.
(re_canonicalize): Declare a new function.
* include/abg-ir.h (class {decl_base, type_base}): Declare
re_canonicalize as a friend of these classes.
* src/abg-dwarf-reader.cc (maybe_strip_qualification): Detect
qualified array types and appropriately qualifies the array
element type, instead of qualifying the array type itself.
Re-canonicalize the resulting type if necessary.
* src/abg-ir.cc (is_array_of_qualified_element): Define 2
overloads of this function.
(re_canonicalize): Define new function.
* tests/data/Makefile.am: The two new test binary input files
PR24430-fold-qualified-array-clang and
PR24430-fold-qualified-array-gcc to source distribution, as well
as the expected reference output.
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-diff-filter/PR24430-fold-qualified-array-clang:
New binary test input coming from the bug report.
* tests/data/test-diff-filter/PR24430-fold-qualified-array-gcc:
Likewise.
* tests/data/test-diff-filter/PR24430-fold-qualified-array-report-0.txt:
Expected reference abi difference.
* tests/data/test-diff-filter/test33-report-0.txt: Adjust.
* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/test-diff-filter.cc: Add the new binary test input to this
test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
PR24410 was fixed by these recent commits:
1b83138 Propagate private type diff category through refs/qualified type diffs
dc84fee Fix anonymous union constructed under the wrong context
522ac25 Internal pretty repr of union cannot be flat representation
But then I forgot to add a regression test for that issue.
This patch does that.
* tests/data/test-diff-pkg/PR24410-new/poppler-debuginfo-0.73.0-8.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-new/poppler-qt5-0.73.0-8.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-new/poppler-qt5-debuginfo-0.73.0-8.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-new/poppler-qt5-devel-0.73.0-8.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-old/poppler-debuginfo-0.73.0-4.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-old/poppler-qt5-0.73.0-4.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-old/poppler-qt5-debuginfo-0.73.0-4.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-old/poppler-qt5-devel-0.73.0-4.fc30.x86_64.rpm:
Add new test input.
* tests/data/test-diff-pkg/PR24410-report-0.txt: Add new test
input.
* tests/data/Makefile.am: Add the test input above to source
distribution.
* tests/test-diff-pkg.cc: Make this test harness use the new input
rpms above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch is the third of the series:
Internal pretty repr of union cannot be flat representation
Fix anonymous union constructed under the wrong context
Propagate private type diff category through refs/qualified type diffs
The intent of this series is to fix the bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=24410
"Empty change report emitted for libpoppler-qt5.so.1.18.0"
We (mistakenly) don't propagate private type diff categories through
reference and qualified type diffs. This leads to some diff nodes not
being suppressed just because they are private type diffs which
category weren't properly propagated.
This patch fixes this.
Note that the tests updated in this patch reflect the regression tests
changes needed for the entire set of 3 patches.
* src/abg-comparison.cc
(suppression_categorization_visitor::visit_end): Propagate
suppressed and private type diff categories for reference and
qualified types. For qualified types, make sure they don't have
local changes. Even when there are no local changes, do not
propagate private diff categories to typedefs.
* tests/data/test-annotate/test17-pr19027.so.abi: Adjust.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch is second of the series:
Internal pretty repr of union cannot be flat representation
Fix anonymous union constructed under the wrong context
Propagate private type diff category through refs/qualified type diffs
The intent of this series is to fix the bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=24410
"Empty change report emitted for libpoppler-qt5.so.1.18.0"
What happens here is that when the DWARF reader sees an anonymous
union/struct, it can mistakenly think that it has seen it before
(because the comparison doesn't take the scope of the union/struct
into account), and thus mistakenly represent the union/struct.
The solution implemented by this patch is to take the scope of the
anonymous union/struct into account.
Note that regression tests are all updated in the last patch of the
series.
* src/abg-dwarf-reader.cc (add_or_update_class_type)
(add_or_update_union_type): Only reuse anonymous class/union types
which have the same scope as the current one.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is the first patch of this series:
Internal pretty repr of union cannot be flat representation
Fix anonymous union constructed under the wrong context
Propagate private type diff category through refs/qualified type diffs
The intent of this series is to fix the bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=24410
"Empty change report emitted for libpoppler-qt5.so.1.18.0"
The internal pretty representation of a union must be its fully
qualified name, even when it's a anonymous union. It cannot be its
flat representation as for anonymous unions, that would lead to
confusion between anonymous unions that have the same flat
representation but are in different scopes.
Fixed thus.
Note that regression tests are all updated in the last patch of the
series
* src/abg-ir.cc (union_decl::get_pretty_representation):
Anonymous internal pretty representation of unin is its fully
qualified name.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
GCC 4.3.2 wrongly emits some type definition DIEs in the scope of a
DW_TAG_subroutine_type. Whenever the DWARF reader tries to get the
scope of a DIE during the computation of the pretty name of a type DIE
which scope is (wrongly) emitted as being a DW_TAG_subroutine_type
things end-up in an infinite loop.
This patch makes get_scope_die to look through the
DW_TAG_subroutine_type to return the proper scope instead, just like
what we already do for DW_TAG_subprogram and DW_TAG_array_type.
* src/abg-dwarf-reader.cc (get_scope_die): Look through
DW_TAG_subroutine_type to get the scope of a given DIE.
* tests/data/Makefile.am: Add the two new files below to source
distribution.
* tests/data/test-read-dwarf/PR24378-fn-is-not-scope.abi: New
reference test output.
* tests/data/test-read-dwarf/PR24378-fn-is-not-scope.o: New binary
test input.
* tests/test-read-dwarf.cc (in_out_specs): Add the new test input
to the test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
During DIE de-duplication for the purpose of DIE canonicalization, we
use the so called "pointer name equality" optimization. That is, when
in a given translation unit, we have two different pointers named T*,
we assume they are the same type, without having to compare their
pointed-to T types recursively.
Unfortunately, some Ts can be different, especially in C. Think about
two typedefs with different underlying types, for instance. Or two
struct with data members which types are pointers to typefefs with
different underlying types. We are having the case in the libc binaries
provided in bug https://sourceware.org/bugzilla/show_bug.cgi?id=24257,
for instance.
In those case, we try not only to look at the name of the translation
unit associated to the pointer to T, but also, at the name of the
translation unit of the leaf node of T*. By leaf node, I mean the
resulting of stripping T* from all pointers and typedefs. This won't
solve the case of the Ts being structs with data members which types
are pointers to typedefs with different underlying types. But it
helps with the easier earlier cases.
* src/abg-dwarf-reader.cc
(die_is_pointer_reference_or_typedef_type)
(die_peel_pointer_and_typedef): Define new static functions.
(compare_dies_string_attribute_value): Turn this function into a
static one.
(compare_dies_cu_decl_file): Make this function compare the cu
decl file name of the leaf type of the pointer, not just the one
of the pointer itself.
(compare_as_decl_dies): Compare the DWARF tags too.
(compare_dies): Simplify logic.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I figured it's useful, for debugging
purposes, to be able to lookup a given data member of a union/class by
name, as well as a function parameter by index.
This patch adds both.
* include/abg-ir.h (lookup_data_member, get_function_parameter):
Declare new functions.
* src/abg-ir.cc (lookup_data_member, get_function_parameter):
Define them.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Whenever a void* pointer changes to a T* pointer, we already consider
that change to be ABI-compatible. The issue though is that we don't
detect the case of foo* changing into T* where foo is typedef void
foo. This patch fixes that.
* include/abg-ir.h (is_void_type): Add a new overload that takes
type_base*.
* src/abg-ir.cc (is_void_type): Define the new overload that takes
type_base*.
(is_void_pointer_type): Look through typedefs in
the pointed-to type.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
For languages like C that don't have namespaces, we don't need to
build the DIE -> parent map, and that speeds up the analysis of the
ELF binary in the DWARF reader.
Unfortunately, just because we are seeing some MIPS assembler
translation unit, dwarf_reader::read_context::build_die_parent_maps
unnecessarily builds the DIE -> parent map, making the ELF binary
analysis slower.
This patch introduces the new function
dwarf_reader::read_context::do_we_build_die_parent_maps to make the
decision about building the DIE -> parent map in a central place. And
it makes dwarf_reader::read_context::build_die_parent_maps use it.
With this, analysing the linux kernel becomes faster again.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When analyzing the Linux Kernel (with e.g abidw) and providing a
symbol whitelist the DWARF reader performs a speed optimization which
is that it does not read the symbol table of the kernel binary.
To know if a function is to be suppressed (because it doesn't belong
to the whitelist, for instance) dwarf_reader::function_is_suppressed
actually tries to see if the address of the function corresponds to
the address of an ELF symbol that is publicly exported, before looking
at if the function was suppressed by a suppression specification.
But then, when a whitelist is provided and the speed optimization of
not reading the symbol table is at play, there is no information about
ELF symbol addressed around. So dwarf_reader::function_is_suppressed
almost always supposes that the function is suppressed.
This patch fixes that by not trying to look at the address of the
function/variable when the symbol table optimization is on.
* include/abg-dwarf-reader.h (get_ignore_symbol_table): Take a
const read_context&.
* src/abg-dwarf-reader.cc (get_ignore_symbol_table): Likewise.
(function_is_suppressed): When the symbol table optimization is in
flight -- that is, when no symbol table has been loaded -- do not
try to see if a given function symbol was exported at the ELF
level or not. Just look at if the function was suppressed or not.
(variable_is_suppressed): Likewise for variables.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While analysing a Fortran binary the DWARF reader performs DIE
de-duplication. During that process, the compare_dies function
stumbles accross the a DIE of the DW_TAG_string_type kind. And it
doesn't know how to compare those DIEs. And this leads to an abort of
the abipkgdiff program, in particular.
DW_TAG_string_type DIEs do have a DW_AT_string_length attribute which
value is a location expression that does not resolve to a constant
value. In general, we cannot evaluate those expressions in a static
context like in Libabigail because we lack things like register values
which are dynamic in nature.
So, I decided for now to consider that two DW_TAG_string_type seen at
different DWARF offsets are considered to be different for now. This
pessimises DIEs de-duplication for types that contain
DW_TAG_string_type as their subtypes, but at least this is a basic
support for DW_TAG_string_type.
Tested with the RPMs on which abipkgdiff was failing.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (compare_as_type_dies): Handle
DW_TAG_string_type DIEs here.
(compare_dies): Handle DW_TAG_string_type DIEs by using
compare_as_type_dies.
* tests/data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-10.fc29.x86_64.rpm:
New test RPM.
* tests/data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-11.fc30.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt:
New expected test reference output.
* tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64.rpm:
New test RPM.
* tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-11.fc30.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-10.fc29.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-11.fc30.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-10.fc29.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-11.fc30.x86_64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new test input material above to
source distribution.
* tests/test-diff-pkg.cc (in_out_spec): Add the new test RPMs
above to the set of RPMs to use as test input.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In this problem report, the DWARF reader comes across an ADA subrange
which lower bound is a negative signed integer. The problem is that
the internal representation of libabigail expects the bounds of the
subrange to be unsigned integer. This incompatibility leads to an
assertion failure.
Further down the road I realized that the function
types_have_similar_structure doesn't support subrange types.
This patch thus introduces a new
array_type_def::subrange_type::bound_value class that captures the
signedness of the bound value. This allows the internal
representation to keep the sign information of the bound value, and
yet be able to treat the bound value as either a signed or unsigned
value depending on the contexts.
The patch also extends the function types_have_similar_structure to
make it support subrange types.
* include/abg-ir.h (array_type_def::subrange_type::bound_value):
Define new class.
(array_type_def::subrange_type::subrange_type): Adjust to use the
new bound_value type for bound values.
(array_type_def::subrange_type::{get_upper_bound, get_lower_bound,
set_upper_bound, set_lower_bound}): Return or take int64_t rather
than size_t.
(array_type_def::subrange_type::get_length): Return uint64_t
rather than size_t.
* src/abg-dwarf-reader.cc (die_signed_constant_attribute)
(die_constant_attribute, die_attribute_has_form)
(die_attribute_is_signed, die_attribute_is_unsigned)
(die_attribute_has_no_signedness): Define new static functions.
(get_default_array_lower_bound): Return uint64_t rather than int.
(build_subrange_type): Use the new
array_type_def::subrange_type::bound_value type for bound values.
Use the new die_constant_attribute function, rather than
die_unsigned_constant_attribute to fecth the bound values.
* src/abg-ir.cc
(array_type_def::subrange_type::bound_value::{bound_value,
get_signedness, set_signedness, get_signed_value,
get_unsigned_value, set_unsigned, set_signed}): Define new member
functions.
(array_type_def::subrange_type::priv::{lower_bound_,
upper_bound}): Use the new class bound_value.
(array_type_def::subrange_type::priv::priv): Adjust to use the new
bound_value class to hold bound values.
(array_type_def::subrange_type::subrange_type): Likewise.
(array_type_def::subrange_type::{get_upper_bound, get_lower_bound,
set_upper_bound, set_lower_bound}): Return or take int64_t rather
than size_t.
(array_type_def::subrange_type::get_length): Return uint64_t
rather than size_t.
(types_have_similar_structure): Handle array_type_def::subrange_type
* src/abg-reader.cc (build_subrange_type): Use the new
array_type_def::subrange_type::bound_value to hold bound values.
* tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-29.fc29.x86_64.rpm:
New binary RPM as test input.
* tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-30.fc30.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/GtkAda-devel-2.24.2-29.fc29.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/GtkAda-devel-2.24.2-30.fc30.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt:
New expected test output.
* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64.rpm:
New binary RPM as test input.
* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-30.fc30.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-29.fc29.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-30.fc30.x86_64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new test material above to source
distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add the new input testing
RPMs in here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch teaches the suppression specification subsystem how to
ignore changes of some enumerators in particular.
The patch adds a new property to the [suppress_type] section which is:
changed_enumerators = enumerator1, enumerator2, etc
This property is taken into accound iff the current suppress_type does
have the 'type_kind = enum' property.
Changes to enum types that match the new 'changed_enumerators'
property are suppressed.
* doc/manuals/libabigail-concepts.rst: Document the new
'changed_enumerators' property.
* include/abg-suppression.h
(type_suppression::{g, s}et_changed_enumerator_names): Declare two
new member functions.
* src/abg-suppression-priv.h
(type_suppression::priv::changed_enumerator_names_): Add a new
data member.
* src/abg-suppression.cc
(type_suppression::{g,s}et_changed_enumerator_names): Define two
new member functions.
(type_suppression::suppresses_diff): Support evaluating the new
'changed_enumerators = <vector of changed enumerators>'.
(read_type_suppression): Read the new list
property'changed_enumerators" and store it into the
type_suppression using the new
type_suppression::set_changed_enumerator_names ().
* tests/data/test-diff-suppr/libtest4{0,1}-enumerator-changes-v{0,1}.so:
Add new test inpujts.
* tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-0.suppr:
Add a new suppr spec for this new test.
* tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-report-0.txt:
The default report.
* tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-v{0,1}.cc:
Add Source code of libtest4{0,1}-enumerator-changes-v{0,1}.so.
* tests/data/Makefile.am: Add the test files above to source
distribution.
* tests/test-diff-suppr.cc: Add the test input files above to the
harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (enum diff_category): Add comments to
describe what to update when a new enumerator is added to this enum.
* src/abg-comp-filter.cc (has_fn_return_type_cv_qual_change): Fix
comment thinko here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When the type of a variable changes and that change is only a CV qual
change, we want libabigail to automatically classify that change as
being harmless.
This patch thus introduces a new VAR_TYPE_CV_CHANGE_CATEGORY change
category (enumerator of the abigail::comparison::diff_category enum)
for this kind of changes and classifies that category as being
harmless.
The patch then detects diff nodes that carry CV qualifiers change on
variable types and flags them as belonging to the new
VAR_TYPE_CV_CHANGE_CATEGORY.
* include/abg-comparison.h (VAR_TYPE_CV_CHANGE_CATEGORY): Add new
enumerator to diff_category enum.
(EVERYTHING_CATEGORY): Update this enumerator.
* src/abg-comp-filter.cc (type_diff_has_cv_qual_change_only):
Support array diff nodes carrying a cv qual change on the element
type.
(has_var_type_cv_qual_change): Define new static function.
(categorize_harmless_diff_node): Use the new
has_var_type_cv_qual_change to categorize variable diff node with
cv qual change on its type as harmless.
* src/abg-comparison.cc
(get_default_harmless_categories_bitmap): Update this.
(operator<<(ostream& o, diff_category c)): Likewise.
* include/abg-ir.h (equals_modulo_cv_qualifier): Declare new ...
* src/abg-ir.cc (equals_modulo_cv_qualifier): ... function.
* 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:
Update expected test output.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise.
* tests/data/Makefile.am: Add the new test material below to
source distribution.
* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt:
New expecte test output.
* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64.rpm: New
test input.
* tests/data/test-diff-pkg/nss-3.24.0-1.0.fc23.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/nss-debuginfo-3.23.0-1.0.fc23.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/nss-debuginfo-3.24.0-1.0.fc23.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/nss-devel-3.23.0-1.0.fc23.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/nss-devel-3.24.0-1.0.fc23.x86_64.rpm: Likewise.
* tests/test-diff-pkg.cc (in_out_specs): Add the test input above
to the test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/test-diff-dwarf.cc: Run the rust support regression test
only if we support Rust on the platform.
* tests/test-utils.h: Include config.h.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* configure.ac: Fix the typo HAS_LANG_Rust into HAS_DW_LANG_Rust.
* tests/data/test-diff-dwarf/test46-readme.txt: Add new file to
the test suite.
* tests/data/test-diff-dwarf/test46-rust-libone.so: Likewise.
* tests/data/test-diff-dwarf/test46-rust-libtwo.so: Likewise.
* tests/data/test-diff-dwarf/test46-rust-report-0.txt: Likewise.
* tests/test-diff-dwarf.cc (in_out_specs): Update the tests array
to compare the two new binaries included above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
elfutils regularly adds new members to the anonymous DWARF language
encodings enum which contains the DW_LANG_* enumerators, from the
dwarf.h header file.
If we want libabigail to keep compiling with older versions of
elfutils, we need to detect the absence of a given DW_LANG_*
enumerator and avoid using it in that case.
Until now, we were doing #ifdef DW_LANG_* for that purpose. But then
the DW_LANG_* are *enumerators*, not preprocessor macros. So that
preprocessor macro.
This patch detects the presence of each of the "newer" DW_LANG_*
enumerator using autoconf. And for each DW_LANG_xxx enumerator that
is present, autoconf defines the HAVE_DW_LANG_xxx_enumerator macro.
Libabigail source code can thus do #ifdef HAVE_DW_LANG_xxx_enumerator
to guard the use of DW_LANG_xxx.
Tested with the Rust binaries from
https://gitlab.gnome.org/federico/abi-rust.
* configure.ac: Detect the presence of DW_LANG_{UPC, D, Python,
Go, C11, C_plus_plus_03, C_plus_plus_11, C_plus_plus_14,
Mips_Assembler, Rust} and define the corresponding
HAVE_DW_LANG_*_enumerator macro accordingly.
* include/abg-ir.h (LANG_C_plus_plus_03): Define this new
enumerator in the translation_unit::language enum.
* src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): Use the
new HAVE_DW_LANG_*_enumerator macros.
(get_default_array_lower_bound): Support the
translation_unit::LANG_C_plus_plus_03 enumerator.
* src/abg-ir.cc (is_cplus_plus_language): Support the
translation_unit::LANG_C_plus_plus_03 enumerator.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): Fix a
thinko in the detection of the support of the DW_LANG_Rust enumerator.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Older elfutils (pre-0.170) don't define these constants in dwarf.h so
don't use them in that case.
* include/abg-ir.h (LANG_C_plus_plus_03): Add this new language
enum to "enum translation_unit::language".
* src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): Do not
use DW_LANG_Rust or DW_LANG_C_plus_plus_03 if these are not
defined.
(get_default_array_lower_bound): Handle the new
translation_unit::LANG_C_plus_plus_03 enumerator.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
I tested this on the binaries generated from this project:
https://gitlab.gnome.org/federico/abi-rust and I got this:
$ tools/abidiff libone.so libtwo.so
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with some indirect sub-type change:
[C]'function one::Foo one::foo(u32)' at lib.rs:8:1 has some indirect sub-type changes:
'function one::Foo one::foo(u32) {foo}' now becomes 'function two::Foo two::foo(u32, u32) {foo}'
return type changed:
type name changed from 'one::Foo' to 'two::Foo'
type size changed from 32 to 64 (in bits)
1 data member insertion:
'u32 two::Foo::b', at offset 32 (in bits)
no data member change (1 filtered);
parameter 2 of type 'u32' was added
* include/abg-ir.h (LANG_Rust): Add this new enumerator to the
"enum language" enum.
* src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): Handle
the Rust language.
(get_default_array_lower_bound): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In abidiff when the user uses --headers-dir{1,2}, she implicitly
indicates the public types of the first and the second binary. That
means that any type that is defined in a file that is not located
under the directory tree designated by --headers-dir{1,2} is
considered private and any change involving those private types will
be suppressed.
In practice, what happens is that libabigail constructs a suppression
specification which suppress all types that are defined in files that
are not under the directories located by --headers-dir{1,2}.
abidiff has a problem, though. It uses the same private type
suppressions (derived from --headers-dir1 and --headers-dir2) when
looking at the first binary *and* the second binary. It should rather
only use the private type suppression specifications derived from
--headers-dir1 when looking at the first binary, and use the private
type suppression specifications derived from --headers-dir2 when
looking at the second binary.
This problem leads to some false positives like the one reported at
https://gitlab.gnome.org/GNOME/pango/issues/343#note_397761.
This patch fixes this issue by using the private type suppression
specifications derived from --headers-dir1 only when looking at the
first binary, and using the private type suppression specifications
derived from --headers-dir2 only when looking at the second binary.
* include/abg-dwarf-reader.h (read_context_get_path): Declare new
function.
* include/abg-reader.h (read_context_get_path): Likewise.
* src/abg-dwarf-reader.cc (read_context_get_path): Define new function.
* src/abg-reader.cc (read_context_get_path): Likewise.
* tools/abidiff.cc (set_suppressions): Set the suppression
specification derived from the --headers-dir1 option only for the first
binary, and similarly, from the --headers-dir2 option only for the
second binary.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
There are lots of spots in libabigail's source code where the argument
of the assert() call does have side effects. This is a problem
because when the code is compiled with the NDEBUG macro defined, the
assert call does nothing, so the side effects of its argument are then
suppressed, changing the behaviour of the program.
To handle this issue, this patch introduces the ABG_ASSERT macro which
is a wrapper around the assert call that enable the use of side
effects in its argument. The patch now uses that ABG_ASSERT macro
instead of using the assert call directly.
The patch also makes it so that the configure option accepts the
--disable-assert option so that the user can build libabigail with the
NDEBUG macro defined.
Tested by running the testsuite with and without the --disable-assert
option to configure.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>