]> sourceware.org Git - libabigail.git/commit
Linux symbol CRCs: support 0 and report presence changes
authorGiuliano Procida <gprocida@google.com>
Mon, 13 Jun 2022 14:25:32 +0000 (15:25 +0100)
committerDodji Seketeli <dodji@redhat.com>
Thu, 30 Jun 2022 16:30:58 +0000 (18:30 +0200)
commit89e6854ca4408654bb5ff5665864d80a0ae45b72
tree3d379f029b5c2a0f8e0276dca82c98e9743eb1ba
parentce7bd9f595960d05c4cf12bf2250907db792d00e
Linux symbol CRCs: support 0 and report presence changes

The CRC with value zero was used to mean "absent". This can be better
modelled using optional.

This commit makes this change and also tweaks reporting so that
disappearing / appearing CRCs are noted. This should be essentially
impossible unless CRCs are enabled / disabled altogether but would be
very noteworthy otherwise.

* include/abg-ir.h (elf_symbol::elf_symbol): Argument crc is
now an optional defaulted to absent.
(elf_symbol::create): Likewise.
(elf_symbol::get_crc): Now returns an optional uint64_t.
(elf_symbol::set_src): Now takes an optional uint64_t.
* src/abg-comp-filter.cc (crc_changed): Simplify comparison.
* src/abg-ir.cc (elf_symbol::priv): Member crc_ is now an
optional uint64_t.
(elf_symbol::priv::priv): Argument crc is now an optional
uint64_t.
(elf_symbol::elf_symbol): Likewise.
(elf_symbol::create): Argument crc is now an optional uint64_t
and defaults to absent.
(textually_equals): Simplify comparison.
(elf_symbol::get_crc): Now returns an optional uint64_t.
(elf_symbol::set_crc): Now takes an optional uint64_t.
* src/abg-reader.cc (build_elf_symbol): Treat CRC 0 the same
as other CRC values.
* src/abg-reporter-priv.cc (maybe_report_diff_for_symbol):
Treat CRC 0 the same as other CRC values and also report
changes to CRC presence.
* src/abg-writer.cc (write_elf_symbol): Treat CRC 0 the same
as other CRC values.
* tests/data/Makefile: Remove test-abidiff/test-crc-report.txt
and add test-abidiff/test-crc-report-{0-1,1-0,1-2}.txt.
* tests/data/test-abidiff/test-crc-report-0-1.txt: Report
showing additional of CRCs.
* tests/data/test-abidiff/test-crc-report-1-0.txt: Report
showing removal of CRCs.
* tests/data/test-abidiff/test-crc-report-1-2.txt: Renamed
from tests/data/test-abidiff/test-crc-report.txt.
* tests/test-abidiff.cc: Update test cases that no longer
generate empty reports.
* tests/test-symtab.cc: Update KernelSymtabsWithCRC test.

Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
12 files changed:
include/abg-ir.h
src/abg-comp-filter.cc
src/abg-ir.cc
src/abg-reader.cc
src/abg-reporter-priv.cc
src/abg-writer.cc
tests/data/Makefile.am
tests/data/test-abidiff/test-crc-report-0-1.txt [new file with mode: 0644]
tests/data/test-abidiff/test-crc-report-1-0.txt [new file with mode: 0644]
tests/data/test-abidiff/test-crc-report-1-2.txt [moved from tests/data/test-abidiff/test-crc-report.txt with 100% similarity]
tests/test-abidiff.cc
tests/test-symtab.cc
This page took 0.031349 seconds and 5 git commands to generate.