[libc-commits] [PATCH] D106502: [libc] add option to use SCUDO as the allocator

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jul 23 10:36:27 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGda06d1795ab0: [libc] add option to use SCUDO as the allocator (authored by michaelrj).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106502/new/

https://reviews.llvm.org/D106502

Files:
  libc/CMakeLists.txt
  libc/cmake/modules/LLVMLibCLibraryRules.cmake
  libc/lib/CMakeLists.txt


Index: libc/lib/CMakeLists.txt
===================================================================
--- libc/lib/CMakeLists.txt
+++ libc/lib/CMakeLists.txt
@@ -1,7 +1,15 @@
+set(SCUDO_DEP "")
+
+if(LLVM_LIBC_INCLUDE_SCUDO)
+  list(APPEND SCUDO_DEP RTScudoStandalone.${LIBC_TARGET_ARCHITECTURE})
+endif()
+
 add_entrypoint_library(
   llvmlibc
   DEPENDS
   ${TARGET_LLVMLIBC_ENTRYPOINTS}
+  EXT_DEPS
+  ${SCUDO_DEP}
 )
 
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
Index: libc/cmake/modules/LLVMLibCLibraryRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCLibraryRules.cmake
+++ libc/cmake/modules/LLVMLibCLibraryRules.cmake
@@ -42,6 +42,7 @@
 # Usage:
 #     add_entrypoint_library(
 #       DEPENDS <list of add_entrypoint_object targets>
+#       EXT_DEPS <list of external object targets, no type checking is done>
 #     )
 #
 # NOTE: If one wants an entrypoint to be availabe in a library, then they will
@@ -52,7 +53,7 @@
     "ENTRYPOINT_LIBRARY"
     "" # No optional arguments
     "" # No single value arguments
-    "DEPENDS" # Multi-value arguments
+    "DEPENDS;EXT_DEPS" # Multi-value arguments
     ${ARGN}
   )
   if(NOT ENTRYPOINT_LIBRARY_DEPENDS)
@@ -76,6 +77,11 @@
   foreach(dep IN LISTS all_deps)
     list(APPEND objects $<TARGET_OBJECTS:${dep}>)
   endforeach(dep)
+
+  foreach(dep IN LISTS ENTRYPOINT_LIBRARY_EXT_DEPS)
+    list(APPEND objects $<TARGET_OBJECTS:${dep}>)
+  endforeach(dep)
+
   add_library(
     ${target_name}
     STATIC
Index: libc/CMakeLists.txt
===================================================================
--- libc/CMakeLists.txt
+++ libc/CMakeLists.txt
@@ -71,6 +71,13 @@
     (pass -DLLVM_LIBC_ENABLE_LINTING=ON to cmake).")
 endif()
 
+option(LLVM_LIBC_INCLUDE_SCUDO "Include the SCUDO standalone as the allocator for LLVM libc" OFF)
+if(LLVM_LIBC_INCLUDE_SCUDO)
+  if (NOT "compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS)
+    message(FATAL_ERROR "SCUDO cannot be included without adding compiler-rt to LLVM_ENABLE_PROJECTS")
+  endif()
+endif()
+
 include(CMakeParseArguments)
 include(LLVMLibCRules)
 include(LLVMLibCCheckCpuFeatures)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106502.361276.patch
Type: text/x-patch
Size: 2145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210723/ee013003/attachment.bin>


More information about the libc-commits mailing list