From c57f0f5eb0d862ba58aebf682a32502a2706cbba Mon Sep 17 00:00:00 2001 From: Francis Ricci Date: Tue, 14 Feb 2017 00:56:53 +0000 Subject: Add cmake build support for lsan on OS X Summary: Adds a new cmake flag 'COMPILER_RT_ENABLE_LSAN_OSX', which enables lsan compilation and is turned off by default. Patches to fix build errors when this flag is enabled will be uploaded soon. This is part of an effort to port LSan to OS X, but LSan on OS X does not currently work or pass tests currently. Reviewers: kubamracek, kcc, glider, alekseyshl Reviewed By: kubamracek Subscribers: danalbert, srhines, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29783 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295012 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/asan/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/asan/CMakeLists.txt') diff --git a/lib/asan/CMakeLists.txt b/lib/asan/CMakeLists.txt index 78a504cfa..e940cc756 100644 --- a/lib/asan/CMakeLists.txt +++ b/lib/asan/CMakeLists.txt @@ -36,6 +36,11 @@ set(ASAN_PREINIT_SOURCES include_directories(..) 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) @@ -107,6 +112,7 @@ add_compiler_rt_component(asan) if(APPLE) add_weak_symbols("asan" WEAK_SYMBOL_LINK_FLAGS) + add_weak_symbols("lsan" WEAK_SYMBOL_LINK_FLAGS) add_weak_symbols("ubsan" WEAK_SYMBOL_LINK_FLAGS) add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS) -- cgit v1.2.1