* src/Makefile.am: -L and -l ought to be in LIBADD/LDADD because
that is the only place guaranteed to be in the right spot. So add
Them to libabigail_la_LIBADD.
* tools/Makefile.am: Likewise.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* configure.ac: Check for the existence of libelf at configure
time by looking at the presence of the elf_end symbol. Add the
libelf to the link command line.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* doc/Makefile.am: Do not use @docdir@. It's indeed replaced at
configure time. But there is no need for this limitation with
automake, as $(docdir) is available and replaceable anytime.
* src/Makefile.am: Likewise for @DEPS_LIBS@ and @DEPS_CFLAGS@.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* configure.ac(DEVEL_CFLAGS, DEVEL_CXXFLAGS): Remove these
useless variables.
(CFLAGS, CXXFLAGS): Set these variables directly.
* include/Makefile.am (pkginclude_HEADERS): Use this predefined
variable.
(publicheaders_DATA, publicheadersdir): Remove these.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* ChangeLog: Remove this empty file for now. It'll be added back
right before the first release by automatic generation from the
commit logs.
* INSTALL: Remove this empty file for now.
* NEWS: Remove this empty file for now. It'll be added back right
before the first release.
* configure.ac (AM_INIT_AUTOMAKE): As the mandatory but empty
files above are being removed for now, let's put in the 'foreign'
mode of automake for the moment. We'll likely remove it at
release time.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* configure.ac(AM_INIT_AUTOMAKE): Set the subdir-object option
here ..
* src/Makefile.am: ... not here.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
* include/abg-fwd.h (std::tr1::weak_ptr): Inject this type in the
abigail namespace.
* include/abg-ir.h: Write a memory management guideline for the IR
artifacts.
(Type_base_wptr, function_type_wptr)
(class_decl_wptr): New typedefs.
(translation_unit::get_canonical_function_type): Declare new
member function.
(qualified_type_def::underlying_type_)
(reference_type_def::pointed_to_type_)
(typedef_decl::underlying_type_, function_decl::parameter::type_)
(function_type::return_type_, method_type::class_type_)
(non_type_tparameter::type_, type_composition::type_): Make this a
weak pointer.
(qualified_type_def::get_pointed_to_type)
(reference_type_def::get_pointed_to_type)
(array_type::get_element_type, typedef_decl::get_underlying_type)
(var_decl::get_type, function_decl::parameter::get_type)
(function_type::get_return_type, method_type::get_class_type)
(non_type_tparameter::get_type)
(type_composition::get_composed_type): Adjust to make this return
a shared pointer initialized with the content of the weak pointer.
(function_decl::function_decl, method_decl::method_decl): Remove
the overload that doesn't take a type. This is because now,
function types need to be registered to their containing
translation unit.
(struct function_type::hash): Declare here.
* src/abg-hash.cc (struct function_type::hash): Declare this in
abg-ir.h and just define the methods here.
* src/abg-ir.cc (fn_type_ptr_map): New typedef.
(translation_unit::priv::canonical_types_): Remove this unused
member.
(translation_unit::priv::canonical_function_types_): New member.
(translation_unit::get_canonical_function_type): Define this
function.
(array_type_def::priv::element_type_, var_decl::priv::type_)
(function_decl::priv::type_): Make this a weak pointer.
(qualified_type_def::get_underlying_type)
(pointer_type_def::get_pointed_to_type)
(reference_type_def::get_pointed_to_type)
(array_type_def::get_element_type)
(typedef_decl::get_underlying_type, var_decl::get_type)
(function_decl::get_type): Adjust to make this return a shared
pointer initialized with the content of the weak pointer.
(qualified_type_def::build_name)
(pointer_type_def::get_qualified_name)
(reference_type_def::get_qualified_name): Adjust.
(method_type::set_class_type): Cleanup the logic.
(function_decl::priv::priv): Remove the overload that takes a bare
pointer to a type. This should not be used now that we need the
function type to registered with the translation unit.
(function_decl::function_decl): Remove the overload that doesn't
take a type. This is because now, function types need to be
registered to their containing translation unit.
* src/abg-dwarf-reader.cc (build_function_decl): Register the
function type within its translation type and use its canonical
version. This complies with the new memory management rules.
* src/abg-reader.cc (build_function_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/biar.cc (std::ostream): Add a using directive.
(display_usage): Make it take a string reference and an ostream
as parameters. Use the ostream argument as an output stream
instead of a hard-coded cout.
Prettify output.
(main): Call display_usage with new parameters.
* tools/bidiff.cc (display_usage): Declare it static.
Prettify output.
* tools/bidw.cc (display_usage): Prettify output.
* tools/bilint.cc (display_usage): Declare it static.
Prettify output.
* tools/bisym.cc (std::cerr): Add a using directive.
(prog_name): Rename progname into this.
(display_usage): Rename show_help into this.
Add an ostream as a parameter. Use the ostream argument
as output stream insted of a hard-coded cout.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (changed_type_or_decl_vector): New
typedef.
* include/abg-fwd.h (is_data_member): Change the overload that
takes a decl_base_sptr to make it return the real var_decl_sptr
rather than just a bool.
* src/abg-comparison.cc (ChangedDataMemberComp, DataMemberComp):
New comparison functors.
(sort_changed_data_members, sort_data_members): Sorting functions
for changed data members and data members.
(class_diff::report): Sort reports for deleted, inserted and
change data members by the increasing value of the offsets of said
data members.
* src/abg-ir.cc (is_data_member): Change the overload that takes a
decl_base_sptr to make it return the real var_decl_sptr rather
than just a bool.
* tests/data/test-bidiff/test-struct1-report.txt: Adjust.
* tests/data/test-diff-dwarf/test13-report.txt: New test input.
* tests/data/test-diff-dwarf/test13-v0.cc: Source code for new
test input.
* tests/data/test-diff-dwarf/test13-v0.o: New test input.
* tests/data/test-diff-dwarf/test13-v1.cc: Source code for new
test input.
* tests/data/test-diff-dwarf/test13-v1.o: New test input.
* tests/Makefile.am: Add the new test inputs above to the source
distribution.
* tests/test-diff-dwarf.cc: Run this test harness on the new test
input.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (diff::is_filtered_out): If a diff not is
only in the NOT_REDUNDANT_CATEGORY category consider it as not
being filtered.
* tests/data/test-diff-filter/test18-report.txt: New test input.
* tests/data/test-diff-filter/test18-v0.cc: Source code for new
test input.
* tests/data/test-diff-filter/test18-v0.o: New test input.
* tests/data/test-diff-filter/test18-v1.cc: Source code for new
test input.
* tests/data/test-diff-filter/test18-v1.o: New test input.
* tests/Makefile.am: Add the new test inputs to the source distribution.
* tests/test-diff-filter.cc: Run this test harness on the new test
input above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc: Add a comment for the file.
(struct class_diff::priv::{subtype_changed_dm_,changed_dm_}): Add
comment for these data members.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER{2,3}): New
macros.
({pointer_diff, array_diff, reference_diff, qualified_type_diff,
class_diff, typedef_diff}::report): Use the new macros above.
* tests/data/test-bidiff/test-qual-type0-report.txt: Adjust
because type pretty representation are now always quoted.
* tests/data/test-bidiff/test-struct1-report.txt: Adjust likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* configure.ac: Support a new --enable-zip-archive option. By
default its value is set to the 'auto', meaning that if libzip is
installed, that turns the option on -- just like if
--enable-zip-archive was called with the value 'yes'; if libzip is
not installed, that turns the option off -- just like if
--enable-zip-archive was called with the value 'no'. If libzip is
detected, the pre-processor macro HAVE_LIBZIP is set to 1. If
--enable-zip-archive is turned on, the pre-processor macro
WITH_ZIP_ARCHIVE is set to 1.
* config.h.in (HAVE_LIBZIP, WITH_ZIP): New define.
* src/abg-corpus.cc: Include config.h. Guard the inclusion of
abg-libzip-utils.h with the WITH_ZIP_ARCHIVE macro. Likewise for
the use of declarations coming from abg-libzip-utils.h.
* src/abg-libzip-utils.cc: Include config.h. Guard the file's
content with the WITH_ZIP_ARCHIVE macro.
* src/abg-reader.cc: Include config.h. Guard the inclusion of
abg-libzip-utils.h with the WITH_ZIP_ARCHIVE. Likewise for the
use of declarations coming from abg-libzip-utils.h.
* src/abg-writer.cc: Likewise.
* tests/Makefile.am: Build runtestwritereadarchive and runtestdot
only if zip archives are supported.
* tools/Makefile.am: The biar program is built only if
zip archives are supported.
* tools/bidiff.cc: Handle zip archives only if the
WITH_ZIP_ARCHIVE macros is defined.
* tools/bilint.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/bidiff.cc (options::{display_usage,missing_operand}): New
data members.
(options::options): Initialize them.
(parse_command_line): Flag missing operands. Return false only
when an option could not be parsed. Flag when the user wants us
to display help.
(main): Tell --help, wrong options and missing argument apart and
give an appropriate message on stderr. The help string goes to
stdout though. Just like what GNU diff does.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (ENSURE_DIFF_NODE_TRAVERSED_ONCE): If the
diff node is being traversed for the first time, mark it as being
in the NOT_REDUNDANT_CATEGORY. I don't know why I was doing this
only for classes and basic types. Update comments.
* tests/data/test-diff-filter/test16-report.txt: New test input.
* tests/data/test-diff-filter/test16-v0.cc: Source code of new
test input.
* tests/data/test-diff-filter/test16-v0.o: New test input.
* tests/data/test-diff-filter/test16-v1.cc: Source code of new
test input.
* tests/data/test-diff-filter/test16-v1.o: New test input.
* tests/data/test-diff-filter/test17-0-report.txt: Likewise.
* tests/data/test-diff-filter/test17-1-report.txt: Likewise.
* tests/data/test-diff-filter/test17-v0.cc: Source code of new
test input.
* tests/data/test-diff-filter/test17-v0.o: Likewise.
* tests/data/test-diff-filter/test17-v1.cc: Source code of new
test input.
* tests/data/test-diff-filter/test17-v1.o: Likewise.
* tests/Makefile.am: Add the new files to the source distribution.
* tests/test-diff-filter.cc (in_out_spec): Run this test harness
over the new test inputs.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Set
the name of anonymous structs to '__anonymous_struct_'.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/bidiff.cc (display_usage): Change--no-linkage-names -o
--no-linkage-name in the help string.
(parse_command_line): Adjust the command line parsing accordingly.
* tests/test-diff-filter.cc (in_out_specs): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (represent, corpus_diff::report): show
symbol version info in linkage name info.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-ir.cc (elf_symbol::operator==): Rather than comparing
bindings, compare public-ness here. That is, if two symbol
versions' differ because one is GLOBAL and the other one is WEAK,
they should still be considered equal, from an ABI standpoint.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc
({class,corpus}_diff::ensure_lookup_tables_populated): Now that in the
intermediate maps we store symbol *ids* rather than symbol names,
make sure to really refer to symbol names for symbol lookups,
rather than (wrongly) referring to symbol ids.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/bidiff.cc (display_usage): Add help strings for --harmless
and --no-harmful.
(main): Emit the help string to stdout, not stderr.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/bidiff.cc (display_usage): Remove the help string for the
--no-harmless option that doesn't exist anymore, as it's on by
default.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h ({var,function}_decl::get_id): New member
function declarations.
* src/abg-ir.cc ({var,function}_decl::get_id): New member function
definitions.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Use the
::get_id() function to get an identifier for the function or
variable.
* src/abg-corpus.cc (symtab_build_visitor_type::build_id): Use the
get_id of the function/variable.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (read_context::alternate_die_decl_map):
Return the real alternate die decl map, rather than what we was
doing previously b/c of a stupid copy/paste. Oh well.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h
(corpus::lookup_{function,variable}_symbol): Add an overload
declaration that takes the version of the symbol to lookup.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): So when looking
up the corpora for symbols, take their versions in account.
* src/abg-corpus.cc (corpus::lookup_{function,variable}_symbol):
Add an overload definition that takes the version of the symbol to
lookup.
(symtab_build_visitor_type::build_id): New
member functions.
(corpus::priv::build_public_decl_table): Use the new member
functions above.
* src/abg-ir.cc (elf_symbol::version::operator==): Do not take the
is_default flag in account when comparing two symbol versions.
* libtest12-v{0,1}.so: New test input files.
* libtest12-v{0,1}.c: Source code for the test input files.
* test12-version-script: Version script to build the files above.
* test12-report.txt: Test input file.
* tests/Makefile.am: Add the new test input files above to the
source distribution.
* tests/test-diff-dwarf.cc (in_out_specs[]): Add an entry to this
table for the new test input files.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h (corpus::lookup_function_symbol)
(corpus::lookup_variable_symbol): Add the name of the function
parameter in the declaration.
* include/abg-ir.h (elf_symbol::version::version): Properly indent
this constructor declaration.
* src/abg-corpus.cc
(symtab_build_visitor_type::symtab_build_visitor_type): Properly
indent constructor parameters.
* src/abg-ir.cc (function_decl::operator==): Fix typo in
comments.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/bidiff.cc (display_usage): remove the '--harmful' line
from the help string as this option is now activated by default.
It's --harmless that exists now.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comp-filter.h (has_harmless_name_change): New
function declaration.
* include/abg-comparison.h
(diff_category::DECL_NAME_CHANGE_CATEGORY): Renamed this into
HARMLESS_DECL_NAME_CHANGE_CATEGORY.
(diff_category::EVERYTHING_CATEGORY): Update.
* include/abg-fwd.h (is_enum): New function declaration.
(is_var_decl): Return the shared_ptr<var_decl> rather than a bool.
(is_data_member): New overload that takes a shared_ptr<decl_base>.
* src/abg-comp-filter.cc (decl_name_changed): Consider the
qualified name here.
(has_harmless_name_change): Define new function declaration.
(harmless_filter::visit): Use the new has_harmless_name_change
function.
* src/abg-comparison.cc (represent)
(report_name_size_and_alignment_changes, enum_diff::report)
(typedef_diff::report, is_data_member): Use the new
filtering::has_harmless_name_change function to simplify logic of
emitting the name change related diff
* tools/bidiff.cc (set_diff_context_from_opts): Adjust
DECL_NAME_CHANGE_CATEGORY -> HARMLESS_DECL_NAME_CHANGE_CATEGORY.
* src/abg-ir.cc (is_data_member, is_enum): New function definitions.
(is_var_decl): Return the var_decl_sptr rather than just a bool.
* tests/data/test-diff-filter/test13-report.txt: Adjust.
* tests/data/test-diff-filter/test6-report.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (array_diff): Declare new class.
(array_diff_sptr): Shared pointer to type array_diff.
(compute_diff): Overload the function to take type
array_diff_sptr as the first two arguments.
* include/abg-fwd.h (array_type_def): Declare new class.
(subrange_type): Likewise.
(is_array_def): Declare new function.
* include/abg-ir.h (array_type_def_sptr): Shared pointer
to type array_type_def.
(array_type_def): Declare new class.
(ir_node_visitor::visit): Declare a new virtual function
taking a pointer to type array_type_def as an argument.
* src/abg-comparison.cc (compute_diff_for_types): Add
try_to_diff for two instances of type array_type_def.
(array_diff::priv): declare struct for holding private members
of type array_diff.
(array_diff::array_diff): Define constructor.
(array_diff::{first,second}_array):Define new
member functions.
(array_diff::element_type_diff): Likewise.
(array_diff::{length,report,traverse}): Likewise.
(compute_diff): Define function overloaded in
include/abg-comparison.h.
* src/abg-dwarf-reader.cc (build_array_type): Define new
function. Handle DW_TAG_array_type and DW_TAG_subrange type.
(build_ir_node_from_die): Amend case DW_TAG_array_type with
a call to build_array_type.
* src/abg-hash.cc (array_type_def::hash): Declare new struct.
(type_base::dynamic_hash::operator()): Attempt to dynamic_cast
the argument to type array_type_def as well.
(array_type_def::hash): Declare new struct.
* src/abg-ir.cc (array_type_def::array_type_def): Define
constructors.
(array_type_def::priv): declare struct for holding private members
of type array_type_def.
(array_type_def::operator==(const decl_base&):
Define new operator.
(array_type_def::operator==(const type_base&):
Likewise.
(array_type_def::append_subrange{,s}): Define
new functions.
(array_type_def::{set,get}_size_in_bits): Likewise.
(array_type_def::get_dimension_count): Likewise.
(array_type_def::get_qualified_name): Likewise.
(array_type_def::get_pretty_representation): Likewise.
(array_type_def::get_subrange_representation): Likewise.
(array_type_def::traverse): Likewise.
(array_type_def::get_{element_type,location,subranges}): Likewise.
(array_type_def::is_infinite): Likewise.
(array_type_def::~array_type_def): Define destructor.
(ir_node_visitor::visit): Define function, taking
pointer to array_type_def as an argument.
* src/abg-reader.cc (map_id_and_node): Check if node
is an array.
(is_array_def): Check if object is an array.
(handle_element_node): Handle array_type_def as well.
(build_subrange_type): Define new function.
(build_array_type_def): Likewise.
(build_type): Build type array_type_def as well.
(build_type_composition): Likewise.
(handle_array_type_def): Define new function.
* src/abg-writer.cc: (write_decl): Output arrays
as well.
(write_member_type): Likewise.
(write_type_composition): Likewise.
(write_array_type_def): Define new function.
* tests/data/test-diff-dwarf/test{10,11}-v{0,1}.{cc,o}: New test source
files
* tests/data/test-diff-dwarf/test{10,11}-report.txt: Likewise.
* tests/data/test-diff-dwarf/test10-report.txt: New test input.
* tests/data/test-read-dwarf/test7.cc: New test source
file.
* tests/data/test-read-dwarf/test7.so: New input binary
to read.
* tests/data/test-read-dwarf/test7.so.abi: New reference
test to compare against.
* tests/data/test-read-write/test25.xml: New test source
file.
* tests/test-diff-dwarf.cc: Adjust to launch the new test.
* tests/test-read-dwarf.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* test/Makefile.am: Add the new test inputs to the source
distribution.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-ir.cc (elf_symbol::is_variable): Accept TLS objects as
variables too.
* src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr)
(die_location_address): Add an output parameter to say if the
resulting constant value is a tls address or not.
(lookup_public_variable_symbol_from_elf): Use the proper
elf_symbol::is_variable() method, rather than trying to figure out
the low levels of what a variable is here. Also, cleanup the
condition.
(read_context::load_symbol_maps): Consider symbols of type
STT_TLS, when loading symbols for variables. Also, to avoir
symbols that are for versions, filter out symbols of type
STT_OBJECT and with a SHN_ABS section index.
(read_context::get_variable_address): If the address is for a tls
variable, do no try to adjust the address to arrange for things
like prelink. As that doesn't seem to affect TLS variables.
(dwarf_expr_eval_context::set_tls_addr): New data member.
(dwarf_expr_eval_context::dwarf_expr_eval_context): Initialize it.
(dwarf_expr_eval_context::set_tls_address): New accessors.
(dwarf_expr_eval_context::op_manipulates_stack): Handle
DW_OP_GNU_push_tls_address, a bit like DW_OP_form_tls_address, but
then, its result is a constant. Set the
dwarf_expr_eval_context::set_tls_addr flag when these two OPs are
run.
(die_member_offset): Adjust to the new signature of
eval_last_constant_dwarf_sub_expr.
* tests/data/test-diff-dwarf/libtest9-v0.so: New test input.
* tests/data/test-diff-dwarf/libtest9-v1.so: Likewise.
* tests/data/test-diff-dwarf/test9-report.txt: Likewise
* tests/data/test-diff-dwarf/test9-v0.cc: Source code for the
first input.
* tests/data/test-diff-dwarf/test9-v1.cc: Source code for the
second input.
* tests/test-diff-dwarf.cc: Run this harness on the two new inputs
above.
* tests/Makefile.am: Add the new inputs to the source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug:
Make this link be relative.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>