]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/lib/msan/CMakeLists.txt
New upstream version 1.12.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 19set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
5bcae85e 20append_rtti_flag(OFF 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)
5bcae85e
SL
29set_target_properties(msan PROPERTIES FOLDER "Compiler-RT Misc")
30
92a42be0
SL
31foreach(arch ${MSAN_SUPPORTED_ARCH})
32 add_compiler_rt_runtime(clang_rt.msan
33 STATIC
34 ARCHS ${arch}
1a4d82fc
JJ
35 SOURCES ${MSAN_RTL_SOURCES}
36 $<TARGET_OBJECTS:RTInterception.${arch}>
37 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
38 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
92a42be0
SL
39 $<TARGET_OBJECTS:RTUbsan.${arch}>
40 CFLAGS ${MSAN_RTL_CFLAGS}
41 PARENT_TARGET msan)
42 add_compiler_rt_runtime(clang_rt.msan_cxx
43 STATIC
44 ARCHS ${arch}
45 SOURCES ${MSAN_RTL_CXX_SOURCES}
46 $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
47 CFLAGS ${MSAN_RTL_CFLAGS}
48 PARENT_TARGET msan)
49 list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
50 clang_rt.msan_cxx-${arch})
1a4d82fc 51 if(UNIX)
92a42be0
SL
52 add_sanitizer_rt_symbols(clang_rt.msan
53 ARCHS ${arch}
54 EXTRA msan.syms.extra)
55 add_sanitizer_rt_symbols(clang_rt.msan_cxx
56 ARCHS ${arch}
57 EXTRA msan.syms.extra)
58 add_dependencies(msan clang_rt.msan-${arch}-symbols
59 clang_rt.msan_cxx-${arch}-symbols)
1a4d82fc 60 endif()
92a42be0 61endforeach()
1a4d82fc 62
5bcae85e 63add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt msan)
1a4d82fc
JJ
64add_dependencies(compiler-rt msan)
65
66if(COMPILER_RT_INCLUDE_TESTS)
67 add_subdirectory(tests)
68endif()