libabigail/tests/data/test-diff-dwarf/test34-pr19173-libfoo2.so
Dodji Seketeli ba980025fb Bug 19173 - Abidiff doesn't detect symbol size change in library
It appears that libabigail does not represent the size of ELF symbols,
so it doesn't detect when a symbol size changes without impacting the
size of the type of said symbol, as described by debug info.

It appears that Address Sanitizer as implemented by Clang does change
the size of variable symbols when it instruments those variables.  And
of course, the size of type of said symbols (as described by debug
information) remains unchanged.

This patch makes Libabigail become aware of symbol sizes, especially
for variables.  Symbol sizes for functions are ignored for now,
because a change in a function symbol size is not an ABI change.

The patch makes libabigail detect and report symbol size changes for
variables, but looking at the ELF information, independently from the
debug information.

The patch adjusts the existing tests and adds a new test using the
binaries that were filed in the bug report.

	* include/abg-ir.h (elf_symbol::{elf_symbol, create}): Take a size
	parameter.
	(elf_symbol::{get,set}_size): New accessors.
	* src/abg-ir.cc (elf_symbol::priv::size_): New data member.
	(elf_symbol::priv::priv): Initialize it.
	(elf_symbol::{elf_symbol, create}) Take a size parameter.
	(textually_equals): Compare the size of variable symbols.
	(elf_symbol::{get, set}_size): New accessors.
	* src/abg-comparison.cc (maybe_report_diff_for_symbol): New static
	function.
	({function_decl_diff,var_diff}::report): Use it.
	* src/abg-dwarf-reader.cc (lookup_symbol_from_sysv_hash_tab)
	(lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_symtab)
	(read_context::lookup_elf_symbol_from_index): Set the size of the
	elf symbols' internal representation.
	* src/abg-reader.cc (build_elf_symbol): Read the size attribute if
	present.
	* src/abg-writer.cc (write_elf_symbol): Write the size attribute
	for variable symbols, if it's not zero.
	* tests/data/test-diff-dwarf/test34-pr19173-libfoo.so: New test
	input binary.
	* tests/data/test-diff-dwarf/test34-pr19173-libfoo2.so: Likewise.
	* tests/data/test-diff-dwarf/test34-pr19173-libfoo-report-0.txt:
	New reference test output.
	* tests/data/Makefile.am: Add the new test input binaries to the
	build system.
	* tests/test-diff-dwarf.cc (in_out_specs): Add the new test input
	above to the test harness.
	* tests/data/test-diff-dwarf/test9-report.txt: Adjust.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test6.so.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-07 23:22:18 +01:00

9.8 KiB