[libc-commits] [libc] a50bcc0 - [libc][stdlib] Only add internal malloc in full build mode. Use the system malloc in overlay mode. (#95845)

via libc-commits libc-commits at lists.llvm.org
Mon Jun 17 13:56:22 PDT 2024


Author: lntue
Date: 2024-06-17T16:56:19-04:00
New Revision: a50bcc03cbaecf6473c6bf41f4497758a7876f3d

URL: https://github.com/llvm/llvm-project/commit/a50bcc03cbaecf6473c6bf41f4497758a7876f3d
DIFF: https://github.com/llvm/llvm-project/commit/a50bcc03cbaecf6473c6bf41f4497758a7876f3d.diff

LOG: [libc][stdlib] Only add internal malloc in full build mode.  Use the system malloc in overlay mode. (#95845)

This causes an issue in overlay mode:
https://github.com/llvm/llvm-project/pull/95736#issuecomment-2172739705

Added: 
    

Modified: 
    libc/src/stdlib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index e26c19f03f5ab..fdbf7b75e72f4 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -418,15 +418,23 @@ else()
       libc.src.string.memory_utils.inline_memcpy
       libc.src.string.memory_utils.inline_memset
   )
-  add_entrypoint_object(
-    malloc
-    SRCS
-      freelist_malloc.cpp
-    HDRS
-      malloc.h
-    DEPENDS
-      .freelist_heap
-  )
+  # Only add malloc in full build mode.  Use the system malloc in overlay mode.
+  if(LLVM_LIBC_FULL_BUILD)
+    add_entrypoint_object(
+      malloc
+      SRCS
+        freelist_malloc.cpp
+      HDRS
+        malloc.h
+      DEPENDS
+        .freelist_heap
+    )
+  else()
+    add_entrypoint_external(
+      malloc
+    )
+  endif()
+
   add_entrypoint_external(
     free
   )


        


More information about the libc-commits mailing list