[PATCH] D53028: [libcxxabi] Allow building with sanitizers enabled
Louis Dionne via Phabricator
reviews at reviews.llvm.org
Wed Oct 10 15:03:01 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCXXA344191: [libcxxabi] Allow building with sanitizers enabled (authored by ldionne, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D53028?vs=168826&id=169106#toc
Repository:
rCXXA libc++abi
https://reviews.llvm.org/D53028
Files:
src/CMakeLists.txt
test/lit.site.cfg.in
Index: test/lit.site.cfg.in
===================================================================
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -11,6 +11,7 @@
config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@"
config.enable_threads = "@LIBCXXABI_ENABLE_THREADS@"
config.use_sanitizer = "@LLVM_USE_SANITIZER@"
+config.sanitizer_library = "@LIBCXXABI_SANITIZER_LIBRARY@"
config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
config.target_info = "@LIBCXXABI_TARGET_INFO@"
config.executor = "@LIBCXXABI_EXECUTOR@"
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -102,6 +102,31 @@
"-compatibility_version 1"
"-install_name /usr/lib/libc++abi.1.dylib")
endif()
+
+ if (LLVM_USE_SANITIZER)
+ if (("${LLVM_USE_SANITIZER}" STREQUAL "Address") OR
+ ("${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined") OR
+ ("${LLVM_USE_SANITIZER}" STREQUAL "Undefined;Address"))
+ set(LIBFILE "libclang_rt.asan_osx_dynamic.dylib")
+ elseif("${LLVM_USE_SANITIZER}" STREQUAL "Undefined")
+ set(LIBFILE "libclang_rt.ubsan_osx_dynamic.dylib")
+ elseif("${LLVM_USE_SANITIZER}" STREQUAL "Thread")
+ set(LIBFILE "libclang_rt.tsan_osx_dynamic.dylib")
+ else()
+ message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X")
+ endif()
+ if (LIBFILE)
+ find_compiler_rt_dir(LIBDIR)
+ if (NOT IS_DIRECTORY "${LIBDIR}")
+ message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER")
+ endif()
+ set(LIBCXXABI_SANITIZER_LIBRARY "${LIBDIR}/${LIBFILE}")
+ set(LIBCXXABI_SANITIZER_LIBRARY "${LIBCXXABI_SANITIZER_LIBRARY}" PARENT_SCOPE)
+ message(STATUS "Manually linking compiler-rt library: ${LIBCXXABI_SANITIZER_LIBRARY}")
+ add_library_flags("${LIBCXXABI_SANITIZER_LIBRARY}")
+ add_link_flags("-Wl,-rpath,${LIBDIR}")
+ endif()
+ endif()
endif()
split_list(LIBCXXABI_COMPILE_FLAGS)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53028.169106.patch
Type: text/x-patch
Size: 2115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181010/6ee29e6d/attachment-0001.bin>
More information about the libcxx-commits
mailing list