mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-17 15:34:34 +00:00
6eee409137
657 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
6eee409137 |
Add primitives callable from the command line of the debugger
During debugging it can be extremely useful to be able to visualize the data members of a class type, instance of abigail::ir::class_decl*. It's actually useful to visualize the pretty representation (type name and kind) of all types and decls that inherit abigail::ir::type_or_decl_base, basically. Today, in the debugger, if we have a variable defined as "abigail::ir::type_or_decl_base* t", we can type: $ p t->get_pretty_representation(true, true); This would display something like: $ typedef foo_t However, if 't' is declared as: "abigail::ir::class_decl* t", then if we type: (gdb) p t->get_pretty_representation(true, true); We'll get something like: class foo_klass (gdb) So we get the kind and the name of the ABI artifact; but in case of a class, we don't get the details of its data members. This patch introduces a function named "debug" which, would be invoked on the 't' above like this: (gdb) p debug(t) I would yield: struct tm { // size in bits: 448 // translation unit: test24-drop-fns.cc // @: 0x5387a0, @canonical: 0x5387a0 int tm_sec; // uses canonical type '@0x538270' int tm_min; // uses canonical type '@0x538270' int tm_hour; // uses canonical type '@0x538270' int tm_mday; // uses canonical type '@0x538270' int tm_mon; // uses canonical type '@0x538270' int tm_year; // uses canonical type '@0x538270' int tm_wday; // uses canonical type '@0x538270' int tm_yday; // uses canonical type '@0x538270' int tm_isdst; // uses canonical type '@0x538270' long int tm_gmtoff; // uses canonical type '@0x461200' const char* tm_zone; // uses canonical type '@0x544528' }; (gdb) This gives much more information to understand what 't' designates. The patch also provides functions to retrieve one data member from a given type that happens to designate a class type. For instance: (gdb) p get_data_member(t, "tm_sec") This would yield: $19 = std::shared_ptr<abigail::ir::var_decl> (use count 4, weak count 0) = {get() = 0x9d9a80} We could visualize that data member by doing: (gdb) p debug(get_data_member(t, "tm_sec")._M_ptr) int tm::tm_sec (gdb) The patch also provides a new 'debug_equals' function that allow us to easily perform an artifact comparison from the command line of the debugger, as well as methods to the environment type to poke at the canonical types available in the environment. These new debugging primitives already proved priceless while debugging issues that are fixed by subsequent patches to come. * include/abg-fwd.h (get_debug_representation, get_data_member) (debug, debug_equals): Declare new functions. * include/abg-ir.h (environment{get_canonical_types, get_canonical_type}): Declare new member functions. * src/abg-ir.cc (environment::{get_canonical_types, get_canonical_type}): Define new member functions. (get_debug_representation, get_data_member) (debug, debug_equals): Define new functions. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
09c7a773a3 |
reader: Use xmlFirstElementChild and xmlNextElementSibling rather than xml::advance_to_next_sibling_element
The xml::advance_to_next_sibling_element is redundant with the xmlNextElementSibling API of libxml. Similarly, xmlFirstElementChild is redundant with using xml::advance_to_next_sibling_element on the xmlNode::children data member. Let's use the libxml API instead. * include/abg-libxml-utils.h (advance_to_next_sibling_element): Remove the declaration of this function. * src/abg-libxml-utils.cc (go_to_next_sibling_element_or_stay) (advance_to_next_sibling_element): Remove definitions of these functions. * src/abg-reader.cc (read_translation_unit_from_input) (read_elf_needed_from_input, read_corpus_group_from_input): Use xmlNextElementSibling instead of xml::advance_to_next_sibling_element. (read_corpus_from_input): Likewise. Also, use xmlFirstElementChild instead of xml::advance_to_next_sibling_element on the xmlNode::children data member. (read_corpus_group_from_input): use xmlFirstElementChild instead of xml::advance_to_next_sibling_element on the xmlNode::children data member. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Maennich
|
acc4bea0b8 |
symtab: Add support for MODVERSIONS (CRC checksums)
The Linux Kernel has a mechanism (MODVERSIONS) to checksum symbols based on their type. In a way similar to what libabigail does, but different. The CRC values for symbols can be extracted from the symtab either by following the __kcrctab_<symbol> entry or by using the __crc_<symbol> value directly. This patch adds support for extracting those CRC values and storing them as a property of elf_symbol. Subsequently, 'crc' gets emitted as an attribute of 'elf-symbol' in the XML representation. CRC comparisons are also added to the abidiff machinery such that if both representations of a comparison contain a CRC value, they will be compared and if any of the values is unset (i.e. == 0), equality is assumed. Differences will be reported in the format that the Kernel presents them e.g. via Module.symvers. It is likely, but not necessary, that a CRC difference comes along with an ABI difference reported by libabigail. Not everything that leads to a change of the CRC value an ABI breakage in the libabigail sense. In case a function or variable symbol changes in a harmless way, we would previously also consider a CRC change harmless (or more precise: not harmful). Explicitly testing for CRC changes when analyzing whether diff nodes need to be considered harmful, allows to still classify them harmful. Also add some test cases to ensure reading CRC values from kernel binaries works as expected. The empty-report files have been consolidated to one file: empty-report.txt. That also clarifies the expected outcome for the affected tests. * include/abg-ir.h (elf_symbol::elf_symbol): Add CRC parameter. (elf_symbol::create): Likewise. (elf_symbol::get_crc): New member method. (elf_symbol::set_crc): New member method. * src/abg-comp-filter.cc (crc_changed): New function. (categorize_harmful_diff_node): Also test for CRC changes. * src/abg-ir.cc (elf_symbol::priv::crc_): New data member. * src/abg-ir.cc (elf_symbol::priv::priv): Add CRC parameter. (elf_symbol::elf_symbol): Likewise. (elf_symbol::create): Likewise. (elf_symbol::textually_equals): Add CRC support. (elf_symbol::get_crc): New member method. (elf_symbol::set_crc): New member method. * src/abg-reader.cc (build_elf_symbol): Add CRC support. * src/abg-reporter-priv.cc (maybe_report_diff_for_symbol): Likewise. * src/abg-symtab-reader.cc (symtab::load): Likewise. * src/abg-writer.cc (write_elf_symbol): Likewise. * tests/data/Makefile.am: Add new test data files. * tests/data/test-abidiff-exit/test-crc-report.txt: New test file. * tests/data/test-abidiff-exit/test-crc-v0.abi: Likewise. * tests/data/test-abidiff-exit/test-crc-v1.abi: Likewise. * tests/data/test-abidiff/empty-report.txt: New file. * tests/data/test-abidiff/test-PR18166-libtirpc.so.report.txt: Deleted. * tests/data/test-abidiff/test-PR24552-report0.txt: Deleted. * tests/data/test-abidiff/test-crc-0.xml: New test file. * tests/data/test-abidiff/test-crc-1.xml: Likewise. * tests/data/test-abidiff/test-crc-2.xml: Likewise. * tests/data/test-abidiff/test-crc-report.txt: Likewise. * tests/data/test-abidiff/test-empty-corpus-report.txt: Deleted. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Add CRC values. * tests/data/test-read-write/test-crc.xml: New test data file. * tests/data/test-symtab/kernel-modversions/Makefile: New test source. * tests/data/test-symtab/kernel-modversions/one_of_each.c: Likewise. * tests/data/test-symtab/kernel-modversions/one_of_each.ko: Likewise. * tests/test-abidiff-exit.cc: Add new test case. * tests/test-abidiff.cc: Add new test case. * tests/test-read-write.cc: Likewise. * tests/test-symtab.cc (Symtab::KernelSymtabsWithCRC): New test case. Reviewed-by: Giuliano Procida <gprocida@google.com> Reviewed-by: Dodji Seketeli <dodji@seketeli.org> Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
ff4b4a56b4 |
symtab/dwarf-reader: allow hinting of main symbols for aliases
In case of aliased symbols, the "main symbol" cannot be deduced from the symtab as this solely contains a name->addr mapping and aliases are represented by multiple names resolving to the same address. Therefore the main symbol can only be picked rather randomly and unpredictable. Unlike DWARF, which contains a single symbol entry for only the main symbol. Hence we can (late) detect the main symbol. Exploiting that property allows to correct the addr->symbol lookup in the symtab to return the correct main symbol and it also allows to correct the aliased symbols to maintain the correct main symbol. This patch adds the `update_main_symbol` functionality to `elf_symbol` to update the main symbol by name (ELF symbols need unique names) and adds `update_main_symbol` to `symtab` that makes use of said new method. When we discover a main symbol during DWARF reading, we instruct the symtab to update the mapping. This creates consistent representations across different builds of the same binary with the same ABI by pinning down the main symbol to the defined one. Knowing the main symbol also helps to keep the correct dwarf information in the representation in the presence of symbol suppressions. A later patch will address that. Some test cases in tests/data need adjustment and they have all been verified to be valid changes. - main symbol changed for various elf symbols - test-annotate/test15-pr18892.so.abi - test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi - test-annotate/test3.so.abi - test-read-dwarf/test15-pr18892.so.abi - test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi - test-read-dwarf/test3.so.abi - test-read-dwarf/test3.so.hash.abi - due to main symbol changes, the symbol diff needs to be corrected - test-diff-dwarf/test12-report.txt - test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt - test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt - the test scenario needed adjustments as the main symbol changed - test-diff-suppr/test23-alias-filter-4.suppr - test-diff-suppr/test23-alias-filter-report-0.txt - test-diff-suppr/test23-alias-filter-report-2.txt As usual, the complete changelog follows. * include/abg-ir.h (elf_symbol::update_main_symbol): New method. * include/abg-symtab-reader.h (symtab::update_main_symbol): New method. * src/abg-dwarf-reader.cc (build_var_decl): Hint symtab about main symbol discovered in DWARF. (build_function_decl): Likewise. * src/abg-ir.cc (elf_symbol::get_main_symbol): Lock the weak_ptr on access in both overloads. (update_main_symbol): New method to allow updating the main symbol. * src/abg-symtab-reader.cc (symtab::update_main_symbol): New method. * data/Makefile.am: Add new test data files. * tests/data/test-annotate/test15-pr18892.so.abi: Updated test file. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-diff-dwarf/test12-report.txt: Likewise. * tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-4.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test2.so.abi: Likewise. * tests/data/test-read-dwarf/test2.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test3.so.abi: Likewise. * tests/data/test-read-dwarf/test3.so.hash.abi: Likewise. * tests/data/test-symtab/basic/aliases.c: New test source file. * tests/data/test-symtab/basic/aliases.so: Likewise. * tests/test-symtab.cc (Symtab::AliasedFunctionSymbols): New test case. (Symtab::AliasedVariableSymbols): Likewise. Reviewed-by: Giuliano Procida <gprocida@google.com> Reviewed-by: Dodji Seketeli <dodji@seketeli.org> Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
3abd9742b7 |
dwarf reader: drop (now) unused code related to symbol table reading
The introduction of the new symtab reader incorporated much of the existing functionality. Now that the most code parts are migrated to the new symtab reader, we can safely remove the old code paths. Ignoring the symbol table is not a thing anymore. The new symtab reader does read the symtab unconditionally for consistency reasons. Hence also remove all functionality around conditional symtab reading. * include/abg-dwarf-reader.h (set_ignore_symbol_table): Remove. (get_ignore_symbol_table): Likewise. * src/abg-dwarf-reader.cc (add_symbol_to_map): Likewise. (read_context::options_type::ignore_symbol_table): Likewise. (read_context::options_type): Adjust. (read_context::fun_addr_sym_map_): Remove. (read_context::fun_entry_addr_sym_map_): Likewise. (read_context::fun_syms_): Likewise. (read_context::var_addr_sym_map_): Likewise. (read_context::var_syms_): Likewise. (read_context::undefined_fun_syms_): Likewise. (read_context::undefined_var_syms_): Likewise. (read_context::initialize): Adjust. (read_context::lookup_elf_symbol_from_index): Remove. (read_context::fun_entry_addr_sym_map_sptr): Likewise. (read_context::fun_entry_addr_sym_map): Likewise. (read_context::fun_syms_sptr): Likewise. (read_context::fun_syms): Likewise. (read_context::var_syms_sptr): Likewise. (read_context::var_syms): Likewise. (read_context::undefined_fun_syms_sptr): Likewise. (read_context::undefined_var_syms_sptr): Likewise. (read_context::load_symbol_maps_from_symtab_section): Likewise. (read_context::load_symbol_maps): Likewise. (read_context::maybe_load_symbol_maps): Likewise. (set_ignore_symbol_table): Likewise. (get_ignore_symbol_table): Likewise. (create_default_var_sym): Likewise. (build_var_decl): Adjust. (function_is_suppressed): Likewise. (variable_is_suppressed): Likewise. (build_function_decl): Likewise. (add_symbol_to_map): Remove. (read_corpus_from_elf): Adjust. (build_corpus_group_from_kernel_dist_under): Likewise. * tools/abidw.cc (main): Likewise. Reviewed-by: Giuliano Procida <gprocida@google.com> Reviewed-by: Dodji Seketeli <dodji@seketeli.org> Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
7851ca2b91 |
abg-corpus: remove symbol maps and their setters
With the prework in previous commits, we are now able to drop the public symbols maps in corpus::priv and replace them by private members with access through getters. The getters use the new symtab implementation to generate the maps on the fly. Setters are not required anymore and are removed. Also remove redundant getters. We could also remove the getters for the symbol maps and the local caching variable and leave it all to lookup_symbol, but this is left for a later change. * include/abg-corpus.h (corpus::set_fun_symbol_map): Remove method declaration. (corpus::set_undefined_fun_symbol_map): Likewise. (corpus::set_var_symbol_map): Likewise. (corpus::set_undefined_var_symbol_map): Likewise. (corpus::get_fun_symbol_map_sptr): Likewise. (corpus::get_undefined_fun_symbol_map_sptr): Likewise. (corpus::get_var_symbol_map_sptr): Likewise. (corpus::get_undefined_var_symbol_map_sptr): Likewise. * src/abg-corpus-priv.h (corpus::priv::var_symbol_map): make private and mutable (corpus::priv::undefined_var_symbol_map): Likewise. (corpus::priv::fun_symbol_map): Likewise. (corpus::priv::undefined_fun_symbol_map): Likewise. (corpus::priv::get_fun_symbol_map): New method declaration. (corpus::priv::get_undefined_fun_symbol_map): Likewise. (corpus::priv::get_var_symbol_map): Likewise. (corpus::priv::get_undefined_var_symbol_map): Likewise. * src/abg-corpus.cc (corpus::priv::get_fun_symbol_map): New method implementation. (corpus::priv::get_undefined_fun_symbol_map): Likewise. (corpus::priv::get_var_symbol_map): Likewise. (corpus::priv::get_undefined_var_symbol_map): Likewise. (corpus::is_empty): depend on symtab only. (corpus::set_fun_symbol_map): Remove method. (corpus::set_undefined_fun_symbol_map): Likewise. (corpus::set_var_symbol_map): Likewise. (corpus::set_undefined_var_symbol_map): Likewise. (corpus::get_fun_symbol_map_sptr): Likewise. (corpus::get_undefined_fun_symbol_map_sptr): Likewise. (corpus::get_var_symbol_map_sptr): Likewise. (corpus::get_undefined_var_symbol_map_sptr): Likewise. (corpus::get_fun_symbol_map): Use corpus::priv proxy method. (corpus::get_undefined_fun_symbol_map): Likewise. (corpus::get_var_symbol_map): Likewise. (corpus::get_undefined_var_symbol_map): Likewise. * src/abg-dwarf-reader.cc (read_debug_info_into_corpus): Do not set corpus symbol maps anymore. * src/abg-reader.cc (read_corpus_from_input): Likewise. * tests/test-symtab.cc (assert_symbol_count): Do not access the corpus symbol maps through sptr anymore. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Adjust expected test output. Reviewed-by: Giuliano Procida <gprocida@google.com> Reviewed-by: Dodji Seketeli <dodji@seketeli.org> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Maennich
|
ae094e349e |
Integrate new symtab reader into corpus and read_context
While reading the corpus in the read_context, also load the new type symtab object side-by-side and set it accordingly in the resulting corpus. This is still side by side and passive code that gets active in the following changes. This is applicable for the dwarf reader as well as for the reader that consumes XML. * include/abg-corpus.h (corpus::set_symtab): New method declaration. (corpus::get_symtab): New method declaration. * include/abg-fwd.h (symtab_reader::symtab_sptr): New forward declaration. * src/abg-corpus-priv.h (corpus::priv::symtab_): New data member. * src/abg-corpus.cc (corpus::set_symtab): Likewise. (corpus::get_symtab): Likewise. * src/abg-dwarf-reader.cc (read_context::symtab_): New data member. (read_context::initialize): reset symtab_ as well (read_context::symtab): new method that loads a symtab on first access and returns it. (read_debug_info_into_corpus): also set the new symtab object on the current corpus. (read_corpus_from_elf): Also determine (i.e. load) the new symtab object and contribute to the load status. * src/abg-reader.cc (read_corpus_from_input): also set the new type symtab when reading from xml. * tests/test-symtab.cc: Add test assertions. Reviewed-by: Giuliano Procida <gprocida@google.com> Reviewed-by: Dodji Seketeli <dodji@seketeli.org> Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Dodji Seketeli
|
2eefd17276 |
Bug 27569 - abidiff misses a function parameter addition
Adding or deleting function parameters are changes that have not yet been categorized in the comparison engine. As a result, those changes can be considered harmless and thus be filtered out. Oops. This patch categorizes function addition and removal as FN_PARM_ADD_REMOVE_CHANGE_CATEGORY, which is a new category being introduced. Changes in this category are considered harmful and are thus always reported by default. * include/abg-comparison.h (enum diff_category): Add a new FN_PARM_ADD_REMOVE_CHANGE_CATEGORY enumerator and adjust the following enumerator values. Update the EVERYTHING_CATEGORY accordingly. (function_type_diff::{sorted_deleted_parms, sorted_added_parms}): Add new member functions. * src/abg-comparison.cc (function_type_diff::{sorted_deleted_parms, sorted_added_parms}): Define new accessors. (get_default_harmful_categories_bitmap): Consider changes of the category FN_PARM_ADD_REMOVE_CHANGE_CATEGORY as harmful. (operator<<(ostream& o, diff_category c)): Support the new FN_PARM_ADD_REMOVE_CHANGE_CATEGORY while serializing a category bitmap. * src/abg-comp-filter.cc (has_added_or_removed_function_parameters): Define new static function. (categorize_harmful_diff_node): Categorize diff nodes representing function parameter addition or removal as FN_PARM_ADD_REMOVE_CHANGE_CATEGORY. * tests/data/test-diff-filter/test-PR27569-report-0.txt: New test reference output. * tests/data/test-diff-filter/test-PR27569-v{0,1}.abi: New test inputs. * tests/data/Makefile.am: Add the new test inputs to the source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the new test inputs to this test harness. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Adjust. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ben Woodard via Libabigail
|
05d33d607a |
Bug 27512 - Remove broken zip-archive support
The optional zip archive feature was broken when the concept of
environment was introduced by commit
|
||
Matthias Maennich
|
b67fb3f2e3 |
abg-ir: elf_symbol: add is_suppressed field
In the context of libabigail and a single library run (when reading from dwarf or from xml), a symbol is either suppressed or it is not. While one could argue that this is a property of the read_context, the read_context might not be around anymore when the symbol still is. Hence, persist the 'is_suppressed' state along with the symbol itself. * include/abg-ir.h (elf_symbol::elf_symbol): Add is_suppressed parameter. (elf_symbol::create): Likewise. (elf_symbol::is_suppressed): New getter declaration. (elf_symbol::set_is_suppressed): New setter declaration. * src/abg-ir.cc (elf_symbol::priv::priv): Add is_suppressed parameter. (elf_symbol::priv::is_suppressed_): New field. (elf_symbol::elf_symbol): Add is_suppressed parameter. (elf_symbol::create): Likewise. (elf_symbol::is_suppressed): New getter implementation. (elf_symbol::set_is_suppressed): New setter implementation. Reviewed-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Maennich
|
573c4cad5a |
abg-ir: elf_symbol: add is_in_ksymtab field
Being exported through a ksymtab (in case of Linux Kernel binaries) is actually a property of the Elf symbol itself and we can therefore track it along with the symbol that we collect from symtab. While tracking is currently done by keeping separate symbol lists and maps for symtab and ksymtab symbols, they can be consolidated having a property to indicate whether this symbol also appeared as a ksymtab entry. Hence, and for future changes in this area, add this property and update all references. The flag is false initially unless otherwise specified. * include/abg-ir.h (elf_symbol::elf_symbol): Add is_in_ksymtab parameter. (elf_symbol::create): Likewise. (elf_symbol::is_in_ksymtab): New getter declaration. (elf_symbol::set_is_in_ksymtab): New setter declaration. * src/abg-ir.cc (elf_symbol::priv::priv): Add is_in_ksymtab parameter. (elf_symbol::priv::is_in_ksymtab_): New field. (elf_symbol::elf_symbol): Add is_in_ksymtab parameter. (elf_symbol::create): Likewise. (elf_symbol::is_in_ksymtab): New getter implementation. (elf_symbol::set_is_in_ksymtab): New setter implementation. Reviewed-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Maennich
|
c92d724e01 |
abg-cxx-compat: add simplified version of std::optional
In the absence (but desire) of std::optional<T>, add a simplified version of it to abg_compat:: in case we are compiling with a pre-C++17 standard. Otherwise use std::optional from <optional> directly. This is being used by a later patch and serves as a prerequisite. It only serves the purpose of being a compatibility implementation and does not claim to be complete at all. Just enough for the project's needs. * include/abg-cxx-compat.h (abg_compat::optional): Add new class. * tests/tests-cxx-compat.cc: Add new test cases. Reviewed-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Ben Woodard via Libabigail
|
701de3ba5d |
Fix declaratons of conditionally defined functions
Functions relating to zip archives are declared but are never compiled when --enable-zip-archive=no, the default. This makes sure that they are not declared when they won't be defined due to conditional compilation. * include/abg-reader.h (read_corpus_from_file): Guard the declaration of these overloads with #ifdef WITH_ZIP_ARCHIVE. * tools/abilint.cc: Guard the use of abigail::xml_reader::read_corpus_from_file with #ifdef WITH_ZIP_ARCHIVE. Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f433d4dbdb |
Revert "Fix declaratons of conditionally defined functions"
I forgot to edit the commit message of this commit to make it comply
with the rules in https://sourceware.org/git/?p=libabigail.git;a=blob;f=COMMIT-LOG-GUIDELINES.
So I am reverting commit
|
||
Ben Woodard via Libabigail
|
cd2af9e5f5 |
Fix declaratons of conditionally defined functions
Functions relating to zip archives are declared but are never compiled when --enable-zip-archive=no, the default. This makes sure that they are not declared when they won't be defined due to conditional compilation. Signed-off-by: Ben Woodard <woodard@redhat.com> |
||
Dodji Seketeli
|
77bc4b7b15 |
Don't consider type name when comparing typedefs
This is from a problem report originating from Red Hat bugzilla at https://bugzilla.redhat.com/show_bug.cgi?id=1925876 I some C programs, the same type can be defined more than once in a binary, as there is no "One Definition Rule[1]" in C. [1]: https://en.wikipedia.org/wiki/One_Definition_Rule The definition of those two types can be slightly different and yet be equivalent. For instance, the data member of a struct S might be defined once as having a type which is a typedef Foo of, say, "long int" and that struct S might be defined again elsewhere with a data member of type typedef Bar of "long int" as well. With the current code, because Foo and Bar have different names, they are are going to compare different; so the two struct S are doing to compare different even though they are equivalent. Down the road, this is likely going to imply that the several 'struct S' that are declaration-only will not be resolved as being declarations of the definition of "struct S", because they is more than one such definition, and those definitions are different. This is going to lead to spurious (and hard to debug) type differences that are going to be detected and reported by libabigail later down the road. This patch addresses the problem by not taking typedef names into account when comparing typedefs before canonicalization. That allows the comparison of classes and structs that happens during the resolution of declaration-only classes to correctly deduce their equivalence even in cases like the one exposed above. It thus reduces the amount of declaration-only classes that are unnecessarily considered to be different from the definition they ought to equal. * include/abg-ir.h (maybe_compare_as_member_decls): Declare new function. Make it a friend of class decl_base. * src/abg-dwarf-reader.cc (maybe_canonicalize_type): Don't early canonicalize typedefs because they can be "part" of a type that is not yet completed, especially considering that class declaration resolution is part of type building, stricto sensu. * src/abg-ir.cc (maybe_compare_as_member_decls): Factorize this out of ... (equals): ... the overload for decl_base. Use it in the overload for typedef_decl. * tests/data/test-diff-pkg/nmap-7.70-5.el8_testjcc.x86_64-self-check-report-0.txt: New test reference output. * tests/data/test-diff-pkg/nmap-7.70-5.el8_testjcc.x86_64.rpm: New binary input. * tests/data/test-diff-pkg/nmap-debuginfo-7.70-5.el8_testjcc.x86_64.rpm: Likewise. * tests/data/Makefile.am: Add these new testing material to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new test input to the harness. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt: Adjust. * tests/data/test-diff-suppr/test39-opaque-type-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
23046152e0 |
Bump ABIXML format version to 2.0
After fixing the interpretation of the DW_AT_bit_offset attribute for offset of bit field data members, serialized abixml might now be incompatible with versions of Libabigail that use the previous interpretation. That means that comparing an abixml file generated with previous versions of Libabigail against a corpus resulting from an analysis performed with the current version of libabigail might yield spurious changes due to the differences in the way we now interpret the DW_AT_bit_offset. Hence, this patch bumps the version of abixml files emitted from now on to "2.0". This version is deemed incompatible with the previous "1.0" version. Subsequently, an abixml file of the "1.0" format cannot be compared against an abixml file of the "2.0" format, or against a binary analyzed with a current version of Libabigail. It's thus advised that abixml files of the "1.0" format version should be re-generated with a current version of Libabigail, bumping their format version number to the new "2.0". * include/abg-corpus.h (corpus::init_format_version): Declare new private method. (corpus::set_environment): Make this non-const. (corpus::{get,set}_format_{major,minor}_version_number): Declare new accessors. * src/abg-corpus.cc (corpus::init_format_version): Define new method. (corpus::set_environment): By default, initialize the format version number of the corpus to the one supported by Libabigail. (corpus::{get,set}_format_{major,minor}_version_number): Define new accessors. * include/abg-ir.h: Include abg-config.h to use the abigail::config. (environment::get_config): Declare new accessor. * src/abg-ir.cc (environment::priv::config_): Add new data member. (environment::get_config): Define new accessor. * src/abg-config.cc (config::config): Bump the format version number to "2.0". * src/abg-corpus-priv.h (corpus::priv::format_{major,minor}_version_number_): Add new data members. * src/abg-reader.cc (handle_version_attribute): Define new static function. (read_corpus_from_input, read_corpus_group_from_input): Use it to read the value of the "version" attribute and set the format version number of the corpus and corpus group accordingly. * src/abg-writer.cc (write_context::m_config): Remove the config object because we can now get it from the environment. (write_context::get_config): Get the config object from the environment. (write_translation_unit): Do not emit the version attribute on the translation unit element anymore. (write_version_info): Define static function. (write_corpus, write_corpus_group): Use it to emit version attribute on both the corpus and corpus group elements. * tools/abidiff.cc (emit_incomptatible_format_version_error_message): Define new static function. (main): Ensure that corpora and corpus groups being compared have the same major version number. * tests/update-test-output.py: Adjust syntax for python3. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test-anonymous-members-0.o.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Likewise. * tests/data/test-diff-suppr/libtest48-soname-abixml-v0.so.abi: Likewise. * tests/data/test-diff-suppr/libtest48-soname-abixml-v1.so.abi: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/PR24378-fn-is-not-scope.abi: Likewise. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test-PR26568-1.o.abi: Likewise. * tests/data/test-read-dwarf/test-PR26568-2.o.abi: Likewise. * tests/data/test-read-dwarf/test0.abi: Likewise. * tests/data/test-read-dwarf/test0.hash.abi: Likewise. * tests/data/test-read-dwarf/test1.abi: Likewise. * tests/data/test-read-dwarf/test1.hash.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/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/test2.so.abi: Likewise. * tests/data/test-read-dwarf/test2.so.hash.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/test3.so.abi: Likewise. * tests/data/test-read-dwarf/test3.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test4.so.abi: Likewise. * tests/data/test-read-dwarf/test4.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test5.o.abi: Likewise. * tests/data/test-read-dwarf/test5.o.hash.abi: Likewise. * tests/data/test-read-dwarf/test6.so.abi: Likewise. * tests/data/test-read-dwarf/test6.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test7.so.abi: Likewise. * tests/data/test-read-dwarf/test7.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test0.xml: Likewise. * tests/data/test-read-write/test1.xml: Likewise. * tests/data/test-read-write/test10.xml: Likewise. * tests/data/test-read-write/test11.xml: Likewise. * tests/data/test-read-write/test12.xml: Likewise. * tests/data/test-read-write/test13.xml: Likewise. * tests/data/test-read-write/test14.xml: Likewise. * tests/data/test-read-write/test15.xml: Likewise. * tests/data/test-read-write/test16.xml: Likewise. * tests/data/test-read-write/test17.xml: Likewise. * tests/data/test-read-write/test18.xml: Likewise. * tests/data/test-read-write/test19.xml: Likewise. * tests/data/test-read-write/test2.xml: Likewise. * tests/data/test-read-write/test20.xml: Likewise. * tests/data/test-read-write/test21.xml: Likewise. * tests/data/test-read-write/test22.xml: Likewise. * tests/data/test-read-write/test23.xml: Likewise. * tests/data/test-read-write/test24.xml: Likewise. * tests/data/test-read-write/test25.xml: Likewise. * tests/data/test-read-write/test26.xml: Likewise. * tests/data/test-read-write/test27.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test3.xml: Likewise. * tests/data/test-read-write/test4.xml: Likewise. * tests/data/test-read-write/test5.xml: Likewise. * tests/data/test-read-write/test6.xml: Likewise. * tests/data/test-read-write/test7.xml: Likewise. * tests/data/test-read-write/test8.xml: Likewise. * tests/data/test-read-write/test9.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9a0c823df4 |
Ignore duplicated functions and those not associated with ELF symbols
While looking at several ABIXML files I noticed that several (member) functions didn't have any associated ELF symbol and that in some cases, there were even duplicated member functions. Those are the source of some spurious changes sometimes reported by abidiff. In DWARF the same function F can be represented several times. One representation of F has some properties and other representations of F might have properties that complement the properties carried by the former representations. It's the unions of the properties of all representations of F that constitute the properties of F. An example of that "linked" nature is how DWARF represents inlined functions. A function F can be inlined somewhere else. That inlined version is called F', for instance. The DWARF representation of F' will carry a DW_AT_abstract_origin attribute that points back to F to signify that F' is the concrete inlined version of the abstract F. F' will carry properties that are specific to its "inlined nature" whereas F will carry properties that are more generic and independent from all its various potential inlined forms. So when Libabigail sees the DWARF representation of F, if it's associated with an ELF symbol, then it must wait to encounter an F' representation that is associated with an ELF symbol before adding an internal representation (IR) of F into the final IR graph. Otherwise the IR of F can be unnecessarily duplicated, with some instances having an associated ELF symbol and others not. This is what this patch does, in essence. While working on this, I encountered some tangential issues that needed to be fixed altogether for the whole to function. A lot of regression tests output had to be adjusted. In the end, a number of spurious change reports could be fixed; notably reports about removal of destructors like STR::~STR(int). Note how that destructor has a parameter; it's a GCC-specific implementation detail that should not appear at this level, I believe. * include/abg-ir.h (class_or_union::string_mem_fn_sptr_map_type): Add a typedef for unordered_map<string, method_decl_sptr>. (class_or_union::find_member_function_sptr): Declare new function. * src/abg-ir.cc (class_or_union::priv::mem_fns_map_): Change the type of this to string_mem_fn_sptr_map_type, so that shared pointers to functions can be stored in the map, instead of bare pointers to functions. This is useful to implement class_or_union::find_member_function_sptr which returns a shared pointer to function. (class_or_union::find_member_function_sptr): Define new function. (class_or_union::find_member_function): Adjust. (method_decl::set_linkage_name): Use a non-deleting shared pointer to store the current instance of member function into class_or_union::priv::mem_fns_map_. (hash_as_canonical_type_or_constant): As we are seeing more function types, it appears that some function types are not canonicalized. I am not sure why exactly, but let's loosen the assert here for now, I'll chase the root of this later. * src/abg-dwarf-reader.cc (finish_member_function_reading): Improve detection of member function 'static-ness' by handling cases where a this pointer can be const. Also support DW_AT_object_pointer when it's present. This fixes the occurrence of spurious change reports about loss of 'static-ness' of member functions. (potential_member_fn_should_be_dropped): Define new static function and ... (build_ir_node_from_die): ... use it here. When a function DIE has the same linkage name as an existing function IR, do not create a new IR for it. Rather, re-use the existing one to complete it with the properties found on the function DIE. If a new function doesn't seem to have an associated ELF symbol and is not meant to be a virtual member function then drop its IR on the floor as well. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Likewise. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise. * tests/data/test-diff-filter/test0-report.txt: Likewise. * tests/data/test-diff-filter/test01-report.txt: Likewise. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt: Likewise. * tests/data/test-diff-filter/test41-report-0.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise. * tests/data/test-diff-suppr/test31-report-1.txt: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test0.abi: Likewise. * tests/data/test-read-dwarf/test0.hash.abi: Likewise. * tests/data/test-read-dwarf/test1.abi: Likewise. * tests/data/test-read-dwarf/test1.hash.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/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test6.so.abi: Likewise. * tests/data/test-read-dwarf/test6.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Maennich
|
c458e00db9 |
Drop unneccessary includes of abg-cxx-compat.h
Remove the unneccessary includes of abg-cxx-compat.h as users have been migrated to use the corresponding standard includes. * include/abg-comparison.h: Remove include of abg-cxx-compat.h. * include/abg-diff-utils.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-regex.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-workers.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-read-write.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
5d669e0126 |
Remove <unordered_set> usages from abg_compat
std::unordered_set is now provided through the language standard, hence remove the compatibility code for <unordered_set> and adjust all users accordingly. * include/abg-cxx-compat.h: Drop compatibility for <unordered_set>. * include/abg-comparison.h: migrate abg_compat use to std. * include/abg-interned-str.h: Likewise. * include/abg-suppression.h: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-dwarf-reader.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
af233cd001 |
Remove <unordered_map> usages from abg_compat
std::unordered_map is now provided through the language standard, hence remove the compatibility code for <unordered_map> and adjust all users accordingly. * include/abg-cxx-compat.h: Drop compatibility layer for <unordered_map>. * include/abg-comparison.h: migrate abg_compat use to std. * include/abg-cxx-compat.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-ir.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-writer.cc: Likewise. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
de344c0122 |
Remove <memory> usages from abg_compat
std::shared_ptr, std::weak_ptr, std::dynamic_pointer_cast, std::static_pointer_cast are now provided through the language standard, hence remove the compatibility code for <memory> and adjust all users accordingly. * include/abg-cxx-compat.h: Drop compatibility layer for <memory>. * include/abg-diff-utils.h: migrate abg_compat use to std. * include/abg-fwd.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-regex.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-workers.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
ee3309472a |
Remove <functional> usages from abg_compat
std::hash is now provided through the language standard, hence remove the compatibility code for <functional> and adjust all users accordingly. * include/abg-cxx-compat.h: Drop compatibility layer for <functional>. * include/abg-interned-str.h: migrate abg_compat use to std. * include/abg-ir.h: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ir.cc: Likewise. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Matthias Maennich
|
47a76acf76 |
Drop C++03 compatibility layer
Now with C++11 as minimum standard, we can drop the facilities required to support earlier standards. Hence purge the use of std::tr1 from the sources. * include/abg-cxx-compat.h: remove compatibility with pre C++11. * include/abg-ir.h: Remove mention of std::tr1 from comments. * include/abg-sptr-utils.h: Likewise. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Dodji Seketeli
|
c80f79271a |
Re-license the project to Apache v2 With LLVM Exception
Thanks to the previous work done, changing the license is just a matter of changing the SPDX identifer from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception". Note that for the abigail.m4, tests/test-dot.cc and tests/test-svg.cc the change was from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception". include/abg-cxx-compat.h was changed from "LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception". Source code of programs (as opposed to source code of the library) where generally licensed under GPL-3.0-or-later; they are also now licensed "Apache-2.0 WITH LLVM-exception". This is what this patch does. * abigail.m4: Change the SPDX identifier from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception" * include/abg-cxx-compat.h: Change the SPDX identifier from "LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception". * .clang-format: Change the SPDX identifier from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception". * Makefile.am: Likewise. * bash-completion/Makefile.am: Likewise. * bash-completion/abicompat: Likewise. * bash-completion/abidiff: Likewise. * bash-completion/abidw: Likewise. * bash-completion/abilint: Likewise. * bash-completion/abinilint: Likewise. * bash-completion/abipkgdiff: Likewise. * bash-completion/abisym: Likewise. * bash-completion/fedabipkgdiff: Likewise. * configure.ac: Likewise. * default.abignore: Likewise. * doc/Makefile.am: Likewise. * doc/api/libabigail.doxy: Likewise. * doc/manuals/Makefile.am: Likewise. * doc/website/libabigail-website.doxy: Likewise. * include/Makefile.am: Likewise. * include/abg-comp-filter.h: Likewise. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-regex.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-version.h.in: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * scripts/dot_to_png.sh: Likewise. * scripts/dot_to_svg.sh: Likewise. * scripts/make-verbose.sh: Likewise. * scripts/svg_to_plain_svg.sh: Likewise. * scripts/svg_to_png_and_pdf.sh: Likewise. * src/Makefile.am: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-default-reporter.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-elf-helpers.cc: Likewise. * src/abg-elf-helpers.h: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-regex.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-suppression-priv.h: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-workers.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/Makefile.am: Likewise. * tests/data/Makefile.am: Likewise. * tests/lib/catch.cc: Likewise. * tests/mockfedabipkgdiff.in: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/runtestcanonicalizetypes.sh.in: Likewise. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/runtestdefaultsupprspy3.sh.in: Likewise. * tests/runtestfedabipkgdiff.py.in: Likewise. * tests/runtestfedabipkgdiffpy3.sh.in: Likewise. * tests/test-abicompat.cc: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-annotate.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-cxx-compat.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-dot.cc: Change the SPDX identifier from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception" * tests/test-elf-helpers.cc: Change the SPDX identifier from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception" * tests/test-ini.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-kmi-whitelist.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-svg.cc: Change the SPDX identifier from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception". * tests/test-symtab.cc: Change the SPDX identifier from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception" * tests/test-tools-utils.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tests/update-test-output.py: Likewise. * tools/Makefile.am: Likewise. * tools/abiar.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/fedabipkgdiff: Likewise. * tools/kmidiff.cc: Likewise. * update-copyright.sh: Likewise. Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org> Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Jessica Yu <jeyu@kernel.org> Signed-off-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Matthias Klose <doko@ubuntu.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Roland McGrath <roland@hack.frob.com> Signed-off-by: Sinny Kumari <ksinny@gmail.com> Signed-off-by: Slava Barinov <v.barinov@samsung.com> |
||
Dodji Seketeli
|
be6bf58308 |
Add missing SPDX headers to source files not specifying any license
Default to the project's defautl - LGPLv3+ - for those. * Makefile.am: Add a LGPL-3.0-or-later SPDX header prefixed with '##' so that that the header doesn't get emitted in the resulting Makefile.in file. Note that the license of Makefile.in files is "FSF All Permissible License", which virtually compatible with anything. * bash-completion/Makefile.am: Likewise. * doc/Makefile.am: Likewise * doc/manuals/Makefile.am: Likewise * include/Makefile.am: Likewise * src/Makefile.am: Likewise * tests/Makefile.am: Likewise * tests/data/Makefile.am: Likewise * tools/Makefile.am: Likewise * .clang-format: Add a LGPL-3.0-or-later SPDX header. * bash-completion/abicompat: Likewise. * bash-completion/abidiff: Likewise. * bash-completion/abidw: Likewise. * bash-completion/abilint: Likewise. * bash-completion/abinilint: Likewise. * bash-completion/abipkgdiff: Likewise. * bash-completion/abisym: Likewise. * bash-completion/fedabipkgdiff: Likewise. * configure.ac: Likewise. * default.abignore: Likewise. * doc/api/libabigail.doxy: Likewise. * doc/website/libabigail-website.doxy: Likewise. * include/abg-version.h.in: Likewise. * scripts/dot_to_png.sh: Likewise. * scripts/dot_to_svg.sh: Likewise. * scripts/make-verbose.sh: Likewise. * scripts/svg_to_plain_svg.sh: Likewise. * scripts/svg_to_png_and_pdf.sh: Likewise. * tests/runtestcanonicalizetypes.sh.in: Likewise. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/runtestdefaultsupprspy3.sh.in: Likewise. * tests/runtestfedabipkgdiffpy3.sh.in: Likewise. * tests/update-test-output.py: Likewise. * update-copyright.sh: Likewise. Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org> Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Jessica Yu <jeyu@kernel.org> Signed-off-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Matthias Klose <doko@ubuntu.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Roland McGrath <roland@hack.frob.com> Signed-off-by: Sinny Kumari <ksinny@gmail.com> Signed-off-by: Slava Barinov <v.barinov@samsung.com> |
||
Matthias Maennich
|
58488c5f31 |
Replace individual license references with SPDX Identifiers
This patch replaces license headers with SPDX identifiers in all files containing license headers. For each file, the SPDX identifier formally represents its current license. Note that the list of SPDX identifiers is available on the SPDX web site at https://spdx.org/licenses. For autoconf-archive/ax_prog_python_version.m4 however, there is a little catch. Dodji Seketeli wrote this ax_check_python_modules.m4. Just like the other autoconf-archive macros, it makes sense to have it under the FSF All Permissive license. Actually, the terms of that license was already in the file but then the license header was wrongly set to GPLv2 with autoconf exception. So I fixed that in this commit by setting the SPDX identifier to FSFAP. * abigail.m4: Replace the license header with the SPDX identifier GPL-3.0-or-later WITH GCC-exception-3.1 * autoconf-archive/ax_check_python_modules.m4: Correctly set the SPDX identifier to FSFAP. * autoconf-archive/ax_compare_version.m4: Replace the license header with the SPDX identifier FSFAP. * autoconf-archive/ax_prog_python_version.m4: Likewise. header with the SPDX identifier FSFAP. * autoconf-archive/ax_valgrind_check.m4: Likewise. * gen-changelog.py: Replace the license header with the SPDX identifier LGPL-2.0-or-later. * include/abg-comp-filter.h: Replace the license header with the SPDX identifier LGPL-3.0-or-later. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-cxx-compat.h: Replace the license header with the SPDX identifier LGPL-2.0-or-later. * include/abg-diff-utils.h: Replace the license header with the SPDX identifier LGPL-3.0-or-later * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-regex.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * install-sh: Replace the license header with the SPDX identifier MIT. * ltmain.sh: Replace the license header with the SPDX identifier GPL-2.0-or-later. Note that this file has the libtool special exception which allows us to redistribute it under the general license of the project. * src/abg-comp-filter.cc: Replace the license header with the SPDX * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-default-reporter.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-elf-helpers.cc: Likewise. * src/abg-elf-helpers.h: Likewise. * src/abg-regex.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-sptr-utils.cc: Likewise. * src/abg-suppression-priv.h: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-workers.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/lib/catch.cc: Likewise. * tests/lib/catch.hpp: Add an SPDX identifier BSL-1.0. * tests/mockfedabipkgdiff.in: Replace the license header with the SPDX identifier GPL-3.0-or-later. * tests/print-diff-tree.cc: Likewise. * tests/runtestfedabipkgdiff.py.in: Replaace the license header with the SPDW identifier GPL-3.0-or-later. * tests/test-abicompat.cc: Replace the license header with the SPDX identifier LGPL-3.0-or-later. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-annotate.cc: Likewise. * tests/test-cxx-compat.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-dot.cc: Replace the license header with the SPDX identifier GPL-3.0-with-GCC-exception. * tests/test-elf-helpers.cc: Replace the license header with the SPDX identifier LGPL-3.0-or-later. * tests/test-ini.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-kmi-whitelist.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-svg.cc: Replace the license header with the SPDX identifier GPL-3.0-with-GCC-exception. * tests/test-symtab.cc: Replace the license header with the SPDX identifier LGPL-3.0-or-later. * tests/test-tools-utils.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abiar.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/fedabipkgdiff: Replace the license header with the SPDX identifier GPL-3.0-or-later. * tools/kmidiff.cc: Likewise. Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org> Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Jessica Yu <jeyu@kernel.org> Signed-off-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Matthias Klose <doko@ubuntu.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Roland McGrath <roland@hack.frob.com> Signed-off-by: Sinny Kumari <ksinny@gmail.com> Signed-off-by: Slava Barinov <v.barinov@samsung.com> |
||
Dodji Seketeli
|
a07fce3669 |
ir: Introduce internal pretty representation for anonymous classes
There are two views for internal pretty representation of anonymous classes. 1/ When we look at the anonymous class itself, we use its 'flat representation' i.e: 'class {int blah; char bleh;}' 2/ When we look at a pointer or a reference to the anonymous class we use its generic anonymous internal name, i.e: '__anonymous_struct__*' As a general rule, libabigail always use the keyword 'class' to prefix the name of classes for internal purposes, independent from the fact that the type is a struct or a class. That is a pre-requisite to be able to canonicalize classes and structs together. In other words, if a class and a struct are structurally equal, they are going to be considered equivalent by the canonicalization process. Currently however, in the view 1/ of the pretty representation of anonymous classes, a struct and a class will have different representations. For instance, and empty anonymous struct would be represented as 'struct {}', whereas an empty anonymous class would be represented as 'class {}'. This prevents these two be considered equivalent by the canonicalization process. This leads to spurious change reports later down the road. In the view 2/ we have a similar but different problem: the qualified names of the anonymous classes are not taken into account when representing pointer or references to said anonymous classes. Only their unqualified generic anonymous internal names are taken into account in the representation. This leads to pointers/references to anonymous classes being wrongly considered equivalent even when they belong to different namespaces. This patch corrects the issues related to both views 1/ and 2/. It should make libabigail correctly consider some anonymous classes as equivalent (view 1) and correctly consider pointers/references to anonymous classes as different when they belong to different namespaces (view 2). A number of reference tests are adjusted accordingly. * include/abg-fwd.h (get_class_or_union_flat_representation): Introduce an "internal" parameter. * src/abg-ir.cc (get_class_or_union_flat_representation): Introduce an "internal" parameter. In the flat representation of a class for internal purposes, always use the prefix "class" even if this is a struct. (get_type_name): To build an internal name for a reference or pointer to an anonymous type, consider the namespace name of said type. (equals): In the overload for decl_base, take the namespace name of anonymous decls into account when comparing them. ({var_decl, union_decl}::get_pretty_representation): Adjust calls to get_class_or_union_flat_representation to pass a proper "internal" argument. * src/abg-default-reporter.cc (default_reporter::report): Adjust the call to get_class_or_union_flat_representation to pass an "internal" argument set to 'false'. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
cac59a176a |
Bug 26769 - Fix missing types in abixml output
The symptom of the issue at hand is that sometimes there can be types missing from the abixml output. This happens when analysing some C++ code bases. The core of the issue is the following. Support we have a type "struct S" defined somewhere as: struct S // #0 { int dm1; char dm2; }; S s; Suppose that in another translation unit, we have the class 'S' being extended to add a member type to it: struct S // #1 { typedef int dm1_type; }; typedef S::dm1_type Integer; Integer something; When emitting the abixml for the codebase, the definition of the typedef S::dm1_type can be missing. Note that in location #1, struct S is considered declaration-only. It's definition is in another translation unit, in location #0. So the abixml writer emits the 'struct S' defined in location #0, but forgets to emit the 'struct S' in #1, which is indirectly used for the sole purpose of using its member type S::dm1_type. This patch emits the S::dm1_type type that is mistakenly forgotten today. Now that the "struct S" of #1 is also emitted, a tangent problem is uncovered: S in #0 can be wrongly thought to be equivalent to S in #1, for ABI purposes This is because of an ODR-based optimization that is used for C++. That is, the two struct S can be wrongly considered equivalent just because they have the same name. Note that ODR means "One Definition Rule[1]" This patch removes the ODR-based optimization and thus fixes many of the issues uncovered by the previous changes. The patch also uncovered that some non-static variables were sometimes wrongly being added to the set of exported variables, while libabigail reads corpora from abixml. The patch fixes this as well. [1]: One Definition Rule: https://en.wikipedia.org/wiki/One_Definition_Rule * include/abg-corpus.h (corpus::{record_canonical_type, lookup_canonical_type}): Remove function declarations. * src/abg-corpus-priv.h (corpus::priv::canonical_types_): Remove data member. * src/abg-corpus.cc (corpus::{record_canonical_type, lookup_canonical_type}): Remove functions. * src/abg-ir.cc (type_eligible_for_odr_based_comparison): Remove static function. (type_base::get_canonical_type_for): Don't perform the ODR-based optimization for C++ anymore. * src/abg-reader.cc (read_context&::maybe_add_var_to_exported_decls): Don't add a variable that hasn't been added to its scope. Otherwise, it means we added a variable that wasn't yet properly constructed. Also add a new overload for var_decl_sptr&. (build_var_decl): Do not add the var to its the set of exported declaration before we are sure it has been fully constructed and added to the scope it belongs. (build_class_decl): Only add *static* data members to the list of exported declarations. (handle_var_decl): A var decl seen here is a global variable declaration. Add it to the list of exported declarations. * src/abg-writer.cc (write_context::decl_only_type_is_emitted): Constify parameter. (write_translation_unit): Do not forget to emit referenced types that were maybe not canonicalized. Also, avoid using noop_deleter when it's not necessary. (write_namespace_decl): Do not forget to emit canonicalized types that are present in namespaces other than the global namespace. * tests/runtestslowselfcompare.sh.in: New test that compares libabigail.so against its own ABIXML representation. * tests/Makefile.am: Add the new test runtestslowselfcompare.sh to source distribution. This test is too slow to be run during the course of 'make check'. It takes more than 5 minutes on my slow box here. Rather, it can be run using 'make check-self-compare'. I plan to run this before releases now. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test0.abi: Likewise. * tests/data/test-read-dwarf/test0.hash.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/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test6.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
de5de7b447 |
Make sure to canonicalize all types but decl-only classes
While looking at the remaining potential sources of instability in the generation of type ids at abixml generation time, it occurred to me that we still had several non canonicalized types in the system. When a given type T is not canonicalized, hash_as_canonical_type_or_constant later hashes it as an arbitrary constant. So in the ID hash map of the abixml writer, all the non-canonicalized types will tend to end-up in the same hash map bucket, so to speak. More precisely, if T is equivalent to another type T' which is canonicalized, then T and T' will end-up in different buckets (in the same hash map) because they will have different hash values as returned by hash_as_canonical_type_or_constant. They will thus end-up having different type-ids because they are in different buckets. The solution is to make sure that T is *also* canonicalized. That way, if T and T' are equivalent, they'll end-up in the same bucket and they will have the same type-id. In other words, all types should be canonicalized now. The only exception to that rule is declaration-only classes and unions. The reason why a declaration-only type 'struct foo' needs to stay non-canonicalized is that it must equal all the definitions of 'struct foo' that can be found elsewhere. This patch thus canonicalizes all types that were not still not being canonicalized. It also adds an assert in hash_as_canonical_type_or_constant to ensure that only declaration-only class_or_union types are not canonicalized. * include/abg-fwd.h (is_declaration_only_class_or_union_type): Declare new ... * src/abg-ir.cc (is_declaration_only_class_or_union_type): ... function. (clone_array): Add the cloned array subrange to its scope so that it can later be canonicalized. (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit): Canonicalize the synthesized types. (hash_as_canonical_type_or_constant): Ensure that all types are canonicalized. * src/abg-dwarf-reader.cc (maybe_canonicalize_type): Remove useless overload. (build_ir_node_for_variadic_parameter_type) (schedule_array_tree_for_late_canonicalization): Define new static functions. (maybe_strip_qualification): Schedule type canonicalization for types cloned prior to editing. (build_function_type): Use the new build_ir_node_for_variadic_parameter_type. It takes care of canonicalizing variadic parameter types. (build_function_decl): Canonicalize the function type that is created here. (build_ir_node_from_die): Use the overload of maybe_canonicalize_type which canonicalizes class_or_union nodes directly, rather than the one which handles DIE offsets. The latter was used as an optimization to reduce the size of the array of types scheduled for canonicalization, as DIE offsets take less space than pointers to IR types. Now that we have DIE de-duplication, my bet is that we can do away with the former. And that also ensures that we miss no type for canonicalization purposes. * src/abg-reader.cc (build_array_type_def): Canonicalize the subrange types of the array. (build_type): Canonicalize all types. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test0.abi: Likewise. * tests/data/test-read-dwarf/test0.hash.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/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
90eff56227 |
ir: Add equality op to array_type_def::subrange_type::bound_value
* include/abg-ir.h (array_type_def::subrange_type::bound_value::operator==): Declare new ... * src/abg-ir.cc (array_type_def::subrange_type::bound_value::operator==): ... equality operator. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2cc1ab7ee8 |
writer: Sort decls and fix topological sorting for types
When emitting the declarations of a given translation unit, those declarations are not sorted. Ooops. This patch adds topological sorting for those declarations, making the decls defined first to be emitted first. When the decls are defined at the same location then the pretty representation is used for lexicographic sorting instead. It turns out that during the topological sorting for types there was some uncertainty when the declarations of the types had the same definition location. This patch re-uses the declaration sorting above for the declarations of these types. * include/abg-ir.h (scope_decl::get_sorted_member_decls): Declare new member function. * src/abg-ir.cc (struct decl_topo_comp): New sorting functor. (type_topo_comp::operator()): Re-use the decl_topo_comp to sort type declarations. (scope_decl::priv::sorted_members_): Add new data member. (scope_decl::get_sorted_member_decls): Define new member function. * src/abg-writer.cc (write_translation_unit): Use the new scope_decl::get_sorted_member_decls. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/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-write/test2.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3c87247cb4 |
Bug PR26739 - Handle qualified typedef array types
CV-qualifiers of a typedef of an array type apply to the elements of the array. So this can be transformed into a typedef of array type which element type is similarly CV-qualified. That transformation helps avoiding spurious changes that might occur when comparing the latter form against the former even though both are equivalent. This patch performs that transformation, just like we already do for CV-qualified array types which are transformed into an array of similarly CV-qualified elements. Performing that transformation amounts to editing the type of the array elements. As those types might be used by other parts of the type graph (type node sharing), the patch "clones" the type sub-tree of interest and edits the cloned version. That way, the shared type nodes are not edited. It appears that in the existing version of maybe_strip_qualification, the transformation of CV-qualified arrays into arrays of CV-qualified elements was unfortunately editing shared type nodes. The patch fixes that and re-works the logic of* maybe_strip_qualification to make it handle this new case and the previous one in a somewhat generic manner. * include/abg-fwd.h (is_typedef_of_array, clone_array) (clone_typedef, clone_qualified_type, clone_array_tree): Declare new functions. (peel_qualified_or_typedef_type): Declare new overload. (is_array_of_qualified_element): Constify the parameter. * include/abg-ir.h ({qualified_type, typedef}_def::set_underlying_type): Add new member functions. (array_type_def::subrange_type::subrange_type): Make constify the reference to the underlying type parameter. * src/abg-ir.cc (is_array_of_qualified_element): Constify the parameter. (peel_qualified_or_typedef_type): Define new overload for type_base_sptr. (clone_typedef_array_qualified_type): Define static function. (clone_array clone_typedef, clone_qualified_type) (clone_array_tree, is_typedef_of_array): Define new functions. (qualified_type_def::get_underlying_type): Rename the return type shared_ptr<type_base> into type_base_sptr. ({typedef, qualified_type}_def::set_underlying_type): Define new member function. (array_type_def::subrange_type::priv::priv): Initialize the 'infinite_' data member. * src/abg-dwarf-reader.cc (maybe_strip_qualification): Handle qualified typedef of arrays. Merge this with the handling of qualified arrays. Note that before editing the elements of the array to make the array (or typedef) qualifier apply to the element the sub-tree is cloned to make its type nodes be 'un-shared'. This prevents us from editing type nodes that are shared by other type expressions. * tests/data/test-diff-filter/test-PR26739-report-0.txt: New reference test output. * tests/data/test-diff-filter/test-PR26739-2-report-0.txt: Likewise. * tests/data/test-diff-filter/test-PR26739-v{0,1}.c: Source code of new binary test input. * tests/data/test-diff-filter/test-PR26739-2-v{0,1}.c: Likewise. * tests/data/test-diff-filter/test-PR26739-v{0,1}.o: New binary test inputs. * tests/data/test-diff-filter/test-PR26739-2-v{0,1}.o: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the test inputs above to this harness. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
247f50dbf3 |
abg-tools-utils: Fix comment
* include/abg-tools-utils.h (enum abidiff_status): Fix a comment. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
470e10ff52 |
Structurally compare the few non-canonicalized types in general
In the abixml writer, we recently stopped using type_base::dynamic_hash as a slow path to hash a non-canonicalized type. Rather, we use an arbitrary constant as a hash for those non-canonicalized types. This amounts to using structural comparison for those types. The function that implements this hashing scheme is hash_as_canonical_type_or_constant. A potential concern for that approach was the possible negative impact on speed. As it turns out since the change went in, there was no noticeable speed impact raised after testing. In insight, this is understandable as the number of non-canonicalized types should be extremely reduced now that we canonicalize pretty much all types. As far as I understand it at this point, the only types that would not be canonicalized are unresolved declaration-only types. And, all in all, structurally comparing unresolved declaration-only types should be "fast enough". If we ever stumble across any other non-canonicalized type, I think that would be an artifact of a bug that ought to be fixed. On that basis, I went ahead and used hash_as_canonical_type_or_constant throughout the code base and did away with the use of type_base::dynamic_hash for now, until it's properly audited, regression tested and got ready for the use cases where it might make sense. This patch thus makes hash_type use hash_as_canonical_type_or_constant. The writer is then back to using hash_type again, as it used to; but at the same time, it's still using structural comparison for non-canonilized types. So is hash_type_or_decl, which now uses hash_type to hash types, rather than using type_base::dynamic_hash. Note that the comparison engine heavily uses hash_type_or_decl to hash diff nodes. So with this small patch the comparison engine is now using structural comparison of non-canonicalized types (and diff nodes), just as the abixml writer does. * include/abg-fwd.h (hash_as_canonical_type_or_constant): Remove public declaration of this function. * src/abg-hash.cc (type_base::dynamic_hash::operator()): Add a comment. * src/abg-ir.cc (hash_as_canonical_type_or_constant): Make this function static now. (hash_type_or_decl): Use hash_type for types. * src/abg-writer.cc (type_hasher::operator()): Use hash_type. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2f92777dc8 |
Consider the implicit 'this' parameter when comparing methods
Since 2013 the implicit 'this' parameter has been excluded from the function parameters taken into account while comparing class member functions. This was an early measure to avoid infinite recursion that would then occur when comparing classes (and thus their member functions that are referenced in their vtable). But since then, we've built descent infrastructure to prevent this kind of recursion in a more generic manner. This patch thus removes that restriction and should therefore lift the concerns expressed in the bug https://sourceware.org/bugzilla/show_bug.cgi?id=26672. Namely, changes to (data members of) a class should now be detected when comparing member functions of that class. With this change, the reference output of several comparison regression tests changed because, obviously, some impacted member functions are now reported along with detecting changes in data membrers of classes. The patch thus adjusts those reference ouputs. The patch also adjust the behaviour of the predicate: "accessed_through = pointer|reference|reference-or-pointer" The idea is to make the predicate work on qualified version of a type. * include/abg-ir.h (function_type::get_first_parm): Declare new accessor. * src/abg-ir.cc (function_type::get_first_parm): Define new accessor. (equals): In the overload for function_type, always take the implicit "this" parameter into account in parameter comparisons. (function_type::get_first_non_implicit_parm): Adjust comment. * src/abg-comp-filter.cc (function_name_changed_but_not_symbol): Avoid potential NULL pointer dereferencing. * src/abg-comparison.cc (function_type_diff::ensure_lookup_tables_populated): Always take the changes to the implicit 'this' parameter into account in the function type diff. (compute_diff): In the overload for function_type, Always compare the implicit 'this' parameter when comparing function parameters. * src/abg-default-reporter.cc (default_reporter::report): Refer to "implicit parameter" when reporting changes on parameters artificially generated by the compiler. * src/abg-suppression.cc (type_suppression::suppresses_diff): Make the 'access_through' predicate work on a qualified version of type 'S', even if it was meant to work on type 'S'. This allows it to work on 'const S', especially when S is accessed through 'pointer to const S', which happens when we consider the implicit 'this' parameter of a const member function. * tests/data/test-abicompat/test5-fn-changed-report-0.txt: Adjust. * tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise. * tests/data/test-abidiff-exit/test1-voffset-change-report0.txt: Likewise. * tests/data/test-abidiff/test-PR18791-report0.txt: Likewise. * tests/data/test-abidiff/test-struct1-report.txt: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test29-vtable-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test30-vtable-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test31-vtable-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise. * tests/data/test-diff-dwarf/test5-report.txt: Likewise. * tests/data/test-diff-dwarf/test8-report.txt: Likewise. * tests/data/test-diff-filter/test0-report.txt: Likewise. * tests/data/test-diff-filter/test01-report.txt: Likewise. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test13-report.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt: Likewise. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt: Likewise. * tests/data/test-diff-filter/test4-report.txt: Likewise. * tests/data/test-diff-filter/test41-report-0.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-0.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise. * 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-2.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-3.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-5.txt: Likewise. * 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-report-9.txt: Likewise. * tests/data/test-diff-suppr/test31-report-1.txt: Likewise. * tests/data/test-diff-suppr/test33-report-0.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ee2b54ddd9 |
Make abidiff and abidw support several --headers-dir{1,2} options
When handling a binary with abidiff or abidw it can be useful to provide several different header files directories, for the cases where the header files of the binary are scathered in several different directories. It thus becomes possible to invoke abidiff like this: abidiff --headers-dir1 first-header-dir1 \ --headers-dir1 second-header-dir1 \ --headers-dir2 first-header-dir2 \ --headers-dir2 second-header-dir2 \ binary1 binary2 This patch adds support for that. It also modifies the tests/test-abidiff-exit.cc test harness to make it take header directories. With that modification done, a new test is added in that harness to exercise this new feature. This should close the feature request over at https://sourceware.org/bugzilla/show_bug.cgi?id=26565. * doc/manuals/abidiff.rst: Update documentation for the --headers-dir{1,2} options. * doc/manuals/abidw.rst: Likewise for the --header-dir option. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Add new overload that takes a vector of headers root dirs. * src/abg-tools-utils.cc (gen_suppr_spec_from_headers_root_dir): Define new function. (gen_suppr_spec_from_headers): Define a new overload that takes a vector of head_root_dir strings; it uses the new gen_suppr_spec_from_headers function. Use the new overload in the previous one that takes just one head_root_dir string. * tools/abidiff.cc (options::headers_dirs{1,2}): Rename option::headers_dir{1,2} into this one and make it be a vector of strings rather than just a string. (parse_command_line): Support several --headers-dir{1,2} on the command line. (set_diff_context_from_opts, set_suppressions): Adjust. * tools/abidw.cc (options::headers_dirs): Renamed options::headers_dir into this and make it be a vector of strings rather than just a string. (parse_command_line): Support several --headers-dir on the command line. (set_suppressions): Adjust. * tests/data/test-abidiff-exit/test-headers-dirs/headers-a/header-a-v{0,1}.h: Header files of new binary test input. * tests/data/test-abidiff-exit/test-headers-dirs/headers-b/header-b-v{0,1}.h: Likewise. * tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-v{0,1}.c: Source code of new binary test input. * tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-{1,2}.txt: Reference output of new binary test input. * tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-v{0,1}.o: New binary test input. * tests/data/Makefile.am: Add the new files above to source distribution. * tests/test-abidiff-exit.cc (InOutSpec::in_elfv{0,1}_path): Add new data members. (in_out_specs): Adjust the content of this array as its type changed. Also, add two new entries to run the test over the new binary test inputs above. (do_prefix_strings): Define new static function. (main): Use it the new do_prefix_strings here. Make abidiff use the --header-dir{1,2} option whenever header directories are specified in an entry of the in_out_specs array. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3d7916caa4 |
Bug 26309 - Wrong leaf reporting of changes to typedef underlying type
In leaf mode, libabigail fails to report changes to the underlying type of a typedef. At its core, this is due to the fact that changes to the underlying type of a typedef are not considered local. As the leaf reporter only reports local changes (as opposed to non-local changes which are changes to sub-types) it doesn't detect those non-local typedef changes. To handle this, this patch makes changes to the underlying type of a typedef be considered as local changes. This is like what we already do for pointer and qualified types. Now that we have another set of changes to report in the leaf reporter, we need to handle how to propagate the category and redundancy status of those changes. The patch does this too. Also, just like we do pointer and qualified type changes, the patch avoids marking the diff node carrying the typedef change as being a leaf change. That way, only existing leaf changes carrying that typedef diff node will be reported. For instance, a function whose parameter has a typedef change will be reported because that change to the function is considered a leaf change. Otherwise, reporting the typedef (or the pointer or qualified) type change on its own is not useful unless it impacts those leaf changes that we deem useful. The patch adds the example given in problem report to the testsuite. * src/abg-ir.cc (equals): In the overload for typedef_decls, report changes to the underlying type as being local of kind LOCAL_TYPE_CHANGE_KIND. * src/abg-comparison.cc (leaf_diff_node_marker_visitor::visit_begin): Do not mark typedef diff node as leaf node. (suppression_categorization_visitor::visit_end): Propagate the 'suppressed' category of the underlying type to the parent typedef unless the later has a local non-type change. (redundancy_marking_visitor::visit_end): Likewise for the 'redundant' category. * include/abg-reporter.h (report_non_type_typedef_changes): Rename ... * src/abg-default-reporter.cc (report_non_type_typedef_changes): ... report_local_typedef_changes into this. * src/abg-leaf-reporter.cc (leaf_reporter::report): Make the leaf reporter invoke the reporting method of the default reporter for typedefs as all typedef changes are now local. * tests/data/test-diff-filter/test-PR26309-report-0.txt: Add new test reference output. * tests/data/test-diff-filter/test-PR26309-v{0,1}.o: Add new test binary input. * tests/data/test-diff-filter/test-PR26309-v{0,1}.c: Add source code for new test binary input. * tests/data/Makefile.am: Add the new text material above to source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the new test input above to this test harness. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5cf2473d3c |
writer: Avoid using dynamic hashing in type maps
When using type maps the hash used for a given type T is usually the pointer value of the canonical type of T. In the rare cases where T doesn't have a canonical type, we were using a 'dynamic hash' computed by recursively walking the components of T and progressively building a hash that way. The dynamic hashing code hasn't been updated in a while and would need some overhaul to support hashing with schemes like MD5 or maybe sha even. It might be useful for various use cases that have been proposed by some users over the years but nobody was motivated enough to implement it. In the mean time, rather than trying to come up with a fully beefed up dynamic hashing code, we'd rather just return a constant number for non canonicalized types. In practise that amounts to forcing the code of the maps to always use structural comparison for those non canonicalized types. Note that the amount of non-canonicalized types should be fairly small. For now, the only non-canonicalized types should be declaration-only types and those are quite fast to compare anyway. This patch thus introduces a new hashing scheme for maps in the writer which just uses a numerical constant as the hash for non-canonicalized types. * include/abg-fwd.h (hash_as_canonical_type_or_constant): Declare ... * src/abg-ir.cc (hash_as_canonical_type_or_constant): ... new function. * src/abg-writer.cc (type_hasher::operator()): Use the new hash_as_canonical_type_or_constant. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Giuliano Procida
|
23f11d70de |
Fix inheritance of scope_decl::insert_member_decl
The classes class_decl, class_or_union and scope_decl derive from each other. The method insert_member_decl is declared virtual and defined in each of these. Unfortunately, it has different argument types in the base scope_decl class. Most calls to insert_member_decl are at a statically known class, but in insert_decl_into_scope the method is called via a scope_decl pointer. There is the possibility that this could be a type derived from scope_decl rather than scope_decl itself, in which case the base method would be called, not as intended. This commit adjusts the type of the member argument to scope_decl::insert_member_decl to match the other two classes and eliminates the last trigger of Clang's -Werror-overloaded-virtual. * include/abg-ir.h (scope_decl::insert_member_decl): Change type of member argument from const decl_base_sptr& to plain decl_base_sptr. * src/abg-ir.cc (scope_decl::insert_member_decl): Likewise. Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
Dodji Seketeli
|
38b1476765 |
Pimpl-ify traversable_base and remove its unused traverse method
The traverse method is defined in the traversable_base class but is never used as the synonymous methods in the derived classes have different argument types and so hide it. It's never used because it's mostly intended as documentation for what the implementations of this interface should look like. Namely they should define a traversable method and its parameter type should derive from the parameter type of traversable_base::traverse. But apparently, clang's -Werror-overloaded-virtual is not happy about this. It flags it as an error. It's not. But hey, let's work-around it then. So this patch just comments that method out and document its intent. To make the change somewhat useful, this patch pimpl-ifies this abg-traverse.h header file to get us one step closer to some a{b,p}i stability. The definitions are moved into abg-traverse.cc. * include/abg-traverse.h (traversable_base::priv): Declare new type. (traverse_base::priv_sptr): Add pointer to private data member. (traverse_base::visiting_): Move this data member definition into traverse_base::priv. (traverse_base::{visiting, traverse_base, ~traverse_base}): Move definitions out-of-oline. (traverse_base::traverse): Comment out. * src/abg-traverse.cc (struct traversable_base::priv): Define new type. (traversable_base::{traversable_base, ~traversable_base, traverse, visiting}): Move these previous inline definitions here. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Giuliano Procida
|
93fae877d8 |
Simplify peel_typedef_pointer_or_reference_type
The second argument to this function controls whether CV qualifiers should be stripped as well as the elements mentioned in the function name. While it defaults to true, it is now always passed in as false. The function contains incomplete code for peeling array types. This is not needed or indeed wanted by its current callers. This commits removes the peel_qual_type argument and removes the associated behaviour. It removes the array peeling code. There are no functional changes apart from no longer performing early canonicalisation of certain array types. I looked at the history of this function to see where the behaviours originated. |
||
Giuliano Procida
|
3b93574beb |
Remove unused is_reference_or_pointer_diff.
The function is_reference_or_pointer_diff was added in commit |
||
Giuliano Procida
|
12baf89751 |
abg-comparison.h: Remove stray declaration
The functon is_reference_or_pointer_diff_to_non_basic_distinct_types
was declared in
|
||
Giuliano Procida
|
697347e402 |
Fix corpus_diff::has_net_changes for --leaf-changes-only mode
This function was not aware of --leaf-changes-only mode. - Stats counters for changed variables and types have different names in the different modes. - Net leaf type changes were not included in leaf mode. For some inputs, this resulted in abidiff producing an empty report but returning a non-zero exit status in --leaf-changes-only mode. For other inputs the combination of both issues still resulted in the correct return code. This included the following test-abidiff-exit test cases: - test-leaf-peeling - test-leaf2 - test-no-stray-comma This patch makes corpus_diff::has_net_changes mirror emit_diff_stats, modulo flags like --non-reachable-types which if absent can still result in discrepancies between output and return code. To achieve this in a more maintainable way, the patch introduces a new interface reporter_base::diff_has_net_changes. That interface is implemented by all current reporters. Each reporter focuses on its own particularities to provide the required behavious. Then corpus_diff:has_net_changes just has to invoke reporter_base::diff_has_net_changes on the reporter that is currently in used. The tests below verify that the exit code is zero when all the changes between the test files are suppressed. * include/abg-reporter.h ({reporter_base, default_reporter, leaf_reporter}::diff_has_net_changes): Add new virtual function. This breaks binary compatibility but should conserve source compatibility. * src/abg-default-reporter.cc (default_reporter::diff_has_net_changes): Define new member function. * src/abg-leaf-reporter.cc (leaf_reporter::diff_has_net_changes): Likewise. * src/abg-comparison.cc (corpus_diff::has_net_changes): Invoke reporter_base::diff_has_net_changes on the current reporter, rather than trying to handle all the different kinds of reporters here. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Add a TODO to possibly delegate the implementation of this function to the reporters. * tests/data/Makefile.am: Add new test case files. * tests/data/test-abidiff-exit/test-net-change-report0.txt: Normal mode, nothing suppressed. * tests/data/test-abidiff-exit/test-net-change-report1.txt: Normal mode, everything suppressed. * tests/data/test-abidiff-exit/test-net-change-report2.txt: Leaf mode, nothing suppressed. * tests/data/test-abidiff-exit/test-net-change-report3.txt: Leaf mode, everything suppressions. * tests/data/test-abidiff-exit/test-net-change-v0.c: Test file * tests/data/test-abidiff-exit/test-net-change-v0.o: Test file * tests/data/test-abidiff-exit/test-net-change-v1.c: Test file * tests/data/test-abidiff-exit/test-net-change-v1.o: Test file * tests/data/test-abidiff-exit/test-net-change.abignore: This suppresses changes for all variables, functions and types in the test files, except for the 'victim' function. * tests/test-abidiff-exit.cc: Run new test cases. Reviewed-by: Matthias Maennich <maennich@google.com> Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Giuliano Procida
|
dbef379a96 |
Support incomplete enums in core and diff code.
This is an initial implementation of the support for incomplete, also
known as forward-declared, enum types. I've not made any attempt to
refactor or share logic with the struct/union code.
* include/abg-comp-filter.h (has_decl_only_def_change) : Declare
New function.
* src/abg-comp-filter.cc (there_is_a_decl_only_enum): Define new
static function and ...
(type_size_changed): ... use it here.
(has_decl_only_def_change): Define new function and ...
(categorize_harm{less, ful}_diff_node): ... use it here.
* include/abg-fwd.h (enums_type, decl_base_wptr): Declare new
typedefs.
(look_through_decl_only_class): Declare new overload for
class_or_union*.
(is_compatible_with_enum_type, is_compatible_with_enum_type)
(look_through_decl_only, lookup_enum_types, lookup_enum_types):
Declare new functions.
* include/abg-ir.h (decl_base::{get_is_declaration_only,
set_is_declaration_only, set_definition_of_declaration,
get_definition_of_declaration,
get_naked_definition_of_declaration}): Declare new member
functions. They were moved here from the class_or_union class.
(class_or_union::{get_earlier_declaration,
set_earlier_declaration, get_definition_of_declaration,
set_definition_of_declaration,
get_naked_definition_of_declaration, get_is_declaration_only,
set_is_declaration_only}): Remove these member functions.
* src/abg-ir.cc (decl_base::priv::{declaration_,
definition_of_declaration_, naked_definition_of_declaration_,
is_declaration_only_}): Define data members. Moved here from
class_or_union.
(decl_base::priv::priv): Adjust to initialize the new data
members.
(decl_base::{get_earlier_declaration, set_earlier_declaration,
get_definition_of_declaration,
get_naked_definition_of_declaration, get_is_declaration_only,
set_is_declaration_only, set_definition_of_declaration}): Define
member functions.
(operator|): In the overload for (change_kind, change_kind),
adjust the return type of the call to
decl_base::get_definition_of_declaration.
(look_through_decl_only): Define new function.
(look_through_decl_only_class): Adjust.
(look_through_decl_only_enum): Likewise.
(maybe_update_types_lookup_map<class_decl>): Adjust return type of
call to decl_base::get_definition_of_declaration.
(types_defined_same_linux_kernel_corpus_public): Use
look_through_decl_only_class rather than open coding it.
(class_or_union::priv::{declaration_, definition_of_declaration_,
naked_definition_of_declaration_, is_declaration_only_}): Remove
these data members. They are now carried by decl_base::priv.
(class_or_union::{g,s}et_alignment_in_bits): Adjust.
(class_or_union::{g,s}et_size_in_bits): Likewise.
(class_or_union::operator==): Likewise.
(equals): Adjust the overload for class_or_union.
(is_compatible_with_enum_type)
* src/abg-comparison.cc (try_to_diff<class_decl>): Adjust the
return type of decl_base::get_definition_of_declaration.
(leaf_diff_node_marker_visitor::visit_begin): Use
filtering::has_decl_only_def_change rather than
filtering::has_class_decl_only_def_change. Decl-only changes to
enums (or any other type really) will thus not be recorded as leaf
changes.
* src/abg-dwarf-reader.cc (get_scope_for_die): Adjust return type
of decl_base::get_definition_of_declaration.
* src/abg-default-reporter.cc (default_reporter::report): Report
enum decl-only <-> definition changes.
* src/abg-hash.cc (class_or_union:#️⃣:operator()): In the
overload for class_or_union& adjust the return type for
decl_base::get_definition_of_declaration.
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||
Giuliano Procida
|
401e3cded9 |
abg-ir.cc: Remove unused re_canonicalize function.
The function re_canonicalize was added in commit: |
||
Dodji Seketeli
|
346e88dd76 |
Bug 26135 - Wrong linkage name causes anonymous classes miscomparison
When comparing decls, the overload of the 'equals' function for instances of decl_base compares their linkage names. If they are different, then the decls are generally considered different. Class declarations (and definitions) also use the 'equals' function referred to above. So when two classes have different linkage names, they are always considered different. Now let's consider the case of an anonymous class. It doesn't have any user-provided name, by definition. Libabigail does, however, assigns it an internal name for various (internal) purposes. That internal name is generally ignored for the purpose of (anonymous) type comparison. So by design, two anonymous classes can have different internal anonymous names and yet still happen to be equal. The root issue in this problem report is that by default, the linkage name of a class is set to its name. And when that class is anonymous, its internal name is used as its linkage name. Oops. That leads to anonymous classes being wrongly considered different. This patch fixes the issue by providing additional constructors for a class type to avoid using the internal anonymous name as its linkage name. Note that the same issue is present for unions so the patch does the a similar thing for union types. Enums are properly handled so we don't need to do anything in that regard. For good measure, the patch also adds an assert to type_base::get_canonical_types_for to ensure that anonymous class or union types don't have linkage names for now. * include/abg-ir.h (class_decl::class_decl): Add two overloads that take the "is_anonymous" flag. (union_decl::union_decl): Likewise. * src/abg-ir.cc (class_decl::class_decl): Define two overloads that take the "is_anonymous" flag and set the linkage name accordingly. (union_decl::union_decl): Likewise. (type_base::get_canonical_type_for): Assert that an anonymous class or union can't have a linkage name for now. * src/abg-dwarf-reader.cc (add_or_update_class_type) (add_or_update_union_type): Use a new overload for the constuctor of {class, union}_decl and set the "is_anonymous" flag. Don't use decl_base::set_is_anonymous anymore. * src/abg-reader.cc (build_class_decl, build_union_decl): Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Giuliano Procida
|
dd1c608120 |
Rename declaration-definition change category.
This patch renames CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY to TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY. * include/abg-comparison.h (TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY): Rename CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY into this. (EVERYTHING_CATEGORY): In the value of this enumerator, rename CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY into TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY. * src/abg-comp-filter.cc (categorize_harmless_diff_node): Likewise. * src/abg-comparison.cc (get_default_harmless_categories_bitmap): Likewise. (operator<<(ostream& o, diff_category c)): Likewise. * src/abg-default-reporter.cc (default_reporter::report): Likewise in the overload for class_or_union_diff. * src/abg-leaf-reporter.cc (leaf_reporter::report): Likewise in the overload for class_or_union_diff. Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Giuliano Procida
|
df47240f7d |
Improve code comments and whitespace.
These are zero impact changes. * include/abg-fwd.h: Correct doc-comment reference to enum_type_decl. * src/abg-comp-filter.cc: Fix doc-comment syntax. * src/abg-comparison.cc (operator<<): In the diff_category overload, fix code indentation. * src/abg-default-reporter.cc (report): In the class_or_union_diff overload, adjust comment to reflect that the code is reporting changes between declaration-only and defined types, in either direction. Signed-off-by: Giuliano Procida <gprocida@google.com> |