Index: libsanitizer/lsan/lsan_common.h =================================================================== --- libsanitizer/lsan/lsan_common.h +++ libsanitizer/lsan/lsan_common.h @@ -28,13 +28,17 @@ // 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_MAC) && \ +#if (SANITIZER_LINUX && !SANITIZER_ANDROID) && \ (SANITIZER_WORDSIZE == 64) && \ (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \ defined(__powerpc64__)) #define CAN_SANITIZE_LEAKS 1 #elif defined(__i386__) && \ - (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) + (SANITIZER_LINUX && !SANITIZER_ANDROID) +#define CAN_SANITIZE_LEAKS 1 +// lsan_common_mac.cc uses VM_MEMORY_OS_ALLOC_ONCE which was only +// introduced in Mac OS X 10.9/Darwin 13. +#elif SANITIZER_MAC && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 #define CAN_SANITIZE_LEAKS 1 #elif defined(__arm__) && \ SANITIZER_LINUX && !SANITIZER_ANDROID Index: libsanitizer/sanitizer_common/sanitizer_internal_defs.h =================================================================== --- libsanitizer/sanitizer_common/sanitizer_internal_defs.h +++ libsanitizer/sanitizer_common/sanitizer_internal_defs.h @@ -63,7 +63,13 @@ // SANITIZER_SUPPORTS_WEAK_HOOKS means that we support real weak functions that // will evaluate to a null pointer when not defined. #ifndef SANITIZER_SUPPORTS_WEAK_HOOKS -#if (SANITIZER_LINUX || SANITIZER_MAC) && !SANITIZER_GO +#if SANITIZER_LINUX && !SANITIZER_GO +# define SANITIZER_SUPPORTS_WEAK_HOOKS 1 +// Before Xcode 4.5, the Darwin linker doesn't reliably support undefined +// weak symbols. Mac OS X 10.9/Darwin 13 is the first release only supported +// by Xcode >= 4.5. +#elif SANITIZER_MAC && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 && !SANITIZER_GO # define SANITIZER_SUPPORTS_WEAK_HOOKS 1 #else # define SANITIZER_SUPPORTS_WEAK_HOOKS 0