[PATCH] D44791: [scudo] Fuchsia minimal shared runtime

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 22 10:25:46 PDT 2018


cryptoad created this revision.
cryptoad added reviewers: phosek, flowerhack, alekseyshl.
Herald added subscribers: Sanitizers, delcypher, mgorny.

Fuchsia requires its Scudo shared runtime to not be C++ dependant. Since they
don't use UBSan in conjunction with Scudo, we can just remove the runtime,
and add the extra `nostdinc++` and `nostdlib++` flags. No need for Coverage
either. This allows to keep things going while working on additional splits
of sanitizer_commong and a more minimal runtime.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D44791

Files:
  lib/scudo/CMakeLists.txt


Index: lib/scudo/CMakeLists.txt
===================================================================
--- lib/scudo/CMakeLists.txt
+++ lib/scudo/CMakeLists.txt
@@ -9,9 +9,12 @@
 
 set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
 
-# Use gc-sections by default to avoid unused code being pulled in.
 list(APPEND SCUDO_CFLAGS -ffunction-sections -fdata-sections)
+append_list_if(FUCHSIA -nostdinc++ SCUDO_CFLAGS)
+
+# Use gc-sections by default to avoid unused code being pulled in.
 list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)
+append_list_if(FUCHSIA -Wl,-nostdlib++ SCUDO_DYNAMIC_LINK_FLAGS)
 
 set(SCUDO_SOURCES
   scudo_allocator.cpp
@@ -38,8 +41,7 @@
 endif()
 
 if(COMPILER_RT_HAS_SCUDO)
-  set(SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY}
-                         ${SANITIZER_COMMON_LINK_LIBS})
+  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)
@@ -65,18 +67,32 @@
     CFLAGS ${SCUDO_CFLAGS}
     PARENT_TARGET scudo)
 
-  add_compiler_rt_runtime(clang_rt.scudo
-    SHARED
-    ARCHS ${SCUDO_SUPPORTED_ARCH}
-    SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES}
-    OBJECT_LIBS RTSanitizerCommonNoTermination
-                RTSanitizerCommonLibc
-                RTSanitizerCommonCoverage
-                RTInterception
-                RTUbsan
-                RTUbsan_cxx
-    CFLAGS ${SCUDO_CFLAGS}
-    LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS}
-    LINK_LIBS ${SCUDO_DYNAMIC_LIBS}
-    PARENT_TARGET scudo)
+  if (NOT FUCHSIA)
+    add_compiler_rt_runtime(clang_rt.scudo
+      SHARED
+      ARCHS ${SCUDO_SUPPORTED_ARCH}
+      SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES}
+      OBJECT_LIBS RTSanitizerCommonNoTermination
+                  RTSanitizerCommonLibc
+                  RTSanitizerCommonCoverage
+                  RTInterception
+                  RTUbsan
+                  RTUbsan_cxx
+      CFLAGS ${SCUDO_CFLAGS}
+      LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS}
+      LINK_LIBS ${SCUDO_DYNAMIC_LIBS} ${SANITIZER_CXX_ABI_LIBRARY}
+      PARENT_TARGET scudo)
+  else()
+    add_compiler_rt_runtime(clang_rt.scudo
+      SHARED
+      ARCHS ${SCUDO_SUPPORTED_ARCH}
+      SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES}
+      OBJECT_LIBS RTSanitizerCommonNoTermination
+                  RTSanitizerCommonLibc
+                  RTInterception
+      CFLAGS ${SCUDO_CFLAGS}
+      LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS}
+      LINK_LIBS ${SCUDO_DYNAMIC_LIBS}
+      PARENT_TARGET scudo)
+  endif()
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44791.139466.patch
Type: text/x-patch
Size: 2664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180322/5ca3bef9/attachment.bin>


More information about the llvm-commits mailing list