[compiler-rt] r177784 - Build and install .syms files alongside sanitizer runtimes. These are used to

Richard Smith richard-llvm at metafoo.co.uk
Fri Mar 22 17:31:07 PDT 2013


Author: rsmith
Date: Fri Mar 22 19:31:07 2013
New Revision: 177784

URL: http://llvm.org/viewvc/llvm-project?rev=177784&view=rev
Log:
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.

Added:
    compiler-rt/trunk/lib/asan/asan.syms
    compiler-rt/trunk/lib/msan/msan.syms
    compiler-rt/trunk/lib/tsan/rtl/tsan.syms
    compiler-rt/trunk/lib/ubsan/ubsan.syms
Modified:
    compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
    compiler-rt/trunk/lib/asan/CMakeLists.txt
    compiler-rt/trunk/lib/msan/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/rtl/CMakeLists.txt
    compiler-rt/trunk/lib/ubsan/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=177784&r1=177783&r2=177784&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Fri Mar 22 19:31:07 2013
@@ -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 nam
     # 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()

Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=177784&r1=177783&r2=177784&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt Fri Mar 22 19:31:07 2013
@@ -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()

Added: compiler-rt/trunk/lib/asan/asan.syms
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan.syms?rev=177784&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/asan.syms (added)
+++ compiler-rt/trunk/lib/asan/asan.syms Fri Mar 22 19:31:07 2013
@@ -0,0 +1 @@
+{ __asan_*; };

Modified: compiler-rt/trunk/lib/msan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/CMakeLists.txt?rev=177784&r1=177783&r2=177784&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/msan/CMakeLists.txt Fri Mar 22 19:31:07 2013
@@ -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()
 

Added: compiler-rt/trunk/lib/msan/msan.syms
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.syms?rev=177784&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.syms (added)
+++ compiler-rt/trunk/lib/msan/msan.syms Fri Mar 22 19:31:07 2013
@@ -0,0 +1 @@
+{ __msan_*; };

Modified: compiler-rt/trunk/lib/tsan/rtl/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/CMakeLists.txt?rev=177784&r1=177783&r2=177784&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/rtl/CMakeLists.txt Fri Mar 22 19:31:07 2013
@@ -44,6 +44,7 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT AP
             $<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()

Added: compiler-rt/trunk/lib/tsan/rtl/tsan.syms
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan.syms?rev=177784&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan.syms (added)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan.syms Fri Mar 22 19:31:07 2013
@@ -0,0 +1 @@
+{ __tsan_*; };

Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=177784&r1=177783&r2=177784&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Fri Mar 22 19:31:07 2013
@@ -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}

Added: compiler-rt/trunk/lib/ubsan/ubsan.syms
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan.syms?rev=177784&view=auto
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan.syms (added)
+++ compiler-rt/trunk/lib/ubsan/ubsan.syms Fri Mar 22 19:31:07 2013
@@ -0,0 +1 @@
+{ __ubsan_*; };





More information about the llvm-commits mailing list