[compiler-rt] r328625 - [scudo] Fuchsia minimal shared runtime

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 07:40:40 PDT 2018


Author: cryptoad
Date: Tue Mar 27 07:40:39 2018
New Revision: 328625

URL: http://llvm.org/viewvc/llvm-project?rev=328625&view=rev
Log:
[scudo] Fuchsia minimal shared runtime

Summary:
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.

Reviewers: phosek, flowerhack, alekseyshl

Reviewed By: phosek, alekseyshl

Subscribers: mgorny, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D44791

Modified:
    compiler-rt/trunk/lib/scudo/CMakeLists.txt

Modified: compiler-rt/trunk/lib/scudo/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/CMakeLists.txt?rev=328625&r1=328624&r2=328625&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/scudo/CMakeLists.txt Tue Mar 27 07:40:39 2018
@@ -4,15 +4,34 @@ include_directories(..)
 
 set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 # SANITIZER_COMMON_CFLAGS include -fno-builtin, but we actually want builtins!
-list(APPEND SCUDO_CFLAGS -fbuiltin)
+list(APPEND SCUDO_CFLAGS -fbuiltin -ffunction-sections -fdata-sections)
 append_rtti_flag(OFF SCUDO_CFLAGS)
 
-set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
+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_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)
 list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)
 
+set(SCUDO_OBJECT_LIBS
+  RTSanitizerCommonNoTermination
+  RTSanitizerCommonLibc
+  RTInterception)
+
+if (FUCHSIA)
+  list(APPEND SCUDO_CFLAGS -nostdinc++)
+  list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -nostdlib++)
+  # TODO(kostyak): remove when stacktraces are split off of RTSanitizerCommon
+  list(APPEND SCUDO_DYNAMIC_LIBS unwind_shared)
+else()
+  list(APPEND SCUDO_OBJECT_LIBS RTSanitizerCommonCoverage RTUbsan)
+  list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY})
+endif()
+
 set(SCUDO_SOURCES
   scudo_allocator.cpp
   scudo_crc32.cpp
@@ -38,22 +57,11 @@ if (COMPILER_RT_HAS_MCRC_FLAG)
 endif()
 
 if(COMPILER_RT_HAS_SCUDO)
-  set(SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY}
-                         ${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)
-
   add_compiler_rt_runtime(clang_rt.scudo
     STATIC
     ARCHS ${SCUDO_SUPPORTED_ARCH}
     SOURCES ${SCUDO_SOURCES}
-    OBJECT_LIBS RTSanitizerCommonNoTermination
-                RTSanitizerCommonLibc
-                RTSanitizerCommonCoverage
-                RTInterception
-                RTUbsan
+    OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
     CFLAGS ${SCUDO_CFLAGS}
     PARENT_TARGET scudo)
 
@@ -69,12 +77,7 @@ if(COMPILER_RT_HAS_SCUDO)
     SHARED
     ARCHS ${SCUDO_SUPPORTED_ARCH}
     SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES}
-    OBJECT_LIBS RTSanitizerCommonNoTermination
-                RTSanitizerCommonLibc
-                RTSanitizerCommonCoverage
-                RTInterception
-                RTUbsan
-                RTUbsan_cxx
+    OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
     CFLAGS ${SCUDO_CFLAGS}
     LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS}
     LINK_LIBS ${SCUDO_DYNAMIC_LIBS}




More information about the llvm-commits mailing list