summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/AddCompilerRT.cmake12
-rw-r--r--lib/asan/CMakeLists.txt3
-rw-r--r--lib/asan/asan.syms1
-rw-r--r--lib/msan/CMakeLists.txt3
-rw-r--r--lib/msan/msan.syms1
-rw-r--r--lib/tsan/rtl/CMakeLists.txt3
-rw-r--r--lib/tsan/rtl/tsan.syms1
-rw-r--r--lib/ubsan/CMakeLists.txt6
-rw-r--r--lib/ubsan/ubsan.syms1
9 files changed, 24 insertions, 7 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index 742d81f9a..c261d1045 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -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()
diff --git a/lib/asan/CMakeLists.txt b/lib/asan/CMakeLists.txt
index bddae9fe3..030c7b3ec 100644
--- a/lib/asan/CMakeLists.txt
+++ b/lib/asan/CMakeLists.txt
@@ -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()
diff --git a/lib/asan/asan.syms b/lib/asan/asan.syms
new file mode 100644
index 000000000..33c8fcb0f
--- /dev/null
+++ b/lib/asan/asan.syms
@@ -0,0 +1 @@
+{ __asan_*; };
diff --git a/lib/msan/CMakeLists.txt b/lib/msan/CMakeLists.txt
index 6f10942ce..5eedbea74 100644
--- a/lib/msan/CMakeLists.txt
+++ b/lib/msan/CMakeLists.txt
@@ -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()
diff --git a/lib/msan/msan.syms b/lib/msan/msan.syms
new file mode 100644
index 000000000..91499b4d1
--- /dev/null
+++ b/lib/msan/msan.syms
@@ -0,0 +1 @@
+{ __msan_*; };
diff --git a/lib/tsan/rtl/CMakeLists.txt b/lib/tsan/rtl/CMakeLists.txt
index f2a8533b8..8d89e6e7b 100644
--- a/lib/tsan/rtl/CMakeLists.txt
+++ b/lib/tsan/rtl/CMakeLists.txt
@@ -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()
diff --git a/lib/tsan/rtl/tsan.syms b/lib/tsan/rtl/tsan.syms
new file mode 100644
index 000000000..bedbe1316
--- /dev/null
+++ b/lib/tsan/rtl/tsan.syms
@@ -0,0 +1 @@
+{ __tsan_*; };
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt
index 3dd8613be..c8470bc6d 100644
--- a/lib/ubsan/CMakeLists.txt
+++ b/lib/ubsan/CMakeLists.txt
@@ -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}
diff --git a/lib/ubsan/ubsan.syms b/lib/ubsan/ubsan.syms
new file mode 100644
index 000000000..e74de33f0
--- /dev/null
+++ b/lib/ubsan/ubsan.syms
@@ -0,0 +1 @@
+{ __ubsan_*; };