filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
x86_64 i386 powerpc64 powerpc)
-file(GLOB_RECURSE COMPILER_RT_HEADERS
- RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/include"
- "include/*.h")
-
-set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
-
-if(MSVC_IDE OR XCODE)
- set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
-endif()
-
-# Copy compiler-rt headers to the build tree.
-set(out_files)
-foreach( f ${COMPILER_RT_HEADERS} )
- set( src ${CMAKE_CURRENT_SOURCE_DIR}/include/${f} )
- set( dst ${output_dir}/${f} )
- add_custom_command(OUTPUT ${dst}
- DEPENDS ${src}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
- COMMENT "Copying compiler-rt's ${f}...")
- list(APPEND out_files ${dst})
-
- if(other_output_dir)
- set(other_dst ${other_output_dir}/${f})
- add_custom_command(OUTPUT ${other_dst}
- DEPENDS ${src}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
- COMMENT "Copying compiler-rt's ${f}...")
- list(APPEND out_files ${other_dst})
- endif()
-endforeach( f )
-
-add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
-
-# Install compiler-rt headers.
-install(DIRECTORY include/
- DESTINATION ${LIBCLANG_INSTALL_PATH}/include
- FILES_MATCHING
- PATTERN "*.h"
- PATTERN ".svn" EXCLUDE
- )
-
# Add the public header's directory to the includes for all of compiler-rt.
include_directories(include)
+add_subdirectory(include)
+
+set(SANITIZER_COMMON_LIT_TEST_DEPS
+ clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
+ compiler-rt-headers)
add_subdirectory(lib)
--- /dev/null
+set(SANITIZER_HEADERS
+ sanitizer/asan_interface.h
+ sanitizer/common_interface_defs.h
+ sanitizer/linux_syscall_hooks.h
+ sanitizer/msan_interface.h)
+
+set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
+
+if(MSVC_IDE OR XCODE)
+ set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
+endif()
+
+# Copy compiler-rt headers to the build tree.
+set(out_files)
+foreach( f ${SANITIZER_HEADERS} )
+ set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
+ set( dst ${output_dir}/${f} )
+ add_custom_command(OUTPUT ${dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+ COMMENT "Copying compiler-rt's ${f}...")
+ list(APPEND out_files ${dst})
+
+ if(other_output_dir)
+ set(other_dst ${other_output_dir}/${f})
+ add_custom_command(OUTPUT ${other_dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
+ COMMENT "Copying compiler-rt's ${f}...")
+ list(APPEND out_files ${other_dst})
+ endif()
+endforeach( f )
+
+add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
+
+# Install sanitizer headers.
+install(FILES ${SANITIZER_HEADERS}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ DESTINATION ${LIBCLANG_INSTALL_PATH}/include/sanitizer)
if(COMPILER_RT_CAN_EXECUTE_TESTS)
# Run ASan tests only if we're sure we may produce working binaries.
set(ASAN_TEST_DEPS
- clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
- ${ASAN_RUNTIME_LIBRARIES}
- )
+ ${SANITIZER_COMMON_LIT_TEST_DEPS}
+ ${ASAN_RUNTIME_LIBRARIES})
set(ASAN_TEST_PARAMS
asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
)
if(COMPILER_RT_CAN_EXECUTE_TESTS)
# Run MSan tests only if we're sure we may produce working binaries.
set(MSAN_TEST_DEPS
- clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
- ${MSAN_RUNTIME_LIBRARIES}
- )
+ ${SANITIZER_COMMON_LIT_TEST_DEPS}
+ ${MSAN_RUNTIME_LIBRARIES})
set(MSAN_TEST_PARAMS
msan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
)
if(COMPILER_RT_CAN_EXECUTE_TESTS)
# Run TSan output tests only if we're sure we can produce working binaries.
set(TSAN_TEST_DEPS
- clang clang-headers FileCheck count not llvm-symbolizer
- ${TSAN_RUNTIME_LIBRARIES}
- )
+ ${SANITIZER_COMMON_LIT_TEST_DEPS}
+ ${TSAN_RUNTIME_LIBRARIES})
set(TSAN_TEST_PARAMS
tsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
)
# Run UBSan output tests only if we're sure that clang would produce
# working binaries.
set(UBSAN_TEST_DEPS
- clang clang-headers FileCheck count not
- ${UBSAN_RUNTIME_LIBRARIES}
- )
+ ${SANITIZER_COMMON_LIT_TEST_DEPS}
+ ${UBSAN_RUNTIME_LIBRARIES})
set(UBSAN_TEST_PARAMS
ubsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
)