mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-19 16:30:04 +00:00
The Git repository of the Libabigail Project
843de38b6c
Forcing each TU to be read in a self contained way was a mistake because it introduces differences with how DWARF is represented. In DWARF, types need to be reconciled at the DSO level. I.e, some types that are only declared in some TUs are to be defined later in other TUs. So abixml needs to reflect that, otherwise, some types read from abixml might wrongly appear to be different from the same type read from DWARF. But then we need to be able to use a type (refer to its type id) before defining it later. That means, we need to read the abixml file in, as a whole. Rather than walking it with a cursor like we used to do. This patch does that. That implies to be able to build (on-demand) an entire translation unit, just because we refer to a type that is inside that TU. The patch also fixes some ancillary issues that are related or uncovered by this "whole-corpus" way of seeing things; these issues were causing type hashing differences with what the DWARF reader does. * src/abg-reader.cc (class read_context): Move data member at the top of the class like what is done elsewhere in the code base. (read_context::m_corp_node): New data member. (read_context::read_context): Initialize it. (read_context::{get,set}_corpus_node): New accessors. (read_context::map_id_and_node): Accept that a node id previously defined is defined again. In that case we just remember the first mapping id -> xml-node. That seems to work for now. (read_context::get_translation_unit): Fix the logic. (read_context::m_wip_types_map): Rename read_context::m_wip_classes_map into this. (read_context::clear_wip_types_map): Rename read_context::clear_wip_classes into this. (read_context::mark_type_as_wip): Rename read_context::mark_class_as_wip into this. (read_context::unmark_type_as_wip): Rename read_context::unmark_type_as_wip into this. (read_context::is_wip_type): Rename read_context::is_wip_class into this. (read_context::types_equal): New member function. (read_context::clear_per_translation_unit_data): Do not clear anything anymore as the previous data that were per-tu are now per-corpus. (read_context::clear_per_corpus_data): Clear here the previous data that were per-tu. (read_context::maybe_canonicalize_type): Add a new force_delay flag that forces the type to be late-canonicalized. Also force late-canonicalize references, pointers, qualified-type and typedef because they must be canonicalized once they've been added to their context; but then this function might be called too early, before they are added to their context. (read_context::type_id_new_in_translation_unit): Remove this member function. (read_translation_unit_from_input): Be able to either use the xmlTextReader interface, or get the current 'abi-instr' xml element node. If using the xmlTextReader interface, use it to move to the 'abi-instr' node, expand it and then use that. In either case, call read_translation_unit() with the 'abi-instr' xml element node. (read_translation_unit): Take an 'abi-instr' XML element in argument now, use that to read the translation unit, as opposed to using the xmlTextReader interface we where using before to walk the sub-tree of the abi-instr xml node. (read_context::get_scope_for_node): If the scope is a new translation unit, then build the new translation unit. (read_symbol_db_from_input): Take the function and variable symbol data bases, and read the current xml element node (do not use the xmlTextReader interface anymore) to populate the function and variable symbols. (read_elf_needed_from_input): Do not use the xmlTextReader interface anymore. Rather, use the current xml element node, look for the 'elf-needed' xml element node and use it to populate the set of elf dependencies. (read_corpus_from_input): Rework to expand the contents of the corpus node and use the result, rather than just exclusively relying on the xmlTextReader interface. (build_function_parameter): Build a proper IR node for variadic parameters. Build function type node *after* having built all the parameters IR, so that parameter indexing is the same as what is done in the DWARF reader. Also, if the function is not being added to its context yet, then delay the canonicalizing of its type, just like what is done by the DWARF reader. (build_qualified_type_decl, build_pointer_type_def) (build_reference_type_def, build_enum_type_decl, build_type_decl): Adjust. Do not enforce anymore that the ID of this type be new in the current TU. Delay canonicalizing if the type is not being added to its context. For typedefs, use an adapted way of checking the consistency of the underlying type. (build_array_type_def): Do not enforce anymore that the ID of this type be new in the current TU. Support the fact that the array might not have any DW_AT_byte_size attribute. Force late canonicalizing if the array is not being added to its context. (build_class_decl): Adjust. Reuse the read_context::maybe_canonicalize_type() function rather than trying to determine locally when to canonicalize. (build_template_tparameter): Adjust Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
doc | ||
include | ||
m4 | ||
scripts | ||
src | ||
tests | ||
tools | ||
.gitignore | ||
abigail.m4 | ||
AUTHORS | ||
ChangeLog | ||
COMMIT-LOG-GUIDELINES | ||
COMPILING | ||
config.h.in | ||
configure.ac | ||
CONTRIBUTING | ||
COPYING | ||
COPYING-GPLV3 | ||
COPYING-LGPLV2 | ||
COPYING-LGPLV3 | ||
gen-changelog.py | ||
install-sh | ||
libabigail.pc.in | ||
ltmain.sh | ||
Makefile.am | ||
README | ||
test21-type-suppr-0.suppr | ||
test21-type-suppr-report-0.txt |
This is the Application Binary Interface Generic Analysis and Instrumentation Library. It aims at constructing, manipulating, serializing and de-serializing ABI-relevant artifacts. The set of artifacts that we are intersted is made of quantities like types, variable, fonctions and declarations of a given library or program. For a given library or program this set of quantities is called an ABI corpus. This library aims at (among other things) providing a way to comparing two ABI Corpuses, provide detailed information about their differences, and help build tools to infer interesting conclusions about these differences. You are welcome to contribute to this project after reading the files CONTRIBUTING and COMMIT-LOG-GUIDELINES files in the source tree. Communicating with the maintainers of this project -- including sending patches to be include to the source code -- happens via email at libabigail@sourceware.org.