[NewPM] Remove SimpleLoopUnswitchLegacyPass (#72934)
[llvm-project.git] / compiler-rt / lib / ubsan_minimal / CMakeLists.txt
blob07e96a70a49dce197526394c88248d76866a814b
1 # Build for the minimal undefined behavior sanitizer runtime support library.
3 set(UBSAN_MINIMAL_SOURCES
4   ubsan_minimal_handlers.cpp
5   )
7 include_directories(..)
9 set(UBSAN_CFLAGS
10   ${SANITIZER_COMMON_CFLAGS}
11   -DSANITIZER_COMMON_NO_REDEFINE_BUILTINS)
12 append_rtti_flag(OFF UBSAN_CFLAGS)
14 set(UBSAN_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
16 set(UBSAN_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS})
18 add_compiler_rt_component(ubsan-minimal)
20 # Common parts of minimal UBSan runtime.
21 add_compiler_rt_object_libraries(RTUbsan_minimal
22   OS ${SANITIZER_COMMON_SUPPORTED_OS}
23   ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH}
24   SOURCES ${UBSAN_MINIMAL_SOURCES} CFLAGS ${UBSAN_CFLAGS})
27 if(COMPILER_RT_HAS_UBSAN_MINIMAL)
28   # Standalone minimal UBSan runtimes.
29   add_compiler_rt_runtime(clang_rt.ubsan_minimal
30     STATIC
31     OS ${UBSAN_SUPPORTED_OS}
32     ARCHS ${UBSAN_SUPPORTED_ARCH}
33     OBJECT_LIBS RTUbsan_minimal
34     CFLAGS ${UBSAN_CFLAGS}
35     PARENT_TARGET ubsan-minimal)
37   add_compiler_rt_runtime(clang_rt.ubsan_minimal
38     SHARED
39     OS ${UBSAN_SUPPORTED_OS}
40     ARCHS ${UBSAN_SUPPORTED_ARCH}
41     OBJECT_LIBS RTUbsan_minimal
42     CFLAGS ${UBSAN_CFLAGS}
43     LINK_FLAGS ${UBSAN_LINK_FLAGS}
44     LINK_LIBS ${UBSAN_DYNAMIC_LIBS}
45     PARENT_TARGET ubsan-minimal)
47   if (SANITIZER_USE_SYMBOLS AND NOT APPLE)
48     set(ARCHS_FOR_SYMBOLS ${UBSAN_SUPPORTED_ARCH})
49     list(REMOVE_ITEM ARCHS_FOR_SYMBOLS i386 i686)
50     add_sanitizer_rt_symbols(clang_rt.ubsan_minimal
51       ARCHS ${ARCHS_FOR_SYMBOLS}
52       PARENT_TARGET ubsan-minimal
53       EXTRA ubsan.syms.extra)
54   endif()
55 endif()