While building on an 32 bit intel platform, compilation of
abipkgdiff.cc failed because fts.h wouldn't compile with
the macro _FILE_OFFSET_BITS set to 64. That macro is set by config.h!
The idea of this patch is to make config.h have an effect only on
libabigail's own header files, not on system header files.
* tools/abipkgdiff.cc: Include config.h after system headers and
before libabigail's headers.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Up until now, the --no-show-locs option only had effect when abidiff
was used with the --abidiff option. It had no effect on the ABIXML
output of abidw.
This patch changes that to make it so that --no-show-locs avoids
emitting source location to the ABIXML output.
* doc/manuals/abidw.rst: Update the documentation.
* tests/test-annotate.cc: Now that --no-show-locs has an effect on
the ABIXML output, let's not use it here, because it changes the
output and we don't want that.
* tools/abidw.cc (display_usage): Fix a typo in the help string.
(load_corpus_and_write_abixml): Set the "show-locs" option to the
write_context object that we use.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Up to know, it wasn't possible to set options to instances of
xml_writer::write_context. So it wasn't possible to, say, make abidw
stop emitting source locations in the abixml.
This patch does the work necessary to set two options: annotate and
show locations. Note that the patch doesn't yet enable abidw to stop
emitting source locations. That will be done in a subsequent patch.
* include/abg-writer.h (create_write_context, set_show_locs)
(set_annotate): Declare new functions.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context.
* src/abg-writer.cc (write_context::m_show_locs): New data member.
(write_context::write_context): Initialize it.
(write_context::{get_show_locs, set_show_locs}): Add new member
functions.
(write_location): Take a write_context, rather than an output
stream. From the context, we detect if the user did set the "show
loc" option and act accordingly. Write the second overload in
terms of the first one.
(create_write_context, set_show_locs, set_annotate): Define new
functions.
(write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_array_type_def, write_enum_type_decl, write_typedef_decl)
(write_var_decl, write_function_decl)
(write_class_decl_opening_tag, write_union_decl_opening_tag)
(write_type_tparameter, write_non_type_tparameter)
(write_function_tdecl, write_class_tdecl): Adjust the invocation
of write_location.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context. Adjust.
* tools/abidw.c: (load_corpus_and_write_abixml): Create a
write_context object, set the 'annotate' option to it and use that
object to actually write out the corpus.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds a --suppressions option to fedabipkgdiff so that a
suppression specification can be applied to the comparisons performed.
* tools/fedabipkgdiff (abipkgdiff): If a suppression file was
provided, pass it to the underlying abipkgdiff tool.
(build_commandline_args_parser): Parse the new --suppressions
option.
* docs/manuals/fedabipkgdiff.rst: Add documentation for the new
--suppressions option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Handling an exception in fedabipkgdiff requires that the global_config
object is set because we reference some if its data members.
This patch avoids requiring the global_config object so that users can
still be aware of the reason of the exception when that object is not
yet set.
* tools/fedabipkgdiff: When handling an exception, if the
global_config object is not yet set then just let the exception
through.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/abipkgdiff.cc (compare): In the overload of elf_file, fix
a mis-indentation pointed out by a GCC 7.2.1 warning.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
kmidiff displays leaf changes by default and and it does so by *not*
showing impacted interfaces.
This patch add a --impacted-changes option to kmidiff so that it shows
the interfaces that are impacted by each leaf change. Thus, by
default, no impacted interface is shown.
* doc/manuals/kmidiff.rst: Document the new --impacted-changes
option.
* tools/kmidif.cc (options::show_impacted_interfaces): Add new
data member.
(options::options): Initialize the new data member to false.
(display_usage): Add a description string for the new
--impacted-changes option.
(parse_command_line): Parse the new --impacted-changes option.
(set_diff_context): Update the 'show-impacted-interface' property
accordingly.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch changes the default report emitted by kmidiff. Now, it
emits a leaf changes report by default. And if the user wants the
classical kind of report then she can use the --full-impact option.
* doc/manuals/kmidiff.rst: Add documentation for the new
--full-impact|-f option.
* tools/kmidiff.cc (options::leaf_changes_only): Add new data
member.
(option::option): Initialize the new data member.
(display_usage): Add a documentation string for the new
--full-impact|-f option.
(parse_command_line): Parse the new --full-impact|-f option.
(set_diff_context): Set the diff context appropriately.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds the --leaf-changes-only option to abipkgdiff, just
like what we have for abidiff. The patch also emit leaf changes
report by default when comparing two Linux Kernel packages.
The patch also adds the --impacted-interfaces and --full-impact
options.
* doc/manuals/abipkgdiff.rst: Add documentation for the new
--leaf-change-only, --impacted-interfaces and --full-impact
options.
* tools/abipkgdiff.cc (options::{leaf_changes_only,
show_impacted_interfaces, show_full_impact_report): Add new data
members.
(options::options): Initialize them.
(display_usage): Add help strings for the new --leaf-change-only,
--impacted-interfaces and --full-impact|-f options.
(set_diff_context_from_opts): Set the diff context for the
'leaf-changes-only' and 'show-impacted-interfaces' flags.
(parse_command_line): Parse the --leaf-change-only,
--impacted-interfaces and --full-impact options. Handle the case
where the --linux-kernel-abi-whitelist|-w option is given a
whitelist *package*.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
New test output reference.
* tests/test-diff-pkg.cc (in_out_spec): Compare
data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm and
data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm with the
new --leaf-changes-only and --impacted-interfaces options, using
the new output reference above.
* tests/data/Makefile.am: Add the new test material to source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch allows abidiff to take the --leaf-changes-only option and
then to display only the changes that are local to any given type.
That means the reporting agent won't follow pointers when displaying
changes. That gives less context to the ABI change reports but then
they are less cluttered.
To do this, the patch introduces a new reporting agent to libabigail:
abigail::comparison::leaf_reporter. When given a graph of diff nodes,
this agent only reports about the leaf (local) changes. That is, it
will *NOT* follow pointers, references, underlying types of qualified
and typedef types and things like that. It will just report about
changes that are local to a given type.
This reporting agent is then used (in lieu of the default
abigail::comparison::default_reporter agent) when the
--leaf-changes-only option is provided by the user on the command line
of abidiff.
Note that abidiff also takes the --impacted-interfaces option to so
that the leaf reporter shows the set of interfaces impacted
by each leaf change.
* doc/manuals/abidiff.rst: Add documentation the new
--leaf-changes-only and --impacted-interfaces options.
* src/abg-leaf-reporter.cc: New file.
* src/Makefile.am: Add the new src/abg-leaf-reporter.cc file to
source distribution.
* include/abg-fwd.h (get_var_size_in_bits)
(function_decl_is_less_than): Declare new functions.
(get_name): Add new overload for type_or_decl_base*.
* include/abg-ir.h (struct type_or_decl_hash, type_or_decl_equal)
(type_or_decl_base_comp): Define new types.
(artifact_sptr_set_type, artifact_ptr_set_type): Define new
typedefs.
* include/abg-comp-filter.h: Update copyright year.
(has_basic_type_name_change): Add new function declaration.
* src/abg-comp-filter.cc (decl_name_changed): Take a
type_or_decl_base rather than just a decl. Add an overload for
diff*.
(has_basic_type_name_change): Define new function.
* include/abg-comparison.h: Update copyright year.
(string_diff_ptr_map): Define this new typedef.
(class diff_maps): Define this new class.
(diff_context::{set_corpora}): Remove this member function.
(diff_context::{set_corpus_diff, get_corpus_diff,
show_leaf_changes_only, show_impacted_interfaces,
forbid_visiting_a_node_twice_per_interface}): Declare these new
member functions.
(diff_node_visitor::priv_): Add a new pimpl data member.
(diff_node_visitor::{diff_node_visitor, get_visiting_kind,
set_visiting_kind}): Turn these into out-of-line member functions.
(diff_node_visitor::{set,get}_current_topmost_iface_diff): Add new
member functions.
(class {scope_diff, function_type_diff, corpus_diff}): Add class
leaf_reporter as a friend.
(corpus_diff::mark_leaf_diff_nodes, get_leaf_diffs): Declare new
member functions.
(diff::{visiting_a_node_twice_is_forbidden_per_interface,
parent_interface_node}): Define new member functions.
(is_diff_of_basic_type): Return a type_decl_diff* rather than just
a bool.
(is_enum_diff, is_array_diff, is_function_type, is_typedef_diff)
(is_corpus_diff): Declare new functions.
(corpus_diff::diff_stats::{num_leaf_changes,
num_leaf_changes_filtered_out, net_num_leaf_changes}): Add new
member functions.
(is_distinct_diff): Declare new function.
* include/abg-reporter.h: Forward-declare "class diff_maps".
(reporter_base::diff_to_be_reported): Declare a new virtual member
function.
(reporter_base::{report_local_typedef_changes,
report_local_reference_type_changes,
report_local_function_type_changes}): Declare new member
functions.
(class leaf_reporter): Define new type.
* src/abg-comparison-priv.h (struct diff_hash, diff_equal): Define
new types.
(diff_artifact_set_map_type): Define new typedef.
(diff_context::priv::{first_corpus_, second_corpus_}): Remove
these data members.
(diff_context::priv::{corpus_diff_, leaf_changes_only_,
reset_visited_diffs_for_each_interface_,
show_impacted_interfaces_}): Add new data members.
(diff_context::priv::priv): Adjust.
(corpus_diff::priv::{leaf_diffs_, parent_interface_}): Add new
data member.
(corpus_diff::diff_stats::priv::{num_leaf_changes,
num_leaf_changes_filtered_out}): Add new data members.
(corpus_diff::priv::count_leaf_changes): Define new member
function.
(sort_artifacts_set, get_fn_decl_or_var_decl_diff_ancestor)
(is_diff_of_global_decls): Declare new functions.
(function_comp::operator()): Factorize this out into the new
function abigail::ir::function_decl_is_less_than.
* src/abg-ir.cc (get_var_size_in_bits)
(function_decl_is_less_than): Define new functions.
(get_name): Define new overload for type_or_decl_base*.
* src/abg-comparison.cc (is_enum_diff, is_typedef_diff)
(is_array_diff, is_function_type_diff, is_corpus_diff)
(is_distinct_diff, sort_artifacts_set, is_diff_of_global_decls):
Define new functions.
(is_union_diff): Fix comment.
(diff_context::forbid_visiting_a_node_twice_per_interface): Define
new member functions.
(diff_context::set_corpus_diff, get_corpus_diff)
(diff_context::show_leaf_changes_only)
(diff_context::visiting_a_node_twice_is_forbidden_per_interface)
(diff_context::show_impacted_interfaces): Define new member
functions.
(diff_context::get_reporter): Create the reporter that matches
what diff_context::show_leaf_changes_only says.
(diff_node_visitor::priv): Define a new type.
(diff_node_visitor::{diff_node_visitor, get_visiting_kind,
set_visiting_kind, or_visiting_kind,
set_current_topmost_iface_diff, get_current_topmost_iface_diff}):
Define new out-of-line member functions.
(struct diff_maps::priv): Define new type.
(diff_maps::{diff_maps, get_type_decl_diff_map,
get_type_decl_diff_map, get_enum_diff_map, get_class_diff_map,
get_union_diff_map, get_typedef_diff_map, get_array_diff_map,
get_function_type_diff_map, get_function_decl_diff_map,
get_var_decl_diff_map, get_reference_diff_map,
get_fn_parm_diff_map, get_distinct_diff_map, insert_diff_node,
lookup_impacted_interfaces}): Define member functions.
(corpus_diff::{mark_leaf_diff_nodes, get_leaf_diffs}): Define new
member functions.
(struct leaf_diff_node_marker_visitor): Define new type.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Mark diff nodes in here.
(corpus_diff::traverse): Appropriately set the current topmost
interface into the visitor before visiting a diff node.
(compute_diff): In the overload for corpus_sptr, adjust to reflect
that we are now storing the corpus_diff in the diff context.
(is_diff_of_basic_type): Return a type_decl_diff*, not just a
bool.
(corpus_diff::priv::count_leaf_changes): Define a new member
function.
(corpus_diff::diff_stats::{num_leaf_changes,
num_leaf_changes_filtered_out, net_num_leaf_changes}): Define new
member functions.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Use the
new corpus_diff::priv::count_leaf_changes to compute the number of
leaf changes.
(corpus_diff::priv::emit_diff_stats): Emit the report about leaf
type changes when necessary.
* src/abg-reporter-priv.h (report_mem_header): Declare new
overload.
(maybe_show_relative_offset_change,): Pass the var_diff_sptr
parameter by const reference.
(represent): Pass the var_diff_sptr parameter by const reference
and take a new "local-only" flag.
(maybe_show_relative_size_change)
(maybe_report_interfaces_impacted_by_diff): Declare new functions.
* src/abg-default-reporter.cc: Adjust copyright year.
(default_reporter::{report_local_typedef_changes,
report_local_qualified_type_changes,
report_local_reference_type_changes,
report_local_function_type_changes}): Define new member functions.
(default_reporter::report): Adjust. Add an overload for
function_type_diff&. In the overload for qualified_type_diff, if
the name of the underlying type changed, do not detail the changes
any further. In the overload for function_decl_diff, Adjust to
use the new diff_context::get_{first, second}_corpus member
function. In the overload for enum_diff, call the new
maybe_report_interfaces_impacted_by_diff that is advertised below.
* src/abg-reporter-priv.cc (represent): Adjust the overload for
var_diff_sptr.
(report_mem_header): Define new overload.
(maybe_show_relative_size_change)
(maybe_report_interfaces_impacted_by_diff): Define new functions.
(reporter_base::diff_to_be_reported): Define new member function.
(maybe_show_relative_offset_change): Pass the var_diff_sptr
parameter by const reference.
(represent): In the overload for var_diff_sptr, pass the
var_diff_sptr parameter by reference. Take a 'local_only' flag.
Iisplay type changes only if we are not displaying "local changes
only". Display size changes of data members too, when in
"local-only" mode.
* src/abg-suppression.cc (sonames_of_binaries_match)
(names_of_binaries_match): Adjust.
* tools/abidiff.cc (options::{leaf_changes_only,
show_impacted_interfaces}): Add new data members.
(display_usage): Emit usage string for the new --leaf-changes-only
and --impacted-interfaces options.
(parse_command_line): Parse the new --leaf-changes-only and the
--impacted-interfaces options.
(set_diff_context_from_opts): Set the 'show-leaf-changes' and the
'show-impacted-interfaces' flags.
* tests/data/test-diff-filter/libtest42-leaf-report-v{0,1}.so: New
test input.
* tests/data/test-diff-filter/test42-leaf-report-output-0.txt: New
test reference output.
* tests/data/test-diff-filter/test42-leaf-report-v{0,1}.cc: Source
code of the new test inputs.
* tests/test-diff-filter.cc (in_out_specs): Use the new test
inputs above in this harness.
* tests/data/test-diff-suppr/libtest35-leaf-v0.so: New test input.
* tests/data/test-diff-suppr/test35-leaf-report-0.txt: New test
reference output.
* tests/data/test-diff-suppr/test35-leaf-v{0,1}.cc: Source code of
the new test inputs.
* tests/data/test-diff-suppr/test35-leaf.suppr: Suppression
specification to use for the test35 test.
* tests/data/test-diff-suppr/libtest36-leaf-v0.so: New test input.
* tests/data/test-diff-suppr/libtest36-leaf-v1.so: Likewise.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: New
reference test output.
* tests/data/test-diff-suppr/test36-leaf-v0.cc: Source code of
test input above.
* tests/data/test-diff-suppr/test36-leaf-v1.cc: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Use the new test inputs
above in this harness.
* tests/data/Makefile.am: Add the new test inputs above to source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch initializes the annotate state flag in abidw. Oops.
* tools/abidw.cc (options::options): Initialize the annotate data
member.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is the initial patch that makes abipkgdiff recognize Linux kernel
packages passed in argument and do the right thing.
abipkgdiff gets the vmlinux binary from the debug info package,
considers the union of that vmlinux binary and the thousands of kernel
modules that we shall name "the Kernel". It then compares ABI
(actually Kernel/Module Interface, a.k.a KMI) of the Kernel of the
first package against the KMI of the Kernel of the second package.
* include/abg-tools-utils.h (get_vmlinux_path_from_kernel_dist):
Declare new function.
(get_binary_paths_from_kernel_dist): Re-organize order of
parameters.
(file_is_kernel_package, file_is_kernel_debuginfo_package): Make
the file_path parameter be const.
(build_corpus_group_from_kernel_dist_under): Take an additional
debug_info_root parameter.
* src/abg-tools-utils.cc (file_is_kernel_package)
(file_is_kernel_debuginfo_package): Const-ify the file_name
parameter.
(find_vmlinux_path): Define new static function.
(get_binary_paths_from_kernel_dist): Re-organize the order of
parameters. The debug_info_root_path parameter is now an input
parameter.
(get_vmlinux_path_from_kernel_dist): Define new function.
(get_binary_paths_from_kernel_dist): Adjust invocation of
get_binary_paths_from_kernel_dist.
(build_corpus_group_from_kernel_dist_under): Take an additional
debug_info_root parameter.
* tools/abidw.cc (load_kernel_corpus_group_and_write_abixml):
Adjust invocation to build_corpus_group_from_kernel_dist_under.
* tools/abipkgdiff.cc (create_maps_of_package_content): Don't map
the content of a Linux Kernel package.
(compare_prepared_userspace_packages)
(compare_prepared_linux_kernel_packages, compare_prepared): Define
new functions.
(compare): Use the new functions above here.
* tools/kmidiff.cc (print_kernel_dist_binary_paths_under): Adjust
the invocation of get_binary_paths_from_kernel_dist.
(main): Adjust the invocation of
build_corpus_group_from_kernel_dist_under. Make sure that a
kernel package is accompanied by a debug info package.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The user should be able to specify one white list package per kernel
package on the command line. That means the user should be able to
say:
--wp whitelist-pkg1 --wp whitelist-pkg2
on the command line.
This patch adds support for that.
* doc/manuals/abipkgdiff.rst: Update the documentation to say that
--wp can be provided twice, but not more than that.
* tools/abipkgdiff.cc (options::kabi_whitelist_packages): Rename
kabi_whitelist_package to this, and make be of vector<string>
type.
(package::erase_extraction_directories): Erase the white list
package extracted data.
(maybe_handle_kabi_whitelist_pkg, parse_command_line): Adjust.
(main): Make sure there is no more than 2 --wp on the command
line. Associate a white list package to each kernel package on
the command line.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The package passed to the --wp option was not found because we were
not considering the absolute path of that package. Fixed thus.
* tools/abipkgdiff.cc (parse_command_line): Consider the absolute
path of the package given in argument to --wp.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Make these short options be shorter.
* doc/manuals/abipkgdiff.rst: Adjust the documentation.
* tools/abipkgdiff.cc (display_usage): Adjust the usage string.
(parse_command_line): Parse -w instead of --lkaw and --wp
insteadof --lkaw-pkg.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When abipkgdiff compares binaries of a package, it doesn't report
errors like debug info or symbol not found.
This patch fixes that.
* include/abg-dwarf-reader.h (status_to_diagnostic_string):
Declare new function.
* src/abg-dwarf-reader.cc (status_to_diagnostic_string): Define
new function.
* tools/abipkgdiff.cc (compare): Take a new detailed_error_status
parameter.
(compare_task::perform): Get the details of the error, in case the
status of the comparison is ABIDIFF_ERROR.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When using abidw to generate an abixml for a Linux Kernel build tree,
usually, people have to copy the vmlinux binary into the directory
where modules are, so that the tool can find it. This --vmlinux
option helps to avoid doing that copy.
Simarly, when comparing two Linux Kernel build trees, --vmlinux1 and
--vmlinux2 are there to make the tool find the vmlinux binaries to
compare, independantly from the directories under which the modules
are to be found.
* include/abg-tools-utils.h
(build_corpus_group_from_kernel_dist_under): Add a new
vmlinux_path parameter.
* src/abg-tools-utils.cc (find_vmlinux_and_module_paths): Do not
try to find a vmlinux binary if we already have the path to one.
(build_corpus_group_from_kernel_dist_under): Add a new
vmlinux_path parameter.
* tools/abidw.cc (options::vmlinux): New data member.
(display_usage): Add a usage string for --vmlinux
(parse_command_line): Parse the new --vmlinux option.
(load_kernel_corpus_group_and_write_abixml): Fix some return code
when the function fails. Verify the presence of the vmlinux
binary that was given. Adjust.
* tools/kmidiff.cc (options::{vmlinux1, vmlinux2}): New data
members.
(display_usage): Add a usage string for --vmlinux1 and --vmlinux2.
(parse_command_line): Parse the --vmlinux1 and --vmlinux2
options.
(main): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When a class is forward-declared, resolving it to a definition that
appears later in the same translation unit or in another translation
is an interesting problem.
Until now, the declaration would be resolved to the definition of that
class found in the binary. The problem is that there can be different
such definitions, especially in C where there is no "One Definition
Rule". In that case, the definition chosen is random.
This patch resolves that randomness.
For a given class declaration, if there is just one possible
definition in the binary, then the declaration is resolved to that
definition. If there is one definition for that declaration in the
same translation unit, then the declaration is resolved to that
definition. If there are more than one definitions in translation
units that are not the one of the declaration, then the declaration is
left unresolved. This is what I call "selective class declaration resolution".
Note that an unresolved class declaration now compares different to a
definition of a class of the same name. This is so that we can have
an unresolved class be present in the resulting .abi file, alongside
an (incompatible) definition of the same class. The change from a class
declaration to its definition is filtered out by default, though.
* include/abg-fwd.h (type_base_wptrs_type)
(istring_type_base_wptrs_map_type): Define new typedefs.
(lookup_class_types): Declare new functions.
* include/abg-ir.h
(environment::decl_only_class_equals_definition): Declare new
accessor.
(type_maps::{*_types}): Make these accessors return
istring_type_base_wptrs_map_type& instead of
istring_type_base_wptr_map_type&.
* src/abg-dwarf-reader.cc
(read_context::resolve_declaration_only_classes): Implement the
new selective declaration resolution scheme.
* src/abg-ir.cc (type_maps::priv::{*_types_}): Change the type of
these data members from istring_type_base_wptr_map_type to
istring_type_base_wptrs_map_type.
(type_maps::{*_types}): Make these accessors definitions return
istring_type_base_wptrs_map_type& instead of
istring_type_base_wptr_map_type&.
(translation_unit::bind_function_type_life_time): Adjust.
(environment::priv::decl_only_class_equals_definition_): New data
member.
(environment::priv::priv): Initialize it. By default, a decl-only
class is now considered different from its definition.
(environment::decl_only_class_equals_definition): Define new
accessor.
(lookup_types_in_map, lookup_class_types): Define new functions.
(lookup_type_in_map, lookup_union_type_per_location)
(lookup_basic_type, lookup_basic_type_per_location)
(lookup_class_type, lookup_class_type_per_location)
(lookup_union_type, lookup_enum_type)
(lookup_enum_type_per_location, lookup_typedef_type)
(lookup_typedef_type_per_location, lookup_qualified_type)
(lookup_pointer_type, lookup_reference_type, lookup_array_type)
(lookup_function_type, maybe_update_types_lookup_map)
(maybe_update_types_lookup_map<class_decl>)
(maybe_update_types_lookup_map<function_type>): Adjust.
(type_base::get_canonical_type_for): When doing type comparison
here, we can now consider that an unresolved class declaration
compares different to an incompatible class definition of the same
name. So no need to look through decl-only classes in that case.
(equals): In the overload for class_or_union, if
environment::decl_only_class_equals_definition() is false, then an
unresolved class declaration of name "N" compares different to a
class definition named "N".
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
* tests/data/test-diff-dwarf/test28-vtable-changes-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.
* tests/data/test-diff-filter/test38/Makefile: New test material.
* tests/data/test-diff-filter/test38/test38-a.c: Likewise.
* tests/data/test-diff-filter/test38/test38-b.c: Likewise.
* tests/data/test-diff-filter/test38/test38-c.c: Likewise.
* tests/data/test-diff-filter/test38/test38-report-0.txt: Likewise.
* tests/data/test-diff-filter/test38/test38-v0: Likewise.
* tests/data/test-diff-filter/test38/test38-v1: Likewise.
* tests/data/test-diff-filter/test38/test38.h: Likewise.
* tests/data/test-diff-filter/test39/Makefile: Likewise.
* tests/data/test-diff-filter/test39/test39-a-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-a-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-b-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-b-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-c-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-c-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-main.c: Likewise.
* tests/data/test-diff-filter/test39/test39-report-0.txt: Likewise.
* tests/data/test-diff-filter/test39/test39-v0: Likewise.
* tests/data/test-diff-filter/test39/test39-v1: Likewise.
* tests/data/test-diff-filter/test39/test39.h: Likewise.
* tests/data/Makefile.am: Add the new test material above to the
source distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the new test
inputs above to the test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
With this patch, kmidiff knows how to compare a serialized
corpus_group that represents a Kernel Module Interface (a .kmi file)
against either another serialized .kmi file, or against a kernel tree.
The patch extends the abixml reader to make it parse an
'abi-corpus-group' element. To do that, the patch modifies
read_corpus_from_input to make it be capable of parsing several
'abi-corpus' in a row. That modified function is then used by a new
read_corpus_group_from_input, which is itself used by the new public
entry points read_corpus_group_from_native_xml_file and
read_corpus_group_from_native_xml.
With that read_corpus_group_from_native_xml_file building block
function, the kmidiff program is modified so that it can take either
two directory trees, two .kmi files or one directory tree and one .kmi
file.
* include/abg-libxml-utils.h (advance_to_next_sibling_element):
Declare new function.
* src/abg-libxml-utils.cc (go_to_next_sibling_element_or_stay)
(advance_to_next_sibling_element): Define new functions.
* include/abg-reader.h (read_corpus_group_from_input)
(read_corpus_group_from_native_xml)
(read_corpus_group_from_native_xml_file): Declare new functions.
* src/abg-reader.cc (read_context::m_corpus_group): New data
member.
(read_context::{get_corpus_group, set_corpus_group}): Define new
member functions.
(read_translation_unit_from_input): Cleanup logic.
(read_corpus_from_input): Don't assume that the document is
starting with an 'abi-corpus' element. Support the mode where a
caller called the xmlTextReaderExpand function (and so we are
given an expanded xmlNodePtr) and the mode where we need to use
the xmlTextReader API to walk through the 'abi-corpus' element.
Also, if we are building a corpus group, do not clear what used to
be 'per-corpus' data. That data must be shared by all the corpora
of a given abi-corpus-group.
(read_corpus_group_from_input, read_corpus_group_from_native_xml)
(read_corpus_group_from_native_xml_file): Define new functions.
* include/abg-tools-utils.h (FILE_TYPE_XML_CORPUS_GROUP): New
enumerator of the file_type enum.
* src/abg-tools-utils.cc (operator<<): In the overload for
file_type, add a case for the new FILE_TYPE_XML_CORPUS_GROUP.
(guess_file_type): Dectect abi-corpus-group xml element.
* tools/abidiff.cc (adjust_diff_context_for_kmidiff): Define new
static function.
(main): Adjust to handle the new FILE_TYPE_XML_CORPUS_GROUP. That
is, compare two FILE_TYPE_XML_CORPUS_GROUP if they are present.
* tools/abilint.cc (main): Likewise.
* tools/kmidiff.cc (main): Detect that one of two .kmi files are
passed. In that case, load the .kmi file(s), build a corpus_group
of it and use it in the comparison.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
We have the kmidiff program that takes two Linux Kernel trees
containing the vmlinux binary and its modules and compare their Kernel
Module Interface, aka KMI.
We need to be able to serialize (save in a file) a representation of
that KMI. We need to load that KMI back, and compare two serialized
KMIs.
This patch implements the serialization of the KMI of a Linux Kernel
tree. It actually serializes an instance of abigail::ir::corpus_group
that is a collection of instances of abigail::ir::corpus. The KMI of
each individual binary (vmlinux or kernel module) is represented by
one abigail::ir::corpus. All the corpora share the same definitions
of types and decls, whenever that makes sense.
The patch thus factorizes the routines used to walk a Linux kernel out
of the kmidiff program. These routines are then re-used in the abidw
program to make it walk a Linux kernel tree (when the --linux-tree
option is provided), load the vmlinux and module binaries as an
instance of abigail::corpus_group and serialize it out into an output
stream.
* include/abg-tools-utils.h (check_dir)
(get_binary_paths_from_kernel_dist)
(build_corpus_group_from_kernel_dist_under): Declare new
functions. The last two functions are being moved from
tools/kmidiff.cc so that they can be re-used.
* include/abg-writer.h (write_corpus): Declare one overload that
takes a write_context parameter.
(write_corpus_group): Declare three overloads of this new function.
* src/abg-tools-utils.cc (check_dir): Define new function.
(load_generate_apply_suppressions, is_vmlinux, is_kernel_module)
(find_vmlinux_and_module_paths)
(get_binary_paths_from_kernel_dist)
(build_corpus_group_from_kernel_dist_under): Define new functions.
* src/abg-writer.cc (write_context::set_annotate): Define new
member function.
(write_corpus): Add an overload that takes a write_context. Adapt
the existing overload to make it use this new one.
(write_corpus_group): Define this new function and two additional
overloads for it.
* tools/kmidiff.cc (set_suppressions, is_vmlinux)
(is_kernel_module, find_vmlinux_and_module_paths)
(get_binary_paths_from_kernel_dist)
(build_corpus_group_from_kernel_dist_under): Remove.
(main): Adjust the call to
build_corpus_group_from_kernel_dist_under as its arguments are now
adapted since it's been factorized out into abg-tools-utils.h.
* tools/abidw.cc (options::corpus_group_for_linux): Define new
data member.
(options::options): Adjust.
(display_usage): Add help strings for the new --linux-tree option.
(load_corpus_and_write_abixml): Factorize this function out of the
main function.
(load_kernel_corpus_group_and_write_abixml): Define new function.
(main): Use the factorized load_corpus_and_write_abixml and the
new load_corpus_and_write_abixml functions.
* tests/test-read-write.cc: Adjust.
* doc/manuals/abidw.rst: Add documentation for the new
--linux-tree option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
abidiff had an --linux-kernel-abi-whitelist option. Rename it
--kmi-whitelist.
* doc/manuals/abidiff.rst: Add documentation for the
--kmi-whitelist option.
* tools/abidiff.cc (display_usage): Emit help string for the
--kmi-whitelist option
(parse_command_line): Parse the new --kmi-whitelist option, of the
-w shortcut.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When writting out the ABI of a Linux kernel binary we must be able to
restrict it to the set of functions and global variables which ELF
symbols have names defined in a white list.
This patch adds that support, using the --kmi-whitelist
option.
* tools/abidw.cc (options::{kabi_whitelist_paths,
kabi_whitelist_supprs}): New data members.
(display_usage): Add a help string for the new --kmi-whitelist
option.
(parse_command_line): Parse the new --kmi-whitelist option.
(maybe_check_suppression_files): Check the presence of the linux
kernel abi white list passed by the option --kmi-whitelist.
(main): Ignore loading the symbol table if the kernel abi white
list is provided.
* doc/manuals/abidw.rst: Add documentation for the new option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch makes abipkgdiff compare two kernel packages. At the
moment the comparison is done by comparing each binary from the first
package to its counterpart in the second package. No optimization is
done do represent a vmlinux binary and its modules as one single
entity. So this is different from what kmidiff does.
* include/abg-suppression.h
(variable_suppression::variable_suppression): Add default arguments
to the parameters.
* include/abg-tools-utils.h (dir_exists, dir_is_empty)
(string_begins_with, get_rpm_name, get_rpm_arch, get_deb_name)
(file_is_kernel_package, file_is_kernel_debuginfo_package):
Declare new functions.
* src/abg-tools-utils.cc (dir_exists, dir_is_empty)
(string_begins_with, get_deb_name, get_rpm_name, get_rpm_arch)
(file_is_kernel_package, file_is_kernel_debuginfo_package): Define
new functions.
(gen_suppr_spec_from_kernel_abi_whitelist): The kernel ABI
whitelist is made of ELF symbols names that ought to match
functions *and* variables that have ELF symbols with those names.
So generate variable suppression specifications as well. Not just
function suppression specifications.
* tools/abipkgdiff.cc (options::{kabi_whitelist_package,
show_symbols_not_referenced_by_debug_info, kabi_whitelist_paths,
kabi_suppressions}): New data members.
(options::options): Adjust.
(package::KIND_KABI_WHITELISTS): New enumerator in the
package::kind enum.
(package::kabi_whitelist_package_): New data member.
(package::{base_name, kabi_whitelist_package, }): New member
functions.
(display_usage): Add a help string to the new
--linux-kernel-abi-whitelist and --no-unreferenced-symbols
options.
(parse_command_line): Parse the new --no-unreferenced-symbols,
--linux-kernel-abi-whitelist and --lkaw-pkg options.
(maybe_check_suppression_files): Check the presence of kabi
whitelist files.
(set_diff_context_from_opts): Consider (not) showing symbols not
referenced by debug info.
(compare): If we are looking at linux kernel packages, take the
kernel abi whitelist into account, apply the suppressions
resulting from the kabi whitelists to the ELF read context.
(maybe_collect_kabi_whitelists)
(get_kabi_whitelists_from_arch_under_dir)
(maybe_handle_kabi_whitelist_pkg, maybe_collect_kabi_whitelists)
(get_interesting_files_under_dir): Define new functions.
(maybe_update_vector_of_package_content): Take a new
file_name_to_look_for parameter.
(create_maps_of_package_content)
(extract_package_and_map_its_content): Consider the case of the
package being a linux kernel package.
(main): Take the potential --lkaw-pkg into account.
* doc/manuals/abipkgdiff.rst: Add documentation for options
--linux-kernel-abi-whitelist, --lkaw-pkg and
--no-unreferenced-symbols.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-dwarf-reader.h (set_read_context_corpus_group)
(read_and_add_corpus_to_group_from_elf, set_ignore_symbol_table)
(get_ignore_symbol_table): Declare new functions.
* abg-dwarf-reader.cc (read_context::options_type): Define new
type.
(die_dependant_container_set::clear): Define new member function.
(read_context::{bss, tesxt, rodata, data, data1}_section_): Add
new data members.
(read_context::{symbol_versionning_sections_loaded_,
symbol_versionning_sections_found_}): Likewise.
(read_context::corpus_group_): Likewise.
(read_context::{load_in_linux_kernel_mode, load_all_types,
show_stats, do_log_}): Replace these options by ..
(read_context::options_): ... this instance of the new
read_context:options_type.
(read_context::read_context): Adjust.
(read_context::{clear_alt_debug_info_data, clear_per_corpus_data,
env, get_data_section_for_variable_address, load_all_types,
load_in_linux_kernel_mode, show_stats, do_log}): Adjust.
(create_read_context): Adjust.
(read_context::~read_context): Define destructor.
(read_context::{options, bss_section, text_section,
rodata_section, data_section, data1_section, current_corpus_group,
has_corpus_group, main_corpus_from_current_group,
main_corpus_from_current_group,
current_corpus_is_main_corpus_from_current_group,
should_reuse_type_from_corpus_group}): Define new member
functions.
(read_context::get_die_qualified_type_name): Handle the name of
the current translation unit.
(read_context::load_symbol_maps): Really don't load (linux kernel
specific) symbol maps if we were told to ignore the ELF symbol
table.
(set_ignore_symbol_table, get_ignore_symbol_table)
(create_default_var_sym, create_default_fn_sym, add_symbol_to_map)
(set_read_context_corpus_group)
(read_and_add_corpus_to_group_from_elf): Define new functions.
(build_type_decl, build_typedef_type, build_enum_type)
(add_or_update_class_type)
(add_or_update_union_type): Reuse the type being built, from the
main corpus of the corpus group.
(build_qualified_type): Cleanup logic.
(build_var_decl, build_function_decl): Create a default symbol for
the variable or function if we are supposed to ignore the symbol
table of the current binary. Add that symbol to the symbol table
that is created in the read context.
(read_debug_info_into_corpus): Don't load the ELF symbol table
information if we are asked to ignore the symbol table. But set
the symbol table that we built artificially while loading
functions and variables, into the ABI corpus being built.
(read_context::maybe_adjust_var_sym_address): Adjust.
(build_ir_node_from_die): Add ir node to its logical scope. For
the C language, the scope of a type is the global scope.
(read_corpus_from_elf): Don't load ELF properties if we were asked
to avoid the ELF symbol table.
* include/abg-comparison.h (compute_diff): Declare ...
* src/abg-comparison.cc (compute_diff): ... an overload to compare
corpus_group.
* tools/kmidiff.cc: New tool.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The build libxcb-1.12-3.fc26 has been tagged for Fedora 27 (i.e,
fc27).
When we ask fedabipkgdiff to get the builds of libxcb for Fedora 27,
it looks for builds which release string ends with 'fc27'. It thus
fails to pick libxcb-1.12-3.fc26.
This patch changes this behaviour by making
Brew.get_package_latest_build to first try to get builds which
release string match exactly the distro string we are looking at.
But then if no build was found, the member function then tries to get
builds for which the distro part of the release string is "less than"
(in a lexicographic way) the distro string we are looking at.
I haven't added any regression test specifically for this because we
are planning to use the libabigail-selfcheck external tool to perform
regression testing on tons of Fedora packages:
https://pagure.io/libabigail-selfcheck. Fixing this issue is a
pre-requisite for putting that regression test infrastructure in
place.
* tools/fedabipkgdiff (get_distro_from_string): Define new function.
(Brew.get_package_latest_build): Also consider builds which distro
property is less than the expected distro string that we were
given.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In fedabipkgdiff tool, some packages might have only
noarch sub-packages. In these cases, no package is
available for running abipkgdiff. This leads to
return_codes list being empty.
* tools/fedabipkgdiff (run_abipkgdiff()): Check if
return_codes list is empty
Signed-off-by: Sinny Kumari <sinny@redhat.com>
When abipkgdiff decides that two packages have no content to compare
it forgets to remove the temporary directories that were created.
* tools/abipkgdiff.cc (maybe_erase_temp_dirs): Define new static
function.
(compare): Call the new maybe_erase_temp_dirs on all return
points.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
fedabipkgdiff tool can communicate with Fedora koji and has
capability to download and perform ABI comparison between
specified NVRs.
With addition of --self-compare option, it will be possible
to perform ABI comparison on same package. One of the important
usecase of this option is to run automated ABI checks on
packages with known expected result i.e. no ABI change. This usecase
will be useful to ensure that libabigail functionality doesn't
break with new commits made.
This option can be invoked as:
fedabipkgdiff -a --self-compare -fc24 package_name
* bash-completion/fedabipkgdiff: Add new option --self-compare
* tests/data/Makefile.am: Add new test file
* tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt:
New reference output for testing ABI comparison on same package
* tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS):
Add test case for --self-compare
* tools/fedabipkgdiff (build_commandline_args_parser()): Add
new option --self-compare
(generate_comparison_halves()): Find second comparision half in same
package list while doing self-compare
(self_compare_rpms_from_distro()): New function to perform ABI
comparision on same pacakge
(main()): Add if condition when --self-compare option is enabled
This updates the description of what abipkgdiff in termes of sequence
of actions.
* tools/abipkgdiff.cc: Update the description of the sequence of
actions performed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
We are seeing some random cases where the regression test
runtestfedabipkgdiff.py hangs in what seems to be a deadlock. This
seems to happen in fedabipkgidiff when it spawns a process to run
abipkgdiff. More precisely, proc.communicate() hangs.
The documentation of that function at
https://docs.python.org/2/library/subprocess.html#subprocess.Popen.communicate
says:
Note: The data read is buffered in memory, so do not use this
method if the data size is large or unlimited.
So this patch avoids using proc.communicate() because the output of
abipkgdiff *can* be large. Rather, the patch manually waits for the
the spawned abipkgdiff to finish, and then, read its output.
* tools/fedabipkgdiff (abipkgidff): Do not use Popen.communicate()
as it might hang if the data is large. Rather, busy wait for the
abipkgdiff process to finish and then get its output.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Cache data, currently containing downloaded RPM packages from Koji, is
stored in XDG_CACHE_HOME. This patch allows user to delete cache before
or after the ABI comparison, or both.
* configure.ac: Require shutil module.
* doc/manuals/fedabipkgdiff.rst: Add document for new option
clean-cache, clean-cache-before, and clean-cache-after.
* tools/fedabipkgdiff (build_commandline_args_parser): Add new
option --clean-cache, --clean-cache-before and
--clean-cache-after.
(diff_local_rpm_with_latest_rpm_from_koji): Delete download
cache directory before or after downloading RPMs.
(diff_latest_rpms_based_on_distros): Likewise.
(diff_two_nvras_from_koji): Likewise.
(diff_from_two_rpm_files): Likewise.
* bash-completion/fedabipkgdiff: Add new options.
* tests/mockfedabipkgdiff.in (get_download_dir): Rewrite to
behave just like the original get_download_dir.
(mock_get_download_dir): Removed.
(DOWNLOAD_CACHE_DIR): New global variable pointing directory
holding packages during tests.
(run_fedabipkgdiff): Mock original get_download_dir with the
rewrite get_download_dir.
* tests/runtestfedabipkgdiff.py.in (run_fedabipkgdiff_tests):
Add --clean-cache to run tests to ensure no regression.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
With this patch, the code of abipkgdiff.cc doesn't use the pthreads
API directly anymore. Rather, it uses the higher level "Workers
Queue" API provided by the abigail::workers namespace.
The main benefits are:
- better code readability and maintainability. The code base doesn't
have any global variable anymore. This is going to be helpful when
adding new features to the abipkgdiff.cc code base.
- faster code. The tests/runtestdiffpkg test program executes on ~
17s without the patch, and on ~ 11s with the patch on my old X220
laptop.
* tools/abipkgdiff.cc: Remove ftw.h, pthread.h, unistd.h, add
fts.h and abg-workers.h.
(verbose, elf_file_paths_tls_key, reports_map, env_map, map_lock)
(arg_lock, prog_options): Remove all these global variables.
(struct package_descriptor): Remove this type.
(pthread_routine_extract_package)
(first_package_tree_walker_callback_fn)
(second_package_tree_walker_callback_fn, pthread_routine_compare)
(pthread_join, pthread_routine_extract_pkg_and_map_its_content):
Remove these functions.
(options::{num_workers, verbose}): Define new data members.
(options::options): Initialize the new verbose and num_workers data members.
(package::erase_extraction_directory)
(erase_created_temporary_directories_parent): Take the program
options in parameter. Don't use the global verbose variable
anymore.
(package::erase_extraction_directories)
(erase_created_temporary_directories, extract_package): Take the
program options in parameter.
(extract_rpm, extract_deb, extract_tar): Likewise. And don't use
the global verbose variable anymore.
(compare): Don't use the global verbose variable anymore. Use the
new compare_task type along with the abigail::workers::queue type.
(pkg_extraction_task, pkg_prepare_task, compare_task)
(comparison_done_notify): Define new classes.
(maybe_update_vector_of_package_content): Define new static
function.
(create_maps_of_package_content): Don't take the ftw_cp_type
anymore. Don't use the global verbose variable anymore. Use the
fts_{open,read,close} functions, rather than the ftw one.
(extract_package_and_map_its_content): Don't use pthreads anymore.
Use the new pkg_extraction_task type created along with the
abigail::workers::queue type.
(prepare_packages): Don't use pthreads anymore. Use the new
pkg_prepare_task type along with the abigail::workers::queue type.
(elf_size_is_greater): Adjust to use
abigail::workers::queue::tasks, rather than the previous
compaer_args_sptr type.
(parse_command_line): Adjust to stop using the global verbose
variable.
(main): Remove use of global variables prog_options and also the
packages variable.
* tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64--dbus-glib-0.104-3.fc23.armv7hl-report-0.txt:
Adjust.
* tests/data/test-diff-pkg/dirpkg-0-report-0.txt: Likewise.
* tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt:
Likewise.
* tests/data/test-diff-pkg/test-rpm-report-0.txt: Likewise.
* tests/data/test-diff-pkg/test-rpm-report-1.txt: Likewise.
* tests/data/test-diff-pkg/test-rpm-report-2.txt: Likewise.
* tests/data/test-diff-pkg/test-rpm-report-3.txt: Likewise.
* tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
I tried to run:
fedabipkgdiff vte291-0.39.1-1.fc22.x86_64 vte291-0.39.90-1.fc22.x86_64
And it wouldn't work :-(
The program considers the two packages as not being "peers". This has
to do with the RPM.is_peer method which considers the two package as
not being "peers", just because they have the same release number
(1.fc22).
They should be considered peers, though, because they have the same
name but different {version, release} pairs.
This patch fixes the RPM.is_peer method and adds the aforementioned
packages to the regression test suite for good measure.
* tools/fedabipkgdiff (RPM.is_peer): Update comment. Fix logic.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm:
New test input file.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm:
Likewise.
* tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt: Likewise.
* tests/data/Makefile.am: Add the new test input data to source
distribution.
* tests/mockfedabipkgdiff.in: Update the package and build
information to add the new vte291-0.39.1-1.fc22.x86_64.rpm and
vte291-0.39.90-1.fc22.x86_64.rpm packages (as well as their devel
and debuginfo packages) into the "mock" Koji build database.
* tests/runtestfedabipkgdiff.py.in: Make this test harness run
over the two aforementioned packages.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
There are cases where a virtual member function doesn't have an
implementation that is defined and publicly exported. This is the
cases for virtual pure classes.
Even in those cases, users might want to detect vtable changes on
virtual member pure classes (interfaces).
Now that, for C++ binaries, all the partial representations of a class
are merged into one class (in a given binary), we can envision to
compare virtual member functions of classes as part of comparing two
classes.
This is what this patch does. While comparing two classes, the
virtual member functions are compared too.
Note that as there can be several virtual member functions that have
the same vtable offset (think about a virtual destructor that might
have several generated functions that 'conceptually' share the same
vtable offset), comparing the virtual functions can be a little bit
non-trivial.
The approach taken is to check that in the first set of virtual
functions, each virtual function actually matches at least one virtual
function in the second set. And the match is a "loose" one. That is,
it doesn't take into account the symbol name or the mangled name.
The patch also fixes the "less than" operator used to sort virtual
member functions.
There is also a buglet in the way we compute the highest vtable offset
number today. This patch provides a new function named
class_decl::get_biggest_vtable_offset that is used in the change reports.
The patch also fixes a related bug in where we were forgetting to
report about added and removed virtual member functions without an
associated elf symbol. This patch fixes that.
* include/abg-ir.h (class_decl::get_biggest_vtable_offset):
Declare new member function.
* src/abg-ir.cc (virtual_member_function_less_than::operator()):
Either compare the symbol id strings if the functions have
symbols or just compare their pretty representations.
(class_decl::get_biggest_vtable_offset): Define new member
function.
(methods_equal_modulo_elf_symbol)
(method_matches_at_least_one_in_vector): New static methods.
(equals): In the overload for classes, compare the virtual member
functions while comparing classes.
* src/abg-comparison.cc (represent): In the overload for
method_decl_sptr, fix the way we compute the highest vtable offset
number for a give class_decl.
(class_decl::ensure_lookup_tables_populated): Don't forget added
and removed virtual member functions in the report for changed
classes.
* tests/data/test-diff-dwarf/libtest41-PR20476-hidden-old.so: New
test binary input file.
* tests/data/test-diff-dwarf/libtest41-PR20476-hidden-new.so: Likewise.
* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt:
New reference output.
* tests/data/Makefile.am: Add the new test material above to the
source distribution.
* tests/test-diff-dwarf.cc (in_out_spec): Add the new tests
here.
* tests/data/test-annotate/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-annotate/test11-pr18828.so.abi: Adjust.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
* tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
* tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Adjust.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.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.
* tools/abidw.cc (parse_command_line): Don't require an empty
output file when parsing the --headers-dir option. This was a
thinko.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This option that is present for the abidiff tool was missing for
abipkgdiff.
* doc/manuals/abidiff.rst: Fix a typo.
* doc/manuals/abipkgdiff.rst: Document the --harmless option.
* tools/abipkgdiff.cc: Update copyright year.
(options::show_harmless_changes): Add new data member.
(options::options): Initialize the new data member.
(display_usage): Add a help string for the new --harmless option.
(parse_command_line): Parse the new --harmless option.
(set_diff_context_from_opts): Configure the diff context
accordingly, if the user provided the --harmless option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When using abipkgdiff types that are defined in files not present in
the devel packages provided by the --devel1 and --devel2 option are
dropped from the internal representation by default.
This has been designed as such, not only to avoid showing changes on
types that are not part of the public headers of a shared library, but
also to help lower the memory consumption of libabigail.
In this particular bug report, we see a library that uses types (in
its public interface) that are defined in headers of a *different*
package. For instance, suppose a particular package foo that uses
types defined in headers of the glib package. And some of those Glib
types can be present in its public interface.
So in this case, libabigail is dropping a type that is actually part
of the public interface of the library that is being analyzed, even if
the type was not defined in the devel package of the current package.
This patch addresses the issue by doing a number of things:
1/ If a type is defined in a file which path starts with
"/usr/include/", then consider it as a public type. This is so
that type coming from the public interface of other packages, and
that are defined in system headers are considered as part of the
public types of the package being analyzed.
2/ by default, don't drop types not defined in the associated
devel package. This will hinder our ability to decrease the
memory usage, but there have been a number of recent optimization
that help in that regard independently. So I am hoping this
shouldn't have a big impact now.
Incidentally, the option --dont-drop-private-types (from abidiff)
is changed into --drop-private-types, so that interested users can
still drop non-private types from the model, if they wish. That
--drop-private-types option is added to abipkgdiff too.
As the offended types are not dropped from the model anymore, the
usual filtering mechanisms of libabigail can take place.
* doc/manuals/abidiff.rst (--dont-drop-private-types): Remove documentation.
(--drop-private-types): Document this new option.
* src/abg-tools-utils.cc: Update copyright notice
(handle_fts_entry): On the generated suppression specification, do
not set the flag to drop matched types. Also, don't match types
defined in files which patch start with "/usr/include/".
* tools/abidiff.cc (options::options): Initialize the
drop_private_types data member to false.
(display_usage): Remove usage string for
--dont-drop-private-types. Add a new one for
--drop-private-types.
(parse_command_line): Don't part --dont-drop-private-types,
rather, parse --drop-private-types.
(set_suppressions): When the suppression for private types is
generated, if --drop-private-types was provided, then instruct the
suppression to drop matched types.
* tools/abipkgdiff.cc (options::drop_private_types): New option.
(options::options): Initialize the new drop_private_types data
member to false.
(display_usage): Add a usage string for --drop-private-types.
(parse_command_line): Parse the new --drop-private-types option.
(maybe_create_private_types_suppressions): Don't take just a
package, but a package_descriptor because the latter carries the
options. So when the user used the --drop-private-types option,
make the generated private types suppression to drop matched
types.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
Adjust.
* tests/test-diff-suppr.cc (in_out_specs): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Enterprise Linux (at least) kernels come with ABI whitelist files that list the
names of the set of functions to be considered when looking at the ABI
exposed by the kernel to its modules.
This patch adds a new --linux-kernel-abi-whitelist option to abidiff
so that it drops changes that relate to functions that are *NOT*
defined in the whitelist.
The patch reads the whitelist file and generates one or several
instances of function_suppression that are applied when the two
binaries are loaded.
* include/abg-suppression.h
(function_suppression::function_suppression): Make the declaration
of the default constructor public.
* src/abg-suppression-priv.h (function_suppression::priv::priv):
Declare a default constructor.
* src/abg-suppression.cc
(function_suppression::function_suppression): Define default
constructor.
* include/abg-tools-utils.h
(gen_suppr_spec_from_kernel_abi_whitelist): Declare new function.
* src/abg-tools-utils.cc
(gen_suppr_spec_from_kernel_abi_whitelist): Define new function.
* tools/abidiff.cc (options::kernel_abi_whitelist_paths):
(display_usage): Display a help string for the new
--linux-kernel-abi-whitelist option.
(parse_command_line): Parse the --linux-kernel-abi-whitelist from
the command line.
(maybe_check_suppression_files): Check the presence of the kernel
abi whitelist files.
(set_suppressions): Generate suppression specifications from the
whitelist files.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch teaches the ELF/DWARF reader of libabigail to load special
ELF sections that are specific to Linux Kernel binaries (either
vmlinux or linux kernel modules).
The patch creates a new flag that tells the ELF reader that it needs
to consider the input binary as a Linux Kernel binary. This is the
new 'Linux Kernel mode'.
In this linux kernel mode, the reader expects sections that are named
__ksymtab and/or __ksymtab_gpl sections. Those sections contain
indexes (of ELF symbols described in the normal ELF symbol table) of
exported ELF symbols that are specifically marked by developers using
EXPORT_SYMBOL or EXPORT_SYMBOL_GPL macros. These are symbols of
global variables and functions defined and meant to be used by kernel
modules. They constitute the interface exported by the Linux Kernel
to its modules. So the patch only exports the publicly defined and
exported ELF symbols that are also listed in __ksymtab and
__ksymtab_gpl sections.
The patch also fixes and re-organizes things left and right so that
this new mode works in a well integrated manner with the other parts
of the reader:
- The load address of the binary is no more assumed to be the load
address specified by the program header that is at offset zero.
This is usually the case for user-space programs. To handle Linux
Kernel binaries, the load address is now the one specified by the
program header that is at the smallest offset.
- The patch now tries to populate the various symbol maps only when
necessary. That way, the new symbol maps defined for the ksymtab
and ksymtab_gpl section are also loaded only when necessary; that
is, when in Linux Kernel mode.
- The patch (more) agressively suppresses non-member functions or
variables that are not declarations and that have no associated
ELF symbol.
The patch knows how to recognize and read relevant ELF symbol
information from __ksymtab and __ksymtab_gpl sections.
The patch makes abidiff and abidw detect that a binary is a
Linux Kernel binary (either a vmlinux or a module). It does this by
detecting the presence of the speciall __ksymtab_strings section.
If it detects that a binary is a Linux Kernel binary then it only
considers functions and variables which are defined and exported in
the sense of ELF *AND* which ELF symbols are listed in the __ksymtab
and __ksymtab_gpl sections.
If users want abidiff and abidw to consider their input binaries as
normal ELF binaries then they can use the option --no-linux-kernel-mode.
* include/abg-dwarf-reader.h (create_read_context): Take a new
flag to say if the context is to read an ELF binary in linux
kernel mode.
* src/abg-dwarf-reader.cc (typedef address_set_type)
(address_set_sptr): New typedefs.
(get_binary_load_address): The load address of the binary is
the load address specified by the program header that is at the
smallest offset; not by the program header that is at offset zero.
(read_context::{ksymtab_section_, ksymtab_gpl_section_,
linux_exported_fn_syms_, linux_exported_var_syms_,
linux_exported_gpl_fn_syms_, linux_exported_gpl_var_syms_,
load_in_linux_kernel_mode_}): New data members.
(read_context::read_context): Initialize ksymtab_section_,
ksymtab_gpl_section_ and load_in_linux_kernel_mode_.
(read_context::{find_symbol_table_section, find_opd_section,
lookup_elf_fn_symbol_from_address,
lookup_elf_var_symbol_from_address, get_function_address,
get_variable_address}): Make these const.
(read_context::{find_ksymtab_section, find_ksymtab_gpl_section,
lookup_elf_symbol_from_address, function_symbol_is_exported,
variable_symbol_is_exported, linux_exported_fn_syms,
create_or_get_linux_exported_fn_syms, linux_exported_var_syms,
create_or_get_linux_exported_var_syms, linux_exported_gpl_fn_syms,
linux_exported_gpl_var_syms,
create_or_get_linux_exported_gpl_fn_syms,
linux_exported_gpl_var_syms,
create_or_get_linux_exported_gpl_var_syms, architecture_word_size,
load_kernel_symbol_table, load_ksymtab_symbols,
load_ksymtab_gpl_symbols,
load_linux_specific_exported_symbol_maps,
load_in_linux_kernel_mode}): New member functions.
(read_context::read_int_from_array_of_bytes): Factorize this
new member function out of ...
(read_context::{lookup_ppc64_elf_fn_entry_point_address}):
... this. Make this function const too.
(read_context::read_uint64_from_array_of_bytes): New function.
Uses read_int_from_array_of_bytes above.
(read_context::{fun_entry_addr_sym_map_sptr}): Try to load symbol
maps only when it's necessary.
(read_context::elf_architecture_is_big_endian): Fix logic.
(read_context::{var_addr_sym_map}): Express the const variant in
terms of the non-const one. In the non-const one, load the map
only when necessary.
(read_context::load_symbol_maps_from_symtab_section): Renamed
load_symbol_maps into this.
(read_context::is_linux_kernel_binary): Define new member
function.
(read_context::{function, variable}_symbol_is_exported): If we are
not prevented from considering loading in linux kernel mode, then
just looking at a linux kernel binary makes us consider the
special kernel sections.
(read_debug_info_into_corpus): Likewise.
(build_ir_node_from_die): Take a new flag that says if the ir node
is a declaration required by another concrete IR node.
(enum read_context::kernel_symbol_table_kind): New enum.
(read_context::load_symbol_maps): Support loading linux kernel
specific sections too.
(build_var_decl): Use the new
read_context::variable_symbol_is_exported.
(function_is_suppressed): Suppress non-member functions or
variables that are not declarations and that have no symbol.
(variable_is_suppressed, build_var_decl_if_not_suppressed): Take a
new flag that says if the variable is a declaration required by a
concrete variable. If non member variable that is a declaration
is not the specification of another concrete variable, then it's
suppressed.
(add_fn_symbols_to_map, add_var_symbols_to_map): New function
definitions.
(read_debug_info_into_corpus): If we are reading linux kernel or
linux kernel modules, only set explicitely exported symbols (in
the linux kernel binary sense) as exported function or variable
symbols.
(create_read_context): Take a new flag to say if the context is to
read an ELF binary in linux kernel mode.
* tools/abidiff.cc (options::options): Initialize
options::linux_kernel_mode to true.
(display_usage): Display usage of the --no-linux-kernel-mode option.
(parse_command_line): Parse the --no-linux-kernel-mode option.
* tools/abidw.cc (options::options): Initialize
options::linux_kernel_mode to true.
(display_usage): Display usage of --no-linux-kernel-mode option.
(parse_command_line): Parse the --no-linux-kernel-mode option.
* doc/manuals/abidiff.rst: Document the new --no-linux-kernel-mode
options.
* doc/manuals/abidw.rst: Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
* 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/libtest23.so.abi: Adjust.
* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust.
* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
With this option, abidiff is now able to filter out added
symbols just like abipkgdiff is.
* doc/manuals/abidiff.rst: Document the new --no-added-syms
option.
* tools/abidiff.cc (struct options): Add show_added_syms and
set it to true by default.
(display_usage): Document the new options --no-added-syms. If
this is the only suppression option specified, it is equivalent
to specifying --show_{changed,deleted}_{fns,vars} as arguments
to abidiff. If any of those options are specified before
--no-added-syms, then it has no effect.
(parse_command_line): Parse the new option and set
show_added_{fns,vars,syms} and show_all_{fns,vars} to false if
--no-added-syms is specified.
* tests/test-diff-filter.cc: Add a test for the new option.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
Reference results for the new test.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt:
Likewise.
* tests/data/Makefile.am: Add the above test files to the list of
test data.
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>