summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2015-11-06 11:07:26 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2015-11-06 11:07:26 +0000
commit3a618b03172f715774ce1e74a914ce7af47e5a94 (patch)
treef2dbe8b741d8b41cf01d486c35607bd78048ed75
parent1ef2414861993df7ac95738d4418f69bd8d15f39 (diff)
downloadbcm5719-llvm-3a618b03172f715774ce1e74a914ce7af47e5a94.tar.gz
bcm5719-llvm-3a618b03172f715774ce1e74a914ce7af47e5a94.zip
[tsan] Enable new/delete C++ interceptors for OS X
This patch adds `tsan_new_delete.cc` into the OS X build. Differential Revision: http://reviews.llvm.org/D14424 llvm-svn: 252284
-rw-r--r--compiler-rt/lib/tsan/CMakeLists.txt2
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_new_delete.cc8
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt
index 6971a0fee16..cbfca5ce281 100644
--- a/compiler-rt/lib/tsan/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/CMakeLists.txt
@@ -92,7 +92,7 @@ if(APPLE)
SHARED
OS ${TSAN_SUPPORTED_OS}
ARCHS ${TSAN_SUPPORTED_ARCH}
- SOURCES ${TSAN_SOURCES}
+ SOURCES ${TSAN_SOURCES} ${TSAN_CXX_SOURCES}
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
diff --git a/compiler-rt/lib/tsan/rtl/tsan_new_delete.cc b/compiler-rt/lib/tsan/rtl/tsan_new_delete.cc
index d3ac472b7dc..18ba9082c4a 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_new_delete.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_new_delete.cc
@@ -12,6 +12,7 @@
// Interceptors for operators new and delete.
//===----------------------------------------------------------------------===//
#include "sanitizer_common/sanitizer_internal_defs.h"
+#include "interception/interception.h"
#include "tsan_interceptors.h"
using namespace __tsan; // NOLINT
@@ -20,6 +21,13 @@ namespace std {
struct nothrow_t {};
} // namespace std
+DECLARE_REAL(void *, malloc, uptr size)
+DECLARE_REAL(void, free, void *ptr)
+#if SANITIZER_MAC
+#define __libc_malloc REAL(malloc)
+#define __libc_free REAL(free)
+#endif
+
#define OPERATOR_NEW_BODY(mangled_name) \
if (cur_thread()->in_symbolizer) \
return __libc_malloc(size); \
OpenPOWER on IntegriCloud