Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -476,7 +476,7 @@ endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Linux|FreeBSD") + OS_NAME MATCHES "Darwin|Linux|FreeBSD") set(COMPILER_RT_HAS_LSAN TRUE) else() set(COMPILER_RT_HAS_LSAN FALSE) Index: lib/sanitizer_common/sanitizer_flags.inc =================================================================== --- lib/sanitizer_common/sanitizer_flags.inc +++ lib/sanitizer_common/sanitizer_flags.inc @@ -62,7 +62,8 @@ COMMON_FLAG( int, verbosity, 0, "Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).") -COMMON_FLAG(bool, detect_leaks, !SANITIZER_MAC, "Enable memory leak detection.") +COMMON_FLAG(bool, detect_leaks, !(SANITIZER_MAC && SANITIZER_WORDSIZE == 32), + "Enable memory leak detection.") COMMON_FLAG( bool, leak_check_at_exit, true, "Invoke leak checking in an atexit handler. Has no effect if " Index: test/asan/lit.cfg =================================================================== --- test/asan/lit.cfg +++ test/asan/lit.cfg @@ -217,7 +217,8 @@ config.available_features.add('fast-unwinder-works') # Turn on leak detection on 64-bit Linux. -if config.host_os == 'Linux' and (config.target_arch == 'x86_64' or config.target_arch == 'i386'): +if ((config.host_os == 'Linux') and (config.target_arch == 'x86_64' or config.target_arch == 'i386')) \ + or ((config.host_os == 'Darwin') and (config.target_arch == 'x86_64')): config.available_features.add('leak-detection') # Set LD_LIBRARY_PATH to pick dynamic runtime up properly. Index: test/lsan/lit.common.cfg =================================================================== --- test/lsan/lit.common.cfg +++ test/lsan/lit.common.cfg @@ -75,4 +75,8 @@ if re.search('mthumb', config.target_cflags) is not None: config.unsupported = True +# LeakSanitizer tests are supported on 64-bit Darwin +if config.host_os is 'Darwin' and config.target_arch is 'x86_64': + config.unsupported = False + config.suffixes = ['.c', '.cc', '.cpp']