[PATCH] D48377: [scudo] Add a minimal runtime for -fsanitize-minimal-runtime compatibility

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 21 14:52:36 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT335296: [scudo] Add a minimal runtime for -fsanitize-minimal-runtime compatibility (authored by cryptoad, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48377?vs=152104&id=152386#toc

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D48377

Files:
  lib/scudo/CMakeLists.txt


Index: lib/scudo/CMakeLists.txt
===================================================================
--- lib/scudo/CMakeLists.txt
+++ lib/scudo/CMakeLists.txt
@@ -7,30 +7,33 @@
 list(APPEND SCUDO_CFLAGS -fbuiltin)
 append_rtti_flag(OFF SCUDO_CFLAGS)
 
-set(SCUDO_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS})
-append_list_if(COMPILER_RT_HAS_LIBDL dl SCUDO_DYNAMIC_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBRT rt SCUDO_DYNAMIC_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread SCUDO_DYNAMIC_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBLOG log SCUDO_DYNAMIC_LIBS)
+set(SCUDO_MINIMAL_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS})
+append_list_if(COMPILER_RT_HAS_LIBDL dl SCUDO_MINIMAL_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBRT rt SCUDO_MINIMAL_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread SCUDO_MINIMAL_DYNAMIC_LIBS)
+append_list_if(COMPILER_RT_HAS_LIBLOG log SCUDO_MINIMAL_DYNAMIC_LIBS)
 
 set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
 # Use gc-sections by default to avoid unused code being pulled in.
 list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)
 
-set(SCUDO_OBJECT_LIBS
+# The minimal Scudo runtime does not inlude the UBSan runtime.
+set(SCUDO_MINIMAL_OBJECT_LIBS
   RTSanitizerCommonNoTermination
   RTSanitizerCommonLibc
   RTInterception)
+set(SCUDO_OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS})
+set(SCUDO_DYNAMIC_LIBS ${SCUDO_MINIMAL_DYNAMIC_LIBS})
 
 if (FUCHSIA)
   list(APPEND SCUDO_CFLAGS -nostdinc++)
   list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -nostdlib++)
 else()
+  list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY})
   list(APPEND SCUDO_OBJECT_LIBS
     RTSanitizerCommonCoverage
     RTSanitizerCommonSymbolizer
     RTUbsan)
-  list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY})
 endif()
 
 set(SCUDO_SOURCES
@@ -59,22 +62,45 @@
 endif()
 
 if(COMPILER_RT_HAS_SCUDO)
+  add_compiler_rt_runtime(clang_rt.scudo_minimal
+    STATIC
+    ARCHS ${SCUDO_SUPPORTED_ARCH}
+    SOURCES ${SCUDO_SOURCES}
+    OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS}
+    CFLAGS ${SCUDO_CFLAGS}
+    PARENT_TARGET scudo)
+  add_compiler_rt_runtime(clang_rt.scudo_cxx_minimal
+    STATIC
+    ARCHS ${SCUDO_SUPPORTED_ARCH}
+    SOURCES ${SCUDO_CXX_SOURCES}
+    CFLAGS ${SCUDO_CFLAGS}
+    PARENT_TARGET scudo)
+
   add_compiler_rt_runtime(clang_rt.scudo
     STATIC
     ARCHS ${SCUDO_SUPPORTED_ARCH}
     SOURCES ${SCUDO_SOURCES}
     OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
     CFLAGS ${SCUDO_CFLAGS}
     PARENT_TARGET scudo)
-
   add_compiler_rt_runtime(clang_rt.scudo_cxx
     STATIC
     ARCHS ${SCUDO_SUPPORTED_ARCH}
     SOURCES ${SCUDO_CXX_SOURCES}
     OBJECT_LIBS RTUbsan_cxx
     CFLAGS ${SCUDO_CFLAGS}
     PARENT_TARGET scudo)
 
+  add_compiler_rt_runtime(clang_rt.scudo_minimal
+    SHARED
+    ARCHS ${SCUDO_SUPPORTED_ARCH}
+    SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES}
+    OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS}
+    CFLAGS ${SCUDO_CFLAGS}
+    LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS}
+    LINK_LIBS ${SCUDO_MINIMAL_DYNAMIC_LIBS}
+    PARENT_TARGET scudo)
+
   add_compiler_rt_runtime(clang_rt.scudo
     SHARED
     ARCHS ${SCUDO_SUPPORTED_ARCH}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48377.152386.patch
Type: text/x-patch
Size: 3124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180621/f16a50ec/attachment-0001.bin>


More information about the llvm-commits mailing list