[PATCH] D96133: Allow building with scudo memory allocator on Windows

Russell Gallop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 06:30:15 PST 2021


russell.gallop created this revision.
russell.gallop added reviewers: aganea, cryptoad.
Herald added subscribers: pengfei, hiraditya, mgorny.
russell.gallop requested review of this revision.
Herald added a project: LLVM.

Following on from https://reviews.llvm.org/D96120, this allows scudo to be used as a memory allocator for Windows.

For example, adding:

-DLLVM_INTEGRATED_CRT_ALLOC="<folder>/llvm-project/stage1/lib/clang/13.0.0/lib/windows/clang_rt.scudo-x86_64.lib"

Note that -DLLVM_INTEGRATED_CRT_ALLOC only allows hooking in C library so this doesn't replace C++ new/delete etc.

check-all passes with scudo. Intermittently see failures in:

  ExecutionEngine/MCJIT/test-global-init-nonzero-sm-pic.ll
  ExecutionEngine/MCJIT/test-ptr-reloc-sm-pic.ll
  ExecutionEngine/MCJIT/multi-module-sm-pic-a.ll
  ExecutionEngine/MCJIT/cross-module-sm-pic-a.ll

Which appear to be due to https://bugs.llvm.org/show_bug.cgi?id=24978 (see analysis here: https://reviews.llvm.org/D86694#2539630). This bug happens more frequently with Scudo due to the difference in allocated addresses.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96133

Files:
  llvm/lib/Support/CMakeLists.txt


Index: llvm/lib/Support/CMakeLists.txt
===================================================================
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -62,7 +62,7 @@
   string(REGEX REPLACE "(/|\\\\)$" "" LLVM_INTEGRATED_CRT_ALLOC "${LLVM_INTEGRATED_CRT_ALLOC}")
 
   if(NOT EXISTS "${LLVM_INTEGRATED_CRT_ALLOC}")
-    message(FATAL_ERROR "Cannot find the path to `git clone` for the CRT allocator! (${LLVM_INTEGRATED_CRT_ALLOC}). Currently, rpmalloc, snmalloc and mimalloc are supported.")
+    message(FATAL_ERROR "Cannot find the path to `git clone` for the CRT allocator! (${LLVM_INTEGRATED_CRT_ALLOC}). Currently, rpmalloc, snmalloc, mimalloc and scudo are supported.")
   endif()
 
   if(LLVM_INTEGRATED_CRT_ALLOC MATCHES "rpmalloc$")
@@ -77,6 +77,8 @@
 	  message(FATAL_ERROR "Cannot find the mimalloc static library. To build it, first apply the patch from https://github.com/microsoft/mimalloc/issues/268 then build the Release x64 target through ${LLVM_INTEGRATED_CRT_ALLOC}\\ide\\vs2019\\mimalloc.sln")
     endif()
     set(system_libs ${system_libs} "${MIMALLOC_LIB}" "-INCLUDE:malloc")
+  elseif(LLVM_INTEGRATED_CRT_ALLOC MATCHES "scudo")
+    set(system_libs ${system_libs} "${LLVM_INTEGRATED_CRT_ALLOC}" "-INCLUDE:malloc")
   endif()
 endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96133.321732.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210205/52212b29/attachment.bin>


More information about the llvm-commits mailing list