Skip to content

Commit 958de20

Browse files
authored
[libc] Enable 'timespec_get' for the GPU build (#120304)
Summary: Currently fails to build libc++ because this is missing.
1 parent 1d06157 commit 958de20

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

libc/config/gpu/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ set(TARGET_LIBC_ENTRYPOINTS
257257
# time.h entrypoints
258258
libc.src.time.clock
259259
libc.src.time.clock_gettime
260+
libc.src.time.timespec_get
260261
libc.src.time.nanosleep
261262

262263
# wchar.h entrypoints

libc/src/__support/time/gpu/time_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ extern gpu::Constant<uint64_t> __llvm_libc_clock_freq;
3838
#error "Unsupported target"
3939
#endif
4040

41+
constexpr uint64_t TICKS_PER_SEC = 1000000000UL;
42+
4143
} // namespace LIBC_NAMESPACE_DECL
4244

4345
#endif // LLVM_LIBC_SRC_TIME_GPU_TIME_UTILS_H

libc/src/time/gpu/nanosleep.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace LIBC_NAMESPACE_DECL {
1515

16-
constexpr uint64_t TICKS_PER_SEC = 1000000000UL;
17-
1816
LLVM_LIBC_FUNCTION(int, nanosleep,
1917
(const struct timespec *req, struct timespec *rem)) {
2018
if (!GPU_CLOCKS_PER_SEC || !req)

libc/src/time/gpu/timespec_get.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "hdr/time_macros.h"
1111
#include "src/__support/common.h"
1212
#include "src/__support/macros/config.h"
13+
#include "src/__support/time/gpu/time_utils.h"
1314

1415
namespace LIBC_NAMESPACE_DECL {
1516

0 commit comments

Comments
 (0)