[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / compiler-rt / lib / dfsan / CMakeLists.txt
blob37c386d2de1f527e60bcc2e95af363440d69055e
1 include_directories(..)
3 # Runtime library sources and build flags.
4 set(DFSAN_RTL_SOURCES
5   dfsan.cpp
6   dfsan_allocator.cpp
7   dfsan_chained_origin_depot.cpp
8   dfsan_custom.cpp
9   dfsan_interceptors.cpp
10   dfsan_new_delete.cpp
11   dfsan_thread.cpp
12   )
14 set(DFSAN_RTL_HEADERS
15   dfsan.h
16   dfsan_allocator.h
17   dfsan_chained_origin_depot.h
18   dfsan_flags.inc
19   dfsan_flags.h
20   dfsan_platform.h
21   dfsan_thread.h
22   )
24 set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS})
25 append_rtti_flag(OFF DFSAN_COMMON_CFLAGS)
26 # Prevent clang from generating libc calls.
27 append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS)
29 # Too many existing bugs, needs cleanup.
30 append_list_if(COMPILER_RT_HAS_WNO_FORMAT -Wno-format DFSAN_COMMON_CFLAGS)
32 # Static runtime library.
33 add_compiler_rt_component(dfsan)
35 foreach(arch ${DFSAN_SUPPORTED_ARCH})
36   set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS})
37   append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS)
38   add_compiler_rt_runtime(clang_rt.dfsan
39     STATIC
40     ARCHS ${arch}
41     SOURCES ${DFSAN_RTL_SOURCES}
42             $<TARGET_OBJECTS:RTInterception.${arch}>
43             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
44             $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
45             $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
46             $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>
47     ADDITIONAL_HEADERS ${DFSAN_RTL_HEADERS}
48     CFLAGS ${DFSAN_CFLAGS}
49     PARENT_TARGET dfsan)
50   add_sanitizer_rt_symbols(clang_rt.dfsan
51     ARCHS ${arch}
52     EXTRA dfsan.syms.extra)
53   add_dependencies(dfsan
54     clang_rt.dfsan-${arch}-symbols)
55 endforeach()
57 set(dfsan_abilist_dir ${COMPILER_RT_OUTPUT_DIR}/share)
58 set(dfsan_abilist_filename ${dfsan_abilist_dir}/dfsan_abilist.txt)
59 add_custom_target(dfsan_abilist ALL
60   DEPENDS ${dfsan_abilist_filename})
61 add_custom_command(OUTPUT ${dfsan_abilist_filename}
62                    VERBATIM
63                    COMMAND
64                     ${CMAKE_COMMAND} -E make_directory ${dfsan_abilist_dir}
65                    COMMAND
66                     ${CMAKE_COMMAND} -E cat
67                          ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt
68                          ${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1404_abilist.txt
69                          > ${dfsan_abilist_filename}
70                    DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
71 add_dependencies(dfsan dfsan_abilist)
72 install(FILES ${dfsan_abilist_filename}
73         DESTINATION ${COMPILER_RT_INSTALL_DATA_DIR})