mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-30 05:42:05 +00:00
10ce99e428
269 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
10ce99e428 |
Bug 20194 - Fail to recognize void type represented by DW_TAG_base_type
This patch makes the DWARF reader recognize a "void" type expressed as a DW_TAG_base_type of size zero and named "void". * src/abg-dwarf-reader.cc (build_type_decl): Recognize a DW_TAG_base_type of size zero and of name "void" as a void type. * tests/data/test-diff-filter/test33-libelf.so.0.8.13-gcc: New binary test input. * tests/data/test-diff-filter/test33-libelf.so.0.8.13-intel16.0.3: Likewise. * tests/data/test-diff-filter/test33-report-0.txt: New reference output. * tests/data/Makefile.am: Add the new files above to source distribution. * tests/test-diff-filter.cc (in_out_specs): Make this test harness run over the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Chenxiong Qi
|
69d2dcd163 |
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages
This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Chenxiong Qi
|
70614e18f1 |
Add integration tests for fedabipkgdiff
A new test case class is introduced as integration tests, that is able to test fedabipkgdiff ability against supported use cases and with other command line options. Currently, integration tests only aim to ensure whether expected comparison against rpms and binaries really happen. * configure.ac: do not detect shutil module. * tests/runtestfedabipkgdiff.py.in: do not import shutil anymore. (BUILT_ABIPKGDIFF): new global variable to reference the abipkgdiff built from source code, as the new test case' tests require this command directly rather than mocking the global_config. (test_data_dir): convert variable name to uppercase, reference to the test data directory by absolute path instead of relative path. (TEST_TOPDIR): new global variable to use data directory as the topdir passed to fedabpkgdiff to download rpms. (TEST_DOWNLOAD_CACHE_DIR): new global variable referencing a fake download cache directory for tests only. (packages, builds, rpms): new global variables as a fake storage holding packages, builds and rpms. (AssertionHelper): new class helping to assert abipkgdiff result easily. (MockClientSession): new class to mock koji.ClientSession. (MockGlobalConfig.abipkgdiff): set this option to global variable BUILT_ABIPKGDIFF. (MockKojiClientSessin): removed. (mock_get_session): removed. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_cannot_find_a_latest_build_with_invalid_distro}): mock koji.ClientSession with new class MockClientSession. Remove invalid documentation from docstring. Use new package rather than httpd. (DownloadRPMTest.setUp): remove self.download_dir and use global TEST_DOWNLOAD_CACHE_DIR. (DownloadRPMTest.tearDown): do not remove download cache directory. (DownloadRPMTest.make_remote_file_url): do not omit positional argument specifiers in string format. (DownloadRPMTest.{test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): set fake download cache directory to mocked get_download_dir in mock.patch decorator. (BrewListRPMsTest.test_select_specific_rpms): use new MockClientSession to mock koji.ClientSession. Rewrite test by using the new package listed in global variable packages. (RunAbipkgdiffWithDSOOnlyOptionTest.{test_abipkgdiff_with_dso_only, test_abipkgdiff_without_dso_only}): set fake download cache directory to mocked get_download_dir in mock.patch decorator. (CompareABIFromCommandLineTest): new integration test case. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/ i686/dbus-glib-0.100.2-2.fc20.i686.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/ i686/dbus-glib-debuginfo-0.100.2-2.fc20.i686.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/ i686/dbus-glib-devel-0.100.2-2.fc20.i686.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/ x86_64/dbus-glib-0.100.2-2.fc20.x86_64.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/ x86_64/dbus-glib-debuginfo-0.100.2-2.fc20.x86_64.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/ x86_64/dbus-glib-devel-0.100.2-2.fc20.x86_64.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/ i686/dbus-glib-0.106-1.fc23.i686.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/ i686/dbus-glib-debuginfo-0.106-1.fc23.i686.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/ i686/dbus-glib-devel-0.106-1.fc23.i686.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/ x86_64/dbus-glib-0.106-1.fc23.x86_64.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/ x86_64/dbus-glib-debuginfo-0.106-1.fc23.x86_64.rpm: new rpm for running tests. * tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/ x86_64/dbus-glib-devel-0.106-1.fc23.x86_64.rpm: new rpm for running tests. * tests/data/Makefile.am: add new rpms. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3e47efb112 |
Escape all characters when reading a string in ini files
It turns out that when parsing foo = bar\[a-z\], the '[' and ']' characters where not being escaped while parsing the string "bar\[a-z\]". This patch fixes that. * src/abg-ini.cc (read_context::peek): Take an output parameter to tell the caller when this function escaped the returned character. Added an overload without this new parameter. (read_context::read_string): Accept all characters as part of the string. * tests/data/test-diff-suppr/test7-var-suppr-9.suppr: New test input. * tests/data/test-diff-suppr/test7-var-suppr-report-9.txt: New test reference output. * tests/data/Makefile.am: Add the files above to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Run a new comparison of libtest7-var-suppr-v{0,1}.so this time using the new test7-var-suppr-9.suppr specification that exercices a string with the escaped characters that we were having difficulty with. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b36ca1501e |
Bug 20180 - Support system-wide suppression specifications
This patch adds support for loading system and user level suppression specifications for libabigail tools. At launch time, relevant libabigail tools (abidiff, abipkgdiff fedabipkgdiff for now) read the default system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE, if set, or from the file $libdir/libabigail/default.abignore. Then it reads the user system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE, if set, or from the file $HOME/.abignore. The content of the user system suppression file is merged with the content of default system suppression file. That content is also merged with the content of the suppression specification files that might be provided by the --suppressions command line option of the invoked tools. The resulting set of all these suppression specifications is thus used to filter the ABI change reports that are emitted. abidiff, abipkgdiff and abipkgdiff gain a --no-default-suppression option to avoid loading any of these default suppression specification files. The patch also installs a default.abignore file into $(pkglibdir). Note that on x86_64, that directory is /usr/lib64/libabigail. Now we just need to think about the content of that default.abignore file. * doc/manuals/abidiff.rst: Document the default suppression scheme, its interaction with the --supprs option and the new --no-default option. * doc/manuals/abipkgdiff.rst: Likewise. * doc/manuals/fedabipkgdiff.rst: Likewise. * configure.ac: Generate the tests/runtestdefaultsupprs.py file from the new tests/runtestdefaultsupprs.py.in template. * default.abignore: New file. * Makefile.am: Add it to source distribution. * src/Makefile.am: Define the ABIGAIL_ROOT_SYSTEM_LIBDIR preprocessor macro that is set the value of the $libdir autotools macro. * include/abg-tools-utils.h: Update copyright years. (get_system_libdir, get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Declare new functions * src/abg-tools-utils.cc (get_system_libdir) (get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Define new functions. (is_regular_file): Amend this so that it return true for symlinks to regular files too. (is_dir): Amend this so that it returns true for symlinks to directories too. * tools/abidiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (display_usage): Display a new help string for the new --no-default-suppression command line option. (parse_command_line): Parse this new command line option. (set_diff_context_from_opts): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/abipkgdiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (parse_command_line): Parse the new --no-default-suppression command line option. (main): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/fedabipkgdiff (abipkgdiff): Add --no-default-suppression to the invocation of abipkgdiff if it was provided on the command line. (build_commandline_args_parser): Parse the new --no-default-suppression command line option. * tests/runtestdefaultsupprs.py.in: New test harness template. * tests/Makefile.am: Add the new runtestdefaultsupprs.py to the set of tests. * tests/data/test-default-supprs/test0-type-suppr-0.suppr: New test input. * tests/data/test-default-supprs/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v0.o: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v1.o: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir-report-0.txt: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir1: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir2: Likewise. * tests/data/Makefile.am: Add new the new tests input above to Makefile.am. * tests/runtestcanonicalizetypes.sh.in: Pass --no-default-suppression to abidiff invocations. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7013500ca7 |
Add test data for tests/runtestfedabipkgdiff.py
While applying the patch
|
||
Chenxiong Qi
|
59917a8118 |
Bug 20085 - Add --dso-only option to fedabipkgdiff
abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e19bf5627a |
Make abi{pkg}diff filter out changes about private types
This is to address the following enhancement requests: #19588 - Add a --headers-dir1 and --headers-dir2 option to abidiff #19948 - Add --devel-pkg1 and --devel-pkg2 options to abipkgdiff When the user specifies where to find header files for two binaries (or packages) being compared, this patch generates a type suppression specification that filters out change reports about types that are defined in files that are not in the set of header files specified. The type suppression specification also suppresses change reports about changed/added/removed virtual member functions which enclosing class type matches the type suppression specification. There is a corner case that the patch handles too, and that is exhibited by the accompanying test case for abidiff. There can be a class defined by DWARF as having no source location and as being a pure declaration. This can be a class declaration that has inline virtual members only, and one or several non-defined virtual methods too. When that declaration is included in a source file, GCC generates debug info that describes that class as being a declaration-only class with no source declaration. This patch considers such a class as being non defined; you know, like a true opaque type. So it's considered being not defined in any public header file. Changes to this kind of class are thus filtered out. * include/abg-comp-filter.h: Update copyright year. * src/abg-comp-filter.cc (has_virtual_mem_fn_change): Make this static function become exported. (has_virtual_mem_fn_change): Declare new function. * include/abg-suppression.h (suppression_base::{get,set}_is_artificial): Declare new accessors. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Add a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. * src/abg-suppression.cc (suppression_base::priv::is_artificial_): New data member. (suppression_base::priv::priv): Initialize the new data member. (suppression_base::{get,set}_is_artificial): Define new accessors. (type_suppression::priv::source_locations_to_keep_): Change the vector of strings representing source file names into unordered set of string. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Define a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. (type_suppression::suppresses_diff): Make this suppress virtual member function diffs if the enclosing type of the changed virtual member is suppressed by the current type_suppression. (read_type_suppression): Adjust to use the fact that the source locations are not stored in an unordered set, not in a vector anymore. Otherwise, using a vector here make things too slow. (type_suppression::suppresses_type): Likewise. Also, If the type we are looking at has no location because it's a true opaque type and if the current suppression is an artificial suppression that is meant to suppress change reports about non-public types, then suppress the type. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Declare new public function. * src/abg-tools-utils.cc (PRIVATE_TYPES_SUPPR_SPEC_NAME): Define a new constant variable. (handle_fts_entry): Define new static function. (gen_suppr_spec_from_headers): Define new public function. * src/abg-comparison.cc (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): If a type suppression suppresses a given class C, make it change added/removed virtual functions whose enclosing type is C. * tools/abidiff.cc (options::{headers_dir1, headers_dir2}): New data members. (display_usage): Add help strings for --headers-dir1 and --headers-dir2. (parse_command_line): Parse the new --headers-dir1 and --headers-dir2 options. (set_diff_context_from_opts): Generate suppression specifications to filter out changes on private types, if --headers-dir1 or --headers-dir2 is given. * tools/abipkgdiff.cc (options::{devel_package1, devel_package2}): New data members. (typedef package_sptr): New typedef. (enum package::kind): New enum. (package::kind_): New data member. This replaces ... (package::is_debug_info_): ... this data member. (package::{devel_package_, private_types_suppressions_}): New data members. (package::package): Adjust. (package::get_kind): Define new member function. This replaces ... (package::is_debug_info): ... this member function overload. (package::set_kind): Define new member functin. It replaces ... (package::is_debug_info): ... this member function overload. (package::{devel_package, private_types_suppressions}): Define new accessors. (package::erase_extraction_directies): Erase the sub-directory where development packages are extracted to. (compare_args::private_types_suppr{1,2}): New data members. (compare_args::compare_args): Adjust. (display_usage): Add help strings for --devel-pkg1/--devel-pkg2. (compare): Make the overload that compares elf files take private types suppressions. Add the private types suppressions to the diff context. (pthread_routine_compare): Adjust the call to compare. (maybe_create_private_types_suppressions): Define new static function. (pthread_routine_extract_pkg_and_map_its_content): If a devel package was specified for the main package then extract it in parallel with the other package extraction. When the extraction is done, create private types suppressions by visiting the directories that contain the header files. (compare): In the overload that compares packages by scheduling comparison of individual elf files that are in the packages, pass in the private type suppressions too. (parse_command_line): Parse the new --devel-pkg{1,2} command line options. (main): Associate the devel package to the main package, if the --devel-pkg{1,2}. * doc/manuals/abidiff.rst: Add documentation about the new --headers-dir1 and --headers-dir2 options. * doc/manuals/abipkgdiff.rst: Likewise, add documentation about the new --devel-pkg1 and --devel-pkg2 libraries. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: New test reference output. * tests/data/test-diff-pkg/tbb-devel-4.1-9.20130314.fc22.x86_64.rpm: New test input package. * tests/data/test-diff-pkg/tbb-devel-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc (InOutSpec::{first,second}_in_devel_package_path): New data members. (in_out_specs): Adjust. Also, add a new entry describing the new test inputs above. (test_task::perform): When the new test entry contains devel packages, pass them to abipkgdiff using the --devel1 and --devel2 options. * tests/data/test-diff-suppr/test30-include-dir-v0/test30-pub-lib-v0.h: A new test input source code. * tests/data/test-diff-suppr/test30-include-dir-v1/test30-pub-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.so: Add new test binary input. * tests/data/test-diff-suppr/test30-pub-lib-v1.cc: Add new test input source code. * tests/data/test-diff-suppr/test30-pub-lib-v1.so: Add new test binary input. * tests/data/test-diff-suppr/test30-report-0.txt: Add new test reference output. * tests/data/test-diff-suppr/test30-report-1.txt: Add new test reference output. * tests/test-diff-suppr.cc (InOutSpec::headers_dir{1,2}): New data members. (InOutSpec::abidiff_options): Renamed the bidiff_options data member into this. (in_out_specs): Adjust. Also, added the new test input above to this. (main): Adjust to invoke abidiff with the new --hd1 and --hd2 options if the input specs for the tests has the new InOutSpec::headers_dir{1,2} data member set. Renamed bidiff into abidiff. * tests/data/Makefile.am: Add the new test inputs to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ce5e4889b1 |
Plug leak of debug info handles
On recent elfutils where the libdw's function dwarf_getalt exists, we don't need to try and find the alternate debug info file ourselves by using the function dwfl_standard_find_debuginfo. Furthermore, when we use that function on those recent elfutils versions, we leak the elf resources allocated in the debug info resources; we also leak the file descriptor to access the alternate debug info sections. More generally, we also leak debug info handles used to access debug info when using get_soname_of_elf_file and get_type_of_elf_file. This patch plugs those leaks. In the first case, if the function dwarf_getalt exists, the patch just uses it to get the alternate debug info. Otherwise, the patch uses the dwfl_standard_find_debuginfo function like we used to, but then it tries hard to free the file descriptor and debuginfo memory of the alternate debug info. * configure.ac: Check the presence of dwarf_getalt in libdw. If it's present, define the preprocessor macro LIBDW_HAS_DWARF_GETALT. Update the autoconf configuration summary. * src/abg-dwarf-reader.cc: Add config.h. (find_alt_debug_info_location): Factorize this out of ... (find_alt_debug_info): ... this function. Use dwarf_getalt if present, otherwise, keep using dwfl_standard_find_debuginfo. In the later case, return the file descriptor opened to access the alternate debug info, by parameter, so that the caller can fclose it. (read_context::alt_fd_): New data member. (read_context::read_context): Initialize the new alt_fd_ data member. (read_context::load_debug_info): Store the file descriptor used to access the alternate debug info into the new alt_fd_ data member. (read_context::~read_context): New desctructor. (get_soname_of_elf_file, get_type_of_elf_file): Free the elf handle. (read_context::load_debug_info): Be paranoid in making sure we never override alt_dwarf_. * tests/data/test-alt-dwarf-file/test0-report.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
080b88c9a1 |
Implement a [suppress_file] suppression directive
abidiff, abipkgdiff and abicompat now recognize a [suppress_file] directive in suppression specifications. That directive instructs the tool to avoid loading some binaries altogether. This is the first directive that won't act on the result of the comparison of two binaries. It actually acts earlier and prevents the tool from loading some binaries altogether. The directive looks like: [suppress_file] # Don't load any library named lib_private*.so file_name_regexp = lib_private.*\\.so This prevents the tool from loading (and thus comparing) any library which name matches the pattern "lib_private*.so". [suppress_file] # Only load libraries name lib_public*.so file_name_not_regexp = lib_public.*\\.so This instructs the tool to only load (and compare) files which name match the pattern "lib_public*.so". * doc/manuals/libabigail-concepts.rst: Document the new 'suppress_file' directive. * include/abg-suppression.h (file_suppression): Define new class. (file_suppression_sptr): Define new typedef. (is_file_suppression, file_is_suppressed): Declare new functions. * src/abg-suppression.cc (): (read_file_suppression, is_file_suppression, file_is_suppressed): Define new functions. (file_suppression::{file_suppression, suppresses_file, ~file_suppression}): Define new member functions. * tools/abidiff.cc (main): If a suppression specification suppresses one of the input files, then do not perform the comparison. * tools/abipkgdiff.cc (compare): If a suppression specification suppresses a file that is to be compared, then do not perform the comparison. * tools/abicompat.cc (create_diff_context): New static function. (perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode): Adjust to take a context in parameter. Do not create a diff context here anymore, do not load suppression files here either. (main): Use the new create_diff_context to create a diff context and initialize it, including loading suppression specifications. If any suppression specification suppresses a file to load, then do not load perform any compatibility checking. Adjust invocations of perform_compat_check_in_weak_mode and perform_compat_check_in_normal_mode to pass the diff context. * tests/data/test-diff-suppr/test0-type-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test0-type-suppr-4.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-5.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-6.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-6.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Likewise. * tests/test-diff-suppr.cc (in_out_specs): Use the new test inputs. * tests/data/test-abicompat/test0-fn-changed-1.suppr: New test input. * tests/data/test-abicompat/test0-fn-changed-report-3.txt: Likewise. * tests/test-abicompat.cc (in_out_specs):: Use the new test inputs. * tests/data/Makefile.am: Add the new test material to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b885e6283f |
Bug 20015 - support file_name_not_regexp and soname_not_regexp in suppr specs
The supression directives suppress_type, suppress_function and suppress_variable support the two properties below, among others: file_name_regexp = <some-regexp> soname_regexp = <some-regexp> When the regular expression matches either the file name or the soname, then the suppression directive is activated. This patch adds the support for these two additional properties for these suppression directives: file_name_not_regexp = <some-regexp> soname_not_regexp = <some-regexp> These activate the current suppression directive if the regular expression does *NOT* match the file name or soname. This is very helpful to express change report suppressions like: "suppress all ABI change reports for all libraries but those with file names (or sonames) with the pattern libfoobar.*" * include/abg-comparison.h (suppression_base::{get,set}_file_name_not_regex_str): Declare new member functions. (suppression_base::{get,set}_soname_not_regex_str): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Likewise. * src/abg-comparison.cc (suppression_base::priv::get_file_name_regex): Fix comment. (suppression_base::priv::get_file_name_not_regex): New member function. (suppression_base::priv::get_soname_regex): Fix comment. (suppression_base::priv::get_soname_not_regex): New member function. (suppression_base::{get,set}_file_name_not_regex_str): Define new member functions. (suppression_base::{get,set}_soname_not_regex_str): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Likewise. These got factorized out of type_suppression::suppresses_type, function_suppression::suppresses_function, function_suppression::suppresses_function_symbol, variable_suppression::suppresses_variable, variable_suppression::suppresses_variable_symbol. (type_suppression::suppresses_type): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_type_suppression): Read the new file_name_not_regexp and soname_not_regexp properties. (function_suppression::{suppresses_function, suppresses_function_symbol}): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_function_suppression): Read the new file_name_not_regexp and soname_not_regexp properties. (variable_suppression::{suppresses_variable, variable_suppression::suppresses_variable_symbol}): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_variable_suppression): Use the new suppression_base::{names,sonames}_of_binaries_match. * doc/manuals/libabigail-concepts.rst: Document the new file_name_not_regexp and soname_not_regexp suppression properties. * tests/data/test-diff-suppr/test24-soname-report-10.txt: New test reference output. * tests/data/test-diff-suppr/test24-soname-report-11.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-13.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-15.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-9.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-10.txt: New test input. * tests/data/test-diff-suppr/test24-soname-suppr-11.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-13.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-15.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-9.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-2.txt: New test reference output. * tests/data/test-diff-suppr/test29-soname-report-3.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-4.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-5.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-6.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-7.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-8.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-2.txt: New test input. * tests/data/test-diff-suppr/test29-suppr-3.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-4.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-5.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-7.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Make this test harness run over the new test inputs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2529f84ae0 |
Bug 19964 - Cannot load function aliases on ppc64
Registering alias of functions on ppc64 seems to be broken since this
commit:
|
||
Sinny Kumari
|
8944ceb9ef |
Bug 19961 - Distinguish between PI executable and shared library
In the ELF format, Position Independent Executables (aka PIE) and shared libraries are marked as being of type ET_DYN. So just looking at the type of the ELF file is not enough to discriminate a position independent executable from a shared library. And this is the problem. Libabigail just looks at the type of the ELF file to discriminate PIE binaries from shared libraries binaries. So it treats both kinds of binaries as being shared libraries. When we run abipkgdiff with the --dso-only option, the tool considers both PIEs and shared libraries, even though the intent of the --dso-only option is have the tool consider shared libraries only. With this patch, we introduce a new enumerator ELF_TYPE_PI_EXEC (to the elf_type enum) for PIE binaries. From now on, a file will be properly recognized as being of the ELF_TYPE_DSO kind only if it is a shared library. * include/abg-dwarf-reader.h (elf_type): Add new enumerator ELF_TYPE_PI_EXEC. * src/abg-dwarf-reader.cc (lookup_data_tag_from_dynamic_segment): New function for data tag lookup in dynamic segment of an elf (elf_file_type): Return ELF_TYPE_PI_EXEC file type for a PI executable. (get_elf_file_type): Change this to take an elf handle. (get_type_of_elf_file): New function that got factorized out of ... (load_dt_soname_and_needed): ... this one. * tools/abipkgdiff.cc (create_maps_of_package_content): Also consider ELF_TYPE_PI_EXEC file type. (compare): Likewise. * tests/test-diff-pkg.cc (in_out_specs): Test case additions * tests/data/Makefile.am: Include test files * tests/data/test-diff-pkg/tarpkg-1-dir1.tar.gz: New test data * tests/data/test-diff-pkg/tarpkg-1-dir2.tar.gz: New test data * tests/data/test-diff-pkg/tarpkg-1-report-0.txt: New test result Signed-off-by: Sinny Kumari <sinny@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f6c182bb56 |
Ease use of soname_regexp/file_name_regexp in suppr specs
In a suppression specification, soname_regexp or file_name_regexp cannot be the only property of a suppression directive. For instance, the suppression specification below won't work: [suppress_type] # suppress all change reports about *any type* from the library # libtestfoo.so file_name_regexp = libtestfoo.so This is because as documented in the manual, the suppression directive 'suppress_type' requires that some other properties be specified. For instance, the below would work: [suppress_type] name_regexp = .* file_name_regexp This was done on purpose to prevent folks from inadvertently suppressing too much of change report bits. But experience is showing that this is surprising some users. And in hindsight, I kind of agree it's surprising. So this patch allows the first example to work, as seems to be expected. The patch allows the first example to work for the suppress_function and suppress_variable directive too. * doc/manuals/libabigail-concepts.rst: Update the manual to reflect the changes in the suppression_type, suppress_function and suppress_variable directives. * src/abg-comparison.cc (read_type_suppression): Accept that the suppress_type directive contains only file_name_regexp or the soname_regexp property. (read_function_suppression): Likewise for the suppress_function directive. (read_variable_suppression): Likewise for the suppress_variable directive. * tests/data/test-diff-suppr/libtest29-soname-v0.so: New binary test input. * tests/data/test-diff-suppr/libtest29-soname-v1.so: Likewise. * tests/data/test-diff-suppr/test24-soname-report-5.txt: New reference test output. * tests/data/test-diff-suppr/test24-soname-report-6.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-7.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-8.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-5.txt: New test suppression file. * tests/data/test-diff-suppr/test24-soname-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-7.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-0.txt: New reference test output. * tests/data/test-diff-suppr/test29-soname-report-1.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-v0.cc: Source code for the new binary output above. * tests/data/test-diff-suppr/test29-soname-v1.cc: Likewise. * tests/data/test-diff-suppr/test29-suppr-0.txt: New test suppression file. * tests/data/test-diff-suppr/test29-suppr-1.txt: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Make this test harness run over the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
11f5dbaab2 |
Bug 19885 - Cannot associates a function DIE to a symbol on powerpc64
On powerpc 64 ELFv1, the address of a function is different from the address of the entry point of that function. The value of a en ELF symbol represents the address of the function, whereas the DW_AT_low_pc DWARF attribute of a function DIE points to the entry point address of the function. So to get the symbol a function's DW_AT_low_pc points to, one needs to get the address of the function *from* the address of its entry point. More precisely, on ppc64, the address of a function is the address of a function descriptor. The function descriptor is a set of three 64 bits addresses. The first element of the triplet is the function entry pointer address. So to get the symbol a given function entry point address belongs to, one must get to the function descriptor which contains said function entry point address. And function descriptors are in the ".opd" special section. Unfortunately, Libabigail's ELF/DWARF reader has no knowledge of all this. So it cannot get the symbol of a given function DWARF description. So it considers all functions as having no ELF symbols. So it shows no ABI change pertaining to function sub-types on ppc64. This patch makes Libabigail support function descriptors on ppc64 so it can detect changes on function sub-types there. * src/abg-dwarf-reader.cc (read_context::{opd_section_, fun_entry_addr_sym_map_}): New data members. (read_context::read_context): Initialize the new opd_section_ data member. (read_context::{find_opd_section, lookup_ppc64_elf_fn_entry_pointer_address, fun_entry_addr_sym_map_sptr, fun_entry_addr_sym_map, elf_architecture_is_ppc64, elf_architecture_is_big_endian}): New member functions. (read_context::lookup_elf_fn_symbol_from_address): Adjust to use the new read_context::fun_entry_addr_sym_map() function. (read_context::load_symbol_maps): Populate the function entry addresses -> symbol map, for ppc64 ELFv1. (read_context::load_elf_properties): Renamed read_context::load_remaining_elf_data into this. (read_corpus_from_elf): Load elf properties before trying to load elf symbols information. * tests/data/test-diff-filter/libtest32-struct-change-v0.so: New binary test input, compiled for ppc64le. * tests/data/test-diff-filter/libtest32-struct-change-v1.so: Likewise. * tests/data/test-diff-filter/test32-ppc64le-struct-change-report0.txt: New test reference output. * tests/data/test-diff-filter/test32-ppc64le-struct-change-v0.c: Source code of the new binary test input above. * tests/data/test-diff-filter/test32-ppc64le-struct-change-v1.c: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-filter.cc (in_out_spec): Make this test harness run over the new test input binaries above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
67435cf6cd |
Bug 19867 - abipkgdiff skips symbolic links
When comparing two directories, abipkgdiff skips symbolic links pointing to ELF binaries altogether. It only consider regular files. This is a problem when abipkgdiff is given two directories that only contain symbolic links. In that case, abipkgdiff just performs no comparison. This patch makes abipkgdiff resolve the symbolic link to its target file. * include/abg-tools-utils.h (maybe_get_symlink_target_file_path): Declare new function. * src/abg-tools-utils.cc (get_stat): Use lstat here, not stat. Update comment. * tools/abipkgdiff.cc (first_package_tree_walker_callback_fn) (second_package_tree_walker_callback_fn): Follow symbolic links to elf files to get their target paths, and only work with that target path. (maybe_get_symlink_target_file_path): Define new function. * test-diff-pkg/symlink-dir-test1-report0.txt New test material. * test-diff-pkg/symlink-dir-test1/dir1/symlinks/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/symlinks/libfoo.so: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/targets/foo.c: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/targets/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/targets/libfoo.so: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/symlinks/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/symlinks/libfoo.so: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/targets/foo.c: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/targets/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/targets/libfoo.so: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-pkg.cc (in_out_spec): Run this test harness over the new test material above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
10b029b385 |
Bug 19844 - Cannot try to canonicalize a type that is being constructed
maybe_canonicalize_type aborts because the assertion that read_context::lookup_type_from_die_offset should always return a type is violated. read_context::lookup_type_from_die_offset is called on the offset of a DIE of a type that is being constructed. The problem is that that fonction only looks in the map of types that are fully constructed. This patch addresses the issue by making read_context::lookup_type_from_die_offset look up class and function types being constructed as well. While doing that I had to add maps for class and function types being constructed and that are in the alternate debug info section. I adjusted the accessors for class and function types accordingly. The code using those accessors was adjusted accordingly as well. The patch also prevents maybe_canonicalize_type for DIEs which no type was built for, in buid_ir_node_from_die. This is particularly for DW_TAG_class_type and DW_TAG_structure_type DIEs. * src/abg-dwarf-reader.cc (read_context::{alternate_die_wip_classes_map_, alternate_die_wip_function_types_map_}): New data members. (read_context::lookup_type_from_die_offset): Lookup WIP class and function types too. (read_context::{die_wip_classes_map, die_wip_function_types_map}): Take a flag saying if we should get the map for the alternate debug info section or not. (read_context::{is_wip_class_die_offset, is_wip_function_type_die_offset}): Take a flagy saying if the DIE is in the alternate debug info section or not. (build_class_type_and_add_to_ir, build_function_type) (maybe_canonicalize_type): Adjust. (build_ir_node_from_die): Do not call maybe_canonicalize_type on type DIEs which no type has been constructed for. * tests/data/test-diff-pkg/gtk2-debuginfo-2.24.22-5.el7.i686.rpm: New test input. * tests/data/test-diff-pkg/gtk2-debuginfo-2.24.28-8.el7.i686.rpm: Likewise. * tests/data/test-diff-pkg/gtk2-immodule-xim-2.24.22-5.el7.i686.rpm: Likewise. * tests/data/test-diff-pkg/gtk2-immodule-xim-2.24.28-8.el7.i686.rpm: Likewise. * tests/data/test-diff-pkg/gtk2-immodule-xim-2.24.22-5.el7.i686--gtk2-immodule-xim-2.24.28-8.el7.i686-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-pkg.cc (in_out_spec): Make this test harness run on the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9efa6af3e2 |
Fix reference to test file in Makefile.am
* tests/data/Makefile.am: Fix bogus reference to libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3cf729c3ee |
Bug 19778 - diff_has_ancestor_filtered_out() loops forever
It appears that there can be cycles in the path made of ancestors. In that case, diff_has_ancestors_filtered_out() just loops forever. Oops. This patch addresses that issue by making diff_has_ancestors_filtered_out() detect cycles. * src/abg-comparison.cc (diff_has_ancestor_filtered_out): Add an overload that takes an additional map of pointer values. Make the older overload call the new one. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm: New test material. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: New reference output. * tests/data/test-diff-pkg/libICE-1.0.9-2.el7.x86_64.rpm: New test material. * tests/data/test-diff-pkg/libICE-debuginfo-1.0.6-1.el6.x86_64.rpm: New test material. * tests/data/test-diff-pkg/libICE-debuginfo-1.0.9-2.el7.x86_64.rpm: New test material. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Run this test harness over the new tests material above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ba1b9916ac |
Forgot to add test2-filtered-removed-fns-v{0,1}.o
I forgot to add these files as part of my previous commit * test2-filtered-removed-fns-v{0,1}.o: Add these test input files. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ddc21ed73e |
Bug 19596 - Suppressed removed symbol changes still considered incompatible
Libabigail considers a removed function (or global variable) as being an incompatible change, whether it has been suppressed or not. Likewise, even if all function sub-type changes have been suppressed, changed virtual offset on functions are still considered incompatible. Thus, abidiff still returns an exit code that reflects an incompatible change even if the removed symbol change was suppressed. The rule should rather be that if incompatible changes have been suppressed, abidiff (and the other tools) should take that into account and not return an exit code that reflects incompatible changes. This patch implements that rule, at least for the incompatible changes that are detected so far. * src/abg-comparison.cc (corpus_diff::has_incompatible_changes): Consider the *net* number of removed function and variable symbols. Also, if all function sub-type changes have been suppressed, then no virtual offset change should be considered incompatible. * tests/data/test-abidiff-exit/test1-voffset-change-report1.txt * tests/data/test-abidiff-exit/test1-voffset-change.abignore * tests/data/test-abidiff-exit/test2-filtered-removed-fns-report0.txt * tests/data/test-abidiff-exit/test2-filtered-removed-fns-report1.txt * tests/data/test-abidiff-exit/test2-filtered-removed-fns-v0.c * tests/data/test-abidiff-exit/test2-filtered-removed-fns-v1.c * tests/data/test-abidiff-exit/test2-filtered-removed-fns.abignore * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-abidiff-exit.cc (InOutSpec::in_suppr_path): New data member. (in_out_specs): Adjust. Add new test inputs. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2bbe75a08a |
Fixup virtual member functions with linkage and no underlying symbol
This is from the problem report at https://sourceware.org/bugzilla/show_bug.cgi?id=19707. GCC 5.3.1, when invoked with -g -O2 emits some debug info where some virtual member functions with linkage name have no reference to any underlying symbol. When that binary is compared to its counterpart compiled with -g, the member function in question does have an underlying symbol and thus the comparison of the enclosing types yield a spurious change report like: method virtual void unity::scopes::ScopeBase::stop() didn't have any linkage name, and it now has: '_ZN5unity6scopes9ScopeBase4stopEv' This patch introduces a pass in the DWARF reader which fixes up virtual member function with linkage and no underlying symbol. If there is a symbol with a name equals to the linkage name, the virtual member function has its underlying symbol set to that symbol. This fixes the spurious change report. * src/abg-dwarf-reader.cc (die_function_decl_map_type): New typedef. (read_context::die_function_with_no_symbol_map_): New data member. (read_context::die_function_decl_with_no_symbol_map): New accessor. (read_context::fixup_functions_with_no_symbols): New member function. (finish_member_function_reading): Take a read_context. Schedule virtual member functions with linkage and no underlying symbol to be fixed up after all the debug info is read. (build_function_decl): After a virtual member function_decl has been updated, if it has its underlying symbol and was scheduled for fixup, then de-schedule it. (build_class_type_and_add_to_ir, build_ir_node_from_die): Adjust call to finish_member_function_reading. (read_corpus_from_elf): Move the pure ELF (symbol and other mundane information) information reading ... (read_debug_info_into_corpus): ... here. Make it happen *before* actual reading of DWARF information. We need symbol information to be present and fully set before we start reading debug info. This is so that we can know when a virtual member function doesn't need to be fixed up. Also, perform the fixup after the debug information was read. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
cf8eba68c3 |
Implement string interning for Libabigail
This patch implements string interning optimization. One can read about the principles of this optimization at https://en.wikipedia.org/wiki/String_interning. The patch introduces an abigail::interned_string type, as well as an abigail::interned_string_pool type. Each environment type owns a string pool and strings are interned in that pool for all types and decls of that environments. The interned_string has methods to interact seemingly with std::string including a hashing function. Of course hashing and comparing interned_string is faster than for std::string. To enable ABI artifacts to intern strings, each constructor of ABI artifacts now takes the environment it's constructed in as parameter. From the environment, it can thus use the interned string pool. The patch then changes declaration names to be of type interned_string, and performs the necessary adjustments. The hash maps that hash strings coming from those declaration names are adjusted to hash interned_string. * include/Makefile.am: Add the new abg-interned-str.h file to source distribution. * include/abg-corpus.h (corpus::corpus): Re-arrange the order of * src/abg-corpus.cc (corpus::exported_decls_builder::priv::get_id): Return interned_string rather than std::string. (corpus::corpus): Re-arrange the order of parameters: take an environment as first parameter. parameters: take an environment as first parameter. * include/abg-dwarf-reader.h (lookup_symbol_from_elf) (lookup_public_function_symbol_from_elf): Likewise. * src/abg-dwarf-reader.cc (lookup_symbol_from_sysv_hash_tab) (lookup_symbol_from_gnu_hash_tab) (lookup_symbol_from_elf_hash_tab, lookup_symbol_from_symtab) (lookup_symbol_from_elf, lookup_public_function_symbol_from_elf) (lookup_public_variable_symbol_from_elf, lookup_symbol_from_elf) (lookup_public_function_symbol_from_elf): Take an environment as first parameter and adjust. (build_translation_unit_and_add_to_ir) (build_namespace_decl_and_add_to_ir, build_type_decl) (build_enum_type, finish_member_function_reading) (build_class_type_and_add_to_ir, build_function_type) (read_debug_info_into_corpus, read_corpus_from_elf): Adjust. * include/abg-fwd.h: Include abg-interned-str.h (get_type_name, get_function_type_name, get_method_type_name): Return a interned_string, rather than a std::string. * include/abg-interned-str.h: New declarations for interned strings and their pool. * include/abg-ir.h (environment::intern): Declare new method. (elf_symbol::{g,s}et_environment): Likewise. (type_or_decl_base::type_or_decl_base): Make the default constructor private. ({translation, type_or_decl_base}::set_environment) (set_environment_for_artifact): Take a const environment*. (elf_symbol::elf_symbol) (elf_symbol::create) (type_or_decl_base::type_or_decl_base) (translation::translation, decl_base::decl_base) (scope_decl::scope_decl, type_base::type_base) (type_decl::type_decl, scope_type_decl::scope_type_decl) (namespace_decl::namespace_decl) (enum_type_decl::enumerator::enumerator) (function_type::function_type, method_type::method_type) (template_decl::template_decl, function_tdecl::function_tdecl) (class_tdecl::class_tdecl, class_decl::class_decl): Take an environment. (type_or_decl_base::operator=) (enum_type_decl::enumerator::get_environment): Declare new method. (decl_base::{peek_qualified_name, peek_temporary_qualified_name, get_qualified_name, get_name, get_qualified_parent_name, get_linkage_name}, qualified_type_def::get_qualified_name) (reference_type_def::get_qualified_name) (array_type_def::get_qualified_name) (enum_type_decl::enumerator::{get_name, get_qualified_name}) ({var,function}_decl::get_id) (function_decl::parameter::{get_type_name, get_name_id}): Return an interned_string, rather than a std::string. (decl_base::{set_qualified_name, set_temporary_qualified_name, get_qualified_name, set_linkage_name}) (qualified_type_def::get_qualified_name) (reference_type_def::get_qualified_name) (array_type_def::get_qualified_name) (function_decl::parameter::get_qualified_name): Take an interned_string, rather than a std::string. (class_decl::member_{class,function}_template::member_{class,function}_template): Adjust. * src/abg-ir.cc (environment_setter::env_): Make this be a pointer to const environment. (environment_setter::visit_begin): Adjust. (interned_string_pool::priv): Define new type. (interned_string_pool::*): Define the method declared in abg-interned-str. h. (operator==, operator!=, operator+): Define operator for interned_string and std::string (operator<<): Define for interned_string. (translation_unit::priv::env_): Make this be a pointer to const environment. (translation_unit::priv::priv): Take a pointer to const environment. (elf_symbol::priv::env_): New data member. (elf_symbol::priv::priv): Adjust. Make an overoad take an environment. (translation_unit::{g,s}et_environment): Adjust. (interned_string_bool_map_type): New typedef. (environment::priv::classes_being_compared_): Make this hastable of string be a hashtable of interned_string. (environment::priv::string_pool_): New data member. (environment::{get_void_type_decl, get_variadic_parameter_type_decl}): Adjust. (type_or_decl_base::priv::env_): Make this be a pointer to const environment. (type_or_decl::base::priv::priv): Adjust. (type_or_decl_base::set_environment) (set_environment_for_artifact): Take a pointer to const environment. (elf_symbol::{g,s}et_environment, environment::intern) (type_or_decl_base::operator=): Define new methods. (decl_base::priv::{name_, qualified_parent_name_, temporary_qualified_name_, qualified_name_, linkage_name_}): Make these data member be of tpe interned_string. (decl_base::priv::priv): Make this take an environment. Adjust. (decl_base::{peek_qualified_name, peek_temporary_qualified_name, get_linkage_name, get_qualified_parent_name, get_name, get_qualified_name}, get_type_name, get_function_type_name) (get_method_type_name, get_node_name) (qualified_type_def::get_qualified_name) (pointer_type_def::get_qualified_name) (array_type_def::get_qualified_name) (enum_type_decl::enumerator::get_qualified_name) (var_decl::get_id, function_decl::get_id) (function_decl::parameter::get_{name_id, type_name}): Return an interned_string. (decl_base::{set_qualified_name, set_temporary_qualified_name}) (qualified_type_def::get_qualified_name) (pointer_type_def::get_qualified_name) (reference_type_def::get_qualified_name) (array_type_def::get_qualified_name) (function_decl::parameter::get_qualified_name): Take an interned_string. (decl_base::{set_name, set_linkage_name}): Intern the std::string passed in parameter. (equals): In the overload for decl_base, adjust for a little speed optimization that is justified by profiling. (pointer_type_def::priv::{internal_qualified_name_, temp_internal_qualified_name_}): Make these data member be interned_string. (enum_type_decl::enumerator::priv::env_): New data member. (enum_type_decl::enumerator::priv::{name_, qualified_name}): Make these data member be of type interned_string. (enum_type_decl::enumerator::get_environment): New method. (enum_type_decl::enumerator::priv::priv) Adjust. (typedef_decl::operator==): Implement a little speed optimization. (var_decl::priv::nake_type_): New data member. (var_decl::priv::id_): Make this data member be of type interned_string. (equals): In the overload for var_decl, function_type, function_decl, adjust for the use of interned_string. (function_decl::priv::id_): Make this be of type interned_string. (scope_decl::{add_member_decl, insert_member_decl}) (lookup_function_type_in_translation_unit) (synthesize_type_from_translation_unit, lookup_node_in_scope) (lookup_type_in_scope, scope_decl::scope_decl) (qualified_type_def::qualified_type_def) (qualified_type_def::get_qualified_name) (pointer_type_def::pointer_type_def) (reference_type_def::reference_type_def) (array_type_def::array_type_def, array_type_def::append_subrange) (array_type_def::get_qualified_name) (enum_type_decl::enum_type_decl) (enum_type_decl::enumerator::get_qualified_name) (enum_type_decl::enumerator::set_name) (typedef_decl::typedef_decl, var_decl::var_decl) (function_type::function_type, method_type::method_type) (function_decl::function_decl) (function_decl::parameter::parameter) (class_decl::priv::comparison_started) (class_decl::add_base_specifier) (class_decl::base_spec::base_spec) (class_decl::method_decl::method_decl) (type_tparameter::type_tparameter) (non_type_tparameter::non_type_tparameter) (template_tparameter::template_tparameter) (type_composition::type_composition) (function_tdecl::function_tdecl, class_tdecl::class_tdecl) (qualified_name_setter::do_update): Adjust. (translation_unit::translation_unit, elf_symbol::elf_symbol) (elf_symbol::create, type_or_decl_base::type_or_decl_base) (decl_base::decl_base, type_base::type_base) (type_decl::type_decl, scope_type_decl::scope_type_decl) (namespace_decl::namespace_decl) (enum_type_decl::enumerator::enumerator, class_decl::class_decl) (template_decl::template_decl, function_tdecl::function_tdecl) (class_tdecl::class_tdecl): Take an environment. * src/abg-comparison.cc (function_suppression::suppresses_function): Adjust. * src/abg-reader.cc (read_translation_unit) (read_corpus_from_input, build_namespace_decl, build_elf_symbol) (build_function_parameter, build_function_decl, build_type_decl) (build_function_type, build_enum_type_decl, build_enum_type_decl) (build_class_decl, build_function_tdecl, build_class_tdecl) (read_corpus_from_native_xml): Likewise. * src/abg-writer.cc (id_manager::m_cur_id): Make this mutable. (id_manager::m_env): New data member. (id_manager::id_manager): Adjust. (id_manager::get_environment): New method. (id_manager::{get_id, get_id_with_prefix}): Return an interned_string. (type_ptr_map): Make this be a hash map of type_base* -> interned_string, rather a type_base* -> string. (write_context::m_env): New data member. (write_context::m_type_id_map): Make this data member be mutable. (write_context::m_emitted_type_id_map): Make this be a hash map of interned_string -> bool, rather than string -> bool. (write_context::write_context): Take an environment and adjust. (write_context::get_environment): New method. (write_context::get_id_manager): New const overload. (write_context::get_id_for_type): Return an interned_string; adjust. (write_context::{record_type_id_as_emitted, record_type_as_referenced}): Adjust. (write_context::type_id_is_emitted): Take an interned_string. (write_context::{type_is_emitted, record_decl_only_type_as_emitted}): Adjust. (write_translation_unit, write_corpus_to_native_xml, dump): Adjust. * tools/abisym.cc (main): Adjust. * tests/data/test-read-write/test22.xml: Adjust. * tests/data/test-read-write/test23.xml: Adjust. * tests/data/test-read-write/test26.xml: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9d5b898f28 |
Make the tree pass distcheck again.
I forgot to add a test reference output file to the source distribution and this breaks "make distcheck". Fixed thus. * tests/data/Makefile.am: Add file test-diff-suppr/test28-add-aliased-function-report-0.txt to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e62901963f |
Bug 19658 - Type canonicalization slow for the 2nd binary loaded
When loading two binaries (e.g, when the library is used by abidiff), and when the second one does have deep types (e.g, classes with recursively deep hierarchies) with lots of duplicated types in lots of translation units, canonicalizing the types of the second binaries can take a *lot* of time, given the quadratic nature of the structural type comparisons that take place and the cheer number of those type comparisons (because of the duplication). There is already an optimization based on the One Definition Rule in the canonicalization code. That optimization avoids structural comparison of types of the same corpus which have the same name. But then, this optimization only works on types of the first corpus. As soon as we are loading a second corpus, all types being canonicalized are coming from a corpus that is different from the first corpus, by definition. So a structural comparison is taking place for *all* those types. The patch extends the existing optimization to make it work on the second corpus being loaded. Once a type from the second corpus is canonicalized, the canonical type is cached inside the corpus. Then, later, when a type with the same name has to be canonicalized, the system looks inside the cache of that corpus to see if there is a canonicalized type the same name. I tested the patch on this command: abipkgdiff --d1 nss-debuginfo-3.19.1-8.el6_7.i686.rpm \ --d2 nss-debuginfo-3.21.0-0.1.el6_7.i686.rpm \ nss-3.19.1-8.el6_7.i686.rpm \ nss-3.21.0-0.1.el6_7.i686.rpm I whitnessed a x10 speedup, at least. On binaries that don't have a lot of duplicated deep types, the patch doesn't have any noticeable effect. At lesat It doesn't slow things down in that case. * include/abg-corpus.h (corpus::{record_canonical_type, lookup_canonical_type}): Declare new member functions. * src/abg-corpus.cc (corpus::priv::canonical_types_): New data member. (corpus::{record_canonical_type, lookup_canonical_type}): Define new member functions. * src/abg-ir.cc (type_base::get_canonical_type_for): Cache the canonical type inside the corpus of the type being canonicalized. Then later when canonicalizing another type, lookup in the cache inside its corpus to see if there is a type with the same name. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1bb3461d1d |
Bug 19638 - DWARF reader fails to link clone function to its declaration
There are three mains issues that cause the reported problem. Let's look at them closely. Suppose there is a DIE of a member function Klass::clone_of_foo, which is a clone of the DIE of the function Klass_foo, which is the concrete instance of the DIE of the declaration of Klass::foo. When libabigail's DWARF reader sees the DIE for Klass::clone_of_foo, it fails to get the context of the declaration of Klass::clone_of_foo -- which is Klass::foo. So, in the model built by libabigail, the symbol of Klass::clone_of_foo never gets associated to Klass::foo. It thus looks like Klass::clone is never defined. It also looks like that symbol is unreferenced. From there, a number of bad things happen. This is the first root cause of the reported problem. I call it issue 1/. 2/ While looking at this, I noticed that libabigail uses the underlying symbol name of a given function as the linkage name of that function, rather than using the value of the DW_AT_linkage_name DWARF property. This usually works, until the the function has a symbol which has several aliases. In that case, depending on the symbol alias that is used, a given function can have different linkage names. This causes problems later at comparison time. This is issue 2/. 3/ I also noticed that in the libabigail model, even if type Klass does have all its member functions (including Klass::foo) defined in in a particular translation unit TU1 , the same Klass in another translation unit TU2 might not have that Klass::foo defined, just because that function is not used in TU2. So after type canonicalization, if the version of Klass that is kept is the one from TU2, we end up with a type Klass *NOT* having Klass::foo defined. Sometimes, it's just that one member function in the canonical type doesn't have any underlying symbol, whereas the same member function in another type of the same class of equivalence as the canonical type does have that an underlying symbol. This is issue 3/. To address issue 1/ the patch fixes build_ir_node_from_die, in the case where a DW_TAG_subprogram DIE is being handled. It fixes the case of finding the root interface of the clone of a function definition. The patch also fixes a bug in build_function_decl that prevents it to update the linkage name of a function, *if* that function already had one. This was preventing build_function_decl to adjust the linkage name of a function which is a clone of an original function which already had a non-empty linkage name. To address 2/ the patch makes function_decl::get_id return the linkage name of the function, *if* it exists (rather than primarily returning the ID of the underlying symbol). To address 3/ the patch implements the copying of member functions or underlying function symbols missing from the canonical type -- but otherwise present in the type that has just been canonicalized. * include/abg-ir.h (decl_base::set_linkage_name): Make this member function virtual. (class_decl::string_mem_fn_ptr_map_type): Define new member type. (class_decl::find_member_function): Declare new member function. (copy_member_function): Declare new function. Declare it as friend of class_decl. (method_decl::set_linkage_name): Declare an overload for this virtual function. * src/abg-dwarf-reader.cc (build_function_decl): Allow updating of linkage_name even if the linkage_name was already defined. (build_ir_node_from_die): In the case DW_TAG_subprogram, make the lookup of scope of the DIE work even if it has both an abstract origin and a specification (DW_AT_abstract_origin and DW_AT_specification). * src/abg-ir.cc (maybe_adjust_canonical_type): Define new function. (canonicalize): Use it. (function_decl::get_id): Return the linkage name first, if it exist. (class_decl::priv::mem_fns_map_): New data member. (class_decl::find_member_function): Define new member function. (class_decl::method_decl::set_linkage_name): Likewise. (class_decl::add_member_function): Update the new data member class_decl::priv::mem_fns_map_. (copy_member_function): Define new static function. * tests/data/test-abidiff/test-PR18791-report0.txt: Adjust. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1eecd89ee1 |
Bug 19619 - failing to suppress added aliased function reports for C++
Libabigail is designed to avoid suppressing a change report about an added (or removed) function if that function has aliases. For the change report to be suppressed, the condition of the suppression specification must match all the aliases of the symbol of the function. This is to avoid suppressing change reports about aliases by error. If the binary results from a C program, the name of the function is the same as the name of its underlying symbol. So if the condition of the suppression specification is the property "name_regexp", the value of the condition can be made to match the names of all the aliases of the underlying symbol of the function. In that case, if value of the property name_regexp does *NOT* match all the aliases, then it's OK for the "change report suppression sub-system" to avoid suppressing the change report. But if the binary results from a C++ program, the name of the function is *different* from the name of its underlying symbol. If the condition of the suppression specification is the property "name_regexp", there is *NO* way for the user to provide a value which matches *ANY* of the names of the underlying function symbols while also matching the name of the function. So in this case, the "change report suppression sub-system" should assume that the user wants to suppress the change reports about all the aliases of the function. In this problem report, the issue is that in the case of a C++ program for which the user provided the "name_regexp" property, Libabigail is expecting the "name_regexp" to match all the aliased symbol names. Which is not possible. So the suppression specification is not suppressing the change report about the added function, just because the function has an alias. This patch fixes the issue by taking into account the difference between languages where the name of the function is the same as the name of their underlying symbol and languages where it is not. * src/abg-comparison.cc (function_suppression::suppresses_function): Make the evaluation of the "name" and "name_regexp" consider the cases of languages in which the function name is the same as the symbol name and the case of languages in which it is not. In the former case, all symbol alias names must be matched. In the latter case, if "name" and "name_regexp" match the function name, the suppression specification is considered to match the report about the function change. Also, use the elf_symbol::is_main_symbol() predicate to test for the symbol being a main symbol, rather than using error-prone pointer equality. * tests/data/test-diff-suppr/test27-add-aliased-function-0.suppr: New test input. * tests/data/test-diff-suppr/test27-add-aliased-function-1.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-2.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-3.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-4.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-0.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-1.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-2.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-3.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-4.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-5.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v0.cc: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v0.o: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v1.cc: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v1.o: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-0.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-1.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-2.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-3.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-4.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-5.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-0.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-1.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-2.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-3.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-4.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-5.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-6.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v0.c: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v0.o: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v1.c: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v1.o: Likewise. * tests/data/Makefile.am: Add the new test material above to the source distribution. * tests/test-diff-suppr.cc: Add the new test inputs above to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4b7e295b20 |
Bug 19596 - Incorrect exit status for incompatible ABI change
The comparison engine doesn't take virtual offset changes into account when deciding if a diff node carries an incompatible change. This is obviously an oversight. Fixed thus. * include/abg-comparison.h (enum diff_category): Adjust the comment for enumerator VIRTUAL_MEMBER_CHANGE_CATEGORY; changes of this category are incompatible ABI changes. (corpus_diff::diff_stats::num_func_with_virtual_offset_changes): Declare new accessors. * src/abg-comparison.cc (corpus_diff::diff_stats::priv::num_func_with_virt_offset_changes): New data member. (corpus_diff::diff_stats::priv::priv): Initialize the new data member. (corpus_diff::diff_stats::num_func_with_virtual_offset_changes): Define new accessors. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Use the new accessor to set the number of functions with virtual offset changes onto the stats data structure. (corpus_diff::has_incompatible_changes): Take functions with virtual offset changes into account. * tests/test-abidiff-exit.cc: New test harness to test for exit codes of abidiff. * tests/Makefile.am: Build the new test harness runtestabidiff from the test-abidiff-exit.cc source file. * tests/data/test-abidiff-exit/test1-voffset-change-report0.txt: New reference test output. * tests/data/test-abidiff-exit/test1-voffset-change-v0.cc: New test input source code. * tests/data/test-abidiff-exit/test1-voffset-change-v0.o: New test input. * tests/data/test-abidiff-exit/test1-voffset-change-v1.cc: New test input source code. * tests/data/test-abidiff-exit/test1-voffset-change-v1.o: New test input. * tests/data/Makefile.am: tests/data/Makefile.am: Add the new test inputs above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
31aef952c8 |
Fix synthesizing of reference type
Libabigail fails to synthesize a non-existing reference type to an existing type. This is similar to the previous commit "2f88edd Fix synthesizing of pointer type" which, obviously dealt with pointer types. This patch adds support for synthesizing a reference type to an existing type. * src/abg-ir.cc (synthesize_type_from_translation_unit): Support synthesizing reference types. * tests/data/test-abicompat/libtest9-fn-changed-v0.so: Add new test input. * tests/data/test-abicompat/libtest9-fn-changed-v1.so: Likewise. * tests/data/test-abicompat/test9-fn-changed-app: Likewise. * tests/data/test-abicompat/test9-fn-changed-app.cc: : Likewise. * tests/data/test-abicompat/test9-fn-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test9-fn-changed-v0.cc: Likewise. * tests/data/test-abicompat/test9-fn-changed-v0.h: Likewise. * tests/data/test-abicompat/test9-fn-changed-v1.cc: Likewise. * tests/data/test-abicompat/test9-fn-changed-v1.h: Likewise. * tests/data/Makefile.am: Add the new material to source distribution. * tests/test-abicompat.cc (in_out_specs): Add the new test inputs to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2f88edd3b3 |
Fix synthesizing of pointer type
Libabigail fails to to synthesize a non-existing pointer type to an existing type. This makes abicompat fail in weak mode when trying to detect changes to a function type where the parameter is a pointer to a structure which changed. In the application, the function is invoked and a pointer to the structure is passed to it. It appears that the type of structure is defined in the debug info of the application, but not the pointer to that structure. So abicompat needs to synthesize that pointer to struct in order to synthesize the type of the function, and so, compare it to the type of the function coming from the library. It appears that synthesizing a pointer type (to an existing type) is not supported. Only synthesizing qualified type was supported. This patch adds support for that and thus fixes the abicompat test case that is attached. * include/abg-ir.h: Update copyright. * src/abg-ir.cc (synthesize_type_from_translation_unit): Support synthesizing pointer types. * tests/data/test-abicompat/libtest8-fn-changed-libapp-v0.so: New test input. * tests/data/test-abicompat/libtest8-fn-changed-libapp-v1.so: Likewise. * tests/data/test-abicompat/test8-fn-changed-app: Likewise. * tests/data/test-abicompat/test8-fn-changed-app.c: Likewise. * tests/data/test-abicompat/test8-fn-changed-libapp-v0.c: Likewise. * tests/data/test-abicompat/test8-fn-changed-libapp-v0.h: Likewise. * tests/data/test-abicompat/test8-fn-changed-libapp-v1.c: Likewise. * tests/data/test-abicompat/test8-fn-changed-libapp-v1.h: Likewise. * tests/data/test-abicompat/test8-fn-changed-report-0.txt: Likewise. * tests/data/Makefile.am: Add the new test input files to source distribution. * tests/test-abicompat.cc (in_out_specs): Add the new test inputs above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
066ebbdf0e |
Bug 19204 - libabigail aborts on DWARF referencing non-existing DIE
In this bug the DWARF reader tries to get the parent of a DIE (referred-to by its offset) which is not defined in the debug info. The DIE is not defined, but it's referred-to by another DIE of the debug info. This definitely looks like a faulty DWARF. The DWARF reader aborts because, obviously, it cannot get the parent DIE of a DIE that is not defined. This patch changes the behaviour of the DWARF reader in this case. Rather than aborting, the DWARF reader just drops the DIE (which refers to a non-existing DIE) on the floor. It thus do not abort on such faulty DWARF anymore. * src/abg-dwarf-reader.cc (get_parent_die): If we couldn't find the parent of a given DIE, return false, do not abort. Also, assert that if we don't find the parent of a DIE in the main debug info, we don't find it in the alternate debug info either (and vice versa). This is because I'd like to abort on cases where we look for a DIE in the wrong debug info; those cases are likely to be hint that the DWARF reader is doing something wrong which ought to be investigated and fixed. (get_scope_for_die): If we couldn't get the parent of the DIE, then return a nil scope. * tests/data/test-types-stability/pr19204-libtcmalloc.so.4.2.6-xlc: New test binary input. * tests/data/Makefile.am: Add the new binary test input to the source distribution. * tests/test-types-stability.cc (elf_paths): Account for the new binary input. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
640b3a2f59 |
Bug 19141 - Libabigail doesn't support common ELF symbols
Libabigail's internal representation of elf symbols fails to account for common symbols in relocatable files. There can be several common symbols of the same name (defined in a section of SHN_COMMON kind). In that case, Libabigail wrongly considers these multiple instances of the same common symbol as being alias, and that breaks some basic assumptions about aliases. Oops. This patch adds support for the common symbols (and the fact that relocatable files can have several instances of the same common symbol) and amends the ELF reader to make it properly represent those. * include/abg-ir.h (elf_symbol::elf_symbol): Take a new flag to say if the symbol is common. (elf_symbol::{is_common_symbol, has_other_common_instances, get_next_common_instance, add_common_instance}): New member functions. * src/abg-ir.cc (elf_symbol::priv::{is_common_, next_common_instance_): New data members. (elf_symbol::priv::priv): Adjust. (elf_symbol::{elf_symbol, create}): Take a new flag to say if the symbol is common. (textually_equals): Adjust to account for symbol common-ness. (elf_symbol::{is_common_symbol, has_other_common_instances, get_next_common_instance, add_common_instance}): Define new member functions. (elf_symbol::add_alias): Drive-by fix; compare symbols using pointer value. Value comparison is not necessary. * src/abg-dwarf-reader.cc (lookup_symbol_from_sysv_hash_tab) (lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_symtab) (read_context::lookup_elf_symbol_from_index): Adjust the creation of the symbol to account for common-ness. (read_context::load_symbol_maps): Recognize instances of a given common symbol and represent them as such. Do not mistake this with symbol aliases. * src/abg-reader.cc (build_elf_symbol): Adjust the creation of the symbol to account for common-ness. * src/abg-writer.cc (write_elf_symbol): Adjust symbol serialization to account common-ness. * tests/data/test-types-stability/pr19141-get5d.o: Add new test binary input. * tests/data/test-types-stability/pr19142-topo.o: Likewise. * tests/data/Makefile.am: Add the new test inputs to source distribution. * tests/test-types-stability.cc (elf_paths): The the new test inputs into account. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
c3869ecc7b |
Bug 19434 - invalid character in attribute value
* include/abg-tools-utils.h (string_is_ascii_identifier): Declare new function. * src/abg-tools-utils.cc (string_is_ascii_identifier): Define new function. * src/abg-dwarf-reader.cc (build_function_type): Discard parameter name if it's made of non-identifier ascii characters. * tests/data/test-types-stability/pr19434-elf0: New test binary input file. * tests/data/Makefile.am: Add the new test input to source distribution. * tests/test-types-stability.cc: Test the new test input into account. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
c8c7a3b5e7 |
Escape the value of the filepath attribute.
* src/abg-writer.cc (write_location): Sanitize the filepath with xml::escape_xml_string(). (write_translation_unit): Likewise. (write_corpus_to_native_xml): Likewise. * tests/data/test-types-stability/pr19433-custom0: Add a new test file. * tests/test-types-stability.cc: Add the test file to the test harness. * tests/data/Makefile.am: Add the new test file to the list. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> |
||
Dodji Seketeli
|
5c8c049e70 |
Bug 19138 - Failure to relate variables address from DWARF and ELF
In this problem report libabigail's DWARF reader wrongly looks up the address of variables (that it got from DWARF) in the .bss section of the ELF file. But then, in these files (generated by the Intel C++ compiler) the variables we are looking at have their addresses in the .data1 section. This patch changes the DWARF/ELF reader to make it look for variable addresses in .data, .data1, .rodata and .bss sections, as it should be. * include/abg-dwarf-reader.h (elf_type::ELF_TYPE_RELOCATABLE): New enumerator. * src/abg-dwarf-reader.cc (find_section): Factorize this from ... (find_text_section, find_bss_section): ... these. (find_rodata_section, find_data_section, find_data1_section): Define new static functions. (elf_file_type): Move this static function definition up. (read_context::{get_elf_file_type, address_is_in_section, get_data_section_for_variable_address}): New member functions. (read_context::maybe_adjust_fn_sym_address): Adjust comment. Adjust to use the new read_context::get_data_section_for_variable_address(). * tests/data/test-types-stability/pr19138-elf0: New test input binary. * tests/data/Makefile.am: Add the new test input binary to the test suite. * tests/test-types-stability.cc (elf_paths): Take it into account. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
068a974774 |
Fix tests/data/Makefile.am glitch
* tests/data/Makefile.am: Fix a faulty file path. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
03808c483a |
Lexicographically sort added/removed base classes in change report
Until now, added and removed base classes were not sorted in class change reports. This causes differences change reports when running the tests on different platorms. This patch fixes that. * src/abg-comparison.cc (sort_string_base_diff_sptr_map): Define new static function. (struct base_spec_comp): Define new type. (class_diff::priv::sorted_{deleted,inserted}_bases_): New data members. (class_diff::ensure_lookup_tables_populated): Sort the deleted and inserted base classes. (class_diff::report): Use the sorted set of deleted/inserted base classes in the report. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6f00afe353 |
Fix regression on the support for alternate debug info files
My commit "5a8c000 Bug 19355 - Libabigail slow on r300_dri.so" introduced a faster way of getting the logical parent of a DIE, when one of its ancestor DIEs has been imported into a the current translation unit. But then that commit broke the support for alternate debug info files. Oops. This commit brings back the support for alternate debug info files. * src/abg-dwarf-reader.cc (imported_unit_point::imported_unit_from_alt_di): New data member. (imported_unit_point::imported_unit_point): Adjust. (read_context::alt_tu_die_imported_unit_points_map_): New data member. (read_context::alt_tu_die_imported_unit_points_map): New accessor. (die_die_attribute): Remove the overload which doesn't say if the resulting DIE comes from alternate debug info. (build_die_parent_relations_under): Take a new flag which says if we are building the relations about DIEs in the alternate debug info section or not. Use that flag to know if the imported unit trace we are building is for an alternate debug info file or not. (build_die_parent_maps): Build two different imported unit point trace vectors: one for the main debug info file, and another one for the alternate debug info file. (find_import_unit_point_between_dies): Take a flag that says if the beginning of the search is a DIE in the alternate debug info file or not. Use it to know if we should use the import point trace vectors from alternate debug info or from the main debug info file. When the import point trace vector is empty, return immediatly. (get_parent_die): If the parent DIE is a DW_TAG_partial_unit which hasn't been imported into this TU, then assume the logical parent is the DIE for the current translation unit. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Reference test output. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64.rpm: New input test rpm. * tests/data/test-diff-pkg/tbb-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/tbb-debuginfo-4.1-9.20130314.fc22.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/tbb-debuginfo-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/data/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-pkg.cc (int_out_specs): Add the new rpms to the list of rpms to test against. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
6a7566d513 |
Add the option of printing the file, line and column information about a type being reported.
* bash-completion/abicompat: Complete the new "--no-show-locs" option. * bash-completion/abidiff: Likewise. * bash-completion/abidw: Likewise. * bash-completion/abipkgdiff: Likewise. * doc/manuals/abicompat.rst: Mention the new "--no-show-locs" option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-comparison.h (show_locs): Add declarations. * src/abg-comparison.cc: (diff_context::priv): Add a new switch called "show_locs_" and set its default value to false. (report_loc_info): New function. Outputting the extra information is conditionalized based on the associated diff contexts settings. (show_locs): define a getter/setter for diff_context::priv::show_locs_. ({distinct,pointer,reference,qualified_type,enum,class,scope,fn_parm, typedef,corpus}_diff::report): Call report_loc_info when appropriate. (maybe_report_diff_for_member): Likewise. (represent): Accept a const reference to a diff_context_sptr as a first argument and call report_loc_info on its second argument. * src/abg-dwarf-reader.cc: * tests/data/Makefile.am: Add the new test reference files. * tests/data/test-abicompat/test0-fn-changed-report-2.txt: New test reference output. * tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise. * tests/test-abidiff.cc: Explicitly create a diff context and turn off location emitting. * tests/test-diff-dwarf.cc: Likewise. * tests/test-abicompat.cc: Add --no-show-locs to all existing test arguments. Run a few of the existing tests again, but without this option. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abicompat.cc: Handle the new "--no-show-locs" option. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> |
||
Dodji Seketeli
|
43c908ed15 |
Bug 19336 - Better handle redundantly qualified reference types
Sometimes we can see const references in DWARF. But then, a reference is always const, so that qualified reference is redundant. Furthermore, having that construct make its way into the internal representation can cause awkward diagnostics. The DWARF reader was thus eliding such redundant qualifiers in the function "maybe_strip_qualification". It was doing so by stripping the qualifier from the qualified type. So const reference, for instance, becomes a (non-qualified) reference. In that case, we are turning a qualified type into a non-qualified one. But as the accompanying problem report suggests, this can cause issues during the DWARF parsing. This is because a given Debug Information Entry (DIE) of qualified type kind can be referenced elsewhere, by another type. That other type expects that DIE to be a qualified type. And libabigail's DWARF reader code enforces that. So the internal representation of a type resulting from a qualified type DIE must be a qualified type itself. So the way the function "maybe_strip_qualification" was doing the redundancy elision was wrong. This patch fixes that by keeping the type qualified, but introducing a "no-op" qualifier. Actually, the IR already has that "no-op" qualifier: abigail::ir::qualified_type_def::CV_NONE. So now "maybe_strip_qualification" just turns the CV_CONST qualifier into a CV_NONE one when the former is redundant. Now that the libabigail type system actually *has* types qualified with this no-op qualifier, we need to handle things like printing the name of such qualified types. When we are printing the name of the type for internal reasons (i.e, for type canonicalization purposes) we need to make a difference between the name of a no-op qualified type and the name of the underlying type of the qualified type, otherwise, the canonicalizer wrongly considers the two types as being equal. But then when we are printing the name of the no-op qualified type for diagnostics reasons, then the name is the same as the name of its underlying unqualified type. * src/abg-dwarf-reader.cc (maybe_strip_qualification): Do not nuke the qualified type. Rather, just turn the redundant const qualifier into a no-op one. * src/abg-comparison.cc (compute_diff_for_types): Look through no-op qualified types. * include/abg-ir.h (decl_base::{peek,set}_temporary_qualified_name): Declare new accessors. * src/abg-ir.cc (decl_base::priv::temporary_qualified_name_): New data member. (decl_base::{peek,set}_temporary_qualified_name): Define new accessors. (qualified_type_def::priv::{temporary_internal_name_, internal_name}): New data members. (qualified_type_def::build_name): For a no-op qualified type, the internal name (which contains the 'none' qualifier) is different from the non-internal name. (qualified_type_def::get_qualified_name): Handle temporary names and non-temporary names in two different caches. Also handle internal and non-internal names in two different caches. This makes four different caches. (qualified_name_setter::do_update): Do not touch the non-internal, non-temporary qualified name cache if the qualified parent name is empty. * tools/abidw.cc (main): change --check-alternate-debug-info to make it *not* display the name/path to the alternate debug info, when it's found. Rather, only --check-alternate-debug-info-base-name keeps displaying the base name of the alternate debug info. * tests/data/test-alt-dwarf-file/test1-libgromacs-debug-dir/*: New test material. * tests/data/Makefile.am: Add the new test material to the build system. * tests/test-alt-dwarf-file.cc (in_out_specs): Take the new test input into account. * tests/data/test-read-dwarf/test1.abi: Adjust. * tests/data/test-read-dwarf/test7.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/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/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7722e27a89 |
Do not abort when there is no binary to compare in a package
When given a package which has no binary to compare, abipkgdiff aborts. This patch fixes that. * tests/data/test-diff-pkg/empty-pkg-libvirt-0.9.11.3-1.el7.ppc64.rpm: New input test package. * tests/data/test-diff-pkg/empty-pkg-libvirt-1.2.17-13.el7_2.2.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/empty-pkg-report-0.txt: New test reference output. * data/Makefile.am: Add the new test material above to the build system. * tests/test-diff-pkg.cc (int_out_specs): Add the new test inputs to the set of tests. * tools/abipkgdiff.cc (compare): Do not abort if there is no binary to compare. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
18c3ce3e56 |
Correctly handle fn DIE with abstract_origin in alt debug info
When a function decl DIE is in the main DWARF file but has an abstract origin that is in the alternate DWARF file, the dwarf reader mistakenly considers the resulting function decl as being for a DIE that is in the alternate DWARF file. Fixed thus. * src/abg-dwarf-reader.cc (build_ir_node_from_die): Consider that the function decl is for a DIE in the alternate debug info file only if the DIE itself comes from the alternate debug info file, not if the specification or the origin of the function comes from the alternate debug info file. * tests/data/test-diff-pkg/qemu-img-rhev-2.3.0-20.el7.ppc64.rpm: New test input rpm. * tests/data/test-diff-pkg/qemu-img-rhev-2.3.0-7.el7.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/qemu-kvm-rhev-debuginfo-2.3.0-20.el7.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/qemu-kvm-rhev-debuginfo-2.3.0-7.el7.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/qemu-img-rhev-2.3.0-7.el7.ppc64--qemu-img-rhev-2.3.0-20.el7.ppc64-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-pkg.cc (in_out_specs): Use the new test rpm inputs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3f22e252ae |
Avoid canonicalizing function types too early
In the DWARF reader it can happen that a function type being built is canonicalized too early, before the type is done building. This leads to some spurious type differences later at comparison time. It typically happens when a sub-type of the function type refers to the function type itself. We correctly handle similar cases for class types, but not for function types. Oops. This patch handles this case for function types in the dwarf reader and in the abixml reader. * src/abg-dwarf-reader.cc (die_function_type_map_type): New typedef. * (): (read_context::die_wip_function_types_map_): New data member. (read_context::{die_wip_function_types_map, is_wip_function_type_die_offset}): New methods. (build_function_type): Mark the function being built as "work in progress". (maybe_canonicalize_type): Do not early-canonicalize WIP function types. * src/abg-reader.cc (build_function_type): Mark the function being built as "work in progress". * tests/test-diff-dwarf-abixml.cc: New test harness. * tests/Makefile.am: Add new test harness runtestdiffdwarfabixml to the build system. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1: New test binary input. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: New test input. * tests/data/Makefile.am: Add new test inputs to source distribution. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4a8ea96dab |
Propagate environment property to base specifiers
It appears that when setting a base class specifier for a given class, the environment of the class is not propagated to the base specifier. This patch fixes that. * src/abg-comparison.cc (compute_diff): In the overload for class_decl::base_spec_sptr, assert that the environment of the base classes are equal and that the environment the base class is the same as the environment of the base specifier. * src/abg-ir.cc (add_base_specifier): Propagate the environment of the class to its base specifiers. * tests/data/test-types-stability/pr19026-libvtkIOSQL-6.1.so.1: New test binary input. * tests/data/Makefile.am: Add the new test input to the build system. * tests/test-types-stability.cc (elf_paths): Add new binary to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5d24cf87d7 |
Support DW_AT_count DWARF attribute
Libabigail's DWARF reader does not support the DW_AT_count attribute used to specify the number of elements in an array subrange. Rather, it uses the DW_AT_lower_bound and DW_AT_upper_bound attributes that are emitted by GCC. Recent versions of Clang, on the other hand, use the DW_AT_count attribute. This patch adds support for the DW_AT_count attribute too. * src/abg-dwarf-reader.cc (get_default_array_lower_bound): Define new static function. (build_array_type): Support the DW_AT_count attribute. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-clang.so: New test binary input. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-clang2.so: Likewise. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-clang-report-0.txt: New test reference output. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-gcc.so: New test binary input. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-gcc2.so: New test binary input. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-gcc-report-0.txt: New test reference output. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long.c: Source code for the binaries above. * tests/data/Makefile.am: Add the new test material to the build system. * tests/test-diff-dwarf.cc (in_out_specs): Add the new test inputs to the harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ba980025fb |
Bug 19173 - Abidiff doesn't detect symbol size change in library
It appears that libabigail does not represent the size of ELF symbols, so it doesn't detect when a symbol size changes without impacting the size of the type of said symbol, as described by debug info. It appears that Address Sanitizer as implemented by Clang does change the size of variable symbols when it instruments those variables. And of course, the size of type of said symbols (as described by debug information) remains unchanged. This patch makes Libabigail become aware of symbol sizes, especially for variables. Symbol sizes for functions are ignored for now, because a change in a function symbol size is not an ABI change. The patch makes libabigail detect and report symbol size changes for variables, but looking at the ELF information, independently from the debug information. The patch adjusts the existing tests and adds a new test using the binaries that were filed in the bug report. * include/abg-ir.h (elf_symbol::{elf_symbol, create}): Take a size parameter. (elf_symbol::{get,set}_size): New accessors. * src/abg-ir.cc (elf_symbol::priv::size_): New data member. (elf_symbol::priv::priv): Initialize it. (elf_symbol::{elf_symbol, create}) Take a size parameter. (textually_equals): Compare the size of variable symbols. (elf_symbol::{get, set}_size): New accessors. * src/abg-comparison.cc (maybe_report_diff_for_symbol): New static function. ({function_decl_diff,var_diff}::report): Use it. * src/abg-dwarf-reader.cc (lookup_symbol_from_sysv_hash_tab) (lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_symtab) (read_context::lookup_elf_symbol_from_index): Set the size of the elf symbols' internal representation. * src/abg-reader.cc (build_elf_symbol): Read the size attribute if present. * src/abg-writer.cc (write_elf_symbol): Write the size attribute for variable symbols, if it's not zero. * tests/data/test-diff-dwarf/test34-pr19173-libfoo.so: New test input binary. * tests/data/test-diff-dwarf/test34-pr19173-libfoo2.so: Likewise. * tests/data/test-diff-dwarf/test34-pr19173-libfoo-report-0.txt: New reference test output. * tests/data/Makefile.am: Add the new test input binaries to the build system. * tests/test-diff-dwarf.cc (in_out_specs): Add the new test input above to the test harness. * tests/data/test-diff-dwarf/test9-report.txt: Adjust. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-read-dwarf/test0.abi: Likewise. * tests/data/test-read-dwarf/test1.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test6.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7b35e89315 |
Bug 19139 - DWARF reader doesn't handle garbage in function names
In this bug, the DWARF debug info of the binary (generated by Intel's ICC compiler) has interesting constructs like: [ 6b5a0] subprogram decl_line (data2) 787 decl_column (data1) 15 decl_file (data1) 46 declaration (flag) accessibility (data1) public (1) type (ref4) [ 6b56a] prototyped (flag) name (string) "ldiv" MIPS_linkage_name (string) "ldiv" [ 6b5b6] formal_parameter type (ref4) [ 5f2aa] name (string) "$Ë2" [ 6b5bf] formal_parameter type (ref4) [ 5f2aa] name (string) "$Ë3" Note the strings that make up the name of the formal parameters of the function, near the end: [ 6b5b6] formal_parameter type (ref4) [ 5f2aa] name (string) "$Ë2" [ 6b5bf] formal_parameter type (ref4) [ 5f2aa] name (string) "$Ë3" The strings "$Ë2" and $Ë3" (which are the names of the parameters of the function) are garbage. Libabigail's DWARF reader naively uses those strings as names for the function parameters, in the type of the function. Then, the abixml writer emits an XML document, with these strings as property values, representing the name of the type of the function. And of course, the XML later chokes when it tries to read that XML document, saying that the property is not valid UTF-8. This patch addresses the issue by dropping those garbage names on the floor, for function type names. In that context, any string that is not made of ASCII characters is considered as being garbage, for now. The patch, in the abixml writer, also escapes function parameters names so that they don't contain characters that are not allowed in XML. The abixml reader already handles the un-escaping of the names it reads, so I think there is nothing to do there. Ultimately, I guess I should get the unicode value of the characters of that string, encode the string into UTF-8 and use the result as the name for the parameter. That would mean using UTF-8 strings for function parameter names, and, for all declarations names. But that is too much for worfk too little gain for now. The great majority of the binaries we are dealing with are still using ASCII for declaration names. The patch also introduces a new test harness that runs "abidw --abidiff" on a bunch of input binaries. This harness runs over the binaries that were submitted in this bug report. * include/abg-tools-utils.h (string_is_ascii): Declare new function ... * src/abg-tools-utils.cc (string_is_ascii): ... and define it. * src/abg-writer.cc (write_function_type): Escape forbidden XML characters in function type names. * src/abg-dwarf-reader.cc (build_function_type): If a parameter name is not ascii, drop it on the floor. * tests/data/test-types-stability/pr19139-DomainNeighborMapInst.o: New test input binary. * tests/data/test-types-stability/pr19202-libmpi_gpfs.so.5.0: Likewise. * tests/data/Makefile.am: Add the new binaries above to the build system. * tests/test-types-stability.cc: New test harness. * tests/Makefile.am: Add the new test harness to the build system. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
14ff32b322 |
Adjust regression tests reference output for the current patch set
This is the last patch of a series of patches which aims at fixing bug libabigail/19097. The short titles of the patches of the set are, including this one: Don't canonicalize types not added to their context in abixml reader Support updating a class in the abixml reader Fix emitting of referenced type in abixml writer Use abidw --abidiff in test-read-dwarf.cc Adjust regression tests reference output for the current patch set Below is the cover letter of the last patch of the set. The current patch set needs big reference output adjustments, that we are doing at the end, here. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so: New test input binary. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: New test reference output. * tests/data/Makefile.am: Add the new test files above to the source distribution. * tests/test-read-dwarf.cc (in_out_specs): Add the two new test files above to the set of test input files. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.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/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.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/test9-pr18818-clang.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
09de4435ce |
Bug 19092 - abidw aborts on types that violate the ODR
It appears that two different types from two different translation units might have the same name in a DSO, like in the example of this bug. This violates the One Definition Rule, which we rely on to go fast, and more importantly, it introduces type canonicalization errors. This patch recognizes more of these ODR violation cases by looking at the size of the types. That is, if two types (from the same DSO) with the same name have different sizes, then they are different. * src/abg-ir.cc (type_base::get_canonical_type_for): Look at the size of types with the same name which could be considered ODR-equal, to spot possible violations that would induce a type canonicalization error. * tests/data/test-read-dwarf/test21-pr19092.so: New test input binary. * tests/data/test-read-dwarf/test21-pr19092.so.abi: New reference abixml for the binary above. * tests/data/Makefile.am: Add the new test input above to source distribution. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/test-read-dwarf.cc (int_out_specs): Add the two test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
33b4badd03 |
Adjust tests for the patchset
This is the last patch of the series of patches whose titles are (including this one): Force late canonicalizing of function types read from abixml Fix strip_typedef issues Do not compare access specs for member types & functions Fix "is-anonymous" abixml property impact on some tests Fix const-ness of a function parameter Handle aliased function decls when comparing decls in general Make canonicalization non sensitive to struct-ness of subtypes Set the corpus of all ABI artifact reads from abixml Implement fast type lookup in a corpus Accelerate a slow path in hash_type_or_decl() A series of small speed optimizations here and there Allow only one definition of a given type per corpus in abixml Make abidw --abidiff not show definitely harmless changes Adjust tests for the patchset This patch carries the numerous adjustments necessary for the regresion tests output after this patch set. * tests/data/test-read-dwarf/test10-pr18818-gcc.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/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |