Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -245,6 +245,24 @@ -stdlib=libc++ -lc++ -lc++abi) + + set(DARWIN_WEAK_SYMBOLS + ___asan_default_options + ___asan_default_suppressions + ___asan_on_error + ___lsan_default_suppressions + ___lsan_is_turned_off + ___sanitizer_free_hook + ___sanitizer_malloc_hook + ___sanitizer_symbolize_code + ___sanitizer_symbolize_data + ___sanitizer_symbolize_demangle + ___sanitizer_symbolize_flush + ___ubsan_default_options) + + foreach(SYMBOL ${DARWIN_WEAK_SYMBOLS}) + set(DARWIN_COMMON_LINKFLAGS ${DARWIN_COMMON_LINKFLAGS} -Wl,-U,${SYMBOL}) + endforeach() check_linker_flag("-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION) if(COMPILER_RT_HAS_APP_EXTENSION) Index: lib/sanitizer_common/sanitizer_internal_defs.h =================================================================== --- lib/sanitizer_common/sanitizer_internal_defs.h +++ lib/sanitizer_common/sanitizer_internal_defs.h @@ -32,7 +32,7 @@ # define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak)) #endif -#if (SANITIZER_LINUX || SANITIZER_WINDOWS) && !SANITIZER_GO +#if (SANITIZER_LINUX || SANITIZER_MAC || SANITIZER_WINDOWS) && !SANITIZER_GO # define SANITIZER_SUPPORTS_WEAK_HOOKS 1 #else # define SANITIZER_SUPPORTS_WEAK_HOOKS 0