2018-10-30 09:20:12 +08:00
|
|
|
# Build for the minimal undefined behavior sanitizer runtime support library.
|
2017-08-30 04:03:51 +08:00
|
|
|
|
|
|
|
set(UBSAN_MINIMAL_SOURCES
|
2019-08-01 20:41:23 +08:00
|
|
|
ubsan_minimal_handlers.cpp
|
2017-08-30 04:03:51 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(..)
|
|
|
|
|
|
|
|
set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
|
|
|
append_rtti_flag(OFF UBSAN_CFLAGS)
|
|
|
|
|
2017-11-11 10:32:02 +08:00
|
|
|
set(UBSAN_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
|
|
|
|
|
|
|
|
set(UBSAN_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS})
|
2017-08-30 04:03:51 +08:00
|
|
|
|
|
|
|
add_compiler_rt_component(ubsan-minimal)
|
|
|
|
|
2018-10-30 09:20:12 +08:00
|
|
|
# Common parts of minimal UBSan runtime.
|
2017-08-30 04:03:51 +08:00
|
|
|
add_compiler_rt_object_libraries(RTUbsan_minimal
|
2017-09-12 05:37:53 +08:00
|
|
|
OS ${SANITIZER_COMMON_SUPPORTED_OS}
|
2017-08-30 04:03:51 +08:00
|
|
|
ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${UBSAN_MINIMAL_SOURCES} CFLAGS ${UBSAN_CFLAGS})
|
|
|
|
|
|
|
|
|
2017-08-30 05:15:08 +08:00
|
|
|
if(COMPILER_RT_HAS_UBSAN_MINIMAL)
|
2018-10-30 09:20:12 +08:00
|
|
|
# Standalone minimal UBSan runtimes.
|
2017-08-30 04:03:51 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.ubsan_minimal
|
|
|
|
STATIC
|
2017-09-12 05:37:53 +08:00
|
|
|
OS ${SANITIZER_COMMON_SUPPORTED_OS}
|
2017-08-30 04:03:51 +08:00
|
|
|
ARCHS ${UBSAN_SUPPORTED_ARCH}
|
|
|
|
OBJECT_LIBS RTUbsan_minimal
|
|
|
|
CFLAGS ${UBSAN_CFLAGS}
|
|
|
|
PARENT_TARGET ubsan-minimal)
|
|
|
|
|
|
|
|
add_compiler_rt_runtime(clang_rt.ubsan_minimal
|
|
|
|
SHARED
|
2017-09-12 05:37:53 +08:00
|
|
|
OS ${SANITIZER_COMMON_SUPPORTED_OS}
|
2017-08-30 04:03:51 +08:00
|
|
|
ARCHS ${UBSAN_SUPPORTED_ARCH}
|
|
|
|
OBJECT_LIBS RTUbsan_minimal
|
|
|
|
CFLAGS ${UBSAN_CFLAGS}
|
2017-11-11 10:32:02 +08:00
|
|
|
LINK_FLAGS ${UBSAN_LINK_FLAGS}
|
2017-08-30 04:03:51 +08:00
|
|
|
LINK_LIBS ${UBSAN_DYNAMIC_LIBS}
|
|
|
|
PARENT_TARGET ubsan-minimal)
|
|
|
|
|
2018-05-10 05:24:06 +08:00
|
|
|
if (SANITIZER_USE_SYMBOLS AND NOT APPLE)
|
2017-08-30 04:03:51 +08:00
|
|
|
set(ARCHS_FOR_SYMBOLS ${UBSAN_SUPPORTED_ARCH})
|
|
|
|
list(REMOVE_ITEM ARCHS_FOR_SYMBOLS i386 i686)
|
|
|
|
add_sanitizer_rt_symbols(clang_rt.ubsan_minimal
|
|
|
|
ARCHS ${ARCHS_FOR_SYMBOLS}
|
|
|
|
PARENT_TARGET ubsan-minimal
|
|
|
|
EXTRA ubsan.syms.extra)
|
|
|
|
endif()
|
|
|
|
endif()
|