abidiff/kmidiff: do not default-suppress added symbols
authorMatthias Maennich <maennich@google.com>
Mon, 13 Jan 2020 10:16:37 +0000 (10:16 +0000)
committerMatthias Maennich <maennich@google.com>
Fri, 17 Jan 2020 12:40:27 +0000 (12:40 +0000)
commite84537afeaa7262e3584a772450ed6ed7d193a9b
treeb1d182ac987c43028d0d4208c7beb5d269f52189
parentade58f9c498993a0e1b165e6acc4d695a1e7dbf3
abidiff/kmidiff: do not default-suppress added symbols

kmidiff and abidiff do filter out added symbols (vars, functions and
symbols without debug info) by default when dealing with kernel
binaries. The reason for this is that the ABI could be considered
compatible and not broken when adding symbols. In practice, this is
confusing as there is no possibility for a symmetric comparison (i.e. a
deleted function when comparing left to right is an added function when
comparing right to left). Furthermore, there is no option available to
actually report these added symbols. I thought of adding an option to
report added symbols, but in the end came to the conclusion that we
should behave consistent across the various ways you can diff an ABI
with abidiff and kmidiff and should not change default behaviour for a
particular type of binary. Hence, remove the default behaviour of
filtering out added symbols when comparing kernel binaries. To restore
the current behaviour, the user needs to parametrize with the tools with
--no-added-syms --no-unreferenced-symbols.

Adjusted test cases accordingly and add a new test that covers the old
behaviour new available with additional flags to abidiff.

* tools/abidiff.cc (adjust_diff_context_for_kmidiff): Drop
default suppression of added symbols.
* tools/kmidiff.cc (set_diff_context): Likewise.
* tests/data/test-diff-suppr/test46-PR25128-report-1.txt: Adjust
test expectation.
* tests/data/test-diff-suppr/test46-PR25128-report-2.txt: Add
test case for abidiff with flag --no-added-syms.
* tests/data/Makefile.am: add new testcase.

Reviewed-by: Dodji Seketeli <dodji@seketeli.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
tests/data/Makefile.am
tests/data/test-diff-suppr/test46-PR25128-report-1.txt
tests/data/test-diff-suppr/test46-PR25128-report-2.txt [new file with mode: 0644]
tests/test-diff-suppr.cc
tools/abidiff.cc
tools/kmidiff.cc