[libc-commits] [libc] [libc] Fix warnings for freelist_heap_test/fuzz (PR #136634)

Daniel Thornburgh via libc-commits libc-commits at lists.llvm.org
Mon Apr 21 16:29:01 PDT 2025


https://github.com/mysterymath created https://github.com/llvm/llvm-project/pull/136634

Fixes #122367

>From e5150552986ead593d31aad0ea6ccc934bde1fbe Mon Sep 17 00:00:00 2001
From: Daniel Thornburgh <dthorn at google.com>
Date: Mon, 21 Apr 2025 16:27:06 -0700
Subject: [PATCH] [libc] Fix warnings for freelist_heap_test/fuzz

Fixes #122367
---
 libc/fuzzing/__support/CMakeLists.txt          |  1 -
 libc/fuzzing/__support/fake_heap.s             | 15 ---------------
 libc/fuzzing/__support/freelist_heap_fuzz.cpp  |  9 +++++++++
 libc/test/src/__support/CMakeLists.txt         |  1 -
 libc/test/src/__support/fake_heap.s            | 15 ---------------
 libc/test/src/__support/freelist_heap_test.cpp |  9 +++++++++
 6 files changed, 18 insertions(+), 32 deletions(-)
 delete mode 100644 libc/fuzzing/__support/fake_heap.s
 delete mode 100644 libc/test/src/__support/fake_heap.s

diff --git a/libc/fuzzing/__support/CMakeLists.txt b/libc/fuzzing/__support/CMakeLists.txt
index 7742ee43860d5..cfe51605ed2aa 100644
--- a/libc/fuzzing/__support/CMakeLists.txt
+++ b/libc/fuzzing/__support/CMakeLists.txt
@@ -30,7 +30,6 @@ if(LLVM_LIBC_FULL_BUILD AND NOT LIBC_TARGET_OS_IS_GPU)
   add_libc_fuzzer(
     freelist_heap_fuzz
     SRCS
-      fake_heap.s
       freelist_heap_fuzz.cpp
     DEPENDS
       libc.src.__support.freelist_heap
diff --git a/libc/fuzzing/__support/fake_heap.s b/libc/fuzzing/__support/fake_heap.s
deleted file mode 100644
index 69522f53c8b1f..0000000000000
--- a/libc/fuzzing/__support/fake_heap.s
+++ /dev/null
@@ -1,15 +0,0 @@
-//===-- Test fake definition for heap symbols -----------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-.globl _end, __llvm_libc_heap_limit
-
-.bss
-_end:
-.fill 1024
-__llvm_libc_heap_limit:
-
diff --git a/libc/fuzzing/__support/freelist_heap_fuzz.cpp b/libc/fuzzing/__support/freelist_heap_fuzz.cpp
index d152d0f35499f..7b7985a83c3e6 100644
--- a/libc/fuzzing/__support/freelist_heap_fuzz.cpp
+++ b/libc/fuzzing/__support/freelist_heap_fuzz.cpp
@@ -17,6 +17,15 @@
 #include "src/string/memory_utils/inline_memmove.h"
 #include "src/string/memory_utils/inline_memset.h"
 
+asm(R"(
+.globl _end, __llvm_libc_heap_limit
+
+.bss
+_end:
+  .fill 1024
+__llvm_libc_heap_limit:
+)";
+
 using LIBC_NAMESPACE::FreeListHeap;
 using LIBC_NAMESPACE::inline_memset;
 using LIBC_NAMESPACE::cpp::nullopt;
diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt
index b50bf245f202c..c1736c8fe59e2 100644
--- a/libc/test/src/__support/CMakeLists.txt
+++ b/libc/test/src/__support/CMakeLists.txt
@@ -63,7 +63,6 @@ if(LLVM_LIBC_FULL_BUILD AND NOT LIBC_TARGET_OS_IS_GPU)
     SUITE
       libc-support-tests
     SRCS
-      fake_heap.s
       freelist_heap_test.cpp
     DEPENDS
       libc.src.__support.CPP.span
diff --git a/libc/test/src/__support/fake_heap.s b/libc/test/src/__support/fake_heap.s
deleted file mode 100644
index 69522f53c8b1f..0000000000000
--- a/libc/test/src/__support/fake_heap.s
+++ /dev/null
@@ -1,15 +0,0 @@
-//===-- Test fake definition for heap symbols -----------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-.globl _end, __llvm_libc_heap_limit
-
-.bss
-_end:
-.fill 1024
-__llvm_libc_heap_limit:
-
diff --git a/libc/test/src/__support/freelist_heap_test.cpp b/libc/test/src/__support/freelist_heap_test.cpp
index 0623272dd5b9f..93e23619661a0 100644
--- a/libc/test/src/__support/freelist_heap_test.cpp
+++ b/libc/test/src/__support/freelist_heap_test.cpp
@@ -13,6 +13,15 @@
 #include "src/string/memcpy.h"
 #include "test/UnitTest/Test.h"
 
+asm(R"(
+.globl _end, __llvm_libc_heap_limit
+
+.bss
+_end:
+  .fill 1024
+__llvm_libc_heap_limit:
+)");
+
 using LIBC_NAMESPACE::Block;
 using LIBC_NAMESPACE::freelist_heap;
 using LIBC_NAMESPACE::FreeListHeap;



More information about the libc-commits mailing list