]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/lib/msan/CMakeLists.txt
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / lib / msan / CMakeLists.txt
CommitLineData
1a4d82fc
JJ
1include_directories(..)
2
3# Runtime library sources and build flags.
4set(MSAN_RTL_SOURCES
5 msan.cc
6 msan_allocator.cc
92a42be0 7 msan_chained_origin_depot.cc
1a4d82fc
JJ
8 msan_interceptors.cc
9 msan_linux.cc
1a4d82fc
JJ
10 msan_report.cc
11 msan_thread.cc
92a42be0 12 msan_poisoning.cc
1a4d82fc
JJ
13 )
14
92a42be0
SL
15set(MSAN_RTL_CXX_SOURCES
16 msan_new_delete.cc)
17
18
1a4d82fc
JJ
19set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
20append_no_rtti_flag(MSAN_RTL_CFLAGS)
92a42be0 21append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS)
1a4d82fc 22# Prevent clang from generating libc calls.
92a42be0
SL
23append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
24
25set(MSAN_RUNTIME_LIBRARIES)
1a4d82fc
JJ
26
27# Static runtime library.
28add_custom_target(msan)
92a42be0
SL
29foreach(arch ${MSAN_SUPPORTED_ARCH})
30 add_compiler_rt_runtime(clang_rt.msan
31 STATIC
32 ARCHS ${arch}
1a4d82fc
JJ
33 SOURCES ${MSAN_RTL_SOURCES}
34 $<TARGET_OBJECTS:RTInterception.${arch}>
35 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
36 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
92a42be0
SL
37 $<TARGET_OBJECTS:RTUbsan.${arch}>
38 CFLAGS ${MSAN_RTL_CFLAGS}
39 PARENT_TARGET msan)
40 add_compiler_rt_runtime(clang_rt.msan_cxx
41 STATIC
42 ARCHS ${arch}
43 SOURCES ${MSAN_RTL_CXX_SOURCES}
44 $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
45 CFLAGS ${MSAN_RTL_CFLAGS}
46 PARENT_TARGET msan)
47 list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
48 clang_rt.msan_cxx-${arch})
1a4d82fc 49 if(UNIX)
92a42be0
SL
50 add_sanitizer_rt_symbols(clang_rt.msan
51 ARCHS ${arch}
52 EXTRA msan.syms.extra)
53 add_sanitizer_rt_symbols(clang_rt.msan_cxx
54 ARCHS ${arch}
55 EXTRA msan.syms.extra)
56 add_dependencies(msan clang_rt.msan-${arch}-symbols
57 clang_rt.msan_cxx-${arch}-symbols)
1a4d82fc 58 endif()
92a42be0 59endforeach()
1a4d82fc
JJ
60
61add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt)
62add_dependencies(msan msan_blacklist)
63add_dependencies(compiler-rt msan)
64
65if(COMPILER_RT_INCLUDE_TESTS)
66 add_subdirectory(tests)
67endif()