[libc-commits] [libc] 8f878c5 - [libc] Include time.h in baremetal targets (#85026)
via libc-commits
libc-commits at lists.llvm.org
Sat Mar 16 16:11:08 PDT 2024
Author: Petr Hosek
Date: 2024-03-16T16:11:04-07:00
New Revision: 8f878c501886e6dc8b0cf062320a803593972bed
URL: https://github.com/llvm/llvm-project/commit/8f878c501886e6dc8b0cf062320a803593972bed
DIFF: https://github.com/llvm/llvm-project/commit/8f878c501886e6dc8b0cf062320a803593972bed.diff
LOG: [libc] Include time.h in baremetal targets (#85026)
These types and conversion functions are used in embedded development.
Note that we cannot yet include other entrypoints such as asctime
because `src/time/time_utils.h` unconditionally uses `EOVERFLOW`, which
is only defined in POSIX and not in C standard. This issue is tracked by
#85556.
Added:
Modified:
libc/config/baremetal/api.td
libc/config/baremetal/arm/entrypoints.txt
libc/config/baremetal/arm/headers.txt
libc/config/baremetal/riscv/entrypoints.txt
libc/config/baremetal/riscv/headers.txt
Removed:
################################################################################
diff --git a/libc/config/baremetal/api.td b/libc/config/baremetal/api.td
index 28364726077942..ea2c1d23b01ab1 100644
--- a/libc/config/baremetal/api.td
+++ b/libc/config/baremetal/api.td
@@ -76,6 +76,15 @@ def StringAPI : PublicAPI<"string.h"> {
let Types = ["size_t"];
}
+def TimeAPI : PublicAPI<"time.h"> {
+ let Types = [
+ "clock_t",
+ "time_t",
+ "struct tm",
+ "struct timespec",
+ ];
+}
+
def UCharAPI : PublicAPI<"uchar.h"> {
let Types = ["mbstate_t"];
}
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 589ec5237e98da..fa5d12412ced28 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -180,6 +180,9 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdlib.strtoll
libc.src.stdlib.strtoul
libc.src.stdlib.strtoull
+
+ # time.h entrypoints
+ libc.src.time.
diff time
)
set(TARGET_LIBM_ENTRYPOINTS
diff --git a/libc/config/baremetal/arm/headers.txt b/libc/config/baremetal/arm/headers.txt
index 962981f8a2087d..3608364e45bdeb 100644
--- a/libc/config/baremetal/arm/headers.txt
+++ b/libc/config/baremetal/arm/headers.txt
@@ -13,5 +13,6 @@ set(TARGET_PUBLIC_HEADERS
libc.include.string
libc.include.strings
libc.include.sys_queue
+ libc.include.time
libc.include.uchar
)
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 09de1b416e0e94..58624e8b250987 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -180,6 +180,9 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdlib.strtoll
libc.src.stdlib.strtoul
libc.src.stdlib.strtoull
+
+ # time.h entrypoints
+ libc.src.time.
diff time
)
set(TARGET_LIBM_ENTRYPOINTS
diff --git a/libc/config/baremetal/riscv/headers.txt b/libc/config/baremetal/riscv/headers.txt
index 962981f8a2087d..3608364e45bdeb 100644
--- a/libc/config/baremetal/riscv/headers.txt
+++ b/libc/config/baremetal/riscv/headers.txt
@@ -13,5 +13,6 @@ set(TARGET_PUBLIC_HEADERS
libc.include.string
libc.include.strings
libc.include.sys_queue
+ libc.include.time
libc.include.uchar
)
More information about the libc-commits
mailing list