summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-03-23 00:31:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-03-23 00:31:07 +0000
commita06fe9183fbffb78798a444da9bc3040fdd444aa (patch)
treed0891fc14db3ce813e10b7da7902eeff9bbc70cb /cmake
parenta05af3d0f2417cd6516460a46d0381a7345a5837 (diff)
downloadcompiler-rt-a06fe9183fbffb78798a444da9bc3040fdd444aa.tar.gz
compiler-rt-a06fe9183fbffb78798a444da9bc3040fdd444aa.tar.bz2
compiler-rt-a06fe9183fbffb78798a444da9bc3040fdd444aa.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177784 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/AddCompilerRT.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index 742d81f9..c261d104 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()