At present there are discrepancies between the suppression
specification parsing code and the documented lists of properties (per
suppression type) that are consider sufficient to prevent a
suppression specification being ignored altogether.
This patch updates the documentation to match the code and adjusts
some confusing language in the documentation.
* doc/manuals/libabigail-concepts.rst: Add missing
sufficient properties for suppress_file, suppress_function and
suppress_variable. Use consistent language about what will
happen when no property in the list in provided.
Signed-off-by: Giuliano Procida <gprocida@google.com>
This is an empty test to begin with and its sole purpose for now is to
make sure abg-cxx-compat.h can be compiled on its own.
* tests/Makefile.am: Add new test case runtestcxxcompat.
* tests/test-cxx-compat.cc: New test source file.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
We only have runtest* executables that we can ignore there with this
prefix. Hence, stop adding each and every test and use an exclusion
pattern instead.
* tests/.gitignore: gitignore all files named runtest*
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
When compiling with clang, several locations in the code emit the
warning -Woverloaded-virtual. That warning is not trivial to fix. In order
to allow CXX=clang++ ABIGAIL_DEVEL=1 development, demote the warning to
not be an error when compiling with clang.
* configure.ac: set -Wno-error-overloaded-virtual for clang++
Signed-off-by: Matthias Maennich <maennich@google.com>
This patch replaces some verbose code with one-liners that rely on
std::unordered_map::operator[] to insert a missing key and return a
reference to the default-constructed inserted value.
* src/abg-reader.cc (read_context::key_type_decl): Rely on
std::unordered_map::operator[] to create map entries if they
are missing. (build_elf_symbol_db): Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
This function extracts either a string or a regex from the same input.
This patch simplifies the string vs regex conditional logic, in order
to make following patches simpler.
There are no behavioural changes.
* src/abg-suppression.cc (read_parameter_spec_from_string):
Use separate string and regex variables to simplify the
creation of returned parameter specification.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
This patch eliminates all calls to regexec except that by regex::match
itself.
There are no behavioural changes.
* src/abg-corpus-priv.h: Mechanically substitute use of
regexec with regex::match wrapper.
* src/abg-suppression-priv.h: Ditto.
* src/abg-suppression.cc: Ditto.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Each suppression specification must have at least one of a documented
per-suppression type list of properties defined if it is to be
considered at all.
At present:
- suppression specifications which fail the check are silently ignored
- in the function suppression case, the check does not trigger an
early return and risks a later null pointer dereference.
This commit:
- reimplements the checks using arrays and helper function calls
- adds a helper function to determine if a suppression specification
is going to be ignored due a lack of properties
- makes the parsing functions return failure early if the check fails
Inconsistencies between suppression types (in particular, the
treatment of the "label" property) remain.
The only behavioural change may be to how present but empty properties
are handled. This is an edge case that may be worth revisiting in a
more general fashion in a later commit.
* src/abg-suppression.cc (check_sufficient_props): New helper
function to check for sufficient properties in a section.
(read_type_suppression): Replace conditional logic with call
to check_sufficient_props.
(read_function_suppression): Ditto.
(read_variable_suppression): Ditto.
(read_file_suppression): Ditto.
* tests/data/test-diff-suppr/test15-suppr-added-fn-4.suppr:
Explain why the suppression will be ignored.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-4.suppr:
Ditto.
* tests/data/test-diff-suppr/test17-suppr-added-var-4.suppr:
Ditto.
* tests/data/test-diff-suppr/test18-suppr-removed-var-4.suppr:
Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
When running runtestabidiffexit I am getting this failure:
$ ./build/tests/runtestabidiffexit
--- /home/dodji/git/libabigail/master/tests/data/test-abidiff-exit/test-leaf-cxx-members-report.txt 2020-04-16 11:19:27.615339665 +0200
+++ /home/dodji/git/libabigail/master/build/tests/output/test-abidiff-exit/test-leaf-cxx-members-report.txt 2020-05-12 16:15:34.316685604 +0200
@@ -1,6 +1,6 @@
-Leaf changes summary: 4 artifacts changed
+Leaf changes summary: 3 artifacts changed (1 filtered out)
Changed leaf types summary: 1 leaf type changed
-Removed/Changed/Added functions summary: 1 Removed, 1 Changed, 1 Added function
+Removed/Changed/Added functions summary: 1 Removed, 0 Changed (1 filtered out), 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
1 Removed function:
@@ -13,13 +13,6 @@
[A] 'method virtual long int ops::added_fn()' {_ZN3ops8added_fnEv}
note that this adds a new entry to the vtable of struct ops
-1 function with some sub-type change:
-
- [C] 'method virtual int ops::changed_fn()' at test-leaf-cxx-members-v1.cc:5:1 has some sub-type changes:
- return type changed:
- type name changed from 'int' to 'long int'
- type size changed from 32 to 64 (in bits)
-
'struct ops at test-leaf-cxx-members-v0.cc:2:1' changed:
type size changed from 128 to 192 (in bits)
1 member function deletion:
@@ -27,10 +20,6 @@
1 member function insertion:
'method virtual long int ops::added_fn()' at test-leaf-cxx-members-v1.cc:11:1, virtual at voffset 1/1 {_ZN3ops8added_fnEv}
there are member function changes:
- 'method virtual int ops::changed_fn()' has some changes:
- return type changed:
- type name changed from 'int' to 'long int'
- type size changed from 32 to 64 (in bits)
1 data member deletion:
'int ops::deleted_var', at offset 96 (in bits) at test-leaf-cxx-members-v0.cc:5:1
1 data member insertion:
$
This is because we wrongly consider the canonical diff node for the
change on the type of function "int ops::changed_fn()" as being
suppressed. This is because of an old thinko in the suppression
categorization and propagation pass for local types changes to
functions. Oops.
Fixed thus.
* abg-comparison.cc:
(suppression_categorization_visitor::visit_end): Don't suppress
the entire class of equivalence of a function diff node if that
function diff node itself was not suppressed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch eliminates all calls to regcomp except that by
regex::compile itself.
* src/abg-corpus-priv.h: Mechanically substitute use of
regcomp with regex::compile wrapper.
* src/abg-suppression-priv.h: Ditto.
There are no behavioural changes.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
libabigail code uses the POSIX regex library consistently:
- compile std::string to regex, with the flag REG_EXTENDED
- store regex using a shared pointer wrapper
- check match of regex against std::string
All the C string / std::string logic and so on is repeated at every
call site. This patch introduces wrapper functions to take care of
this logic.
There are no behavioural changes.
* include/abg-regex.h (compile): Declare new function.
(match): Declare new function.
* src/abg-regex.cc (compile): Add new function wrapping
regcomp. (match): Add new function wrapping regexec.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
In abg-suppression.cc most of the read_*_suppression functions
populate and return a single variable "result". Others vary a little
from this, having variables "nil" or "suppr".
This patch makes all the functions use a single variable "result".
This will make the next patches a bit simpler.
There are no behavioural changes.
* src/abg-suppression.cc (read_type_suppression): Rename "nil"
variable to "result" and reset it instead of introducing
"suppr" later on. (read_function_suppression): Rename "nil"
variable to "result" and reset it instead of introducing
"result" later on.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
There is the theoretical possibility that symbols may contain special
regex characters like '.' and '$'. This patch ensures all such
characters in symbol names are escaped before they are added to the
whitelisting regex.
* include/regex.h (escape): New string reference holder
class. (operator<<): Declaration of std::ostream,
regex::escape overload.
* include/regex.cc (operator<<): New std::ostream,
regex::escape overload that outputs regex-escaped strings.
* src/abg-tools-utils.cc
(gen_suppr_spec_from_kernel_abi_whitelists): Make sure any
special regex characters in symbol names are escaped.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Following review of the change to simplify generation of symbol
whitelist regexes, this commit clarifies the purpose of the ^_^ regex
as one which will not match any string.
* src/abg-regex.cc (generate_from_strings): Document ^_^
regex.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Following review of a recent change to move regex definitions into
their own files, this commit ensures that #include directives are
separated into categories and sorted alphabetically within the
categories, subject to known ordering constraints (such as "config.h"
first, "abg-internal.h" before visibility directives etc.).
There are no behavioural changes.
* src/abg-corpus-priv.h: Separate and sort #include
directives.
* src/abg-corpus.cc: Ditto.
* src/abg-regex.cc: Ditto.
* src/abg-suppression-priv.h: Ditto.
* src/abg-suppression.cc: Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
This is for readability.
* src/abg-suppression.cc (type_suppression::suppresses_diff):
Hoist some constant expressions out of loops.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Setters should be non-const but set_drops_artifact_from_ir isn't.
This patch fixes this.
This reason this didn't cause a compilation failure is that const
shared_ptr<X> is equivalent to X *const, not const X*.
Note that resolving the apparent const-safety issue will require
std::experimental::propagate_const or similar.
* include/abg-suppression.h
(suppression_base::set_drops_artifact_from_ir):
Drop const qualifier.
* src/abg-suppression.cc
(suppression_base::set_drops_artifact_from_ir):
Drop const qualifier.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Code of the form
bool x = expression ? true : false;
can be written more concisely as
bool x = expression;
This patch does this. There are no occurences of "? false : true".
* src/abg-corpus.cc (corpus::priv::build_unreferenced_symbols_tables):
Eliminate redundant conditional operator.
* src/abg-dwarf-reader.cc (build_reference_type): Ditto.
* src/abg-reader.cc (read_static): Ditto.
(read_is_artificial): Ditto. (build_function_parameter):
Ditto. (build_function_decl): Ditto.
(build_qualified_type_decl): Ditto.
(build_reference_type_def): Ditto.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
This patch removes some excess blank lines and a space after the
prefix ++ operator.
* src/abg-suppression.cc: Eliminate double blank lines.
(read_parameter_spec_from_string): Eliminate space between
++ operator and its operand.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
By sorting the corpora output, we achieve determinism for the emitted
XML file across multiple runs of abidw.
For that to happen, change the collection of translation units to a
std::set (instead of std::vector), sorted by absolute path name.
Test data needed adjustments, but changes are fully compatible.
* include/abg-fwd.h: remove translation_units fwd declaration.
* include/abg-ir.h (struct shared_translation_unit_comparator):
Define new class.
(translation_units): Define new typedef.
* src/abg-corpus.cc (corpus::add): do checked insert into the
translation_units set (rather than vector::push_back)
* tests/data/test-annotate/test13-pr18894.so.abi: Adjust test data.
* 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: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Reorder the test definition to first start expensive tests and later on
start tests with short runtime. This optimizes the 'make check' runtime
by starting the tests on the critical path.
* tests/Makefile.am(TESTS): split up in expensive and non
expensive tests, sort the expensive ones by runime, the cheap
ones alphabetically
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Commit a9f5fb4089 ("Add --no-write-default-sizes option.") introduced
a new test variant for test-types-stability that is actually independent
of the original test case in terms of execution. Hence it can be
expressed as a separate test case. So, do that by parametrizing the
test_task struct with a new no_default_sizes flag and schedule a
separate test case in the main loop.
That test runs now ~twice as fast dropping from roughly 20s on my
machine to 10s. That effectively removes it from the critical path of
make check, which is now back to about 15s on my machine with my
configuration.
* tests/test-types-stability.cc (test_task): add field no_default_sizes
(test_task::perform) Switch on the new flag to test a different
behaviour.
(main): Schedule an additional test case to test with the new flag.
Cc: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
G++ 4.8.5 doesn't allow a function template specialization to appear
in a namespace that is different from the namespace where the function
template was declared. Also, in that namespace, the name of the
specialized function template must be non-fully-qualified.
Fixed thus.
* include/abg-libxml-utils.h (build_sptr<xmlTextReader>): Wrap
this specialization in the namespace sptr_utils and do away with
the sptr_utils qualifier.
* include/abg-regex.h (build_sptr<regex_t>): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The code to build the symbol whitelist regex uses things like seekp
and tellp to generate regexes like "^foo$|^bar$".
This patch simplifies the code, for further enhancement, resulting in
generated regexes like "^(foo|bar)$".
There should be no change in behaviour, unless whitelisted symbol
names contain special regex characters.
* include/abg-regex.h (generate_from_strings): Declare new
function to build a regex from some strings, representing a
membership test.
* src/abg-regex.cc (generate_from_strings): Implement new
function to build a regex from some strings, representing a
membership test, in a straightfoward fashion.
* src/abg-tools-utils.cc
(gen_suppr_spec_from_kernel_abi_whitelists): Replace
regex-building code with a call to generate_from_strings.
* tests/test-kmi-whitelist.cc: Update regexes in test.
Signed-off-by: Giuliano Procida <gprocida@google.com>
The header file abg-sptr-utils.h contains generic things relating to
shared pointers. It also contains shared pointer typedefs (in the
sptr_utils namespace) and template specialisations for XML types.
The last of these more naturally belong in abg-libxml-utils.h (and in
the xml namespace). This patch moves them.
There are no behavioural changes.
* include/abg-sptr-utils.h: Remove reader_sptr and
xml_char_sptr typedefs, from namespace
sptr_utils. (build_sptr): Remove corresponding template
function specialisations for these types.
* include/abg-libxml-utils.h: Add reader_sptr and
xml_char_sptr typedefs, to namespace xml. (build_sptr): Add
corresponding template function specialisations for these
types.
Signed-off-by: Giuliano Procida <gprocida@google.com>
As a prelude to adding wrapper and helper functions for regex
functionality, it makes sense to move the existing regex code (the
shared pointer type and its specialised deleter) to their own files.
This patch does this and also moves various entities into a new
namespace, abigail::regex. It removes the file abg-sptr-utils.cc which
only contained regex things.
There are no behavioural changes.
* include/Makefile.am: Add abg-regex.h.
* src/Makefile.am: Remove abg-sptr-utils.h, add abg-regex.cc
* include/abg-sptr-utils.h (regex_t_sptr): Remove this
typedef, from namespace abigail::sptr_utils.
(regex_t_deleter): Remove this struct, from namespace
abigail::sptr_utils. (build_sptr): Remove these template
specialisations, in duplicate, for regex_t_sptr.
* include/abg-regex.h: New file, introduces namespace
abigail::regex. (regex_t_sptr): Add this typedef, to namespace
abigail::regex. (regex_t_deleter): Add this struct, to
namespace abigail::regex. (build_sptr): Add these template
specialisations for regex_t_sptr
* src/abg-sptr-utils.cc: Remove this file.
* src/abg-regex.cc: Add new file with contents effectively
the same as abg-sptr-utils.cc.
* src/abg-corpus-priv.h: Update regex_t_sptr namespace
qualification.
* src/abg-corpus.cc: Ditto.
* src/abg-suppression-priv.h: Ditto.
* src/abg-suppression.cc: Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
abidw will write out the exact same size-in-bits address for every
pointer type, reference type, function declaration and function type
even though it is always the same as the translation unit address
size. When giving the --no-write-default-sizes option these aren't
written out anymore. The reader is updated to set the default size
when none is given in the XML description.
Even though size and alignment are handled together in the reader,
default alignment is still set to zero, following commit a05384675
Note that this isn't backward compatible with older libabigail
readers, which will set the size to zero when none is given. So this
option isn't the default.
* doc/manuals/abidw.rst: Document --no-write-default-sizes.
* include/abg-writer.h (set_write_default_sizes): New function
declaration.
(set_common_options): Call set_write_default_sizes.
* src/abg-reader.cc (build_function_decl): Get default size.
(build_pointer_type_def): Likewise.
(build_reference_type_def): Likewise.
(build_function_type): Likewise.
* src/abg-writer.cc (write_context): Add m_write_default_sizes
bool.
(get_write_default_sizes): New method.
(set_write_default_sizes): Likewise.
(write_size_and_alignment): Add default size and alignment
parameters.
(set_write_default_sizes): New function.
(write_type_decl): Set default size and alignment.
(write_pointer_type_def): Likewise.
(write_reference_type_def): Likewise.
(write_function_decl): Likewise.
(write_function_type): Likewise.
(write_class_decl_opening_tag): Likewise.
(write_union_decl_opening_tag): Likewise.
* tests/test-types-stability.cc (perform): Also test --abidiff
with --no-write-default-sizes.
* tools/abidw.cc (option): Add default_sizes bool.
(parse_command_line): Parse --no-write-default-sizes.
(display_usage): Add doc string for --no-write-default-sizes.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
read_elf_symbol_binding was overloaded so that it could be called to
read either a binding or a visibility attribute. This is slightly
confusing, since another elf_symbol attribute, type, does have its own
read_elf_symbol_type. Rename the read_elf_symbol_binding that reads
the visibility to read_elf_symbol_visibility for claritiy.
* src/abg-reader.cc (read_elf_symbol_binding): Renamed to...
(read_elf_symbol_visibility): ...this.
Signed-off-by: Mark Wielaard <mark@klomp.org>
When reporting declaration-only type changes, the size is reported as
changing to or from 0, which is not correct. The declaration type is
of unknown size. This patch eliminates such size reports.
* src/abg-reporter-priv.cc (report_size_and_alignment_changes):
Filter out declaration-only / defined type size changes
unconditionally.
* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
Update test.
Signed-off-by: Giuliano Procida <gprocida@google.com>
In the case where a type change is summarised as declaration-only to
defined or vice versa, the trailing new line was missing.
* src/abg-default-reporter.cc (default_reporter::report): In
the class_or_union_diff overload, emit a new line at the end
of the declaration-only reporting path.
* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
Add missing blank lines.
Signed-off-by: Giuliano Procida <gprocida@google.com>
There were no tests exercising this reporting path. The new test is
run with --harmless as these changes are considered harmless.
* tests/data/Makefile.am: Add new test case files.
* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
New test case generating "declaration-only" output.
* tests/data/test-abidiff-exit/test-decl-struct-v0.c: Ditto.
* tests/data/test-abidiff-exit/test-decl-struct-v0.o: Ditto.
* tests/data/test-abidiff-exit/test-decl-struct-v1.c: Ditto.
* tests/data/test-abidiff-exit/test-decl-struct-v1.o: Ditto.
* tests/test-abidiff-exit.cc: Run new test case.
Signed-off-by: Giuliano Procida <gprocida@google.com>
The elf-needed list is not relevant for the exported ABI of a library
so provide an option to drop it.
* doc/manuals/abidw.rst: Document --no-elf-needed.
* include/abg-writer.h (set_write_elf_needed): New function.
(set_common_options): Call it.
* src/abg-writer.cc (write_context::m_write_elf_needed): New data
member.
(write_context::{g,s}et_write_elf_needed): Add new accessors.
(set_write_elf_needed): New function.
(write_context::write_corpus): Check write_elf_needed.
* tools/abidw.cc (options): Add write_elf_needed bool.
(display_usage): Describe --no-elf-needed.
(parse_command_line): Parse --no-elf-needed.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The function parameter names are not relevant for the (exported)
ABI. So provide an option to simply drop them from the corpus.
* doc/manuals/abidw.rst: Add documentation for --no-parameter-names.
* include/abg-writer.h (set_write_parameter_names): New function.
(set_write_parameter_names): Call it.
* src/abg-writer.cc (write_context): Add m_write_parameter_names
bool, get_write_parameter_names and set_write_parameter_names
functions.
(write_context::write_function_decl): Check write_parameter_names.
* tools/abidw.cc (options): Add write_parameter_names.
(display_usage): Describe --no-parameter-names.
(parse_command_line): Parse --no-parameter-names.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When comparing two packages, abipkgdiff potentially spawns one thread
per pair of binaries to compare. The suppression specifications
generated for the private types of the package are shared among those
threads. As some internals of the suppression specifications are
constructed lazily, that can lead do some data races when more than
two threads access one of those internals.
One effective way to handle that is to make sure each thread has its
own copy of suppression specifications.
That's what this patch does.
* tools/abipkgdiff.cc (compare_args::private_types_suppr{1,2}):
Make these data member *not* be a reference anymore.
(maybe_create_private_types_suppressions): Rename this into ...
(create_private_types_suppressions): ... this. Also, make this
function return a copy of the vector of suppression specifications
for private types created.
(compare_prepared_userspace_packages): Use the new
create_private_types_suppressions to create a copy of private
types suppression specifications, rather than sharing it from
package::private_types_suppressions_.
(extract_package_and_map_its_content): Adjust to avoid creating
the shared suppression specifications for private types.
(package::private_types_suppressions_): Remove this data member
that was holding the shared suppressions for private types.
(package::private_types_suppressions): Remove these accessors.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The property name "reached_through" should have been
"accessed_through" and the property value "reference_or_pointer"
should have been "reference-or-pointer".
This patch fixes these issues.
* tests/data/test-diff-suppr/test24-soname-suppr-0.txt: Fix
typo, change "reached_through" to "accessed_through".
* tests/data/test-diff-suppr/test24-soname-suppr-1.txt: Ditto.
* tests/data/test-diff-suppr/test24-soname-suppr-2.txt: Ditto.
* tests/data/test-diff-suppr/test24-soname-suppr-3.txt: Ditto.
* tests/data/test-diff-suppr/test24-soname-suppr-4.txt: Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Bad regexes are silently ignored. This will be fixed in a later
commit.
* tests/data/test-diff-suppr/test35-leaf.suppr: Fix typo in
regex, "*." -> ".*".
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Move maybe_adjust_et_rel_sym_addr_to_abs_addr to the elf-helpers.
This function had two overloads
GElf_Addr
maybe_adjust_et_rel_sym_addr_to_abs_addr(GElf_Addr addr, Elf_Scn *section);
GElf_Addr
maybe_adjust_et_rel_sym_addr_to_abs_addr(GElf_Sym *sym);
The former one is only ever called by the latter. Hence consolidate them
into
GElf_Addr
maybe_adjust_et_rel_sym_addr_to_abs_addr(Elf* elf_handle, GElf_Sym* sym);
to combine their functionality and preserve the outer interface. We
just add the Elf* handle argument as usual as we are out of
read_context now.
* src/abg-dwarf-reader.cc
(maybe_adjust_et_rel_sym_addr_to_abs_addr)
(drop the wrapped overload completely): Move out functions.
* src/abg-elf-helpers.cc
(maybe_adjust_et_rel_sym_addr_to_abs_addr): New function.
* src/abg-elf-helpers.h
(maybe_adjust_et_rel_sym_addr_to_abs_addr): New function
declaration.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This change migrates all ELF helpers related to section lookup to
abg-elf-helpers.{cc,h}. It also homogenizes the interface of those to
always return Elf_Scn* and NULL in case that section can't be found.
Though this smells like a functional change, this latter change is
purely cosmetic.
* src/abg-dwarf-reader.cc (read_context::{opd_section_,
ksymtab_section_, ksymtab_reloc_section_, ksymtab_gpl_section_,
ksymtab_gpl_reloc_section_, ksymtab_strings_section_}): Make these
data members mutable as they are set by their getter member
functions, as an implementation detail.
(read_context::find_symbol_table_section):
adjust to new interface of elf_helpers::find_symbol_table_section.
(find_opd_section): use elf_helpers::find_opd_section for lookup.
(find_ksymtab_section): use elf_helpers::find_ksymtab_section.
(find_ksymtab_gpl_section): use elf_helpers::find_ksymtab_gpl_section.
(find_relocation_section): Move out function.
(get_binary_load_address): Move out function.
(find_ksymtab_reloc_section): use elf_helpers::find_relocation_section
(find_ksymtab_gpl_reloc_section): use
elf_helpers::find_relocation_section
* src/elf-helpers.cc (find_symbol_table_section): change
interface to match other find_*_section functions.
(find_symbol_table_section_index): Adjust for the new interface of
find_symbol_table_section.
(find_opd_section): New function.
(find_ksymtab_section): New function.
(find_ksymtab_gpl_section): New function.
(find_relocation_section): New function.
(get_binary_load_address): New function.
* src/elf-helpers.h (find_symbol_table_section): Change declaration.
(find_opd_section): New function declaration.
(find_ksymtab_section): New function declaration.
(find_ksymtab_gpl_section): New function declaration.
(find_relocation_section): New function declaration.
(get_binary_load_address): New function declaration.
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This consistently names the is_linux_kernel* helpers and keeps only the
copy in the elf-helpers. All users are adjusted.
* src/abg-dwarf-reader.cc
(read_context::function_symbol_is_exported): use is_linux_kernel
from elf_helpers.
(read_context::variable_is_exported): Likewise.
(read_context::get_symtab_format): Likewise.
(read_context::load_symbol_maps): Likewise.
(read_debug_info_into_corpus): Likewise.
(read_context::is_linux_kernel_binary): Drop function.
(read_context::is_linux_kernel_module): Drop function.
* src/abg-elf-helpers.cc (binary_is_linux_kernel): rename to
is_linux_kernel
(binary_is_linux_kernel_module): rename to is_linux_kernel_module
(find_ksymtab_strings_section): Adjust to function renames.
* src/abg-elf-helpers.h (binary_is_linux_kernel): rename to
is_linux_kernel
(binary_is_linux_kernel_module): rename to is_linux_kernel_module
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Move some definitions from abg-dwarf-reader to abg-elf-helpers that are
strictly only related to ELF.
* abg-dwarf-reader.cc (binary_is_linux_kernel): Move function out.
(binary_is_linux_kernel_module): Likewise.
(find_ksymtab_strings_section): Likewise.
* abg-elf-helpers.cc (binary_is_linux_kernel): Move function in.
(binary_is_linux_kernel_module): Likewise.
(find_ksymtab_strings_section): Likewise.
* abg-elf-helpers.h (binary_is_linux_kernel): Add declaration.
(binary_is_linux_kernel_module): Likewise.
(find_ksymtab_strings_section): Likewise.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
abg-elf-helpers.{h,cc} shall contain the ELF related parts of the
abg-dwarf-reader. Create the stub files, an empty unit test and hook
everything up in the make system.
* src/Makefile.am: Add new source files abg-elf-helpers.{h,cc}.
* src/abg-elf-helpers.cc: New source file.
* src/abg-elf-helpers.h: New header file.
* tests/.gitignore: Exclude runtestelfhelpers from being committed.
* tests/Makefile.am: Add new test case runtestelfhelpers.
* tests/test-elf-helpers.cc: New test source file.
Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Parallelize test execution for diff-suppr test by using abigail's multi
threaded worker queue. To accomplish that, follow a similar pattern like
other tests: Add a test_task struct with some precomputed values and
chunk up the work in main().
The test cases needed to be adjusted to allow parallel execution. In
particular the output files can't be shared anymore. To ensure this, a
small tests has been added that checks for unique output paths.
Finally, one redundant test case has been dropped.
This reduces the test time on my machine from ~31s to ~14s. There are
still two test cases that dominate the overall runtime. Since this test
is on the critical path for 'distcheck' (it is the test with the longest
runtime), this is effectively chopped off the overal make distcheck
time.
* tests/test-diff-suppr.cc(main): parallelize test execution.
(test_task) new abigail::workers::task implementation to run
test cases in this test as separate worker tasks.
Signed-off-by: Matthias Maennich <maennich@google.com>
For the update of fun_syms_, undefined_fun_syms_, var_syms_,
undefined_var_syms_, there is a pattern in
read_context::load_symbol_maps_from_symtab_section that can be
simplified: We try to find the correct entry and keep the iterator. If
we do not find it, we construct the value vector, find it again and
update the iterator. Eventually we push_back the symbol. That can be
simplified to looking up the value with operator[], which either returns
the existing value or default constructs it. The reference returned is
good for the push_back in any case.
* src/abg-dwarf-reader.cc
(read_context::load_symbol_maps_from_symtab_section): simplify
symbol map update for fun_syms_, undefined_fun_syms_, var_syms_,
undefined_var_syms_.
Signed-off-by: Matthias Maennich <maennich@google.com>
The default compression flag defined by automake via GZIP_ENV is --best.
That is pretty expensive for when you just want to make sure your change
is done properly to pass 'make distcheck'.
Hence add a convenience target 'make distcheck-fast' that sets GZIP_ENV
to --fast and runs distcheck with that.
On my machine, this almost cuts the 'make distcheck' time in half:
distcheck 4min 40s
distcheck-fast 2min 32s
This is not invasive as it does not change the existing distcheck
target.
* Makefile.am: add distcheck-fast make target
Signed-off-by: Matthias Maennich <maennich@google.com>