The test programs use googletest and google-benchmark
libraries in order to ensure right level of optimizations
and proper unit testing.
Those two libraries are written in C++ and they
use C++ standard library.
If you want MemorySanitizer to work properly and not
produce any false positives, you must ensure that all
the code in your program and in libraries it uses is
instrumented. That includes C++ standard library.
(see here: https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo)
With this change, the Memory Sanitizer build (enabled
by -DMEMSAN=1) will also build MSan-instrumented libc++
from LLVM and will use it as a standard C++ library
when building unit tests and benchmarks.
In particular what I do is this:
1. Clone LLVM project and build libcxx and libcxxabi with
MSan enabled
2. Build GTEST and GBENCH with -fsanitize=memory and -stdlib=libc++.
Additionally link against -lc++abi
3. Then use this special version of libc++ and GTEST/GBENCH
in order to build final binaries containing unit/benchmark tests
The actuall tests with memory sanitizer are disabled, as
I'm getting some errors which need to be investigated first.
Additionally I've splitted single build into multiple, for
release,debug,clang,gcc and AddressSanitizer.
On unrelated note, I've also added flags to ignore some errors
which I'm getting when using newer GCC (see GH#10 GH#11).
Adds cpu_features library from Google to
recognize CPU capabilities on which implementation
is running.
Uses that library to run either generic-C
or assembly optimized implementation of
some field operations