diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index cee92f2cc56c4..67c292f08be73 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -278,6 +278,14 @@ libc_support_library( hdrs = ["hdr/stdio_overlay.h"], ) +libc_support_library( + name = "hdr_stdlib_macros", + hdrs = ["hdr/stdlib_macros.h"], + deps = [ + ":hdr_stdlib_overlay", + ], +) + libc_support_library( name = "hdr_stdlib_overlay", hdrs = ["hdr/stdlib_overlay.h"], @@ -5066,6 +5074,41 @@ libc_function( ], ) +libc_support_library( + name = "rand_util", + srcs = ["src/stdlib/rand_util.cpp"], + hdrs = ["src/stdlib/rand_util.h"], + deps = [ + ":__support_cpp_atomic", + ":__support_macros_attributes", + ":__support_macros_config", + ], +) + +libc_function( + name = "rand", + srcs = ["src/stdlib/rand.cpp"], + hdrs = ["src/stdlib/rand.h"], + deps = [ + ":__support_common", + ":__support_macros_config", + ":__support_threads_sleep", + ":hdr_stdlib_macros", + ":rand_util", + ], +) + +libc_function( + name = "srand", + srcs = ["src/stdlib/srand.cpp"], + hdrs = ["src/stdlib/srand.h"], + deps = [ + ":__support_common", + ":__support_macros_config", + ":rand_util", + ], +) + libc_support_library( name = "str_from_util", hdrs = ["src/stdlib/str_from_util.h"], diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel index ce92ca8caa6f4..fd4389e8c0579 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel @@ -159,6 +159,15 @@ libc_test( ], ) +libc_test( + name = "rand_test", + srcs = ["rand_test.cpp"], + deps = [ + "//libc:rand", + "//libc:srand", + ], +) + libc_test_library( name = "strfrom_test_helper", hdrs = ["StrfromTest.h"],