libabigail/include
Dodji Seketeli 721728e7de Support reading and comparing soname from ELF files
Libabigail's DWARF reader doesn't read the DT_SONAME tag from the
.dynamic section.  The abigail::corpus type doesn't have a property
for that tag either.  And the comparison engine doesn't take that tag
in when comparing corpora.

This patch modifies the DWARF reader to read the DT_SONAME and
DT_NEEDED tags from the .dynamic section.  The value of DT_SONAME tag
is then saved in the new corpus property accessed by the new
abigail::corpus::get_soname() accessor.  The comparison engine has
also been modified to compare the sonames of two corpora being
compared.  Note that the value of the DT_NEEDED elf tag is saved in a
new corpus property that is accessed via the new
abigail::corpus::get_needed() getter.  This property is not used yet.

This patch also adds a unit test for this new feature.

	* include/abg-corpus.h (corpus::{get_needed, set_needed,
	get_soname, set_soname}): Declare new accessors.
	* src/abg-corpus.cc (corpus::priv::{needed, soname}): New data
	members.
	(corpus::{get_needed, set_needed, get_soname, set_soname}): Define
	new accessors.
	(corpus::is_empty): Take dt_needed and dt_soname in account in
	computing empty-ness.
	* src/abg-dwarf-reader.cc (read_context::{dt_needed_,
	dt_soname_}): New data members.
	(read_context::{dt_needed, dt_soname}): New accessors.
	(read_context::load_dt_soname_and_needed): New member function.
	(read_corpus_from_elf): Call the new
	read_context::load_dt_soname_and_needed() to read the dt_soname
	and dt_needed tags.  Set them to the corpus.
	* include/abg-comparison.h (diff_context::show_soname_change):
	Declare new accessors.
	* src/abg-comparison.cc (diff_context::priv::show_soname_change_):
	New data member.
	(diff_context::priv::priv): Initialize the new data member
	diff_context::priv::show_soname_change_.
	(diff_context::show_soname_change): Define new accessors.
	(corpus_diff::priv::sonames_equal_): New data member.
	(corpus_diff::priv::priv): Initialize the new data member
	corpus_diff::priv::sonames_equal_.
	(corpus_diff::length): Take the new priv_->sonames_equals_ data
	member in account.
	(corpus_diff::{report, priv::emit_diff_stats}): If the sonames
	changed and we are allowed to report it, then report it.
	(compute_diff): In the variant for corpus_diff, do not forget to
	compare the sonames.
	* src/abg-reader.cc (build_needed, read_elf_needed_from_input):
	Define new static functions.
	(read_corpus_from_input): Read the 'soname' attribute from the
	'abi-corpus' xml element node.
	* src/abg-writer.cc (write_elf_needed): Define new static
	function.
	(write_corpus_to_native_xml): Write a new 'elf-needed' xml element
	node that contains one xml 'dependency' element node per
	dependency to emit.  This uses the new write_elf_needed() function
	above.
	* tests/data/test-diff-dwarf/libtest19-soname-v0.so: New test
	input data.
	* tests/data/test-diff-dwarf/libtest19-soname-v1.so: Likewise.
	* tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test19-soname-v0.c: Source code of
	the first binary above.
	* tests/data/test-diff-dwarf/test19-soname-v1.c: Source code of
	the second binary above.
	* tests/test-diff-dwarf.cc (in_out_specs): Add the test input
	above to the list of test input to run this harness on.
	* tests/data/Makefile.am: Add the new test input data above.
	* tests/data/test-read-dwarf/test{0,1}.abi: Adjust.
	* tests/data/test-read-dwarf/test{2,3,4,6,}.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-07 23:42:26 +01:00
..
abg-comp-filter.h Remove useless redundant_filter 2014-10-13 17:39:26 +02:00
abg-comparison.h Support reading and comparing soname from ELF files 2014-12-07 23:42:26 +01:00
abg-config.h Doxygen markup fixes final. 2013-08-14 15:07:18 +02:00
abg-corpus.h Support reading and comparing soname from ELF files 2014-12-07 23:42:26 +01:00
abg-diff-utils.h Make the use of a C++-11 compiler optional 2014-11-05 10:45:07 +01:00
abg-dwarf-reader.h Support comparing symbols not referenced by debug info 2014-10-22 23:04:40 +02:00
abg-fwd.h Fix the reference to the IRC channel on the web page 2014-11-18 23:14:49 +01:00
abg-hash.h Misc style fixes 2014-02-10 15:51:10 +01:00
abg-ini.h Initial support for type suppressions 2014-10-13 17:44:44 +02:00
abg-ir.h Rename elf_symbol::get_is_defined() to elf_symbol::is_defined() 2014-11-30 19:57:04 +01:00
abg-libxml-utils.h Serialize and de-serialize elf symbols for var & function decls 2014-05-14 11:19:34 +02:00
abg-libzip-utils.h Initial writing/reading of an ABI corpus to an archive 2013-08-27 16:20:41 +02:00
abg-reader.h Put IR artifacts in the abigail::ir namespace 2014-10-13 17:44:43 +02:00
abg-sptr-utils.h Factorize a no-op deleter for shared pointer 2014-09-30 18:04:14 +02:00
abg-traverse.h Put IR artifacts in the abigail::ir namespace 2014-10-13 17:44:43 +02:00
abg-version.h.in Collapse subdir of include to include. 2013-08-14 15:07:18 +02:00
abg-viz-common.h Forward decls for abg-ir.h, doxygen fixups, restyle. 2013-08-14 15:07:18 +02:00
abg-viz-dot.h Forward decls for abg-ir.h, doxygen fixups, restyle. 2013-08-14 15:07:18 +02:00
abg-viz-svg.h Forward decls for abg-ir.h, doxygen fixups, restyle. 2013-08-14 15:07:18 +02:00
abg-writer.h Put IR artifacts in the abigail::ir namespace 2014-10-13 17:44:43 +02:00
Makefile.am Initial support of ini-style file parsing 2014-10-13 17:44:43 +02:00