[libc-commits] [libc] [libc] Add separate `rand` implementation for baremetal (PR #96798)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Wed Jun 26 10:18:08 PDT 2024
================
@@ -285,38 +289,55 @@ add_entrypoint_object(
libc.include.stdlib
)
-add_object_library(
- rand_util
- SRCS
- rand_util.cpp
- HDRS
- rand_util.h
- DEPENDS
- libc.src.__support.common
-)
-add_entrypoint_object(
- rand
- SRCS
- rand.cpp
- HDRS
- rand.h
- DEPENDS
- .rand_util
- libc.include.stdlib
- libc.src.__support.threads.sleep
-)
+if(NOT LIBC_TARGET_OS_IS_BAREMETAL)
+ add_object_library(
+ rand_util
+ SRCS
+ rand_util.cpp
+ HDRS
+ rand_util.h
+ DEPENDS
+ libc.src.__support.common
+ )
-add_entrypoint_object(
- srand
- SRCS
- srand.cpp
- HDRS
- srand.h
- DEPENDS
- .rand_util
- libc.include.stdlib
-)
+ add_entrypoint_object(
+ rand
+ SRCS
+ rand.cpp
+ HDRS
+ rand.h
+ DEPENDS
+ .rand_util
+ libc.include.stdlib
+ libc.src.__support.threads.sleep
+ )
+
+ add_entrypoint_object(
+ srand
+ SRCS
+ srand.cpp
+ HDRS
+ srand.h
+ DEPENDS
+ .rand_util
+ libc.include.stdlib
+ )
+else()
+ add_entrypoint_object(
----------------
nickdesaulniers wrote:
Consider adding a comment here, too, that we have non-atomic implementation for baremetal.
https://github.com/llvm/llvm-project/pull/96798
More information about the libc-commits
mailing list