[libc-commits] [libc] [libc] add snmalloc as an alternative allocator to libc (PR #122284)
Matthew Parkinson via libc-commits
libc-commits at lists.llvm.org
Sat Jan 18 08:31:59 PST 2025
================
@@ -0,0 +1,119 @@
+set(SNMALLOC_USE_SELF_VENDORED_STL ON CACHE BOOL "use freestanding snmalloc setup" FORCE)
+set(SNMALLOC_BUILD_TESTING OFF CACHE BOOL "disable snmalloc tests" FORCE)
+set(SNMALLOC_HEADER_ONLY_LIBRARY ON CACHE BOOL "use snmalloc as header only library" FORCE)
+
+# Disable installation
+macro (install)
+endmacro ()
+
+add_subdirectory(${LLVM_LIBC_INCLUDE_SNMALLOC} ${CMAKE_CURRENT_BINARY_DIR}/snmalloc EXCLUDE_FROM_ALL)
+
+target_compile_options(
+ snmalloc
+ INTERFACE
+ -ffreestanding
+ -nostdinc
+ -Wno-newline-eof
+ -Wno-extra-semi
+ -Wno-unused-command-line-argument
+ -Wno-ctad-maybe-unsupported
+ # TODO: define this
+ -DSTDERR_FILENO=2
+ -DSNMALLOC_USE_PTHREAD_DESTRUCTORS
----------------
mjp41 wrote:
This would remove the need for pthread and atexit for tidying up.
```suggestion
-DSNMALLOC_USE_THREAD_CLEANUP
```
https://github.com/llvm/llvm-project/pull/122284
More information about the libc-commits
mailing list