summaryrefslogtreecommitdiff
path: root/libc/config
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2023-04-25 21:34:59 -0500
committerJoseph Huber <jhuber6@vols.utk.edu>2023-04-26 16:52:32 -0500
commitdc9baac1a0148ce0c2b8afdc75e3e208597f79c9 (patch)
tree6f8a8e0f52cdd54bb3d809a9796ce5209f52ddb1 /libc/config
parente7735a57b9d063d85231ea1a2d775639bc632ad0 (diff)
downloadllvm-dc9baac1a0148ce0c2b8afdc75e3e208597f79c9.tar.gz
[libc] Partially implement `atexit` on the GPU
The `atexit` function controls registering functions to call at the end of the program. This is difficult to do in general on the GPU because of the lack of a real mutex implementation. We primarily provide this for testing where we can explicitly restrict how the `atexit` registration functions are called. So we simply create a passthrough Mutex to get past the usage of it as per @sivachandra's suggestion. Depends on D149225 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D149226
Diffstat (limited to 'libc/config')
-rw-r--r--libc/config/gpu/api.td7
-rw-r--r--libc/config/gpu/entrypoints.txt2
2 files changed, 9 insertions, 0 deletions
diff --git a/libc/config/gpu/api.td b/libc/config/gpu/api.td
index 9036bbc89238..3e6927de9463 100644
--- a/libc/config/gpu/api.td
+++ b/libc/config/gpu/api.td
@@ -5,3 +5,10 @@ include "spec/stdc.td"
def StringAPI : PublicAPI<"string.h"> {
let Types = ["size_t"];
}
+
+def StdlibAPI : PublicAPI<"stdlib.h"> {
+ let Types = [
+ "size_t",
+ "__atexithandler_t",
+ ];
+}
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index d42a554577e6..c5ed1e3dd476 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -56,9 +56,11 @@ set(TARGET_LIBC_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.atoi
+ libc.src.stdlib.atexit
# Only implemented in the test suite
libc.src.stdlib.malloc
+ libc.src.stdlib.aligned_alloc
libc.src.stdlib.realloc
libc.src.stdlib.free