[PATCH] D14424: [tsan] Enable new/delete C++ interceptors for OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 00:39:36 PST 2015


kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, kcc, samsonov, glider.
kubabrecka added subscribers: llvm-commits, zaks.anna, ismailp, jasonk, jevinskie.

This patch adds `tsan_new_delete.cc` into the OS X build.

http://reviews.llvm.org/D14424

Files:
  lib/tsan/CMakeLists.txt
  lib/tsan/rtl/tsan_new_delete.cc

Index: lib/tsan/rtl/tsan_new_delete.cc
===================================================================
--- lib/tsan/rtl/tsan_new_delete.cc
+++ lib/tsan/rtl/tsan_new_delete.cc
@@ -12,14 +12,22 @@
 // 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
 
 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); \
Index: lib/tsan/CMakeLists.txt
===================================================================
--- lib/tsan/CMakeLists.txt
+++ lib/tsan/CMakeLists.txt
@@ -92,7 +92,7 @@
     SHARED
     OS ${TSAN_SUPPORTED_OS}
     ARCHS ${TSAN_SUPPORTED_ARCH}
-    SOURCES ${TSAN_SOURCES}
+    SOURCES ${TSAN_SOURCES} ${TSAN_CXX_SOURCES}
     OBJECT_LIBS RTInterception
                 RTSanitizerCommon
                 RTSanitizerCommonLibc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14424.39485.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151106/31aa01c4/attachment.bin>


More information about the llvm-commits mailing list