Skip to content

[libc][stdlib] Only use freelist_malloc for baremetal targets. #96355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions libc/src/stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
Loading