Skip to content

[libc] Fix warnings for freelist_heap_test/fuzz #136634

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
Apr 22, 2025

Conversation

mysterymath
Copy link
Contributor

Fixes #122367

@llvmbot
Copy link
Member

llvmbot commented Apr 21, 2025

@llvm/pr-subscribers-libc

Author: Daniel Thornburgh (mysterymath)

Changes

Fixes #122367


Full diff: https://github.com/llvm/llvm-project/pull/136634.diff

6 Files Affected:

  • (modified) libc/fuzzing/__support/CMakeLists.txt (-1)
  • (removed) libc/fuzzing/__support/fake_heap.s (-15)
  • (modified) libc/fuzzing/__support/freelist_heap_fuzz.cpp (+9)
  • (modified) libc/test/src/__support/CMakeLists.txt (-1)
  • (removed) libc/test/src/__support/fake_heap.s (-15)
  • (modified) libc/test/src/__support/freelist_heap_test.cpp (+9)
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;

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine, I assume it's target agnostic and test only.

@mysterymath mysterymath merged commit 710ffb6 into llvm:main Apr 22, 2025
18 checks passed
@mysterymath mysterymath deleted the libc/malloc/warnings branch April 22, 2025 18:11
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc] missing .note.GPU-stack section in fake_heap.s
4 participants