[PATCH] D33216: Generate ubsan shared libraries.

Leo Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 16:01:31 PDT 2017


aoli updated this revision to Diff 99075.
aoli added a comment.

Use UBSAN_CXXFLAGS for ubsan shared libraries.


https://reviews.llvm.org/D33216

Files:
  lib/ubsan/CMakeLists.txt


Index: lib/ubsan/CMakeLists.txt
===================================================================
--- lib/ubsan/CMakeLists.txt
+++ lib/ubsan/CMakeLists.txt
@@ -34,6 +34,14 @@
 append_rtti_flag(ON UBSAN_CXXFLAGS)
 append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CXXFLAGS)
 
+append_list_if(COMPILER_RT_HAS_LIBDL dl UBSAN_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBLOG log UBSAN_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBC c UBSAN_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBRT rt UBSAN_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBM m UBSAN_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread UBSAN_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ UBSAN_DYNAMIC_LIBS)
+ 
 add_compiler_rt_component(ubsan)
 
 if(APPLE)
@@ -73,6 +81,12 @@
   endif()
 
 else()
+  set(UBSAN_COMMON_RUNTIME_OBJECT_LIBS
+    RTInterception
+    RTSanitizerCommon
+    RTSanitizerCommonLibc
+    )
+
   # Common parts of UBSan runtime.
   add_compiler_rt_object_libraries(RTUbsan
     ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH}
@@ -144,6 +158,16 @@
       CFLAGS ${UBSAN_CXXFLAGS}
       PARENT_TARGET ubsan)
 
+    add_compiler_rt_runtime(clang_rt.ubsan_standalone
+      SHARED
+      ARCHS ${UBSAN_SUPPORTED_ARCH}
+      OBJECT_LIBS ${UBSAN_COMMON_RUNTIME_OBJECT_LIBS}
+      RTUbsan
+      RTUbsan_cxx
+      CFLAGS ${UBSAN_CXXFLAGS}
+      LINK_LIBS ${UBSAN_DYNAMIC_LIBS}
+      PARENT_TARGET ubsan)
+
     if (UNIX)
       set(ARCHS_FOR_SYMBOLS ${UBSAN_SUPPORTED_ARCH})
       list(REMOVE_ITEM ARCHS_FOR_SYMBOLS i386 i686)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33216.99075.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170515/15557de9/attachment.bin>


More information about the llvm-commits mailing list