[scudo] Implement stricter separation of C vs C++
authorKostya Kortchinsky <kostyak@google.com>
Wed, 1 Nov 2017 15:28:20 +0000 (15:28 +0000)
committerKostya Kortchinsky <kostyak@google.com>
Wed, 1 Nov 2017 15:28:20 +0000 (15:28 +0000)
commitd937b0a10c6fdb5ee8956382cdf20b2b42820b82
treee4acaf9bc343359fcb81c37281ce5ab992c84879
parent2b09f39b4d51627cda88118d1d7e9a94693272d2
[scudo] Implement stricter separation of C vs C++

Summary:
Initially, Scudo had a monolithic design where both C and C++ functions were
living in the same library. This was not necessarily ideal, and with the work
on -fsanitize=scudo, it became more apparent that this needed to change.

We are splitting the new/delete interceptor in their own C++ library. This
allows more flexibility, notably with regard to std::bad_alloc when the work is
done. This also allows us to not link new & delete when using pure C.

Additionally, we add the UBSan runtimes with Scudo, in order to be able to have
a -fsanitize=scudo,undefined in Clang (see work in D39334).

The changes in this patch:
- split the cxx specific code in the scudo cmake file into a new library;
  (remove the spurious foreach loop, that was not necessary)
- add the UBSan runtimes (both C and C++);
- change the test cmake file to allow for specific C & C++ tests;
- make C tests pure C, rename their extension accordingly.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, mgorny, llvm-commits

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

llvm-svn: 317097
21 files changed:
compiler-rt/lib/scudo/CMakeLists.txt
compiler-rt/test/scudo/alignment.c [moved from compiler-rt/test/scudo/alignment.cpp with 87% similarity]
compiler-rt/test/scudo/double-free.cpp
compiler-rt/test/scudo/interface.cpp
compiler-rt/test/scudo/lit.cfg
compiler-rt/test/scudo/malloc.cpp
compiler-rt/test/scudo/memalign.c [moved from compiler-rt/test/scudo/memalign.cpp with 96% similarity]
compiler-rt/test/scudo/mismatch.cpp
compiler-rt/test/scudo/options.cpp
compiler-rt/test/scudo/overflow.c [moved from compiler-rt/test/scudo/overflow.cpp with 100% similarity]
compiler-rt/test/scudo/preinit.c [moved from compiler-rt/test/scudo/preinit.cpp with 96% similarity]
compiler-rt/test/scudo/preload.cpp
compiler-rt/test/scudo/quarantine.c [moved from compiler-rt/test/scudo/quarantine.cpp with 99% similarity]
compiler-rt/test/scudo/random_shuffle.cpp
compiler-rt/test/scudo/realloc.cpp
compiler-rt/test/scudo/secondary.c [moved from compiler-rt/test/scudo/secondary.cpp with 97% similarity]
compiler-rt/test/scudo/sized-delete.cpp
compiler-rt/test/scudo/sizes.cpp
compiler-rt/test/scudo/threads.c [moved from compiler-rt/test/scudo/threads.cpp with 98% similarity]
compiler-rt/test/scudo/tsd_destruction.c [moved from compiler-rt/test/scudo/tsd_destruction.cpp with 100% similarity]
compiler-rt/test/scudo/valloc.c [moved from compiler-rt/test/scudo/valloc.cpp with 98% similarity]