[libc] Enable the GPU build to build the UnitTest library
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 26 Apr 2023 00:03:43 +0000 (19:03 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 26 Apr 2023 21:52:30 +0000 (16:52 -0500)
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

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

index 5750fba..d42a554 100644 (file)
@@ -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
 )
index 333873a..ed6de64 100644 (file)
@@ -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