[PATCH] Include ASan blacklist in Clang installation.

Alexey Samsonov samsonov at google.com
Tue Feb 19 06:47:04 PST 2013


Hi kcc,

This is a follow-up for r175505: now that Clang actually looks for
default ASan blacklist in the resource directory, we may want to put the empty
file there.

http://llvm-reviews.chandlerc.com/D421

Files:
  lib/asan/CMakeLists.txt
  lib/asan/asan_blacklist.txt
  CMakeLists.txt
  cmake/Modules/AddCompilerRT.cmake

Index: lib/asan/CMakeLists.txt
===================================================================
--- lib/asan/CMakeLists.txt
+++ lib/asan/CMakeLists.txt
@@ -90,6 +90,8 @@
   endforeach()
 endif()
 
+add_compiler_rt_resource_file(asan_blacklist asan_blacklist.txt)
+
 if(LLVM_INCLUDE_TESTS)
   add_subdirectory(tests)
 endif()
Index: lib/asan/asan_blacklist.txt
===================================================================
--- /dev/null
+++ lib/asan/asan_blacklist.txt
@@ -0,0 +1,10 @@
+# Blacklist for AddressSanitizer. Turns off instrumentation of particular
+# functions or sources. Use with care. You may set location of blacklist
+# at compile-time using -fsanitize-blacklist=<path> flag.
+
+# Example usage:
+# fun:*_ZN4base6subtle*
+# src:file_with_tricky_code.cc
+# global:*global_with_bad_access_or_initialization*
+# global-init:*global_with_initialization_issues*
+# global-init-type:*Namespace::ClassName*
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -23,10 +23,10 @@
 # Setup the paths where compiler-rt runtimes and headers should be stored.
 set(LIBCLANG_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
 string(TOLOWER ${CMAKE_SYSTEM_NAME} LIBCLANG_OS_DIR)
-set(COMPILER_RT_LIBRARY_OUTPUT_DIR 
-  ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/${LIBCLANG_OS_DIR})
+set(CLANG_RESOURCE_DIR ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION})
+set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${CLANG_RESOURCE_DIR}/lib/${LIBCLANG_OS_DIR})
 set(COMPILER_RT_LIBRARY_INSTALL_DIR
- ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR}) 
+  ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR})
 
 # Add path for custom modules
 set(CMAKE_MODULE_PATH
Index: cmake/Modules/AddCompilerRT.cmake
===================================================================
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -121,3 +121,13 @@
   # Make the test suite depend on the binary.
   add_dependencies(${test_suite} ${test_name})
 endmacro()
+
+macro(add_compiler_rt_resource_file target_name file_name)
+  set(src_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_name}")
+  set(dst_file "${CLANG_RESOURCE_DIR}/${file_name}")
+  add_custom_target(${target_name}
+    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src_file} ${dst_file}
+    DEPENDS ${file_name})
+  # Install in Clang resource directory.
+  install(FILES ${file_name} DESTINATION ${LIBCLANG_INSTALL_PATH})
+endmacro()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D421.1.patch
Type: text/x-patch
Size: 2489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130219/f9ebd6ab/attachment.bin>


More information about the llvm-commits mailing list