Motive of abipkgdiff tool is to provide abi changes between two
pacakges. Packages can be .rpm, .deb or archives. It also takes
optional debug-info package to support pacakges shipping separate
debug-info.
This commit set-up initial skeleton of abipkgdif tool consisting of
help and usage otions. It ensures pkgdiff tool compiles and run when
libabigail gets compiled as whole. Initially, we will add support for
ABI changes for two rpm packages. Further, support for other pacakging
format can be added.
* tools/Makefile.am: Include abipkgdiff.cc in compilation and
generate abipkgdiff binary.
* tools/abipkgdiff.cc: New file
Signed-off-by: Sinny Kumari <sinny@redhat.com>
It turned out the hardened Rawhide build is failing if I don't this.
* tools/Makefile.am: Compile the binaries here with -fPIC. Note
that the library libabigail.la is built with libtool which already
takes care of this, so no need to worry about this for
libabigail.la.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This program is meant to be used by libabigail developers to debug its
ini file parsing facilities. So there is no need to install.
* tools/Makefile.am: Add abinilint to the noinst_PROGRAMS primary.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The utilities present in this namespace were previously living in
tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not
exported and were meant to be useful to the tools writting in the
tools/ directory. I realized that these utilities might be useful to
clients of the libabigail library in general so I am making them
available generally. Note that the initial name of the namespace was
libabigail::tools; so renaming it to libabigail::tools_utils required
that I adjust some client code. I have also cleaned up the code,
interfaces and their apidoc a little bit.
* include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in
here. Renamed the namespace tools into tools_utils. Inject
std::ostream, std::istream, std::ifstream, and std::string types
into the tools_utils namespace. Adjust the function declarations
accordingly. Remove the useless dirname() function declaration.
* include/Makefile.am: Add abg-tools-utils.h to the list of
exported headers.
* src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here.
Renamed the namespace tools into tools_utils.
(get_stat): Add apidoc.
(is_dir): Cleanup apidoc.
(dir_name); Cleanup parameter name.
(guess_file_type): Cleanup parameter type.
* src/Makefile.am: Add abg-tools-utils.cc to the list of exported
headers.
* tools/Makefile.am: Do not build the temporary library
libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out
of this directory.
* tools/abicompat.cc (parse_command_line, main): Adjust for tools
-> tools_utils namespace change.
* tools/abidiff.cc (parse_command_line, main): Likewise.
* tools/abidw.cc (parse_command_line, main): Likewise.
* tools/abilint.cc (parse_command_line, main): Likewise.
* tests/test-abicompat.cc (main): Adjust for tools -> tools_utils
namespace change.
* tests/test-abidiff.cc (main): Likewise.
* tests/test-alt-dwarf-file.cc (main): Likewise.
* tests/test-core-diff.cc (main): Likewise.
* tests/test-diff-dwarf.cc (main): Likewise.
* tests/test-diff-filter.cc (main): Likewise.
* tests/test-diff-suppr.cc (main): Likewise.
* tests/test-lookup-syms.cc (main): Likewise.
* tests/test-read-dwarf.cc (main): Likewise.
* tests/test-read-write.cc (main): Likewise.
* tests/Makefile.am: Do not reference the libtoolsutils.la private
library anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Given an application A that links to a shared library L of version V
denoted L(V) and a subsequent version of that library denoted L(V+P),
the 'abicompat' tool tells the user if L(V+P) is still ABI compatible
with L(V+P). And if it is not, abicompat gives a reports that shows
the differences between L(V) and L(V+P) that makes L(V+P)
ABI-incompatible with A.
The source code of this tool is in the tools/abicompat.cc source
file. To support this new tool, this commit changes the comparison
engine to optionally avoid showing added symbols that were not
referenced by any debug info. It changes the ABI corpus type to allow
the specification of a list of variables and functions symbols to keep
(and drop all other functions and variables which have other symbols
on the floor even before starting to compare the two libraries).
This is how the abicompat tool itself works. It basically compares
L(V) and L(V+P) but it only looks at their exported functions and
variables which symbols are undefined in application A. If the list
of exported and defined variables and functions of L(V) whose symbols
are undefined in A equals that of L(V+P) (including the sub-types of
these variables and functions) A is still compatible with L(V+P).
Otherwise, they might not be compatible depending on the kind of
differences that are found.
* include/abg-comparison.h
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Declare new accessors.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols,
apply_filters_and_suppressions_before_reporting}): Declare new
methods.
(corpus_diff::diff_stats): Declare this new type. Actually this
was previously corpus_diff::priv::diff_stats, which was a hidden
internal type.. We are moving it here, in the external API so
that client code can have more information about changes
statistics. Change all the previously publicly accessible data
members into accessor functions.
* src/abg-comparison.cc (class corpus_diff::diff_stats::priv): New
type.
(diff_context::priv::show_added_syms_unreferenced_by_di_): New
data member.
(diff_context::priv::priv): Adjust.
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Define this new method.
(corpus_diff::priv::emit_diff_stats): Do not show the diff stat
if the only changes is added function or variables symbols and if
we were instructed to not show added symbols.
(corpus_diff::priv::{diff_stats_, filters_and_suppr_applied_}):
New data members.
(corpus_diff::priv::priv): Initialize the
filters_and_suppr_applied_ data member.
(corpus_diff::priv::diff_stats): Move this type to
corpus_diff::diff_stats.
(corpus_diff::priv::{apply_filters_and_compute_diff_stats,
emit_diff_stats}): Adjust.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Define new member function.
(corpus_diff::report): Use the new
apply_filters_and_suppressions_before_reporting() function, rather
than applying the filters and suppressions by ourselves. Also
adjust to the use the accessors of the new corpus_diff::diff_stats
type.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols}): Define new accessors.
(corpus_diff::diff_stats::{diff_stats, num_func_removed,
num_func_added, num_func_changed, num_func_filtered_out,
net_num_func_changed, num_vars_removed, num_vars_added,
num_vars_changed, num_vars_filtered_out, net_num_vars_changed,
num_func_sym_removed, num_func_syms_added, num_var_syms_removed,
num_var_syms_added}): Define new member functions.
* include/abg-corpus.h (corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Declare new methods.
* src/abg-corpus.cc (corpus::priv::{sym_id_fns_to_keep,
sym_id_vars_to_keep}): Added data members.
(symtab_build_visitor_type::{unrefed_fun_symbols,
unrefed_var_symbols, sym_id_fns_to_keep, sym_id_vars_to_keep}):
Added new data members.
(symtab_build_visitor_type::symtab_build_visitor_type): Take two
additional parameters for the function and variable symbol ids to
keep.
(symtab_build_visitor_type::add_fn_to_wip_fns): Take the function
symbols to keep in account when building the exported symbol
table.
(symtab_build_visitor_type::add_var_to_wip_vars): Likewise, take
the variable symbols to keep in account when building the exported
symbol table.
(corpus::priv::build_public_decl_table): Adjust the initialization
of the visitor that walks the ABI artifacts to build the exported
symbol table to know take a list of function/variable symbols to
keep.
(corpus::priv::build_unreferenced_symbols_tables): Ensure that the
public table of functions/variables is built before doing the work
of this function. Also, if a list of variable/function symbols to
keep is given, drop all symbols that are not in that list on the
floor.
(corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Define new accessors.
* tools/abicompat.cc: New abicompat tool.
* doc/manuals/abicompat.rst: New documentation source for
abicompat.
* doc/manuals/libabigail-tools.rst: Add an entry for the abicompat
doc.
* tests/test-abicompat.cc: New test harness for the 'abicompat'
tool.
* tests/Makefile.am: Build the runtestabicompat test harness and
add it to the list of tests harnesses that are run by make check.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v0.so: New
test input.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v1.so: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app: Likewise.
* tests/data/test-abicompat/test0-fn-changed-0.suppr: Likewise
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp.h: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v0.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v1.cc: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v1.so: Likewise.
* tests/data/test-abicompat/test2-var-removed-app: Likewise.
* tests/data/test-abicompat/test2-var-removed-app.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test2-var-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-version-script-0 Likewise.:
* tests/data/test-abicompat/test3-fn-removed-version-script-1: Likewise.
* tests/data/Makefile.am: Add the new test inputs above to the
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (type_diff_base, decl_diff_base): New
types.
(type_diff_base_sptr): New typedef.
(pointer_diff, reference_diff, array_diff, qualified_type_diff)
(enum_diff, class_diff, type_decl_diff, typedef_diff): Make this
extend the new type_diff_base.
* src/abg-comparison.cc (type_diff_base::priv, type_diff_base):
Define these new types and their methods.
(pointer_diff::pointer_diff, array_diff::array_diff)
(reference_diff::reference_diff)
(qualified_type_diff::qualified_type_diff, enum_diff::enum_diff)
(class_diff::class_diff, type_decl_diff::type_decl_diff)
(typedef_diff::typedef_diff): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ini.h: New file.
* include/Makefile.am: Add include/abg-ini.h to the source
distribution.
* src/abg-ini.cc: New file.
* src/Makefile.am: Add src/abg-ini.cc to the source distribution.
* tools/binilint.cc: New testing tool.
* tools/Makefile.am: Add tools/binilint.cc to the source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/Makefile.am: Do not install abisym. It's really there
just for testing purposes and is of almost no use for generic
users.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/data/test-bidiff: Rename this directory to
tests/data/test-abidiff.
* tests/test-bidiff.cc: Renamed this to tests/test-abidiff.cc.
* tools/biar.cc: Renamed to tools/abiar.cc
* tools/bidiff.cc: Renamed to tools/abidiff.cc
* tools/bidw.cc: Renamed to tools/abidw.cc
* tools/bilint.cc: Renamed to tools/abilint.cc
* tools/bisym.cc: Renamed to tools/abisym.cc
* tests/test-alt-dwarf-file.cc: Renamed references to bidw* to abidw*.
* tests/test-diff-filter.cc: Renamed references to bidiff to abidiff.
* tests/test-lookup-syms.cc: Renamed references to bisym to abisym.
* tools/Makefile.am: Adjust.
* tests/Makefile.am: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/Makefile.am: -L and -l ought to be in LIBADD/LDADD because
that is the only place guaranteed to be in the right spot. So add
Them to libabigail_la_LIBADD.
* tools/Makefile.am: Likewise.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* configure.ac(AM_INIT_AUTOMAKE): Set the subdir-object option
here ..
* src/Makefile.am: ... not here.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* configure.ac: Support a new --enable-zip-archive option. By
default its value is set to the 'auto', meaning that if libzip is
installed, that turns the option on -- just like if
--enable-zip-archive was called with the value 'yes'; if libzip is
not installed, that turns the option off -- just like if
--enable-zip-archive was called with the value 'no'. If libzip is
detected, the pre-processor macro HAVE_LIBZIP is set to 1. If
--enable-zip-archive is turned on, the pre-processor macro
WITH_ZIP_ARCHIVE is set to 1.
* config.h.in (HAVE_LIBZIP, WITH_ZIP): New define.
* src/abg-corpus.cc: Include config.h. Guard the inclusion of
abg-libzip-utils.h with the WITH_ZIP_ARCHIVE macro. Likewise for
the use of declarations coming from abg-libzip-utils.h.
* src/abg-libzip-utils.cc: Include config.h. Guard the file's
content with the WITH_ZIP_ARCHIVE macro.
* src/abg-reader.cc: Include config.h. Guard the inclusion of
abg-libzip-utils.h with the WITH_ZIP_ARCHIVE. Likewise for the
use of declarations coming from abg-libzip-utils.h.
* src/abg-writer.cc: Likewise.
* tests/Makefile.am: Build runtestwritereadarchive and runtestdot
only if zip archives are supported.
* tools/Makefile.am: The biar program is built only if
zip archives are supported.
* tools/bidiff.cc: Handle zip archives only if the
WITH_ZIP_ARCHIVE macros is defined.
* tools/bilint.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/Makefile.am: Add the subdir-object automake option here.
Do not specify absolute paths for the input files as Automake now
takes care of that just fine.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
* include/abg-dwarf-reader.h (symbol_type, symbol_binding): New
enums.
(operator<<): Declare new overloads for the new enums above.
(lookup_symbol_from_elf, lookup_public_function_symbol_from_elf):
Declare new entry points.
* src/abg-dwarf-reader.cc (lookup_symbol_from_elf)
(lookup_public_function_symbol_from_elf)
(lookup_public_variable_symbol_from_elf): Define new static
functions.
(read_context::elf_{module_, handle}_): New data members.
(read_context::{elf_module, elf_handle}): New accessors.
(read_context::load_debug_info): Store the elf module into
read_context::_elf_module_. Adjust.
(read_context::{lookup_symbol_from_elf,
lookup_public_function_symbol_from_elf,
lookup_public_variable_symbol_from_elf}): New member functions.
(lookup_symbol_from_elf, lookup_public_function_symbol_from_elf)
(operator<<): Define public entry points.
* tools/bisym.cc: New tool to lookup a symbol in an elf file.
* tools/Makefile.am: Add the bisym.cc source file to the
distribution and arrange to compile it into a 'bisym' executable.
* tests/test-lookup-syms.cc: New test harness.
* tests/data/test-lookup-syms/test0-report.txt: New test input
for the harness above.
* tests/data/test-lookup-syms/test0.cc: Likewise.
* tests/data/test-lookup-syms/test0.o: Likewise
* tests/data/test-lookup-syms/test01-report.txt: Likewise.
* tests/data/test-lookup-syms/test02-report.txt: Likewise.
* tests/Makefile.am: Build the new runtestlookupsyms test and add
the new files to the distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* configure.ac: Check the presence of libdw.so and
elfutils/libdwfl.h headers from elfutils and define the necessary
linking flags.
* include/abg-dwarf-reader.h: New header file
* include/Makefile.am: Add the new header file to the source
distribution.
* src/abg-dwarf-reader.cc:: New file.
* src/Makefile.am: Add the new file to the source distribution.
* include/abg-fwd.h (dump): Add declarations for several overloads
to allow dumping to a given output stream.
* include/abg-ir.h (class translation_unit): Use a pimpl idiom for
this now.
(translation_unit::canonicalize_type): Declare new method.
* src/abg-ir.cc (struct translation_unit::priv): New private type
for the pimpl idiom for translation_unit.
(translation_unit::{translation_unit, get_global_scope, get_path,
set_path, get_loc_mgr}): Adjust for pimpl idiom.
(translation_unit::canonicalize_type): Define this new method and
one overload.
* src/abg-writer.cc (dump): Define several overloads to dump IR
nodes to given output streams.
* tools/bidw.cc: New file for the new bidw tool.
* tools/Makefile.am: Define rules to build the new bidw tools.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (class translation_unit_diff): New type.
(compute_diff): Make this take class_decl&, rather than
class_decl_sptr. Add new overloads for scope_decl& and
translation_unit&.
(report_changes): New overload for scope_diff& and
translation_unit&.
* src/abg-comparison.cc (struct class_decl_diff::priv): New type.
(class class_decl_diff): Add comments to methods.
(class translation_unit_diff): Implement methods.
(compute_diff, report_changes): Implement the new overloads.
(scope_diff::ensure_lookup_tables_populated): Fix a thinko here.
* src/abg-ir.cc (is_var_decl): Add new predicate.
* tools/abg-tools-utils.h (file_exists, is_regular_file)
(check_file): Declare new functions.
* tools/abg-tools-utils.cc (get_stat, file_exists, check_file)
(is_regular_file): Define new functions.
(is_dir): Use the new get_stat.
* tools/bidiff.cc: New file.
* tools/Makefile.am: Add tools/bidiff.cc to the build system; make it
produce the bidiff tool.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/test-utils.h (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): Move these directories manipulation
utilities from here to ...
* tools/abg-tools-utils.h (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): ... here in this new file.
(dir_name, base_name): Declare these new functions.
* tests/test-utils.cc (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): Likewise, move these to ...
* tools/abg-tools-utils.cc (is_dir, ensure_dir_path_created)
(ensure_parent_dir_created): ... here in this new file.
(dir_name, base_name): Define these.
* tools/Makefile.am: New file. Create a new libtoolsutils.la
static library with stuff from tools/abg-tools-utils.cc in it.
Also create a new 'biar' program with the stuff from the new
tools/biar.cc in it.
* tools/biar.cc: New file. Contains the code for the new "biar"
archive manipulation command line utility.
* tests/test-read-write.cc (main): Adjust for the change about
ensure_parent_dir_created above.
* tests/test-write-read-archive.cc (main): Likewise.
* Makefile.am (SUBDIRS): Add the new tools/ sub-directory to the
build system.
* configure.ac (AC_CONFIG_FILES): Generate tools/Makefile.
* tests/Makefile.am: Make libtestutils.la link with the new
libtoolsutils.la. Make sure to express the dependencies between
libtestutils.la and the binaries that depend on it. Otherwise
parallel builds can go awry.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>