[libc-commits] [libc] fab84dc - [libc] Enable the GPU build to build the UnitTest library

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Apr 26 14:52:45 PDT 2023


Author: Joseph Huber
Date: 2023-04-26T16:52:30-05:00
New Revision: fab84dcd0a5a38df8ce5d8996fd2d0c917f39ae3

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

LOG: [libc] Enable the GPU build to build the UnitTest library

The previous patch in D149216 allows us to use the internal `<stdlib.h>`
include for the GPU build. However, we currently don't provide the
memory functions so the header wasn't resolving them. This patch adds
these as entrypoints. They don't cause any entrypoints to be emitted
because they are not implemented, but they provide it in the header so
that we can rely on the test's implementation of them.

Depends on D149216

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149217

Added: 
    

Modified: 
    libc/config/gpu/entrypoints.txt
    libc/test/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 5750fba31d6b..d42a554577e6 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -57,6 +57,11 @@ set(TARGET_LIBC_ENTRYPOINTS
     # stdlib.h entrypoints
     libc.src.stdlib.atoi
 
+    # Only implemented in the test suite
+    libc.src.stdlib.malloc
+    libc.src.stdlib.realloc
+    libc.src.stdlib.free
+
     # errno.h entrypoints
     libc.src.errno.errno
 )

diff  --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt
index 333873a07b22..ed6de6478073 100644
--- a/libc/test/CMakeLists.txt
+++ b/libc/test/CMakeLists.txt
@@ -6,9 +6,7 @@ add_dependencies(check-libc libc-unit-tests libc-hermetic-tests)
 add_custom_target(exhaustive-check-libc)
 add_custom_target(libc-long-running-tests)
 
-if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
-  add_subdirectory(UnitTest)
-endif()
+add_subdirectory(UnitTest)
 
 add_header_library(
   errno_setter_matcher


        


More information about the libc-commits mailing list