[compiler-rt] r233011 - [UBSan] Introduce "ubsan_standalone" library (compiler-rt part).

Alexey Samsonov vonosmas at gmail.com
Mon Mar 23 13:05:53 PDT 2015


Author: samsonov
Date: Mon Mar 23 15:05:53 2015
New Revision: 233011

URL: http://llvm.org/viewvc/llvm-project?rev=233011&view=rev
Log:
[UBSan] Introduce "ubsan_standalone" library (compiler-rt part).

Get rid of "libclang_rt.san" library that used to contain
sanitizer_common pieces required by UBSan if it's used in a standalone
mode. Instead, build two variants of UBSan runtime: "ubsan" and
"ubsan_standalone" (same for "ubsan_cxx" and "ubsan_standalone_cxx").

Later "ubsan" and "ubsan_cxx" libraries will go away, as they will
embedded it into corresponding ASan runtimes.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
    compiler-rt/trunk/lib/ubsan/CMakeLists.txt

Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=233011&r1=233010&r2=233011&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Mon Mar 23 15:05:53 2015
@@ -142,12 +142,6 @@ else()
       DEFS ${SANITIZER_COMMON_DEFINITIONS})
     list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch}
                                             RTSanitizerCommonLibc.${arch})
-    add_compiler_rt_runtime(clang_rt.san-${arch} ${arch} STATIC
-      SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
-              $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
-      CFLAGS ${SANITIZER_CFLAGS}
-      DEFS ${SANITIZER_COMMON_DEFINITIONS})
-    add_dependencies(sanitizer_common clang_rt.san-${arch})
   endforeach()
 endif()
 

Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=233011&r1=233010&r2=233011&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Mon Mar 23 15:05:53 2015
@@ -32,24 +32,44 @@ if(APPLE)
 else()
   # Build separate libraries for each target.
   foreach(arch ${UBSAN_SUPPORTED_ARCH})
-    # Main UBSan runtime.
+    add_compiler_rt_object_library(RTUbsan ${arch}
+      SOURCES ${UBSAN_SOURCES} CFLAGS ${UBSAN_CFLAGS})
+    # C++-specific parts of UBSan runtime. Requires a C++ ABI library.
+    add_compiler_rt_object_library(RTUbsan_cxx ${arch}
+      SOURCES ${UBSAN_CXX_SOURCES} CFLAGS ${UBSAN_CXXFLAGS})
+
+    # Standalone UBSan runtimes.
+    add_compiler_rt_runtime(clang_rt.ubsan_standalone-${arch} ${arch} STATIC
+      SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+              $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+              $<TARGET_OBJECTS:RTUbsan.${arch}>
+      CFLAGS ${UBSAN_CFLAGS})
+    add_compiler_rt_runtime(clang_rt.ubsan_standalone_cxx-${arch} ${arch} STATIC
+      SOURCES $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
+      CFLAGS ${UBSAN_CXXFLAGS})
+    # UBSan runtimes used when another sanitizer is available.
     add_compiler_rt_runtime(clang_rt.ubsan-${arch} ${arch} STATIC
-      SOURCES ${UBSAN_SOURCES}
+      SOURCES $<TARGET_OBJECTS:RTUbsan.${arch}>
       CFLAGS ${UBSAN_CFLAGS})
-    # C++-specific parts of UBSan runtime. Requires a C++ ABI library.
     add_compiler_rt_runtime(clang_rt.ubsan_cxx-${arch} ${arch} STATIC
-      SOURCES ${UBSAN_CXX_SOURCES}
+      SOURCES $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
       CFLAGS ${UBSAN_CXXFLAGS})
+
     add_dependencies(ubsan
-      clang_rt.san-${arch}
       clang_rt.ubsan-${arch}
-      clang_rt.ubsan_cxx-${arch})
+      clang_rt.ubsan_cxx-${arch}
+      clang_rt.ubsan_standalone-${arch}
+      clang_rt.ubsan_standalone_cxx-${arch})
     if (UNIX AND NOT ${arch} MATCHES "i386|i686")
       add_sanitizer_rt_symbols(clang_rt.ubsan-${arch} ubsan.syms.extra)
       add_sanitizer_rt_symbols(clang_rt.ubsan_cxx-${arch} ubsan.syms.extra)
+      add_sanitizer_rt_symbols(clang_rt.ubsan_standalone-${arch} ubsan.syms.extra)
+      add_sanitizer_rt_symbols(clang_rt.ubsan_standalone_cxx-${arch} ubsan.syms.extra)
       add_dependencies(ubsan
         clang_rt.ubsan-${arch}-symbols
-        clang_rt.ubsan_cxx-${arch}-symbols)
+        clang_rt.ubsan_cxx-${arch}-symbols
+        clang_rt.ubsan_standalone-${arch}-symbols
+        clang_rt.ubsan_standalone_cxx-${arch}-symbols)
     endif()
   endforeach()
 endif()





More information about the llvm-commits mailing list