[libc-commits] [libc] [libc] Lazily initialize freelist malloc using symbols (PR #99254)

via libc-commits libc-commits at lists.llvm.org
Mon Jul 22 12:38:15 PDT 2024


================
@@ -30,14 +30,19 @@ using LIBC_NAMESPACE::freelist_heap;
 #define TEST_FOR_EACH_ALLOCATOR(TestCase, BufferSize)                          \
   class LlvmLibcFreeListHeapTest##TestCase : public testing::Test {            \
   public:                                                                      \
+    FreeListHeapBuffer<BufferSize> fake_global_buffer;                         \
+    void SetUp() override {                                                    \
+      freelist_heap =                                                          \
+          new (&fake_global_buffer) FreeListHeapBuffer<BufferSize>;            \
+    }                                                                          \
----------------
PiJoules wrote:

Since we have `heap_limit_fake.cpp`, is it be possible to define `_end` and `__llvm_libc_heap_limit` to be the start and end of some static global buffer so we can assert the linker-initialized `freelist_heap` is WAI?

https://github.com/llvm/llvm-project/pull/99254


More information about the libc-commits mailing list