[PATCH] D31307: Enable builds of darwin lsan by default

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 10:54:10 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL299669: Enable builds of darwin lsan by default (authored by fjricci).

Changed prior to commit:
  https://reviews.llvm.org/D31307?vs=93478&id=94393#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31307

Files:
  compiler-rt/trunk/cmake/config-ix.cmake
  compiler-rt/trunk/lib/asan/CMakeLists.txt
  compiler-rt/trunk/lib/asan/asan_flags.cc
  compiler-rt/trunk/lib/lsan/CMakeLists.txt
  compiler-rt/trunk/lib/lsan/lsan_common.h
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc


Index: compiler-rt/trunk/lib/lsan/lsan_common.h
===================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.h
+++ compiler-rt/trunk/lib/lsan/lsan_common.h
@@ -30,13 +30,12 @@
 // To enable LeakSanitizer on new architecture, one need to implement
 // internal_clone function as well as (probably) adjust TLS machinery for
 // new architecture inside sanitizer library.
-#if (SANITIZER_LINUX && !SANITIZER_ANDROID) && (SANITIZER_WORDSIZE == 64) && \
+#if (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) && \
+    (SANITIZER_WORDSIZE == 64) &&                               \
     (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__))
 #define CAN_SANITIZE_LEAKS 1
-#elif SANITIZER_LINUX && !SANITIZER_ANDROID && defined(__i386__)
-#define CAN_SANITIZE_LEAKS 1
-#elif CAN_SANITIZE_LEAKS_MAC && (defined(__x86_64__) ||  defined(__mips64) || \
-      defined(__aarch64__) || defined(__i386__))
+#elif defined(__i386__) && \
+    (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC)
 #define CAN_SANITIZE_LEAKS 1
 #else
 #define CAN_SANITIZE_LEAKS 0
Index: compiler-rt/trunk/lib/lsan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/lsan/CMakeLists.txt
+++ compiler-rt/trunk/lib/lsan/CMakeLists.txt
@@ -18,10 +18,6 @@
 
 set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
-# FIXME(fjricci) - remove this once lsan for darwin is fully enabled
-if(APPLE AND COMPILER_RT_HAS_LSAN)
-  set(LSAN_CFLAGS ${LSAN_CFLAGS} -DCAN_SANITIZE_LEAKS_MAC=1)
-endif()
 add_compiler_rt_object_libraries(RTLSanCommon
     OS ${SANITIZER_COMMON_SUPPORTED_OS}
     ARCHS ${LSAN_COMMON_SUPPORTED_ARCH}
Index: compiler-rt/trunk/lib/asan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt
@@ -37,10 +37,6 @@
 
 set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 
-# FIXME(fjricci) - remove this once lsan for darwin is fully enabled
-if(APPLE AND COMPILER_RT_HAS_LSAN)
-  set(ASAN_CFLAGS ${ASAN_CFLAGS} -DCAN_SANITIZE_LEAKS_MAC=1)
-endif()
 append_rtti_flag(OFF ASAN_CFLAGS)
 
 set(ASAN_DYNAMIC_LINK_FLAGS)
Index: compiler-rt/trunk/lib/asan/asan_flags.cc
===================================================================
--- compiler-rt/trunk/lib/asan/asan_flags.cc
+++ compiler-rt/trunk/lib/asan/asan_flags.cc
@@ -61,7 +61,7 @@
   {
     CommonFlags cf;
     cf.CopyFrom(*common_flags());
-    cf.detect_leaks = CAN_SANITIZE_LEAKS;
+    cf.detect_leaks = cf.detect_leaks && CAN_SANITIZE_LEAKS;
     cf.external_symbolizer_path = GetEnv("ASAN_SYMBOLIZER_PATH");
     cf.malloc_context_size = kDefaultMallocContextSize;
     cf.intercept_tls_get_addr = true;
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
@@ -62,7 +62,7 @@
 COMMON_FLAG(
     int, verbosity, 0,
     "Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).")
-COMMON_FLAG(bool, detect_leaks, true, "Enable memory leak detection.")
+COMMON_FLAG(bool, detect_leaks, !SANITIZER_MAC, "Enable memory leak detection.")
 COMMON_FLAG(
     bool, leak_check_at_exit, true,
     "Invoke leak checking in an atexit handler. Has no effect if "
Index: compiler-rt/trunk/cmake/config-ix.cmake
===================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake
+++ compiler-rt/trunk/cmake/config-ix.cmake
@@ -477,13 +477,6 @@
   set(COMPILER_RT_HAS_LSAN FALSE)
 endif()
 
-if(APPLE)
-  option(COMPILER_RT_ENABLE_LSAN_OSX "Enable building LSan for OS X - Experimental" Off)
-  if(COMPILER_RT_ENABLE_LSAN_OSX)
-    set(COMPILER_RT_HAS_LSAN TRUE)
-  endif()
-endif()
-
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND
     OS_NAME MATCHES "Linux")
   set(COMPILER_RT_HAS_MSAN TRUE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31307.94393.patch
Type: text/x-patch
Size: 4040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170406/02b3c2eb/attachment.bin>


More information about the llvm-commits mailing list