[compiler-rt] r252284 - [tsan] Enable new/delete C++ interceptors for OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 03:07:26 PST 2015


Author: kuba.brecka
Date: Fri Nov  6 05:07:26 2015
New Revision: 252284

URL: http://llvm.org/viewvc/llvm-project?rev=252284&view=rev
Log:
[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


Modified:
    compiler-rt/trunk/lib/tsan/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/rtl/tsan_new_delete.cc

Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=252284&r1=252283&r2=252284&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Fri Nov  6 05:07:26 2015
@@ -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

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_new_delete.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_new_delete.cc?rev=252284&r1=252283&r2=252284&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_new_delete.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_new_delete.cc Fri Nov  6 05:07:26 2015
@@ -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); \




More information about the llvm-commits mailing list