[libc-commits] [libc] [libc][stdlib] Only use freelist_malloc for baremetal targets. (PR #96355)
via libc-commits
libc-commits at lists.llvm.org
Fri Jun 21 13:26:26 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: None (lntue)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/96355.diff
2 Files Affected:
- (modified) libc/src/stdlib/CMakeLists.txt (+15-9)
- (modified) libc/test/src/__support/CMakeLists.txt (+1-1)
``````````diff
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 51d53e0d02ea2..7d99fdf38141a 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -380,18 +380,24 @@ elseif(LIBC_TARGET_OS_IS_GPU)
aligned_alloc
)
else()
- # Only add malloc in full build mode. Use the system malloc in overlay mode.
- if(LLVM_LIBC_FULL_BUILD)
+ # Only use freelist malloc for baremetal targets.
+ add_entrypoint_object(
+ freelist_malloc
+ SRCS
+ freelist_malloc.cpp
+ HDRS
+ malloc.h
+ DEPENDS
+ libc.src.__support.freelist_heap
+ COMPILE_OPTIONS
+ -DLIBC_FREELIST_MALLOC_SIZE=${LIBC_CONF_FREELIST_MALLOC_BUFFER_SIZE}
+ )
+ if(LIBC_TARGET_OS_IS_BAREMETAL)
add_entrypoint_object(
malloc
- SRCS
- freelist_malloc.cpp
- HDRS
- malloc.h
+ ALIAS
DEPENDS
- libc.src.__support.freelist_heap
- COMPILE_OPTIONS
- -DLIBC_FREELIST_MALLOC_SIZE=${LIBC_CONF_FREELIST_MALLOC_BUFFER_SIZE}
+ .freelist_malloc
)
else()
add_entrypoint_external(
diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt
index 082a002959c95..e224e82c922f0 100644
--- a/libc/test/src/__support/CMakeLists.txt
+++ b/libc/test/src/__support/CMakeLists.txt
@@ -36,7 +36,7 @@ if(LLVM_LIBC_FULL_BUILD)
DEPENDS
libc.src.__support.CPP.span
libc.src.__support.freelist_heap
- libc.src.stdlib.malloc
+ libc.src.stdlib.freelist_malloc
libc.src.string.memcmp
libc.src.string.memcpy
)
``````````
</details>
https://github.com/llvm/llvm-project/pull/96355
More information about the libc-commits
mailing list