forked from OSchip/llvm-project
Build and install .syms files alongside sanitizer runtimes. These are used to
specify which symbols are exported to DSOs when the sanitizer is statically linked into a binary. llvm-svn: 177784
This commit is contained in:
parent
f3e624ca73
commit
c91e327cba
|
@ -36,10 +36,11 @@ endmacro()
|
|||
# add_compiler_rt_static_runtime(<name> <arch>
|
||||
# SOURCES <source files>
|
||||
# CFLAGS <compile flags>
|
||||
# DEFS <compile definitions>)
|
||||
# DEFS <compile definitions>
|
||||
# SYMS <symbols file>)
|
||||
macro(add_compiler_rt_static_runtime name arch)
|
||||
if(CAN_TARGET_${arch})
|
||||
parse_arguments(LIB "SOURCES;CFLAGS;DEFS" "" ${ARGN})
|
||||
parse_arguments(LIB "SOURCES;CFLAGS;DEFS;SYMS" "" ${ARGN})
|
||||
add_library(${name} STATIC ${LIB_SOURCES})
|
||||
# Setup compile flags and definitions.
|
||||
set_target_compile_flags(${name}
|
||||
|
@ -52,6 +53,13 @@ macro(add_compiler_rt_static_runtime name arch)
|
|||
# Add installation command.
|
||||
install(TARGETS ${name}
|
||||
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
|
||||
# Generate the .syms file if possible.
|
||||
if(LIB_SYMS)
|
||||
get_target_property(libfile ${name} LOCATION)
|
||||
configure_file(${LIB_SYMS} ${libfile}.syms)
|
||||
install(FILES ${libfile}.syms
|
||||
DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
|
||||
endif(LIB_SYMS)
|
||||
else()
|
||||
message(FATAL_ERROR "Archtecture ${arch} can't be targeted")
|
||||
endif()
|
||||
|
|
|
@ -86,7 +86,8 @@ else()
|
|||
$<TARGET_OBJECTS:RTInterception.${arch}>
|
||||
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
||||
CFLAGS ${ASAN_CFLAGS}
|
||||
DEFS ${ASAN_COMMON_DEFINITIONS})
|
||||
DEFS ${ASAN_COMMON_DEFINITIONS}
|
||||
SYMS asan.syms)
|
||||
list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan-${arch})
|
||||
endforeach()
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{ __asan_*; };
|
|
@ -24,7 +24,8 @@ if(CAN_TARGET_${arch})
|
|||
SOURCES ${MSAN_RTL_SOURCES}
|
||||
$<TARGET_OBJECTS:RTInterception.${arch}>
|
||||
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
||||
CFLAGS ${MSAN_RTL_CFLAGS})
|
||||
CFLAGS ${MSAN_RTL_CFLAGS}
|
||||
SYMS msan.syms)
|
||||
list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch})
|
||||
endif()
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{ __msan_*; };
|
|
@ -44,6 +44,7 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE)
|
|||
$<TARGET_OBJECTS:RTInterception.${arch}>
|
||||
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
||||
CFLAGS ${TSAN_CFLAGS}
|
||||
DEFS ${TSAN_COMMON_DEFINITIONS})
|
||||
DEFS ${TSAN_COMMON_DEFINITIONS}
|
||||
SYMS tsan.syms)
|
||||
list(APPEND TSAN_RUNTIME_LIBRARIES clang_rt.tsan-${arch})
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{ __tsan_*; };
|
|
@ -34,11 +34,13 @@ else()
|
|||
# Main UBSan runtime.
|
||||
add_compiler_rt_static_runtime(clang_rt.ubsan-${arch} ${arch}
|
||||
SOURCES ${UBSAN_SOURCES}
|
||||
CFLAGS ${UBSAN_CFLAGS})
|
||||
CFLAGS ${UBSAN_CFLAGS}
|
||||
SYMS ubsan.syms)
|
||||
# C++-specific parts of UBSan runtime. Requires a C++ ABI library.
|
||||
add_compiler_rt_static_runtime(clang_rt.ubsan_cxx-${arch} ${arch}
|
||||
SOURCES ${UBSAN_CXX_SOURCES}
|
||||
CFLAGS ${UBSAN_CFLAGS})
|
||||
CFLAGS ${UBSAN_CFLAGS}
|
||||
SYMS ubsan.syms)
|
||||
list(APPEND UBSAN_RUNTIME_LIBRARIES
|
||||
clang_rt.san-${arch}
|
||||
clang_rt.ubsan-${arch}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{ __ubsan_*; };
|
Loading…
Reference in New Issue