• Marko Mäkelä's avatar
    MDEV-20377: Introduce cmake -DWITH_MSAN:BOOL=ON · 68e6c2d7
    Marko Mäkelä authored
    MemorySanitizer is a compile-time instrumentation layer in clang and GCC.
    Together with AddressSanitizer mostly makes the run-time instrumentation
    of Valgrind redundant. It is a little more tricky to set up, because
    running with uninstrumented libraries will lead into false positives.
    
    You will need an instrumented libc++, and you should use
    -stdlib=libc++ instead of the default libstdc++. To build the
    instrumented library, you can refer to
    https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
    or you can adapt these steps that worked for me, for clang-8 version 8.0.1:
    
    cd /mariadb
    sudo apt source libc++-8-dev
    cd llvm-toolchain-8-8.0.1
    mkdir libc++msan; cd libc++msan
    cmake ../libcxx -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=Memory \
    -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8
    
    Then, in your MariaDB build directory, you have to compile with
    libc++ and bundled libraries, such as WITH_SSL=bundled, WITH_ZLIB=bundled.
    For uninstr...
    68e6c2d7
CMakeLists.txt 16.4 KB