[scudo][standalone] Implement checksumming functions
authorKostya Kortchinsky <kostyak@google.com>
Tue, 12 Mar 2019 14:46:31 +0000 (14:46 +0000)
committerKostya Kortchinsky <kostyak@google.com>
Tue, 12 Mar 2019 14:46:31 +0000 (14:46 +0000)
commit1f066a717cb1db55e6b219f1308a80b6c3ed116d
tree1235d68b67c33afc54ce10386f4cfff95ee5fcce
parenteec3206a41e721673b1fd6f85ce731e1c15a4743
[scudo][standalone] Implement checksumming functions

Summary:
This CL implements the checksumming functions. This departs from the
current Scudo code in one aspect: the software version is no longer
CRC32 but a BSD checksum. This is because the software CRC32 was too
impactful in terms of performances, the BSD checksum has no array
lookup which is better (and saves 1KB of data).

As with the current version, we only flip the CRC compiler flag for
a single compilation unit by default, to allow for a library compiled
with HW CRC32 to work on a system without HW CRC32.

There is some platform & hardware specific code in those files, but
since departs from a mere platform split, it felt right to me to have
it that way.

Reviewers: morehouse, eugenis, vitalybuka, hctim, mcgrathr

Reviewed By: morehouse

Subscribers: mgorny, delcypher, jfb, jdoerfert, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

Differential Revision: https://reviews.llvm.org/D59116

llvm-svn: 355923
compiler-rt/lib/scudo/standalone/CMakeLists.txt
compiler-rt/lib/scudo/standalone/checksum.cc [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/checksum.h [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/crc32_hw.cc [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
compiler-rt/lib/scudo/standalone/tests/checksum_test.cc [new file with mode: 0644]