HomePhabricator

[CMAKE] Get rid of ECM for running the sanitizers

Description

[CMAKE] Get rid of ECM for running the sanitizers

Summary:
The sanitizer features with CMake were relying the the Extra CMake
Modules from the KDE project. It used to check compatibility with the
compiler version for GCC and Clang, and add the appropriated flags to
the CMAKE_C|CXX_FLAGS. It has several limitations:

  • It only supports GCC and Clang, and fails with another compiler.
  • It supports a finite number of sanitizers, and fails if unknown ones are used.
  • Since it uses the CFLAGS and CXXFLAGS, it messes up with the fuzzer sanitizer which tries to link everything to it's own functions.

This diff replaces these features with a custom file. This is a mixup
between the autotools equivalent check and the ECM features, i.e. it
checks that the -fsanitize flag is supported both for compilation and
linking, and adds the appropriated flags for better sanitizer
efficiency. It does not use the CFLAGS or CXXFLAGS but target
properties to attach the flags, allowing for the use of the fuzzer
sanitizer as well (need the proper definitions to build, will be added
by D4588).

Test Plan:
Run the CI sanitizer build configurations.

Insert an issue by commenting an exception (tested with UBSAN) and check
the sanitizer catches it.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5182

Details

Provenance
FabienAuthored on Feb 6 2020, 15:54
FabienPushed on Feb 7 2020, 09:55
Reviewer
Restricted Project
Differential Revision
D5182: [CMAKE] Get rid of ECM for running the sanitizers
Parents
rABC74d2c5fa9246: fix comments //!< to //!
Branches
Unknown
Tags
Unknown