Symbols with the same zero value are not aliases
authorDodji Seketeli <dodji@redhat.com>
Mon, 12 Jun 2017 17:10:20 +0000 (19:10 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 3 Jul 2017 15:45:49 +0000 (17:45 +0200)
commitbb0c1c322d0d834214b8f13561823bf1b5deb8e4
tree1fc2dda3abc71fe451fda1ecde7d7310b26be550
parenta7492fea56647420ec3e6a8d3dc2faa5af07a46e
Symbols with the same zero value are not aliases

When looking at ELF file of the ET_REL kind (i.e, relocatable object
files), several kinds of symbols (for instance weak symbols) can have
the symbol value zero.  Although they have the same value, the fact
that that value is zero prevents us from considering those symbols as
being aliases.

Libabigail was wrongly considering those symbols with value zero as
being aliases.  So, in practice, it was considering all WEAK symbols
as being aliases, because the value of a weak symbols is zero.

When comparing two binaries originating from the same source code, one
compiled with g++ and the other one compiled with clang++, abidiff was
thus reporting spurious function aliases changes due to this issue.

Note that the two binaries in question come from the bug PR21486.
Comparing them using abidiff exhibits several other issues that were
fixed in previous commits, such as

 - Reporting changes about top cv qualifier changes on function
 parameter types.
 - Not supporting ELF symbol visibility

* src/abg-dwarf-reader.cc (load_symbol_maps_from_symtab_section):
Do not consider symbols with zero value as being aliases.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-1.txt:
Likewise.
* test-diff-filter/test41-PR21486-abg-writer.gcc.o: New test
binary input.
* tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o:
Likewise.
* tests/data/Makefile.am: Add the new test material to source
distribution.
* tests/test-diff-filter.cc (in_out_specs): Run the test harness
on the new test input above.
* tests/data/test-diff-dwarf/test5-report.txt: Adjust.
* tests/data/test-diff-filter/test9-report.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-1.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-dwarf-reader.cc
tests/data/Makefile.am
tests/data/test-diff-dwarf/test5-report.txt
tests/data/test-diff-filter/test20-inline-report-0.txt
tests/data/test-diff-filter/test20-inline-report-1.txt
tests/data/test-diff-filter/test41-PR21486-abg-writer.gcc.o [new file with mode: 0644]
tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o [new file with mode: 0644]
tests/data/test-diff-filter/test41-report-0.txt [new file with mode: 0644]
tests/data/test-diff-filter/test9-report.txt
tests/test-diff-filter.cc