Bug 19173 - Abidiff doesn't detect symbol size change in library
authorDodji Seketeli <dodji@redhat.com>
Sat, 7 Nov 2015 19:51:29 +0000 (20:51 +0100)
committerDodji Seketeli <dodji@redhat.com>
Sat, 7 Nov 2015 22:22:18 +0000 (23:22 +0100)
commitba980025fba9b554fdb0b7116d91c902183a2211
treef2850fd88ddf395464a988737d73c2b2123d518d
parent3a0c65fbc5980bf9597b907bda8d369795092235
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>
27 files changed:
include/abg-ir.h
src/abg-comparison.cc
src/abg-dwarf-reader.cc
src/abg-ir.cc
src/abg-reader.cc
src/abg-writer.cc
tests/data/Makefile.am
tests/data/test-diff-dwarf/test34-pr19173-libfoo-report-0.txt [new file with mode: 0644]
tests/data/test-diff-dwarf/test34-pr19173-libfoo.so [new file with mode: 0644]
tests/data/test-diff-dwarf/test34-pr19173-libfoo2.so [new file with mode: 0644]
tests/data/test-diff-dwarf/test9-report.txt
tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt
tests/data/test-read-dwarf/test0.abi
tests/data/test-read-dwarf/test1.abi
tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi
tests/data/test-read-dwarf/test11-pr18828.so.abi
tests/data/test-read-dwarf/test12-pr18844.so.abi
tests/data/test-read-dwarf/test15-pr18892.so.abi
tests/data/test-read-dwarf/test16-pr18904.so.abi
tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi
tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-read-dwarf/test21-pr19092.so.abi
tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi
tests/data/test-read-dwarf/test6.so.abi
tests/data/test-read-dwarf/test9-pr18818-clang.so.abi
tests/test-diff-dwarf.cc