brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 37c386d Raw
74 lines · plain
1include_directories(..)2 3# Runtime library sources and build flags.4set(DFSAN_RTL_SOURCES5  dfsan.cpp6  dfsan_allocator.cpp7  dfsan_chained_origin_depot.cpp8  dfsan_custom.cpp9  dfsan_interceptors.cpp10  dfsan_new_delete.cpp11  dfsan_thread.cpp12  )13 14set(DFSAN_RTL_HEADERS15  dfsan.h16  dfsan_allocator.h17  dfsan_chained_origin_depot.h18  dfsan_flags.inc19  dfsan_flags.h20  dfsan_platform.h21  dfsan_thread.h22  )23 24set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS})25append_rtti_flag(OFF DFSAN_COMMON_CFLAGS)26# Prevent clang from generating libc calls.27append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS)28 29# Too many existing bugs, needs cleanup.30append_list_if(COMPILER_RT_HAS_WNO_FORMAT -Wno-format DFSAN_COMMON_CFLAGS)31 32# Static runtime library.33add_compiler_rt_component(dfsan)34 35foreach(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.dfsan39    STATIC40    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.dfsan51    ARCHS ${arch}52    EXTRA dfsan.syms.extra)53  add_dependencies(dfsan54    clang_rt.dfsan-${arch}-symbols)55endforeach()56 57set(dfsan_abilist_dir ${COMPILER_RT_OUTPUT_DIR}/share)58set(dfsan_abilist_filename ${dfsan_abilist_dir}/dfsan_abilist.txt)59add_custom_target(dfsan_abilist ALL60  DEPENDS ${dfsan_abilist_filename})61add_custom_command(OUTPUT ${dfsan_abilist_filename}62                   VERBATIM63                   COMMAND64                    ${CMAKE_COMMAND} -E make_directory ${dfsan_abilist_dir}65                   COMMAND66                    ${CMAKE_COMMAND} -E cat67                         ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt68                         ${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1404_abilist.txt69                         > ${dfsan_abilist_filename}70                   DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)71add_dependencies(dfsan dfsan_abilist)72install(FILES ${dfsan_abilist_filename}73        DESTINATION ${COMPILER_RT_INSTALL_DATA_DIR})74