2012-12-25 20:39:56 +08:00
|
|
|
include_directories(..)
|
2012-12-11 20:27:27 +08:00
|
|
|
|
2012-12-25 20:39:56 +08:00
|
|
|
# Runtime library sources and build flags.
|
|
|
|
set(MSAN_RTL_SOURCES
|
2012-12-11 20:27:27 +08:00
|
|
|
msan.cc
|
|
|
|
msan_allocator.cc
|
2014-05-21 17:02:13 +08:00
|
|
|
msan_chained_origin_depot.cc
|
2012-12-11 20:27:27 +08:00
|
|
|
msan_interceptors.cc
|
|
|
|
msan_linux.cc
|
|
|
|
msan_new_delete.cc
|
2012-12-26 17:32:05 +08:00
|
|
|
msan_report.cc
|
2014-04-04 17:47:41 +08:00
|
|
|
msan_thread.cc
|
2012-12-11 20:27:27 +08:00
|
|
|
)
|
2014-02-18 15:52:40 +08:00
|
|
|
|
2014-02-18 16:07:09 +08:00
|
|
|
set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
2014-02-18 15:52:40 +08:00
|
|
|
append_no_rtti_flag(MSAN_RTL_CFLAGS)
|
2014-10-16 06:47:54 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS)
|
2014-02-18 16:07:09 +08:00
|
|
|
# Prevent clang from generating libc calls.
|
2014-10-16 06:47:54 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
|
2012-12-11 20:27:27 +08:00
|
|
|
|
2014-05-10 06:11:03 +08:00
|
|
|
set(MSAN_RUNTIME_LIBRARIES)
|
|
|
|
|
2012-12-25 20:39:56 +08:00
|
|
|
# Static runtime library.
|
2014-02-14 21:02:58 +08:00
|
|
|
add_custom_target(msan)
|
2014-11-20 05:42:33 +08:00
|
|
|
foreach(arch ${MSAN_SUPPORTED_ARCH})
|
2014-03-31 21:45:36 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.msan-${arch} ${arch} STATIC
|
2013-01-20 22:14:13 +08:00
|
|
|
SOURCES ${MSAN_RTL_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
2013-05-18 00:17:19 +08:00
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
|
2013-08-27 23:08:02 +08:00
|
|
|
CFLAGS ${MSAN_RTL_CFLAGS})
|
2014-02-14 21:02:58 +08:00
|
|
|
add_dependencies(msan clang_rt.msan-${arch})
|
2014-05-10 06:11:03 +08:00
|
|
|
list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch})
|
2013-08-28 16:07:04 +08:00
|
|
|
if(UNIX)
|
|
|
|
add_sanitizer_rt_symbols(clang_rt.msan-${arch} msan.syms.extra)
|
2014-02-14 21:02:58 +08:00
|
|
|
add_dependencies(msan clang_rt.msan-${arch}-symbols)
|
2013-08-28 16:07:04 +08:00
|
|
|
endif()
|
2014-11-20 05:42:33 +08:00
|
|
|
endforeach()
|
2012-12-25 20:39:56 +08:00
|
|
|
|
2013-05-21 21:55:56 +08:00
|
|
|
add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt)
|
2014-02-14 21:02:58 +08:00
|
|
|
add_dependencies(msan msan_blacklist)
|
2014-02-18 17:33:45 +08:00
|
|
|
add_dependencies(compiler-rt msan)
|
2013-06-10 17:09:40 +08:00
|
|
|
|
2014-02-19 19:18:47 +08:00
|
|
|
if(COMPILER_RT_INCLUDE_TESTS)
|
2012-12-25 20:39:56 +08:00
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|