diff options
| author | Alexey Samsonov <samsonov@google.com> | 2013-08-27 15:08:02 +0000 |
|---|---|---|
| committer | Alexey Samsonov <samsonov@google.com> | 2013-08-27 15:08:02 +0000 |
| commit | e5fa243b20bf5e6a097bc58cbedfe6bed8a9b7d1 (patch) | |
| tree | 44ec546168b34e749d09d3576ee21f598842a330 /cmake | |
| parent | 0e38a67cd2d877e8680d65878c86c9e7e4fa4b1d (diff) | |
| download | compiler-rt-e5fa243b20bf5e6a097bc58cbedfe6bed8a9b7d1.tar.gz compiler-rt-e5fa243b20bf5e6a097bc58cbedfe6bed8a9b7d1.tar.bz2 compiler-rt-e5fa243b20bf5e6a097bc58cbedfe6bed8a9b7d1.tar.xz | |
Properly generate lists of exported symbols for sanitizer runtimes
This change adds a Python script that is invoked for
the just-built sanitizer runtime to generate the list of exported symbols
passed to the linker. By default, it contains interceptors and sanitizer
interface functions, but can be extended with tool-specific lists.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189356 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/Modules/AddCompilerRT.cmake | 12 | ||||
| -rw-r--r-- | cmake/Modules/SanitizerUtils.cmake | 22 |
2 files changed, 24 insertions, 10 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake index bf114a40..1ece3eb9 100644 --- a/cmake/Modules/AddCompilerRT.cmake +++ b/cmake/Modules/AddCompilerRT.cmake @@ -36,11 +36,10 @@ endmacro() # add_compiler_rt_static_runtime(<name> <arch> # SOURCES <source files> # CFLAGS <compile flags> -# DEFS <compile definitions> -# SYMS <symbols file>) +# DEFS <compile definitions>) macro(add_compiler_rt_static_runtime name arch) if(CAN_TARGET_${arch}) - parse_arguments(LIB "SOURCES;CFLAGS;DEFS;SYMS" "" ${ARGN}) + parse_arguments(LIB "SOURCES;CFLAGS;DEFS" "" ${ARGN}) add_library(${name} STATIC ${LIB_SOURCES}) # Setup compile flags and definitions. set_target_compile_flags(${name} @@ -53,13 +52,6 @@ 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/cmake/Modules/SanitizerUtils.cmake b/cmake/Modules/SanitizerUtils.cmake new file mode 100644 index 00000000..7a4f8670 --- /dev/null +++ b/cmake/Modules/SanitizerUtils.cmake @@ -0,0 +1,22 @@ +include(LLVMParseArguments) + +set(SANITIZER_GEN_DYNAMIC_LIST + ${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/scripts/gen_dynamic_list.py) + +# Create a target "<name>-symbols" that would generate the list of symbols +# that need to be exported from sanitizer runtime "<name>". Function +# interceptors are exported automatically, user can also provide files with +# symbol names that should be exported as well. +# add_sanitizer_rt_symbols(<name> <files with extra symbols to export>) +macro(add_sanitizer_rt_symbols name) + get_target_property(libfile ${name} LOCATION) + set(symsfile "${libfile}.syms") + add_custom_target(${name}-symbols ALL + COMMAND ${SANITIZER_GEN_DYNAMIC_LIST} ${libfile} ${ARGN} + > ${symsfile} + DEPENDS ${name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN}) + install(FILES ${symsfile} DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}) +endmacro() |
