[llvm-branch-commits] [llvm] [bazel] Add subpackages for libc/src/... (PR #242489)
Jackson Stogel via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Nov 13 14:52:02 PST 2026
https://github.com/jtstogel updated https://github.com/llvm/llvm-project/pull/242489
>From 0a6229c164a3b5c66d7670ba283a321755cd9a7f Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:18 -0800
Subject: [PATCH 01/32] [bazel] Add subpackage for libc/src/arpa/inet
---
.../llvm-project-overlay/libc/BUILD.bazel | 115 +++-----------
.../libc/src/arpa/inet/BUILD.bazel | 140 ++++++++++++++++++
.../libc/test/src/arpa/inet/BUILD.bazel | 30 ++--
.../libc/test/src/sys/socket/BUILD.bazel | 2 +-
4 files changed, 174 insertions(+), 113 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/arpa/inet/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index d0dd2756c046d..2337738e19b14 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1870,128 +1870,49 @@ libc_function(
############################### arpa/inet targets ##############################
-libc_function(
+alias(
name = "htonl",
- srcs = ["src/arpa/inet/htonl.cpp"],
- hdrs = ["src/arpa/inet/htonl.h"],
- deps = [
- ":hdr_stdint_proxy",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/arpa/inet:htonl",
)
-libc_function(
+alias(
name = "htons",
- srcs = ["src/arpa/inet/htons.cpp"],
- hdrs = ["src/arpa/inet/htons.h"],
- deps = [
- ":hdr_stdint_proxy",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/arpa/inet:htons",
)
-libc_function(
+alias(
name = "inet_addr",
- srcs = ["src/arpa/inet/inet_addr.cpp"],
- hdrs = ["src/arpa/inet/inet_addr.h"],
- deps = [
- ":hdr_netinet_in_macros",
- ":types_in_addr_t",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:optional",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/__support/net:address",
- ],
+ actual = "//libc/src/arpa/inet:inet_addr",
)
-libc_function(
+alias(
name = "inet_aton",
- srcs = ["src/arpa/inet/inet_aton.cpp"],
- hdrs = ["src/arpa/inet/inet_aton.h"],
- deps = [
- ":types_struct_in_addr",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:optional",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/__support/net:address",
- ],
+ actual = "//libc/src/arpa/inet:inet_aton",
)
-libc_function(
+alias(
name = "inet_ntoa",
- srcs = ["src/arpa/inet/inet_ntoa.cpp"],
- hdrs = ["src/arpa/inet/inet_ntoa.h"],
- deps = [
- ":hdr_inet_address_macros",
- ":types_struct_in_addr",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:span",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/net:address",
- ],
+ actual = "//libc/src/arpa/inet:inet_ntoa",
)
-libc_function(
+alias(
name = "inet_ntop",
- srcs = ["src/arpa/inet/inet_ntop.cpp"],
- hdrs = ["src/arpa/inet/inet_ntop.h"],
- deps = [
- ":hdr_errno_macros",
- ":hdr_sys_socket_macros",
- ":types_socklen_t",
- ":types_struct_in6_addr",
- ":types_struct_in_addr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:span",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/__support/net:address",
- ],
+ actual = "//libc/src/arpa/inet:inet_ntop",
)
-libc_function(
+alias(
name = "inet_pton",
- srcs = ["src/arpa/inet/inet_pton.cpp"],
- hdrs = ["src/arpa/inet/inet_pton.h"],
- deps = [
- ":hdr_errno_macros",
- ":hdr_stdint_proxy",
- ":hdr_sys_socket_macros",
- ":types_struct_in6_addr",
- ":types_struct_in_addr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/__support/net:address",
- ],
+ actual = "//libc/src/arpa/inet:inet_pton",
)
-libc_function(
+alias(
name = "ntohl",
- srcs = ["src/arpa/inet/ntohl.cpp"],
- hdrs = ["src/arpa/inet/ntohl.h"],
- deps = [
- ":hdr_stdint_proxy",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/arpa/inet:ntohl",
)
-libc_function(
+alias(
name = "ntohs",
- srcs = ["src/arpa/inet/ntohs.cpp"],
- hdrs = ["src/arpa/inet/ntohs.h"],
- deps = [
- ":hdr_stdint_proxy",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/arpa/inet:ntohs",
)
################################# ctype targets ################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/arpa/inet/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/arpa/inet/BUILD.bazel
new file mode 100644
index 0000000000000..2aa9063859d45
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/arpa/inet/BUILD.bazel
@@ -0,0 +1,140 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "htonl",
+ srcs = ["htonl.cpp"],
+ hdrs = ["htonl.h"],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "htons",
+ srcs = ["htons.cpp"],
+ hdrs = ["htons.h"],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "inet_addr",
+ srcs = ["inet_addr.cpp"],
+ hdrs = ["inet_addr.h"],
+ deps = [
+ "//libc:hdr_netinet_in_macros",
+ "//libc:types_in_addr_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:optional",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/__support/net:address",
+ ],
+)
+
+libc_function(
+ name = "inet_aton",
+ srcs = ["inet_aton.cpp"],
+ hdrs = ["inet_aton.h"],
+ deps = [
+ "//libc:types_struct_in_addr",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:optional",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/__support/net:address",
+ ],
+)
+
+libc_function(
+ name = "inet_ntoa",
+ srcs = ["inet_ntoa.cpp"],
+ hdrs = ["inet_ntoa.h"],
+ deps = [
+ "//libc:hdr_inet_address_macros",
+ "//libc:types_struct_in_addr",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:span",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/net:address",
+ ],
+)
+
+libc_function(
+ name = "inet_ntop",
+ srcs = ["inet_ntop.cpp"],
+ hdrs = ["inet_ntop.h"],
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:hdr_sys_socket_macros",
+ "//libc:types_socklen_t",
+ "//libc:types_struct_in6_addr",
+ "//libc:types_struct_in_addr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:span",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/__support/net:address",
+ ],
+)
+
+libc_function(
+ name = "inet_pton",
+ srcs = ["inet_pton.cpp"],
+ hdrs = ["inet_pton.h"],
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:hdr_stdint_proxy",
+ "//libc:hdr_sys_socket_macros",
+ "//libc:types_struct_in6_addr",
+ "//libc:types_struct_in_addr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/__support/net:address",
+ ],
+)
+
+libc_function(
+ name = "ntohl",
+ srcs = ["ntohl.cpp"],
+ hdrs = ["ntohl.h"],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "ntohs",
+ srcs = ["ntohs.cpp"],
+ hdrs = ["ntohs.h"],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel
index 3fdcc4ac4615e..f2260223b56f6 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel
@@ -14,9 +14,9 @@ libc_test(
name = "htonl_test",
srcs = ["htonl_test.cpp"],
deps = [
- "//libc:htonl",
- "//libc:ntohl",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:htonl",
+ "//libc/src/arpa/inet:ntohl",
],
)
@@ -24,9 +24,9 @@ libc_test(
name = "htons_test",
srcs = ["htons_test.cpp"],
deps = [
- "//libc:htons",
- "//libc:ntohs",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:htons",
+ "//libc/src/arpa/inet:ntohs",
],
)
@@ -34,9 +34,9 @@ libc_test(
name = "inet_addr_test",
srcs = ["inet_addr_test.cpp"],
deps = [
- "//libc:htonl",
- "//libc:inet_addr",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:htonl",
+ "//libc/src/arpa/inet:inet_addr",
],
)
@@ -44,9 +44,9 @@ libc_test(
name = "inet_aton_test",
srcs = ["inet_aton_test.cpp"],
deps = [
- "//libc:htonl",
- "//libc:inet_aton",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:htonl",
+ "//libc/src/arpa/inet:inet_aton",
],
)
@@ -54,9 +54,9 @@ libc_test(
name = "inet_ntoa_test",
srcs = ["inet_ntoa_test.cpp"],
deps = [
- "//libc:inet_ntoa",
"//libc:types_struct_in_addr",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:inet_ntoa",
],
)
@@ -66,10 +66,10 @@ libc_test(
deps = [
"//libc:hdr_errno_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:inet_ntop",
"//libc:types_struct_in6_addr",
"//libc:types_struct_in_addr",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:inet_ntop",
],
)
@@ -79,11 +79,11 @@ libc_test(
deps = [
"//libc:hdr_errno_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:inet_pton",
"//libc:string_memory_utils",
"//libc:types_struct_in6_addr",
"//libc:types_struct_in_addr",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:inet_pton",
],
)
@@ -91,9 +91,9 @@ libc_test(
name = "ntohl_test",
srcs = ["ntohl_test.cpp"],
deps = [
- "//libc:htonl",
- "//libc:ntohl",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:htonl",
+ "//libc/src/arpa/inet:ntohl",
],
)
@@ -101,8 +101,8 @@ libc_test(
name = "ntohs_test",
srcs = ["ntohs_test.cpp"],
deps = [
- "//libc:htons",
- "//libc:ntohs",
"//libc/src/__support:common",
+ "//libc/src/arpa/inet:htons",
+ "//libc/src/arpa/inet:ntohs",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
index 6ac30c2feeab4..c0f68f82a390b 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
@@ -41,7 +41,6 @@ libc_test(
"//libc:getsockname",
"//libc:hdr_netinet_in_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:htonl",
"//libc:remove",
"//libc:socket",
"//libc:types_sa_family_t",
@@ -49,6 +48,7 @@ libc_test(
"//libc:types_struct_sockaddr_in6",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
+ "//libc/src/arpa/inet:htonl",
],
)
>From 6f5d71a544344288cb999de66e86326e71bf05e8 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:19 -0800
Subject: [PATCH 02/32] [bazel] Add subpackage for libc/src/compiler
---
.../llvm-project-overlay/libc/BUILD.bazel | 11 --------
.../libc/src/compiler/BUILD.bazel | 27 +++++++++++++++++++
.../libc/test/libc_test_rules.bzl | 2 +-
3 files changed, 28 insertions(+), 12 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 2337738e19b14..915e570d92a34 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3434,17 +3434,6 @@ libc_function(
],
)
-libc_support_library(
- name = "__stack_chk_fail",
- srcs = ["src/compiler/generic/__stack_chk_fail.cpp"],
- hdrs = ["src/compiler/__stack_chk_fail.h"],
- deps = [
- ":hdr_stdint_proxy",
- ":stdlib_abort_utils",
- "//libc/src/__support/OSUtil:io",
- ],
-)
-
libc_support_library(
name = "qsort_util",
hdrs = [
diff --git a/utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel
new file mode 100644
index 0000000000000..682dab88637ef
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel
@@ -0,0 +1,27 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "__stack_chk_fail",
+ srcs = ["generic/__stack_chk_fail.cpp"],
+ hdrs = ["__stack_chk_fail.h"],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc:stdlib_abort_utils",
+ "//libc/src/__support/OSUtil:io",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
index 9c558777cb1f7..722ebbf381960 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
@@ -66,7 +66,7 @@ def libc_test(
# The compiler may emit references to symbols it expects to exist,
# like `memset`. These dependencies hermetically provide them.
"//libc/test/UnitTest:HermeticTestUtils",
- "//libc:__stack_chk_fail", # Needed if -fstack-protector is set.
+ "//libc/src/compiler:__stack_chk_fail", # Needed if -fstack-protector is set.
],
"//conditions:default": [],
})
>From 55dcd9e7b425db3c366825735166ad005789975f Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:20 -0800
Subject: [PATCH 03/32] [bazel] Add subpackage for libc/src/complex
---
.../llvm-project-overlay/libc/BUILD.bazel | 223 +++------------
.../libc/src/complex/BUILD.bazel | 259 ++++++++++++++++++
2 files changed, 299 insertions(+), 183 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/complex/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 915e570d92a34..e87a9213f9d0e 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2315,247 +2315,104 @@ libc_support_library(
############################### complex targets ################################
-libc_function(
+alias(
name = "cimag",
- srcs = ["src/complex/generic/cimag.cpp"],
- hdrs = ["src/complex/cimag.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:cimag",
)
-libc_function(
+alias(
name = "cimagf",
- srcs = ["src/complex/generic/cimagf.cpp"],
- hdrs = ["src/complex/cimagf.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:cimagf",
)
-libc_function(
+alias(
name = "cimagf128",
- srcs = ["src/complex/generic/cimagf128.cpp"],
- hdrs = ["src/complex/cimagf128.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- "//libc/src/__support/macros/properties:types",
- ],
+ actual = "//libc/src/complex:cimagf128",
)
-libc_function(
+alias(
name = "cimagf16",
- srcs = ["src/complex/generic/cimagf16.cpp"],
- hdrs = ["src/complex/cimagf16.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- "//libc/src/__support/macros/properties:types",
- ],
+ actual = "//libc/src/complex:cimagf16",
)
-libc_function(
+alias(
name = "cimagl",
- srcs = ["src/complex/generic/cimagl.cpp"],
- hdrs = ["src/complex/cimagl.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:cimagl",
)
-libc_function(
+alias(
name = "conj",
- srcs = ["src/complex/generic/conj.cpp"],
- hdrs = ["src/complex/conj.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:conj",
)
-libc_function(
+alias(
name = "conjf",
- srcs = ["src/complex/generic/conjf.cpp"],
- hdrs = ["src/complex/conjf.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:conjf",
)
-libc_function(
+alias(
name = "conjf128",
- srcs = ["src/complex/generic/conjf128.cpp"],
- hdrs = ["src/complex/conjf128.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- ],
+ actual = "//libc/src/complex:conjf128",
)
-libc_function(
+alias(
name = "conjf16",
- srcs = ["src/complex/generic/conjf16.cpp"],
- hdrs = ["src/complex/conjf16.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- ],
+ actual = "//libc/src/complex:conjf16",
)
-libc_function(
+alias(
name = "conjl",
- srcs = ["src/complex/generic/conjl.cpp"],
- hdrs = ["src/complex/conjl.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:conjl",
)
-libc_function(
+alias(
name = "cproj",
- srcs = ["src/complex/generic/cproj.cpp"],
- hdrs = ["src/complex/cproj.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:cproj",
)
-libc_function(
+alias(
name = "cprojf",
- srcs = ["src/complex/generic/cprojf.cpp"],
- hdrs = ["src/complex/cprojf.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:cprojf",
)
-libc_function(
+alias(
name = "cprojf128",
- srcs = ["src/complex/generic/cprojf128.cpp"],
- hdrs = ["src/complex/cprojf128.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- ],
+ actual = "//libc/src/complex:cprojf128",
)
-libc_function(
+alias(
name = "cprojf16",
- srcs = ["src/complex/generic/cprojf16.cpp"],
- hdrs = ["src/complex/cprojf16.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- ],
+ actual = "//libc/src/complex:cprojf16",
)
-libc_function(
+alias(
name = "cprojl",
- srcs = ["src/complex/generic/cprojl.cpp"],
- hdrs = ["src/complex/cprojl.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_basic_ops",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:cprojl",
)
-libc_function(
+alias(
name = "creal",
- srcs = ["src/complex/generic/creal.cpp"],
- hdrs = ["src/complex/creal.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:creal",
)
-libc_function(
+alias(
name = "crealf",
- srcs = ["src/complex/generic/crealf.cpp"],
- hdrs = ["src/complex/crealf.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:crealf",
)
-libc_function(
+alias(
name = "crealf128",
- srcs = ["src/complex/generic/crealf128.cpp"],
- hdrs = ["src/complex/crealf128.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- "//libc/src/__support/macros/properties:types",
- ],
+ actual = "//libc/src/complex:crealf128",
)
-libc_function(
+alias(
name = "crealf16",
- srcs = ["src/complex/generic/crealf16.cpp"],
- hdrs = ["src/complex/crealf16.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:complex_types",
- "//libc/src/__support/macros/properties:types",
- ],
+ actual = "//libc/src/complex:crealf16",
)
-libc_function(
+alias(
name = "creall",
- srcs = ["src/complex/generic/creall.cpp"],
- hdrs = ["src/complex/creall.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:complex_type",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/complex:creall",
)
################################ link targets ##################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/complex/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/complex/BUILD.bazel
new file mode 100644
index 0000000000000..f0301ac7cd99a
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/complex/BUILD.bazel
@@ -0,0 +1,259 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "cimag",
+ srcs = ["generic/cimag.cpp"],
+ hdrs = ["cimag.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "cimagf",
+ srcs = ["generic/cimagf.cpp"],
+ hdrs = ["cimagf.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "cimagf128",
+ srcs = ["generic/cimagf128.cpp"],
+ hdrs = ["cimagf128.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ "//libc/src/__support/macros/properties:types",
+ ],
+)
+
+libc_function(
+ name = "cimagf16",
+ srcs = ["generic/cimagf16.cpp"],
+ hdrs = ["cimagf16.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ "//libc/src/__support/macros/properties:types",
+ ],
+)
+
+libc_function(
+ name = "cimagl",
+ srcs = ["generic/cimagl.cpp"],
+ hdrs = ["cimagl.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "conj",
+ srcs = ["generic/conj.cpp"],
+ hdrs = ["conj.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "conjf",
+ srcs = ["generic/conjf.cpp"],
+ hdrs = ["conjf.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "conjf128",
+ srcs = ["generic/conjf128.cpp"],
+ hdrs = ["conjf128.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ ],
+)
+
+libc_function(
+ name = "conjf16",
+ srcs = ["generic/conjf16.cpp"],
+ hdrs = ["conjf16.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ ],
+)
+
+libc_function(
+ name = "conjl",
+ srcs = ["generic/conjl.cpp"],
+ hdrs = ["conjl.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "cproj",
+ srcs = ["generic/cproj.cpp"],
+ hdrs = ["cproj.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "cprojf",
+ srcs = ["generic/cprojf.cpp"],
+ hdrs = ["cprojf.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "cprojf128",
+ srcs = ["generic/cprojf128.cpp"],
+ hdrs = ["cprojf128.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ ],
+)
+
+libc_function(
+ name = "cprojf16",
+ srcs = ["generic/cprojf16.cpp"],
+ hdrs = ["cprojf16.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ ],
+)
+
+libc_function(
+ name = "cprojl",
+ srcs = ["generic/cprojl.cpp"],
+ hdrs = ["cprojl.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_basic_ops",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "creal",
+ srcs = ["generic/creal.cpp"],
+ hdrs = ["creal.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "crealf",
+ srcs = ["generic/crealf.cpp"],
+ hdrs = ["crealf.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "crealf128",
+ srcs = ["generic/crealf128.cpp"],
+ hdrs = ["crealf128.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ "//libc/src/__support/macros/properties:types",
+ ],
+)
+
+libc_function(
+ name = "crealf16",
+ srcs = ["generic/crealf16.cpp"],
+ hdrs = ["crealf16.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:complex_types",
+ "//libc/src/__support/macros/properties:types",
+ ],
+)
+
+libc_function(
+ name = "creall",
+ srcs = ["generic/creall.cpp"],
+ hdrs = ["creall.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:complex_type",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/macros:config",
+ ],
+)
>From b2c453cdff316d4bfbc205b741c009f57fd8566f Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:22 -0800
Subject: [PATCH 04/32] [bazel] Add subpackage for libc/src/ctype
---
.../llvm-project-overlay/libc/BUILD.bazel | 171 +++------------
.../libc/src/ctype/BUILD.bazel | 203 ++++++++++++++++++
.../libc/test/src/ctype/BUILD.bazel | 32 +--
3 files changed, 251 insertions(+), 155 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/ctype/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index e87a9213f9d0e..306495b07105f 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1917,191 +1917,84 @@ alias(
################################# ctype targets ################################
-libc_function(
+alias(
name = "isalnum",
- srcs = ["src/ctype/isalnum.cpp"],
- hdrs = ["src/ctype/isalnum.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isalnum",
)
-libc_function(
+alias(
name = "isalpha",
- srcs = ["src/ctype/isalpha.cpp"],
- hdrs = ["src/ctype/isalpha.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isalpha",
)
-libc_function(
+alias(
name = "isascii",
- srcs = ["src/ctype/isascii.cpp"],
- hdrs = ["src/ctype/isascii.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isascii",
)
-libc_function(
+alias(
name = "isblank",
- srcs = ["src/ctype/isblank.cpp"],
- hdrs = ["src/ctype/isblank.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isblank",
)
-libc_function(
+alias(
name = "iscntrl",
- srcs = ["src/ctype/iscntrl.cpp"],
- hdrs = ["src/ctype/iscntrl.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:iscntrl",
)
-libc_function(
+alias(
name = "isdigit",
- srcs = ["src/ctype/isdigit.cpp"],
- hdrs = ["src/ctype/isdigit.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isdigit",
)
-libc_function(
+alias(
name = "isgraph",
- srcs = ["src/ctype/isgraph.cpp"],
- hdrs = ["src/ctype/isgraph.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isgraph",
)
-libc_function(
+alias(
name = "islower",
- srcs = ["src/ctype/islower.cpp"],
- hdrs = ["src/ctype/islower.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:islower",
)
-libc_function(
+alias(
name = "isprint",
- srcs = ["src/ctype/isprint.cpp"],
- hdrs = ["src/ctype/isprint.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isprint",
)
-libc_function(
+alias(
name = "ispunct",
- srcs = ["src/ctype/ispunct.cpp"],
- hdrs = ["src/ctype/ispunct.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:ispunct",
)
-libc_function(
+alias(
name = "isspace",
- srcs = ["src/ctype/isspace.cpp"],
- hdrs = ["src/ctype/isspace.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isspace",
)
-libc_function(
+alias(
name = "isupper",
- srcs = ["src/ctype/isupper.cpp"],
- hdrs = ["src/ctype/isupper.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isupper",
)
-libc_function(
+alias(
name = "isxdigit",
- srcs = ["src/ctype/isxdigit.cpp"],
- hdrs = ["src/ctype/isxdigit.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:isxdigit",
)
-libc_function(
+alias(
name = "toascii",
- srcs = ["src/ctype/toascii.cpp"],
- hdrs = ["src/ctype/toascii.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:toascii",
)
-libc_function(
+alias(
name = "tolower",
- srcs = ["src/ctype/tolower.cpp"],
- hdrs = ["src/ctype/tolower.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:tolower",
)
-libc_function(
+alias(
name = "toupper",
- srcs = ["src/ctype/toupper.cpp"],
- hdrs = ["src/ctype/toupper.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/ctype:toupper",
)
################################ fenv targets ################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/ctype/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/ctype/BUILD.bazel
new file mode 100644
index 0000000000000..f25257d6ffee3
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/ctype/BUILD.bazel
@@ -0,0 +1,203 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "isalnum",
+ srcs = ["isalnum.cpp"],
+ hdrs = ["isalnum.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isalpha",
+ srcs = ["isalpha.cpp"],
+ hdrs = ["isalpha.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isascii",
+ srcs = ["isascii.cpp"],
+ hdrs = ["isascii.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isblank",
+ srcs = ["isblank.cpp"],
+ hdrs = ["isblank.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "iscntrl",
+ srcs = ["iscntrl.cpp"],
+ hdrs = ["iscntrl.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isdigit",
+ srcs = ["isdigit.cpp"],
+ hdrs = ["isdigit.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isgraph",
+ srcs = ["isgraph.cpp"],
+ hdrs = ["isgraph.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "islower",
+ srcs = ["islower.cpp"],
+ hdrs = ["islower.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isprint",
+ srcs = ["isprint.cpp"],
+ hdrs = ["isprint.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "ispunct",
+ srcs = ["ispunct.cpp"],
+ hdrs = ["ispunct.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isspace",
+ srcs = ["isspace.cpp"],
+ hdrs = ["isspace.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isupper",
+ srcs = ["isupper.cpp"],
+ hdrs = ["isupper.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isxdigit",
+ srcs = ["isxdigit.cpp"],
+ hdrs = ["isxdigit.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "toascii",
+ srcs = ["toascii.cpp"],
+ hdrs = ["toascii.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "tolower",
+ srcs = ["tolower.cpp"],
+ hdrs = ["tolower.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "toupper",
+ srcs = ["toupper.cpp"],
+ hdrs = ["toupper.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/ctype/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/ctype/BUILD.bazel
index d6abe21f41eef..6cdc9ca7a7294 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/ctype/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/ctype/BUILD.bazel
@@ -14,8 +14,8 @@ libc_test(
name = "isalnum_test",
srcs = ["isalnum_test.cpp"],
deps = [
- "//libc:isalnum",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:isalnum",
],
)
@@ -23,8 +23,8 @@ libc_test(
name = "islpha_test",
srcs = ["isalpha_test.cpp"],
deps = [
- "//libc:isalpha",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:isalpha",
],
)
@@ -32,7 +32,7 @@ libc_test(
name = "isascii_test",
srcs = ["isascii_test.cpp"],
deps = [
- "//libc:isascii",
+ "//libc/src/ctype:isascii",
],
)
@@ -40,7 +40,7 @@ libc_test(
name = "isblank_test",
srcs = ["isblank_test.cpp"],
deps = [
- "//libc:isblank",
+ "//libc/src/ctype:isblank",
],
)
@@ -48,7 +48,7 @@ libc_test(
name = "iscntrl_test",
srcs = ["iscntrl_test.cpp"],
deps = [
- "//libc:iscntrl",
+ "//libc/src/ctype:iscntrl",
],
)
@@ -56,8 +56,8 @@ libc_test(
name = "isdigit_test",
srcs = ["isdigit_test.cpp"],
deps = [
- "//libc:isdigit",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:isdigit",
],
)
@@ -65,7 +65,7 @@ libc_test(
name = "isgraph_test",
srcs = ["isgraph_test.cpp"],
deps = [
- "//libc:isgraph",
+ "//libc/src/ctype:isgraph",
],
)
@@ -73,8 +73,8 @@ libc_test(
name = "islower_test",
srcs = ["islower_test.cpp"],
deps = [
- "//libc:islower",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:islower",
],
)
@@ -82,7 +82,7 @@ libc_test(
name = "isprint_test",
srcs = ["isprint_test.cpp"],
deps = [
- "//libc:isprint",
+ "//libc/src/ctype:isprint",
],
)
@@ -90,7 +90,7 @@ libc_test(
name = "ispunct_test",
srcs = ["ispunct_test.cpp"],
deps = [
- "//libc:ispunct",
+ "//libc/src/ctype:ispunct",
],
)
@@ -98,7 +98,7 @@ libc_test(
name = "isspace_test",
srcs = ["isspace_test.cpp"],
deps = [
- "//libc:isspace",
+ "//libc/src/ctype:isspace",
],
)
@@ -106,8 +106,8 @@ libc_test(
name = "isupper_test",
srcs = ["isupper_test.cpp"],
deps = [
- "//libc:isupper",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:isupper",
],
)
@@ -115,8 +115,8 @@ libc_test(
name = "isxdigit_test",
srcs = ["isxdigit_test.cpp"],
deps = [
- "//libc:isxdigit",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:isxdigit",
],
)
@@ -124,7 +124,7 @@ libc_test(
name = "toascii_test",
srcs = ["toascii_test.cpp"],
deps = [
- "//libc:toascii",
+ "//libc/src/ctype:toascii",
],
)
@@ -132,8 +132,8 @@ libc_test(
name = "tolower_test",
srcs = ["tolower_test.cpp"],
deps = [
- "//libc:tolower",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:tolower",
],
)
@@ -141,7 +141,7 @@ libc_test(
name = "toupper_test",
srcs = ["toupper_test.cpp"],
deps = [
- "//libc:toupper",
"//libc/src/__support/CPP:span",
+ "//libc/src/ctype:toupper",
],
)
>From b9e2d23515d6c54a11add71db9e2f6dba600bb5c Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:23 -0800
Subject: [PATCH 05/32] [bazel] Add subpackage for libc/src/errno
---
.../llvm-project-overlay/libc/BUILD.bazel | 293 ++++++++----------
.../libc/src/errno/BUILD.bazel | 47 +++
.../libc/src/inttypes/BUILD.bazel | 4 +-
.../libc/startup/linux/BUILD.bazel | 4 +-
.../libc/test/UnitTest/BUILD.bazel | 2 +-
.../libc/test/libc_test_rules.bzl | 2 +-
6 files changed, 189 insertions(+), 163 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/errno/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 306495b07105f..5db87ddb53de8 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1837,35 +1837,14 @@ cc_library(
############################### errno ########################################
-libc_support_library(
- name = "errno",
- srcs = ["src/errno/libc_errno.cpp"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_function(
+alias(
name = "program_invocation_name",
- srcs = ["src/errno/program_invocation_name.cpp"],
- hdrs = ["src/errno/program_invocation_name.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/errno:program_invocation_name",
)
-libc_function(
+alias(
name = "program_invocation_short_name",
- srcs = ["src/errno/program_invocation_short_name.cpp"],
- hdrs = ["src/errno/program_invocation_short_name.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/errno:program_invocation_short_name",
)
############################### arpa/inet targets ##############################
@@ -3051,11 +3030,11 @@ libc_function(
srcs = ["src/stdlib/atoi.cpp"],
hdrs = ["src/stdlib/atoi.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3064,11 +3043,11 @@ libc_function(
srcs = ["src/stdlib/atol.cpp"],
hdrs = ["src/stdlib/atol.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3077,11 +3056,11 @@ libc_function(
srcs = ["src/stdlib/atoll.cpp"],
hdrs = ["src/stdlib/atoll.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3090,11 +3069,11 @@ libc_function(
srcs = ["src/stdlib/atof.cpp"],
hdrs = ["src/stdlib/atof.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_float",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3360,11 +3339,11 @@ libc_function(
srcs = ["src/stdlib/strtol.cpp"],
hdrs = ["src/stdlib/strtol.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3373,11 +3352,11 @@ libc_function(
srcs = ["src/stdlib/strtoll.cpp"],
hdrs = ["src/stdlib/strtoll.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3386,11 +3365,11 @@ libc_function(
srcs = ["src/stdlib/strtoul.cpp"],
hdrs = ["src/stdlib/strtoul.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3399,11 +3378,11 @@ libc_function(
srcs = ["src/stdlib/strtoull.cpp"],
hdrs = ["src/stdlib/strtoull.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3412,11 +3391,11 @@ libc_function(
srcs = ["src/stdlib/strtof.cpp"],
hdrs = ["src/stdlib/strtof.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_float",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3425,11 +3404,11 @@ libc_function(
srcs = ["src/stdlib/strtod.cpp"],
hdrs = ["src/stdlib/strtod.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_float",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -3438,11 +3417,11 @@ libc_function(
srcs = ["src/stdlib/strtold.cpp"],
hdrs = ["src/stdlib/strtold.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_float",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4063,13 +4042,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_fcntl_macros",
":types_mode_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4082,11 +4061,11 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:fcntl",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4099,13 +4078,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_fcntl_macros",
":types_mode_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:openat",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4114,13 +4093,13 @@ libc_function(
srcs = ["src/fcntl/linux/creat.cpp"],
hdrs = ["src/fcntl/creat.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4148,13 +4127,13 @@ libc_function(
srcs = ["src/unistd/linux/access.cpp"],
hdrs = ["src/unistd/access.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:access",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4163,12 +4142,12 @@ libc_function(
srcs = ["src/unistd/linux/chdir.cpp"],
hdrs = ["src/unistd/chdir.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:chdir",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4181,13 +4160,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_gid_t",
":types_uid_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:chown",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4196,11 +4175,11 @@ libc_function(
srcs = ["src/unistd/linux/close.cpp"],
hdrs = ["src/unistd/close.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:close",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4209,13 +4188,13 @@ libc_function(
srcs = ["src/unistd/linux/dup.cpp"],
hdrs = ["src/unistd/dup.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:dup",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4224,7 +4203,6 @@ libc_function(
srcs = ["src/unistd/linux/dup2.cpp"],
hdrs = ["src/unistd/dup2.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
":hdr_unistd_macros",
"//libc/src/__support:common",
@@ -4232,6 +4210,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:dup2",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4244,13 +4223,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_unistd_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:dup3",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4270,12 +4249,12 @@ libc_function(
srcs = ["src/unistd/linux/fchdir.cpp"],
hdrs = ["src/unistd/fchdir.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:fchdir",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4284,11 +4263,11 @@ libc_function(
srcs = ["src/sched/linux/getcpu.cpp"],
hdrs = ["src/sched/getcpu.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getcpu",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4297,11 +4276,11 @@ libc_function(
srcs = ["src/sched/linux/sched_getcpu.cpp"],
hdrs = ["src/sched/sched_getcpu.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getcpu",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4310,11 +4289,11 @@ libc_function(
srcs = ["src/sched/linux/sched_get_priority_max.cpp"],
hdrs = ["src/sched/sched_get_priority_max.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_get_priority_max",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4323,11 +4302,11 @@ libc_function(
srcs = ["src/sched/linux/sched_get_priority_min.cpp"],
hdrs = ["src/sched/sched_get_priority_min.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_get_priority_min",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4336,13 +4315,13 @@ libc_function(
srcs = ["src/sched/linux/sched_getparam.cpp"],
hdrs = ["src/sched/sched_getparam.h"],
deps = [
- ":errno",
":types_pid_t",
":types_struct_sched_param",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_getparam",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4351,12 +4330,12 @@ libc_function(
srcs = ["src/sched/linux/sched_getscheduler.cpp"],
hdrs = ["src/sched/sched_getscheduler.h"],
deps = [
- ":errno",
":types_pid_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_getscheduler",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4365,13 +4344,13 @@ libc_function(
srcs = ["src/sched/linux/sched_rr_get_interval.cpp"],
hdrs = ["src/sched/sched_rr_get_interval.h"],
deps = [
- ":errno",
":types_pid_t",
":types_struct_timespec",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_rr_get_interval",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4380,7 +4359,6 @@ libc_function(
srcs = ["src/sched/linux/sched_setaffinity.cpp"],
hdrs = ["src/sched/sched_setaffinity.h"],
deps = [
- ":errno",
":types_cpu_set_t",
":types_pid_t",
":types_size_t",
@@ -4389,6 +4367,7 @@ libc_function(
"//libc/src/__support/CPP:span",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setaffinity",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4397,13 +4376,13 @@ libc_function(
srcs = ["src/sched/linux/sched_setparam.cpp"],
hdrs = ["src/sched/sched_setparam.h"],
deps = [
- ":errno",
":types_pid_t",
":types_struct_sched_param",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setparam",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4412,13 +4391,13 @@ libc_function(
srcs = ["src/sched/linux/sched_setscheduler.cpp"],
hdrs = ["src/sched/sched_setscheduler.h"],
deps = [
- ":errno",
":types_pid_t",
":types_struct_sched_param",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setscheduler",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4427,11 +4406,11 @@ libc_function(
srcs = ["src/sched/linux/sched_yield.cpp"],
hdrs = ["src/sched/sched_yield.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_yield",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4444,13 +4423,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_gid_t",
":types_uid_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:fchown",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4459,12 +4438,12 @@ libc_function(
srcs = ["src/unistd/linux/fsync.cpp"],
hdrs = ["src/unistd/fsync.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:fsync",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4473,7 +4452,6 @@ libc_function(
srcs = ["src/unistd/linux/ftruncate.cpp"],
hdrs = ["src/unistd/ftruncate.h"],
deps = [
- ":errno",
":hdr_stdint_proxy",
":hdr_unistd_macros",
":types_off_t",
@@ -4482,6 +4460,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:ftruncate",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4524,7 +4503,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":string_utils",
":types_size_t",
":types_struct_utsname",
@@ -4532,6 +4510,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:uname",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4582,7 +4561,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_signal_macros",
":hdr_unistd_macros",
":types_pid_t",
@@ -4594,6 +4572,7 @@ libc_function(
"//libc/src/__support/threads:identifier",
"//libc/src/__support/threads:thread",
"//libc/src/__support/threads:thread_headers",
+ "//libc/src/errno",
],
)
@@ -4602,13 +4581,13 @@ libc_function(
srcs = ["src/poll/linux/poll.cpp"],
hdrs = ["src/poll/poll.h"],
deps = [
- ":errno",
":types_nfds_t",
":types_struct_pollfd",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:poll",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4689,7 +4668,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_errno_macros",
":hdr_signal_macros",
":types_stack_t",
@@ -4697,6 +4675,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sigaltstack",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4719,7 +4698,6 @@ libc_function(
srcs = ["src/sys/wait/linux/waitpid.cpp"],
hdrs = ["src/sys/wait/waitpid.h"],
deps = [
- ":errno",
":hdr_signal_macros",
":hdr_sys_wait_macros",
":types_pid_t",
@@ -4730,6 +4708,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:wait4",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4742,12 +4721,12 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_pid_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getsid",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4809,7 +4788,6 @@ libc_function(
srcs = ["src/unistd/linux/isatty.cpp"],
hdrs = ["src/unistd/isatty.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
":sys_ioctl_macros",
"//libc/src/__support:common",
@@ -4817,6 +4795,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:ioctl",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4825,7 +4804,6 @@ libc_function(
srcs = ["src/unistd/linux/link.cpp"],
hdrs = ["src/unistd/link.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
":hdr_unistd_macros",
"//libc/src/__support:common",
@@ -4833,6 +4811,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:link",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4841,11 +4820,11 @@ libc_function(
srcs = ["src/unistd/linux/linkat.cpp"],
hdrs = ["src/unistd/linkat.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:linkat",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4854,12 +4833,12 @@ libc_function(
srcs = ["src/unistd/linux/pipe.cpp"],
hdrs = ["src/unistd/pipe.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:pipe",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -4868,7 +4847,6 @@ libc_function(
srcs = ["src/unistd/linux/lseek.cpp"],
hdrs = ["src/unistd/lseek.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
":types_off_t",
"//libc/src/__support:common",
@@ -4876,6 +4854,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:lseek",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4888,7 +4867,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_unistd_macros",
":types_off_t",
":types_size_t",
@@ -4898,6 +4876,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:pread",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -4910,7 +4889,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_unistd_macros",
":types_off_t",
":types_size_t",
@@ -4919,6 +4897,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:pwrite",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4927,7 +4906,6 @@ libc_function(
srcs = ["src/unistd/linux/read.cpp"],
hdrs = ["src/unistd/read.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
":types_size_t",
":types_ssize_t",
@@ -4936,6 +4914,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:read",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -4944,7 +4923,6 @@ libc_function(
srcs = ["src/unistd/linux/readlink.cpp"],
hdrs = ["src/unistd/readlink.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
":hdr_unistd_macros",
":types_size_t",
@@ -4954,6 +4932,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:readlink",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4962,7 +4941,6 @@ libc_function(
srcs = ["src/unistd/linux/readlinkat.cpp"],
hdrs = ["src/unistd/readlinkat.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
":hdr_unistd_macros",
":types_size_t",
@@ -4972,6 +4950,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:readlinkat",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4980,13 +4959,13 @@ libc_function(
srcs = ["src/unistd/linux/rmdir.cpp"],
hdrs = ["src/unistd/rmdir.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:rmdir",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -4999,12 +4978,12 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_pid_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:setsid",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5013,12 +4992,12 @@ libc_function(
srcs = ["src/unistd/linux/symlink.cpp"],
hdrs = ["src/unistd/symlink.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:symlink",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5027,12 +5006,12 @@ libc_function(
srcs = ["src/unistd/linux/symlinkat.cpp"],
hdrs = ["src/unistd/symlinkat.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:symlinkat",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5069,13 +5048,13 @@ libc_function(
srcs = ["src/unistd/linux/truncate.cpp"],
hdrs = ["src/unistd/truncate.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
":types_off_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:truncate",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5084,13 +5063,13 @@ libc_function(
srcs = ["src/unistd/linux/unlink.cpp"],
hdrs = ["src/unistd/unlink.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:unlink",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5099,13 +5078,13 @@ libc_function(
srcs = ["src/unistd/linux/unlinkat.cpp"],
hdrs = ["src/unistd/unlinkat.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:unlinkat",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5120,7 +5099,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_limits_macros",
":hdr_sys_auxv_macros",
":hdr_sys_resource_macros",
@@ -5134,6 +5112,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sysinfo",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5142,7 +5121,6 @@ libc_function(
srcs = ["src/unistd/linux/write.cpp"],
hdrs = ["src/unistd/write.h"],
deps = [
- ":errno",
":hdr_unistd_macros",
":types_size_t",
":types_ssize_t",
@@ -5150,6 +5128,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:write",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5215,7 +5194,6 @@ libc_function(
srcs = ["src/stdio/fflush.cpp"],
hdrs = ["src/stdio/fflush.h"],
deps = [
- ":errno",
":fflush_internal",
":hdr_stdio_macros",
":types_FILE",
@@ -5223,6 +5201,7 @@ libc_function(
"//libc/src/__support:error_or",
"//libc/src/__support:libc_errno",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5323,7 +5302,6 @@ libc_function(
srcs = ["src/stdio/sprintf.cpp"],
hdrs = ["src/stdio/sprintf.h"],
deps = [
- ":errno",
"//libc/src/__support:arg_list",
"//libc/src/__support:libc_errno",
"//libc/src/__support/CPP:limits",
@@ -5333,6 +5311,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:printf_main",
"//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
],
)
@@ -5341,7 +5320,6 @@ libc_function(
srcs = ["src/stdio/snprintf.cpp"],
hdrs = ["src/stdio/snprintf.h"],
deps = [
- ":errno",
"//libc/src/__support:arg_list",
"//libc/src/__support:libc_errno",
"//libc/src/__support/CPP:limits",
@@ -5350,6 +5328,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:printf_main",
"//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
],
)
@@ -5358,7 +5337,6 @@ libc_function(
srcs = ["src/stdio/generic/printf.cpp"],
hdrs = ["src/stdio/printf.h"],
deps = [
- ":errno",
":stdout",
":types_FILE",
"//libc/src/__support:arg_list",
@@ -5368,6 +5346,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_core_structs",
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
],
)
@@ -5376,7 +5355,6 @@ libc_function(
srcs = ["src/stdio/generic/fprintf.cpp"],
hdrs = ["src/stdio/fprintf.h"],
deps = [
- ":errno",
":types_FILE",
"//libc/src/__support:arg_list",
"//libc/src/__support/CPP:limits",
@@ -5385,6 +5363,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_core_structs",
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
],
)
@@ -5408,7 +5387,6 @@ libc_function(
srcs = ["src/stdio/vsprintf.cpp"],
hdrs = ["src/stdio/vsprintf.h"],
deps = [
- ":errno",
"//libc/src/__support:arg_list",
"//libc/src/__support:libc_errno",
"//libc/src/__support/CPP:limits",
@@ -5417,6 +5395,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:printf_main",
"//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
],
)
@@ -5425,7 +5404,6 @@ libc_function(
srcs = ["src/stdio/vsnprintf.cpp"],
hdrs = ["src/stdio/vsnprintf.h"],
deps = [
- ":errno",
"//libc/src/__support:arg_list",
"//libc/src/__support:libc_errno",
"//libc/src/__support/CPP:limits",
@@ -5434,6 +5412,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:printf_main",
"//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
],
)
@@ -5442,7 +5421,6 @@ libc_function(
srcs = ["src/stdio/generic/vprintf.cpp"],
hdrs = ["src/stdio/vprintf.h"],
deps = [
- ":errno",
":stdout",
":types_FILE",
"//libc/src/__support:arg_list",
@@ -5452,6 +5430,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_core_structs",
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
],
)
@@ -5460,7 +5439,6 @@ libc_function(
srcs = ["src/stdio/generic/vfprintf.cpp"],
hdrs = ["src/stdio/vfprintf.h"],
deps = [
- ":errno",
":types_FILE",
"//libc/src/__support:arg_list",
"//libc/src/__support/CPP:limits",
@@ -5469,6 +5447,7 @@ libc_function(
"//libc/src/__support/printf_core:printf_core_structs",
"//libc/src/__support/printf_core:printf_error_mapper",
"//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
],
)
@@ -5669,13 +5648,13 @@ libc_function(
srcs = ["src/stdio/linux/remove.cpp"],
hdrs = ["src/stdio/remove.h"],
deps = [
- ":errno",
":hdr_errno_macros",
":hdr_fcntl_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:unlinkat",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5688,7 +5667,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_fcntl_macros",
":llvm_libc_macros_fcntl_macros",
"//libc/src/__support:common",
@@ -5696,6 +5674,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:rename",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5706,12 +5685,12 @@ libc_function(
srcs = ["src/sys/mman/linux/madvise.cpp"],
hdrs = ["src/sys/mman/madvise.h"],
deps = [
- ":errno",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:madvise",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5720,13 +5699,13 @@ libc_function(
srcs = ["src/sys/mman/linux/mincore.cpp"],
hdrs = ["src/sys/mman/mincore.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5735,13 +5714,13 @@ libc_function(
srcs = ["src/sys/mman/linux/mlock.cpp"],
hdrs = ["src/sys/mman/mlock.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5750,13 +5729,13 @@ libc_function(
srcs = ["src/sys/mman/linux/mlock2.cpp"],
hdrs = ["src/sys/mman/mlock2.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5765,12 +5744,12 @@ libc_function(
srcs = ["src/sys/mman/linux/mlockall.cpp"],
hdrs = ["src/sys/mman/mlockall.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5779,7 +5758,6 @@ libc_function(
srcs = ["src/sys/mman/linux/mmap.cpp"],
hdrs = ["src/sys/mman/mmap.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_off_t",
":types_size_t",
@@ -5788,6 +5766,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:mmap",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5796,7 +5775,6 @@ libc_function(
srcs = ["src/sys/mman/linux/mprotect.cpp"],
hdrs = ["src/sys/mman/mprotect.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
@@ -5805,6 +5783,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:mprotect",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5813,13 +5792,13 @@ libc_function(
srcs = ["src/sys/mman/linux/mremap.cpp"],
hdrs = ["src/sys/mman/mremap.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:mremap",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5828,13 +5807,13 @@ libc_function(
srcs = ["src/sys/mman/linux/msync.cpp"],
hdrs = ["src/sys/mman/msync.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5843,13 +5822,13 @@ libc_function(
srcs = ["src/sys/mman/linux/munlock.cpp"],
hdrs = ["src/sys/mman/munlock.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5858,12 +5837,12 @@ libc_function(
srcs = ["src/sys/mman/linux/munlockall.cpp"],
hdrs = ["src/sys/mman/munlockall.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5872,7 +5851,6 @@ libc_function(
srcs = ["src/sys/mman/linux/munmap.cpp"],
hdrs = ["src/sys/mman/munmap.h"],
deps = [
- ":errno",
":hdr_sys_mman_macros",
":types_size_t",
"//libc/src/__support:common",
@@ -5880,6 +5858,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:munmap",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5900,11 +5879,11 @@ libc_function(
srcs = ["src/sys/mman/linux/pkey_alloc.cpp"],
hdrs = ["src/sys/mman/pkey_alloc.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_alloc",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5913,11 +5892,11 @@ libc_function(
srcs = ["src/sys/mman/linux/pkey_free.cpp"],
hdrs = ["src/sys/mman/pkey_free.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_free",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5926,7 +5905,6 @@ libc_function(
srcs = ["src/sys/mman/linux/pkey_get.cpp"],
hdrs = ["src/sys/mman/pkey_get.h"],
deps = [
- ":errno",
":pkey_common",
"//libc/src/__support:common",
"//libc/src/__support:error_or",
@@ -5934,6 +5912,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/errno",
],
)
@@ -5942,7 +5921,6 @@ libc_function(
srcs = ["src/sys/mman/linux/pkey_mprotect.cpp"],
hdrs = ["src/sys/mman/pkey_mprotect.h"],
deps = [
- ":errno",
":hdr_errno_macros",
":types_size_t",
"//libc/src/__support:common",
@@ -5952,6 +5930,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:mprotect",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_mprotect",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -5960,7 +5939,6 @@ libc_function(
srcs = ["src/sys/mman/linux/pkey_set.cpp"],
hdrs = ["src/sys/mman/pkey_set.h"],
deps = [
- ":errno",
":pkey_common",
"//libc/src/__support:common",
"//libc/src/__support:error_or",
@@ -5968,6 +5946,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:attributes",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6006,12 +5985,12 @@ libc_function(
srcs = ["src/sys/mman/linux/remap_file_pages.cpp"],
hdrs = ["src/sys/mman/remap_file_pages.h"],
deps = [
- ":errno",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:remap_file_pages",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6034,7 +6013,6 @@ libc_function(
srcs = ["src/sys/mman/linux/shm_open.cpp"],
hdrs = ["src/sys/mman/shm_open.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
":shm_common",
":types_mode_t",
@@ -6042,6 +6020,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6050,13 +6029,13 @@ libc_function(
srcs = ["src/sys/mman/linux/shm_unlink.cpp"],
hdrs = ["src/sys/mman/shm_unlink.h"],
deps = [
- ":errno",
":shm_common",
":types_mode_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:unlink",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6088,11 +6067,11 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6103,13 +6082,13 @@ libc_function(
srcs = ["src/sys/resource/linux/getrlimit.cpp"],
hdrs = ["src/sys/resource/getrlimit.h"],
deps = [
- ":errno",
":types_struct_rlimit",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6118,13 +6097,13 @@ libc_function(
srcs = ["src/sys/resource/linux/setrlimit.cpp"],
hdrs = ["src/sys/resource/setrlimit.h"],
deps = [
- ":errno",
":types_struct_rlimit",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6139,7 +6118,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_errno_macros",
":hdr_sys_ipc_macros",
":hdr_sys_sem_macros",
@@ -6149,6 +6127,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:semctl",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6161,12 +6140,12 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_key_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:semget",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6179,13 +6158,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_size_t",
":types_struct_sembuf",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:semop",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6200,7 +6179,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_off_t",
":types_size_t",
":types_ssize_t",
@@ -6208,6 +6186,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sendfile",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6218,7 +6197,6 @@ libc_function(
srcs = ["src/sys/stat/linux/mkdir.cpp"],
hdrs = ["src/sys/stat/mkdir.h"],
deps = [
- ":errno",
":hdr_fcntl_macros",
":types_mode_t",
"//libc/src/__support:common",
@@ -6226,6 +6204,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:mkdir",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6234,13 +6213,13 @@ libc_function(
srcs = ["src/sys/stat/linux/mkdirat.cpp"],
hdrs = ["src/sys/stat/mkdirat.h"],
deps = [
- ":errno",
":types_mode_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:mkdirat",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6251,7 +6230,6 @@ libc_function(
srcs = ["src/sys/socket/linux/accept.cpp"],
hdrs = ["src/sys/socket/accept.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_struct_sockaddr",
"//libc/src/__support:common",
@@ -6259,6 +6237,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:accept",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6267,7 +6246,6 @@ libc_function(
srcs = ["src/sys/socket/linux/accept4.cpp"],
hdrs = ["src/sys/socket/accept4.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_struct_sockaddr",
"//libc/src/__support:common",
@@ -6275,6 +6253,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:accept4",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6283,7 +6262,6 @@ libc_function(
srcs = ["src/sys/socket/linux/bind.cpp"],
hdrs = ["src/sys/socket/bind.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_struct_sockaddr",
"//libc/src/__support:common",
@@ -6291,6 +6269,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:bind",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6299,7 +6278,6 @@ libc_function(
srcs = ["src/sys/socket/linux/connect.cpp"],
hdrs = ["src/sys/socket/connect.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_struct_sockaddr",
"//libc/src/__support:common",
@@ -6307,6 +6285,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:connect",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6315,7 +6294,6 @@ libc_function(
srcs = ["src/sys/socket/linux/getpeername.cpp"],
hdrs = ["src/sys/socket/getpeername.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_struct_sockaddr",
"//libc/src/__support:common",
@@ -6323,6 +6301,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getpeername",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6331,7 +6310,6 @@ libc_function(
srcs = ["src/sys/socket/linux/getsockname.cpp"],
hdrs = ["src/sys/socket/getsockname.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_struct_sockaddr",
"//libc/src/__support:common",
@@ -6339,6 +6317,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getsockname",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6347,13 +6326,13 @@ libc_function(
srcs = ["src/sys/socket/linux/getsockopt.cpp"],
hdrs = ["src/sys/socket/getsockopt.h"],
deps = [
- ":errno",
":types_socklen_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getsockopt",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6362,12 +6341,12 @@ libc_function(
srcs = ["src/sys/socket/linux/listen.cpp"],
hdrs = ["src/sys/socket/listen.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:listen",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6376,7 +6355,6 @@ libc_function(
srcs = ["src/sys/socket/linux/recv.cpp"],
hdrs = ["src/sys/socket/recv.h"],
deps = [
- ":errno",
":types_size_t",
":types_socklen_t",
":types_ssize_t",
@@ -6387,6 +6365,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:recvfrom",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -6395,7 +6374,6 @@ libc_function(
srcs = ["src/sys/socket/linux/recvfrom.cpp"],
hdrs = ["src/sys/socket/recvfrom.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_ssize_t",
":types_struct_sockaddr",
@@ -6405,6 +6383,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:recvfrom",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -6413,7 +6392,6 @@ libc_function(
srcs = ["src/sys/socket/linux/recvmmsg.cpp"],
hdrs = ["src/sys/socket/recvmmsg.h"],
deps = [
- ":errno",
":types_struct_mmsghdr",
":types_struct_timespec",
"//libc/src/__support:common",
@@ -6421,6 +6399,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:recvmmsg",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6429,7 +6408,6 @@ libc_function(
srcs = ["src/sys/socket/linux/recvmsg.cpp"],
hdrs = ["src/sys/socket/recvmsg.h"],
deps = [
- ":errno",
":types_ssize_t",
":types_struct_msghdr",
"//libc/src/__support:common",
@@ -6438,6 +6416,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:recvmsg",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -6446,7 +6425,6 @@ libc_function(
srcs = ["src/sys/socket/linux/send.cpp"],
hdrs = ["src/sys/socket/send.h"],
deps = [
- ":errno",
":types_size_t",
":types_socklen_t",
":types_ssize_t",
@@ -6456,6 +6434,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sendto",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6464,13 +6443,13 @@ libc_function(
srcs = ["src/sys/socket/linux/sendmmsg.cpp"],
hdrs = ["src/sys/socket/sendmmsg.h"],
deps = [
- ":errno",
":types_struct_mmsghdr",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sendmmsg",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6479,7 +6458,6 @@ libc_function(
srcs = ["src/sys/socket/linux/sendmsg.cpp"],
hdrs = ["src/sys/socket/sendmsg.h"],
deps = [
- ":errno",
":types_ssize_t",
":types_struct_msghdr",
"//libc/src/__support:common",
@@ -6487,6 +6465,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sendmsg",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6495,7 +6474,6 @@ libc_function(
srcs = ["src/sys/socket/linux/sendto.cpp"],
hdrs = ["src/sys/socket/sendto.h"],
deps = [
- ":errno",
":types_socklen_t",
":types_ssize_t",
":types_struct_sockaddr",
@@ -6504,6 +6482,7 @@ libc_function(
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:sendto",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6512,13 +6491,13 @@ libc_function(
srcs = ["src/sys/socket/linux/setsockopt.cpp"],
hdrs = ["src/sys/socket/setsockopt.h"],
deps = [
- ":errno",
":types_socklen_t",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:setsockopt",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6527,12 +6506,12 @@ libc_function(
srcs = ["src/sys/socket/linux/shutdown.cpp"],
hdrs = ["src/sys/socket/shutdown.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:shutdown",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6541,11 +6520,11 @@ libc_function(
srcs = ["src/sys/socket/linux/sockatmark.cpp"],
hdrs = ["src/sys/socket/sockatmark.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:ioctl",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6554,12 +6533,12 @@ libc_function(
srcs = ["src/sys/socket/linux/socket.cpp"],
hdrs = ["src/sys/socket/socket.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:socket",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6568,13 +6547,13 @@ libc_function(
srcs = ["src/sys/socket/linux/socketpair.cpp"],
hdrs = ["src/sys/socket/socketpair.h"],
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:socketpair",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -6589,13 +6568,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_ssize_t",
":types_struct_iovec",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:readv",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6608,13 +6587,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_ssize_t",
":types_struct_iovec",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:writev",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6629,12 +6608,12 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_struct_utsname",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:uname",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6649,11 +6628,11 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_create",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6666,11 +6645,11 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_create1",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6683,13 +6662,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":hdr_sys_epoll_macros",
":types_struct_epoll_event",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_ctl",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -6702,7 +6681,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_sigset_t",
":types_struct_epoll_event",
"//libc/src/__support:common",
@@ -6710,6 +6688,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_pwait",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -6722,7 +6701,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_sigset_t",
":types_struct_epoll_event",
":types_struct_timespec",
@@ -6731,6 +6709,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_pwait2",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
@@ -6743,13 +6722,13 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":errno",
":types_struct_epoll_event",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_wait",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/errno/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/errno/BUILD.bazel
new file mode 100644
index 0000000000000..c8e08f094c8c4
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/errno/BUILD.bazel
@@ -0,0 +1,47 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "errno",
+ srcs = ["libc_errno.cpp"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "program_invocation_name",
+ srcs = ["program_invocation_name.cpp"],
+ hdrs = ["program_invocation_name.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "program_invocation_short_name",
+ srcs = ["program_invocation_short_name.cpp"],
+ hdrs = ["program_invocation_short_name.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/inttypes/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/inttypes/BUILD.bazel
index fdfb32b99af78..e9437d44e0486 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/inttypes/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/inttypes/BUILD.bazel
@@ -18,12 +18,12 @@ libc_function(
srcs = ["strtoimax.cpp"],
hdrs = ["strtoimax.h"],
deps = [
- "//libc:errno",
"//libc:hdr_stdint_proxy",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
@@ -32,12 +32,12 @@ libc_function(
srcs = ["strtoumax.cpp"],
hdrs = ["strtoumax.h"],
deps = [
- "//libc:errno",
"//libc:hdr_stdint_proxy",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support:str_to_integer",
"//libc/src/__support/macros:config",
+ "//libc/src/errno",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
index 109c11c0067ba..e1780522f0799 100644
--- a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
@@ -63,8 +63,6 @@ libc_startup_library(
"//libc:hdr_stdint_proxy",
"//libc:hdr_sys_auxv_macros",
"//libc:hdr_sys_mman_macros",
- "//libc:program_invocation_name",
- "//libc:program_invocation_short_name",
"//libc:types_struct_link_map",
"//libc:types_struct_r_debug",
"//libc/src/__support/OSUtil:linux_auxv",
@@ -76,6 +74,8 @@ libc_startup_library(
"//libc/src/__support/threads:tcb",
"//libc/src/__support/threads:thread",
"//libc/src/__support/threads:thread_headers",
+ "//libc/src/errno:program_invocation_name",
+ "//libc/src/errno:program_invocation_short_name",
] + selects.with_or({
PLATFORM_CPU_X86_64: [
"//libc/startup/linux/x86_64:irelative",
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index f962c788aaae3..277fe5822dfcf 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -58,7 +58,6 @@ libc_test_library(
":string_utils",
":test_logger",
"//libc:clock",
- "//libc:errno",
"//libc:func_aligned_alloc",
"//libc:func_free",
"//libc:func_malloc",
@@ -90,6 +89,7 @@ libc_test_library(
"//libc/src/__support/macros/properties:compiler",
"//libc/src/__support/macros/properties:types",
"//libc/src/__support/wchar:string_converter",
+ "//libc/src/errno",
] + select({
"//libc:full_build": [
"//libc:close",
diff --git a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
index 722ebbf381960..5914ce60aae97 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
@@ -54,7 +54,7 @@ def libc_test(
"//libc:hdr_stdint_proxy",
"//libc/src/__support/macros:config",
"//libc/src/__support:libc_errno",
- "//libc:errno",
+ "//libc/src/errno",
"//libc:func_aligned_alloc",
"//libc:func_free",
"//libc:func_malloc",
>From 7f87fdc5915fc67004373600017fc6ad53d4b41c Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:24 -0800
Subject: [PATCH 06/32] [bazel] Add subpackage for libc/src/fcntl
---
.../llvm-project-overlay/libc/BUILD.bazel | 66 ++------------
.../libc/src/fcntl/BUILD.bazel | 86 +++++++++++++++++++
.../libc/test/src/stdio/BUILD.bazel | 2 +-
.../libc/test/src/stdlib/BUILD.bazel | 2 +-
.../libc/test/src/sys/mman/BUILD.bazel | 6 +-
.../libc/test/src/sys/resource/BUILD.bazel | 2 +-
.../libc/test/src/sys/socket/BUILD.bazel | 6 +-
.../libc/test/src/unistd/BUILD.bazel | 22 ++---
8 files changed, 114 insertions(+), 78 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/fcntl/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 5db87ddb53de8..65665cd48d4f2 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4033,74 +4033,24 @@ libc_function(
################################ fcntl targets #################################
-libc_function(
+alias(
name = "open",
- srcs = ["src/fcntl/linux/open.cpp"],
- hdrs = ["src/fcntl/open.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_fcntl_macros",
- ":types_mode_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/fcntl:open",
)
-libc_function(
+alias(
name = "fcntl",
- srcs = ["src/fcntl/linux/fcntl.cpp"],
- hdrs = ["src/fcntl/fcntl.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:fcntl",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/fcntl",
)
-libc_function(
+alias(
name = "openat",
- srcs = ["src/fcntl/linux/openat.cpp"],
- hdrs = ["src/fcntl/openat.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_fcntl_macros",
- ":types_mode_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:openat",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/fcntl:openat",
)
-libc_function(
+alias(
name = "creat",
- srcs = ["src/fcntl/linux/creat.cpp"],
- hdrs = ["src/fcntl/creat.h"],
- deps = [
- ":hdr_fcntl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/fcntl:creat",
)
################################ time targets ##################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/fcntl/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/fcntl/BUILD.bazel
new file mode 100644
index 0000000000000..904f1f71fd1dc
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/fcntl/BUILD.bazel
@@ -0,0 +1,86 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "open",
+ srcs = ["linux/open.cpp"],
+ hdrs = ["open.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:types_mode_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "fcntl",
+ srcs = ["linux/fcntl.cpp"],
+ hdrs = ["fcntl.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:fcntl",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "openat",
+ srcs = ["linux/openat.cpp"],
+ hdrs = ["openat.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:types_mode_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:openat",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "creat",
+ srcs = ["linux/creat.cpp"],
+ hdrs = ["creat.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
index bd7ac94f54942..6fa463903585b 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
@@ -125,8 +125,8 @@ libc_test(
"//libc:close",
"//libc:hdr_sys_stat_macros",
"//libc:mkdirat",
- "//libc:open",
"//libc:remove",
+ "//libc/src/fcntl:open",
],
)
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 e6e7c58d01839..b3eba5aefd3c9 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
@@ -151,7 +151,6 @@ libc_test(
"//libc:hdr_errno_macros",
"//libc:hdr_limits_macros",
"//libc:mkdirat",
- "//libc:openat",
"//libc:realpath",
"//libc:strdup",
"//libc:symlinkat",
@@ -164,6 +163,7 @@ libc_test(
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/CPP:utility",
"//libc/src/__support/OSUtil:path",
+ "//libc/src/fcntl:openat",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
index ad87deb4e2624..5858572d607fc 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
@@ -147,8 +147,8 @@ libc_test(
"//libc:hdr_sys_stat_macros",
"//libc:mmap",
"//libc:munmap",
- "//libc:open",
"//libc:remap_file_pages",
+ "//libc/src/fcntl:open",
],
)
@@ -157,14 +157,14 @@ libc_test(
srcs = ["linux/shm_test.cpp"],
deps = [
"//libc:close",
- "//libc:fcntl",
"//libc:ftruncate",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_mman_macros",
"//libc:mmap",
"//libc:munmap",
- "//libc:open",
"//libc:shm_open",
"//libc:shm_unlink",
+ "//libc/src/fcntl",
+ "//libc/src/fcntl:open",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
index 2e2e5fe3cb459..3236578f10e6a 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
@@ -18,10 +18,10 @@ libc_test(
"//libc:getrlimit",
"//libc:hdr_sys_resource_macros",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:setrlimit",
"//libc:types_struct_rlimit",
"//libc:unlink",
"//libc/src/__support/CPP:string_view",
+ "//libc/src/fcntl:open",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
index c0f68f82a390b..c0c5e3f6be457 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
@@ -19,7 +19,6 @@ libc_test_library(
"//libc:fchdir",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:open",
"//libc:strncpy",
"//libc:strnlen",
"//libc:types_size_t",
@@ -27,6 +26,7 @@ libc_test_library(
"//libc:types_struct_sockaddr_un",
"//libc/src/__support:common",
"//libc/src/__support/CPP:string_view",
+ "//libc/src/fcntl:open",
"//libc/test/UnitTest:LibcUnitTest",
],
)
@@ -62,7 +62,6 @@ libc_test(
"//libc:bind",
"//libc:close",
"//libc:connect",
- "//libc:fcntl",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
"//libc:listen",
@@ -73,6 +72,7 @@ libc_test(
"//libc:types_socklen_t",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
+ "//libc/src/fcntl",
],
)
@@ -110,7 +110,6 @@ libc_test(
srcs = ["linux/sendmsg_recvmsg_test.cpp"],
deps = [
"//libc:close",
- "//libc:fcntl",
"//libc:getsockopt",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
@@ -122,6 +121,7 @@ libc_test(
"//libc:socketpair",
"//libc:types_struct_cmsghdr",
"//libc/src/__support/CPP:scope",
+ "//libc/src/fcntl",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
index 1855cc8206338..ab3080721d59a 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
@@ -17,8 +17,8 @@ libc_test(
"//libc:access",
"//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:unlink",
+ "//libc/src/fcntl:open",
],
)
@@ -29,10 +29,10 @@ libc_test(
"//libc:close",
"//libc:dup",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:read",
"//libc:unlink",
"//libc:write",
+ "//libc/src/fcntl:open",
],
)
@@ -43,10 +43,10 @@ libc_test(
"//libc:close",
"//libc:dup2",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:read",
"//libc:unlink",
"//libc:write",
+ "//libc/src/fcntl:open",
],
)
@@ -57,10 +57,10 @@ libc_test(
"//libc:close",
"//libc:dup3",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:read",
"//libc:unlink",
"//libc:write",
+ "//libc/src/fcntl:open",
],
)
@@ -71,11 +71,11 @@ libc_test(
"//libc:close",
"//libc:ftruncate",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:read",
"//libc:unlink",
"//libc:write",
"//libc/src/__support/CPP:string_view",
+ "//libc/src/fcntl:open",
],
)
@@ -94,11 +94,11 @@ libc_test(
"//libc:close",
"//libc:fsync",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:pread",
"//libc:pwrite",
"//libc:unlink",
"//libc:write",
+ "//libc/src/fcntl:open",
],
)
@@ -120,8 +120,8 @@ libc_test(
"//libc:close",
"//libc:hdr_sys_stat_macros",
"//libc:link",
- "//libc:open",
"//libc:unlink",
+ "//libc/src/fcntl:open",
],
)
@@ -140,9 +140,9 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:symlink",
"//libc:unlink",
+ "//libc/src/fcntl:open",
],
)
@@ -152,12 +152,12 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:read",
"//libc:truncate",
"//libc:unlink",
"//libc:write",
"//libc/src/__support/CPP:string_view",
+ "//libc/src/fcntl:open",
],
)
@@ -167,8 +167,8 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:open",
"//libc:unlink",
+ "//libc/src/fcntl:open",
],
)
@@ -195,7 +195,7 @@ libc_test(
"//libc:close",
"//libc:hdr_sys_stat_macros",
"//libc:isatty",
- "//libc:open",
+ "//libc/src/fcntl:open",
],
)
>From 86b3ac7e0b040885fbf50c95d7509ec910d88a1e Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:25 -0800
Subject: [PATCH 07/32] [bazel] Add subpackage for libc/src/fenv
---
.../llvm-project-overlay/libc/BUILD.bazel | 167 +++------------
.../libc/src/fenv/BUILD.bazel | 199 ++++++++++++++++++
.../libc/test/src/fenv/BUILD.bazel | 44 ++--
3 files changed, 253 insertions(+), 157 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/fenv/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 65665cd48d4f2..c12fece108a62 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1978,187 +1978,84 @@ alias(
################################ fenv targets ################################
-libc_function(
+alias(
name = "fetestexcept",
- srcs = ["src/fenv/fetestexcept.cpp"],
- hdrs = ["src/fenv/fetestexcept.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fetestexcept",
)
-libc_function(
+alias(
name = "fetestexceptflag",
- srcs = ["src/fenv/fetestexceptflag.cpp"],
- hdrs = ["src/fenv/fetestexceptflag.h"],
- deps = [
- ":types_fexcept_t",
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fetestexceptflag",
)
-libc_function(
+alias(
name = "feclearexcept",
- srcs = ["src/fenv/feclearexcept.cpp"],
- hdrs = ["src/fenv/feclearexcept.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:feclearexcept",
)
-libc_function(
+alias(
name = "feraiseexcept",
- srcs = ["src/fenv/feraiseexcept.cpp"],
- hdrs = ["src/fenv/feraiseexcept.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:feraiseexcept",
)
-libc_function(
+alias(
name = "fegetround",
- srcs = ["src/fenv/fegetround.cpp"],
- hdrs = ["src/fenv/fegetround.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fegetround",
)
-libc_function(
+alias(
name = "fesetround",
- srcs = ["src/fenv/fesetround.cpp"],
- hdrs = ["src/fenv/fesetround.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fesetround",
)
-libc_function(
+alias(
name = "fedisableexcept",
- srcs = ["src/fenv/fedisableexcept.cpp"],
- hdrs = ["src/fenv/fedisableexcept.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fedisableexcept",
)
-libc_function(
+alias(
name = "feenableexcept",
- srcs = ["src/fenv/feenableexcept.cpp"],
- hdrs = ["src/fenv/feenableexcept.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:feenableexcept",
)
-libc_function(
+alias(
name = "fegetexcept",
- srcs = ["src/fenv/fegetexcept.cpp"],
- hdrs = ["src/fenv/fegetexcept.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fegetexcept",
)
-libc_function(
+alias(
name = "fegetenv",
- srcs = ["src/fenv/fegetenv.cpp"],
- hdrs = ["src/fenv/fegetenv.h"],
- deps = [
- ":types_fenv_t",
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fegetenv",
)
-libc_function(
+alias(
name = "fesetenv",
- srcs = ["src/fenv/fesetenv.cpp"],
- hdrs = ["src/fenv/fesetenv.h"],
- deps = [
- ":types_fenv_t",
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fesetenv",
)
-libc_function(
+alias(
name = "feupdateenv",
- srcs = ["src/fenv/feupdateenv.cpp"],
- hdrs = ["src/fenv/feupdateenv.h"],
- deps = [
- ":types_fenv_t",
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:feupdateenv",
)
-libc_function(
+alias(
name = "fesetexcept",
- srcs = ["src/fenv/fesetexcept.cpp"],
- hdrs = ["src/fenv/fesetexcept.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fesetexcept",
)
-libc_function(
+alias(
name = "fegetexceptflag",
- srcs = ["src/fenv/fegetexceptflag.cpp"],
- hdrs = ["src/fenv/fegetexceptflag.h"],
- deps = [
- ":types_fexcept_t",
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fegetexceptflag",
)
-libc_function(
+alias(
name = "fesetexceptflag",
- srcs = ["src/fenv/fesetexceptflag.cpp"],
- hdrs = ["src/fenv/fesetexceptflag.h"],
- deps = [
- ":types_fexcept_t",
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:fesetexceptflag",
)
-libc_function(
+alias(
name = "feholdexcept",
- srcs = ["src/fenv/feholdexcept.cpp"],
- hdrs = ["src/fenv/feholdexcept.h"],
- deps = [
- ":types_fenv_t",
- "//libc/src/__support:common",
- "//libc/src/__support/FPUtil:fenv_impl",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/fenv:feholdexcept",
)
########################### math support library ###############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/fenv/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/fenv/BUILD.bazel
new file mode 100644
index 0000000000000..8f6dbbddbee5b
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/fenv/BUILD.bazel
@@ -0,0 +1,199 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "fetestexcept",
+ srcs = ["fetestexcept.cpp"],
+ hdrs = ["fetestexcept.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fetestexceptflag",
+ srcs = ["fetestexceptflag.cpp"],
+ hdrs = ["fetestexceptflag.h"],
+ deps = [
+ "//libc:types_fexcept_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "feclearexcept",
+ srcs = ["feclearexcept.cpp"],
+ hdrs = ["feclearexcept.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "feraiseexcept",
+ srcs = ["feraiseexcept.cpp"],
+ hdrs = ["feraiseexcept.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fegetround",
+ srcs = ["fegetround.cpp"],
+ hdrs = ["fegetround.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fesetround",
+ srcs = ["fesetround.cpp"],
+ hdrs = ["fesetround.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fedisableexcept",
+ srcs = ["fedisableexcept.cpp"],
+ hdrs = ["fedisableexcept.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "feenableexcept",
+ srcs = ["feenableexcept.cpp"],
+ hdrs = ["feenableexcept.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fegetexcept",
+ srcs = ["fegetexcept.cpp"],
+ hdrs = ["fegetexcept.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fegetenv",
+ srcs = ["fegetenv.cpp"],
+ hdrs = ["fegetenv.h"],
+ deps = [
+ "//libc:types_fenv_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fesetenv",
+ srcs = ["fesetenv.cpp"],
+ hdrs = ["fesetenv.h"],
+ deps = [
+ "//libc:types_fenv_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "feupdateenv",
+ srcs = ["feupdateenv.cpp"],
+ hdrs = ["feupdateenv.h"],
+ deps = [
+ "//libc:types_fenv_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fesetexcept",
+ srcs = ["fesetexcept.cpp"],
+ hdrs = ["fesetexcept.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fegetexceptflag",
+ srcs = ["fegetexceptflag.cpp"],
+ hdrs = ["fegetexceptflag.h"],
+ deps = [
+ "//libc:types_fexcept_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fesetexceptflag",
+ srcs = ["fesetexceptflag.cpp"],
+ hdrs = ["fesetexceptflag.h"],
+ deps = [
+ "//libc:types_fexcept_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "feholdexcept",
+ srcs = ["feholdexcept.cpp"],
+ hdrs = ["feholdexcept.h"],
+ deps = [
+ "//libc:types_fenv_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel
index 468802a5f1e39..e0f0b4267b4cf 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel
@@ -17,12 +17,12 @@ libc_test(
"excepts.h",
],
deps = [
- "//libc:feclearexcept",
- "//libc:feraiseexcept",
- "//libc:fesetexcept",
- "//libc:fetestexcept",
"//libc:hdr_fenv_macros",
"//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/fenv:feclearexcept",
+ "//libc/src/fenv:feraiseexcept",
+ "//libc/src/fenv:fesetexcept",
+ "//libc/src/fenv:fetestexcept",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -34,9 +34,9 @@ libc_test(
"rounding_mode_test.cpp",
],
deps = [
- "//libc:fegetround",
- "//libc:fesetround",
"//libc:hdr_fenv_macros",
+ "//libc/src/fenv:fegetround",
+ "//libc/src/fenv:fesetround",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -49,14 +49,14 @@ libc_test(
],
tags = ["nosan"],
deps = [
- "//libc:feclearexcept",
- "//libc:feraiseexcept",
- "//libc:fetestexcept",
"//libc:hdr_fenv_macros",
"//libc:hdr_signal_macros",
"//libc/src/__support:common",
"//libc/src/__support/FPUtil:fenv_impl",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/fenv:feclearexcept",
+ "//libc/src/fenv:feraiseexcept",
+ "//libc/src/fenv:fetestexcept",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -69,13 +69,13 @@ libc_test(
],
tags = ["nosan"],
deps = [
- "//libc:feholdexcept",
"//libc:hdr_fenv_macros",
"//libc:hdr_signal_macros",
"//libc:types_fenv_t",
"//libc/src/__support:common",
"//libc/src/__support/FPUtil:fenv_impl",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/fenv:feholdexcept",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -87,12 +87,12 @@ libc_test(
"excepts.h",
],
deps = [
- "//libc:fegetexceptflag",
- "//libc:fesetexceptflag",
- "//libc:fetestexceptflag",
"//libc:hdr_fenv_macros",
"//libc:types_fexcept_t",
"//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/fenv:fegetexceptflag",
+ "//libc/src/fenv:fesetexceptflag",
+ "//libc/src/fenv:fetestexceptflag",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -104,9 +104,9 @@ libc_test(
"feclearexcept_test.cpp",
],
deps = [
- "//libc:feclearexcept",
"//libc:hdr_fenv_macros",
"//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/fenv:feclearexcept",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -118,12 +118,12 @@ libc_test(
"feenableexcept_test.cpp",
],
deps = [
- "//libc:fedisableexcept",
- "//libc:feenableexcept",
- "//libc:fegetexcept",
"//libc:hdr_fenv_macros",
"//libc/src/__support:common",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/fenv:fedisableexcept",
+ "//libc/src/fenv:feenableexcept",
+ "//libc/src/fenv:fegetexcept",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -135,10 +135,10 @@ libc_test(
"feupdateenv_test.cpp",
],
deps = [
- "//libc:feupdateenv",
"//libc:hdr_fenv_macros",
"//libc:types_fenv_t",
"//libc/src/__support/FPUtil:fenv_impl",
+ "//libc/src/fenv:feupdateenv",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -150,14 +150,14 @@ libc_test(
"getenv_and_setenv_test.cpp",
],
deps = [
- "//libc:fegetenv",
- "//libc:fegetround",
- "//libc:fesetenv",
- "//libc:fesetround",
"//libc:hdr_fenv_macros",
"//libc:types_fenv_t",
"//libc/src/__support/FPUtil:fenv_impl",
"//libc/src/__support/macros/properties:os",
+ "//libc/src/fenv:fegetenv",
+ "//libc/src/fenv:fegetround",
+ "//libc/src/fenv:fesetenv",
+ "//libc/src/fenv:fesetround",
"//libc/test/UnitTest:fp_test_helpers",
],
)
>From 7c2b5e3eca0cb0aad42d80089ff1a4040a232e77 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:26 -0800
Subject: [PATCH 08/32] [bazel] Add subpackage for libc/src/link
---
.../llvm-project-overlay/libc/BUILD.bazel | 10 ++-----
.../libc/src/link/BUILD.bazel | 27 +++++++++++++++++++
.../libc/startup/linux/BUILD.bazel | 2 +-
3 files changed, 30 insertions(+), 9 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/link/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c12fece108a62..0415c079fce58 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2186,15 +2186,9 @@ alias(
################################ link targets ##################################
-libc_function(
+alias(
name = "_r_debug",
- srcs = ["src/link/_r_debug.cpp"],
- hdrs = ["src/link/_r_debug.h"],
- deps = [
- ":types_struct_r_debug",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/link:_r_debug",
)
################################ math targets ##################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/link/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/link/BUILD.bazel
new file mode 100644
index 0000000000000..43c70ee1d73cc
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/link/BUILD.bazel
@@ -0,0 +1,27 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "_r_debug",
+ srcs = ["_r_debug.cpp"],
+ hdrs = ["_r_debug.h"],
+ deps = [
+ "//libc:types_struct_r_debug",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
index e1780522f0799..854afd064355d 100644
--- a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
@@ -51,7 +51,6 @@ libc_startup_library(
deps = [
":gnu_property_section",
":irelative_hdr",
- "//libc:_r_debug",
"//libc:atexit",
"//libc:config_app_h",
"//libc:config_linux_app_h",
@@ -76,6 +75,7 @@ libc_startup_library(
"//libc/src/__support/threads:thread_headers",
"//libc/src/errno:program_invocation_name",
"//libc/src/errno:program_invocation_short_name",
+ "//libc/src/link:_r_debug",
] + selects.with_or({
PLATFORM_CPU_X86_64: [
"//libc/startup/linux/x86_64:irelative",
>From 7e5bd4ee036abb5472c20fa723b4916708821bbd Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:28 -0800
Subject: [PATCH 09/32] [bazel] Add subpackage for libc/src/poll
---
.../llvm-project-overlay/libc/BUILD.bazel | 14 ++-------
.../libc/src/poll/BUILD.bazel | 31 +++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 2 +-
3 files changed, 34 insertions(+), 13 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/poll/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 0415c079fce58..2dea8df642959 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4417,19 +4417,9 @@ libc_function(
],
)
-libc_function(
+alias(
name = "poll",
- srcs = ["src/poll/linux/poll.cpp"],
- hdrs = ["src/poll/poll.h"],
- deps = [
- ":types_nfds_t",
- ":types_struct_pollfd",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:poll",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/poll",
)
libc_support_library(
diff --git a/utils/bazel/llvm-project-overlay/libc/src/poll/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/poll/BUILD.bazel
new file mode 100644
index 0000000000000..5c06f7f5e62a3
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/poll/BUILD.bazel
@@ -0,0 +1,31 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "poll",
+ srcs = ["linux/poll.cpp"],
+ hdrs = ["poll.h"],
+ deps = [
+ "//libc:types_nfds_t",
+ "//libc:types_struct_pollfd",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:poll",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index 277fe5822dfcf..2da1b08e4e2e8 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -104,12 +104,12 @@ libc_test_library(
"//libc:llvm_libc_types_pid_t",
"//libc:llvm_libc_types_struct_pollfd",
"//libc:pipe",
- "//libc:poll",
"//libc:signal",
"//libc:stderr",
"//libc:stdout",
"//libc:strsignal",
"//libc:waitpid",
+ "//libc/src/poll",
],
"//conditions:default": [],
}) + select({
>From 8da84884817bf71807b54e4051fd560460371d03 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:29 -0800
Subject: [PATCH 10/32] [bazel] Add subpackage for libc/src/sched
---
.../llvm-project-overlay/libc/BUILD.bazel | 145 +++------------
.../libc/src/sched/BUILD.bazel | 172 ++++++++++++++++++
2 files changed, 194 insertions(+), 123 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sched/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 2dea8df642959..4702a9d11cfd9 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4099,160 +4099,59 @@ libc_function(
],
)
-libc_function(
+alias(
name = "getcpu",
- srcs = ["src/sched/linux/getcpu.cpp"],
- hdrs = ["src/sched/getcpu.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcpu",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:getcpu",
)
-libc_function(
+alias(
name = "sched_getcpu",
- srcs = ["src/sched/linux/sched_getcpu.cpp"],
- hdrs = ["src/sched/sched_getcpu.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcpu",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_getcpu",
)
-libc_function(
+alias(
name = "sched_get_priority_max",
- srcs = ["src/sched/linux/sched_get_priority_max.cpp"],
- hdrs = ["src/sched/sched_get_priority_max.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_get_priority_max",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_get_priority_max",
)
-libc_function(
+alias(
name = "sched_get_priority_min",
- srcs = ["src/sched/linux/sched_get_priority_min.cpp"],
- hdrs = ["src/sched/sched_get_priority_min.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_get_priority_min",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_get_priority_min",
)
-libc_function(
+alias(
name = "sched_getparam",
- srcs = ["src/sched/linux/sched_getparam.cpp"],
- hdrs = ["src/sched/sched_getparam.h"],
- deps = [
- ":types_pid_t",
- ":types_struct_sched_param",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_getparam",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_getparam",
)
-libc_function(
+alias(
name = "sched_getscheduler",
- srcs = ["src/sched/linux/sched_getscheduler.cpp"],
- hdrs = ["src/sched/sched_getscheduler.h"],
- deps = [
- ":types_pid_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_getscheduler",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_getscheduler",
)
-libc_function(
+alias(
name = "sched_rr_get_interval",
- srcs = ["src/sched/linux/sched_rr_get_interval.cpp"],
- hdrs = ["src/sched/sched_rr_get_interval.h"],
- deps = [
- ":types_pid_t",
- ":types_struct_timespec",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_rr_get_interval",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_rr_get_interval",
)
-libc_function(
+alias(
name = "sched_setaffinity",
- srcs = ["src/sched/linux/sched_setaffinity.cpp"],
- hdrs = ["src/sched/sched_setaffinity.h"],
- deps = [
- ":types_cpu_set_t",
- ":types_pid_t",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:span",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setaffinity",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_setaffinity",
)
-libc_function(
+alias(
name = "sched_setparam",
- srcs = ["src/sched/linux/sched_setparam.cpp"],
- hdrs = ["src/sched/sched_setparam.h"],
- deps = [
- ":types_pid_t",
- ":types_struct_sched_param",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setparam",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_setparam",
)
-libc_function(
+alias(
name = "sched_setscheduler",
- srcs = ["src/sched/linux/sched_setscheduler.cpp"],
- hdrs = ["src/sched/sched_setscheduler.h"],
- deps = [
- ":types_pid_t",
- ":types_struct_sched_param",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setscheduler",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_setscheduler",
)
-libc_function(
+alias(
name = "sched_yield",
- srcs = ["src/sched/linux/sched_yield.cpp"],
- hdrs = ["src/sched/sched_yield.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_yield",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sched:sched_yield",
)
libc_function(
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sched/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sched/BUILD.bazel
new file mode 100644
index 0000000000000..f68252601ba91
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sched/BUILD.bazel
@@ -0,0 +1,172 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "getcpu",
+ srcs = ["linux/getcpu.cpp"],
+ hdrs = ["getcpu.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcpu",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_getcpu",
+ srcs = ["linux/sched_getcpu.cpp"],
+ hdrs = ["sched_getcpu.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcpu",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_get_priority_max",
+ srcs = ["linux/sched_get_priority_max.cpp"],
+ hdrs = ["sched_get_priority_max.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_get_priority_max",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_get_priority_min",
+ srcs = ["linux/sched_get_priority_min.cpp"],
+ hdrs = ["sched_get_priority_min.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_get_priority_min",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_getparam",
+ srcs = ["linux/sched_getparam.cpp"],
+ hdrs = ["sched_getparam.h"],
+ deps = [
+ "//libc:types_pid_t",
+ "//libc:types_struct_sched_param",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_getparam",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_getscheduler",
+ srcs = ["linux/sched_getscheduler.cpp"],
+ hdrs = ["sched_getscheduler.h"],
+ deps = [
+ "//libc:types_pid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_getscheduler",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_rr_get_interval",
+ srcs = ["linux/sched_rr_get_interval.cpp"],
+ hdrs = ["sched_rr_get_interval.h"],
+ deps = [
+ "//libc:types_pid_t",
+ "//libc:types_struct_timespec",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_rr_get_interval",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_setaffinity",
+ srcs = ["linux/sched_setaffinity.cpp"],
+ hdrs = ["sched_setaffinity.h"],
+ deps = [
+ "//libc:types_cpu_set_t",
+ "//libc:types_pid_t",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:span",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setaffinity",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_setparam",
+ srcs = ["linux/sched_setparam.cpp"],
+ hdrs = ["sched_setparam.h"],
+ deps = [
+ "//libc:types_pid_t",
+ "//libc:types_struct_sched_param",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setparam",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_setscheduler",
+ srcs = ["linux/sched_setscheduler.cpp"],
+ hdrs = ["sched_setscheduler.h"],
+ deps = [
+ "//libc:types_pid_t",
+ "//libc:types_struct_sched_param",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_setscheduler",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sched_yield",
+ srcs = ["linux/sched_yield.cpp"],
+ hdrs = ["sched_yield.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sched_yield",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
>From c3bc553045ed0e5b78250ef7c15ec943b851546f Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:30 -0800
Subject: [PATCH 11/32] [bazel] Add subpackage for libc/src/signal
---
.../llvm-project-overlay/libc/BUILD.bazel | 100 ++-------------
.../libc/src/signal/BUILD.bazel | 118 ++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 4 +-
3 files changed, 129 insertions(+), 93 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/signal/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 4702a9d11cfd9..058563d16ba54 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3002,13 +3002,13 @@ libc_support_library(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":__signal_utils",
":types_struct_sigaction",
"//libc/src/__support:common",
"//libc/src/__support/OSUtil:exit",
"//libc/src/__support/OSUtil:linux_sigmask",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:raise",
"//libc/src/__support/macros:config",
+ "//libc/src/signal:__signal_utils",
],
)
@@ -4321,106 +4321,24 @@ alias(
actual = "//libc/src/poll",
)
-libc_support_library(
- name = "__restore_rt",
- srcs = ["src/signal/linux/__restore.cpp"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "__signal_utils",
- hdrs = ["src/signal/linux/signal_utils.h"],
- full_build_only = True,
- # Only compatible with full build mode on Linux. Overlay mode has header
- # conflicts with system headers (e.g. sa_handler macro in glibc).
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":__restore_rt",
- ":hdr_signal_macros",
- ":types_siginfo_t",
- ":types_sigset_t",
- ":types_size_t",
- ":types_struct_sigaction",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support/OSUtil:linux_sigmask",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil:vdso",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/threads:raw_rwlock",
- ],
-)
-
-libc_function(
+alias(
name = "kill",
- srcs = ["src/signal/linux/kill.cpp"],
- hdrs = ["src/signal/kill.h"],
- deps = [
- ":types_pid_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:kill",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/signal:kill",
)
-libc_function(
+alias(
name = "sigaction",
- srcs = ["src/signal/linux/sigaction.cpp"],
- hdrs = ["src/signal/sigaction.h"],
- # Full-build only, since it depends on __signal_utils.
- full_build_only = True,
- deps = [
- ":__signal_utils",
- ":types_struct_sigaction",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/signal:sigaction",
)
-libc_function(
+alias(
name = "sigaltstack",
- srcs = ["src/signal/linux/sigaltstack.cpp"],
- hdrs = ["src/signal/sigaltstack.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_errno_macros",
- ":hdr_signal_macros",
- ":types_stack_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sigaltstack",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/signal:sigaltstack",
)
-libc_function(
+alias(
name = "signal",
- srcs = ["src/signal/linux/signal.cpp"],
- hdrs = ["src/signal/signal.h"],
- # Full-build only, since it depends on sigaction.
- full_build_only = True,
- deps = [
- ":hdr_signal_macros",
- ":sigaction",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/signal",
)
libc_function(
diff --git a/utils/bazel/llvm-project-overlay/libc/src/signal/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/signal/BUILD.bazel
new file mode 100644
index 0000000000000..8a058091041f7
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/signal/BUILD.bazel
@@ -0,0 +1,118 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "__restore_rt",
+ srcs = ["linux/__restore.cpp"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "__signal_utils",
+ hdrs = ["linux/signal_utils.h"],
+ full_build_only = True,
+ # Only compatible with full build mode on Linux. Overlay mode has header
+ # conflicts with system headers (e.g. sa_handler macro in glibc).
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ ":__restore_rt",
+ "//libc:hdr_signal_macros",
+ "//libc:types_siginfo_t",
+ "//libc:types_sigset_t",
+ "//libc:types_size_t",
+ "//libc:types_struct_sigaction",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support/OSUtil:linux_sigmask",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil:vdso",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/threads:raw_rwlock",
+ ],
+)
+
+libc_function(
+ name = "kill",
+ srcs = ["linux/kill.cpp"],
+ hdrs = ["kill.h"],
+ deps = [
+ "//libc:types_pid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:kill",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "sigaction",
+ srcs = ["linux/sigaction.cpp"],
+ hdrs = ["sigaction.h"],
+ # Full-build only, since it depends on __signal_utils.
+ full_build_only = True,
+ deps = [
+ ":__signal_utils",
+ "//libc:types_struct_sigaction",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "sigaltstack",
+ srcs = ["linux/sigaltstack.cpp"],
+ hdrs = ["sigaltstack.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:hdr_signal_macros",
+ "//libc:types_stack_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sigaltstack",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "signal",
+ srcs = ["linux/signal.cpp"],
+ hdrs = ["signal.h"],
+ # Full-build only, since it depends on sigaction.
+ full_build_only = True,
+ deps = [
+ ":sigaction",
+ "//libc:hdr_signal_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index 2da1b08e4e2e8..aacf36b0406fb 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -97,19 +97,19 @@ libc_test_library(
"//libc:fflush",
"//libc:fork",
"//libc:getenv",
- "//libc:kill",
"//libc:llvm_libc_macros_poll_macros",
"//libc:llvm_libc_macros_signal_macros",
"//libc:llvm_libc_macros_sys_wait_macros",
"//libc:llvm_libc_types_pid_t",
"//libc:llvm_libc_types_struct_pollfd",
"//libc:pipe",
- "//libc:signal",
"//libc:stderr",
"//libc:stdout",
"//libc:strsignal",
"//libc:waitpid",
"//libc/src/poll",
+ "//libc/src/signal",
+ "//libc/src/signal:kill",
],
"//conditions:default": [],
}) + select({
>From 16ac92661bf220861d3d2a2e295857170687f748 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:31 -0800
Subject: [PATCH 12/32] [bazel] Add subpackage for libc/src/stdio
---
.../llvm-project-overlay/libc/BUILD.bazel | 521 ++--------------
.../libc/src/stdio/BUILD.bazel | 560 ++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 6 +-
.../libc/test/src/stdio/BUILD.bazel | 66 +--
.../libc/test/src/sys/socket/BUILD.bazel | 8 +-
5 files changed, 651 insertions(+), 510 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/stdio/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 058563d16ba54..d963eee68c8b7 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2839,11 +2839,11 @@ libc_function(
# Full-build only, as overlay mode must use the host libc's cleanup.
full_build_only = True,
deps = [
- ":fflush_internal",
"//libc/src/__support:common",
"//libc/src/__support/OSUtil:exit",
"//libc/src/__support/macros:config",
"//libc/src/__support/threads:thread_headers",
+ "//libc/src/stdio:fflush_internal",
],
)
@@ -4782,548 +4782,129 @@ libc_function(
################################ stdio targets #################################
-libc_support_library(
- name = "stdin",
- srcs = ["src/stdio/linux/stdin.cpp"],
- hdrs = ["src/stdio/stdin.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:common",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "stdout",
- srcs = ["src/stdio/linux/stdout.cpp"],
- hdrs = ["src/stdio/stdout.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:common",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "stderr",
- srcs = ["src/stdio/linux/stderr.cpp"],
- hdrs = ["src/stdio/stderr.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:common",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "fflush_internal",
- srcs = ["src/stdio/generic/fflush_internal.cpp"],
- hdrs = ["src/stdio/fflush_internal.h"],
- deps = [
- ":stderr",
- ":stdin",
- ":stdout",
- ":types_FILE",
- "//libc/src/__support:error_or",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_function(
+alias(
name = "fflush",
- srcs = ["src/stdio/fflush.cpp"],
- hdrs = ["src/stdio/fflush.h"],
- deps = [
- ":fflush_internal",
- ":hdr_stdio_macros",
- ":types_FILE",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:fflush",
)
-libc_function(
+alias(
name = "fclose",
- srcs = ["src/stdio/generic/fclose.cpp"],
- hdrs = ["src/stdio/fclose.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:fclose",
)
-libc_function(
+alias(
name = "fopen",
- srcs = ["src/stdio/generic/fopen.cpp"],
- hdrs = ["src/stdio/fopen.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/stdio:fopen",
)
-libc_function(
+alias(
name = "fread",
- srcs = ["src/stdio/generic/fread.cpp"],
- hdrs = ["src/stdio/fread.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:fread",
)
-libc_function(
+alias(
name = "fwrite",
- srcs = ["src/stdio/generic/fwrite.cpp"],
- hdrs = ["src/stdio/fwrite.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:fwrite",
)
-libc_function(
+alias(
name = "feof",
- srcs = ["src/stdio/generic/feof.cpp"],
- hdrs = ["src/stdio/feof.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:feof",
)
-libc_function(
+alias(
name = "ferror",
- srcs = ["src/stdio/generic/ferror.cpp"],
- hdrs = ["src/stdio/ferror.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support/File:file",
- "//libc/src/__support/File:platform_file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:ferror",
)
-libc_function(
+alias(
name = "asprintf",
- srcs = ["src/stdio/asprintf.cpp"],
- hdrs = ["src/stdio/asprintf.h"],
- deps = [
- "//libc/src/__support:arg_list",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:vasprintf_internal",
- ],
+ actual = "//libc/src/stdio:asprintf",
)
-libc_function(
+alias(
name = "sprintf",
- srcs = ["src/stdio/sprintf.cpp"],
- hdrs = ["src/stdio/sprintf.h"],
- deps = [
- "//libc/src/__support:arg_list",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:printf_main",
- "//libc/src/__support/printf_core:printf_writer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:sprintf",
)
-libc_function(
+alias(
name = "snprintf",
- srcs = ["src/stdio/snprintf.cpp"],
- hdrs = ["src/stdio/snprintf.h"],
- deps = [
- "//libc/src/__support:arg_list",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:printf_main",
- "//libc/src/__support/printf_core:printf_writer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:snprintf",
)
-libc_function(
+alias(
name = "printf",
- srcs = ["src/stdio/generic/printf.cpp"],
- hdrs = ["src/stdio/printf.h"],
- deps = [
- ":stdout",
- ":types_FILE",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:vfprintf_internal",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:printf",
)
-libc_function(
+alias(
name = "fprintf",
- srcs = ["src/stdio/generic/fprintf.cpp"],
- hdrs = ["src/stdio/fprintf.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:vfprintf_internal",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:fprintf",
)
-libc_function(
+alias(
name = "vasprintf",
- srcs = ["src/stdio/vasprintf.cpp"],
- hdrs = ["src/stdio/vasprintf.h"],
- deps = [
- "//libc/src/__support:arg_list",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:vasprintf_internal",
- ],
+ actual = "//libc/src/stdio:vasprintf",
)
-libc_function(
+alias(
name = "vsprintf",
- srcs = ["src/stdio/vsprintf.cpp"],
- hdrs = ["src/stdio/vsprintf.h"],
- deps = [
- "//libc/src/__support:arg_list",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:printf_main",
- "//libc/src/__support/printf_core:printf_writer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:vsprintf",
)
-libc_function(
+alias(
name = "vsnprintf",
- srcs = ["src/stdio/vsnprintf.cpp"],
- hdrs = ["src/stdio/vsnprintf.h"],
- deps = [
- "//libc/src/__support:arg_list",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:printf_main",
- "//libc/src/__support/printf_core:printf_writer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:vsnprintf",
)
-libc_function(
+alias(
name = "vprintf",
- srcs = ["src/stdio/generic/vprintf.cpp"],
- hdrs = ["src/stdio/vprintf.h"],
- deps = [
- ":stdout",
- ":types_FILE",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:vfprintf_internal",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:vprintf",
)
-libc_function(
+alias(
name = "vfprintf",
- srcs = ["src/stdio/generic/vfprintf.cpp"],
- hdrs = ["src/stdio/vfprintf.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:vfprintf_internal",
- "//libc/src/errno",
- ],
-)
-
-libc_support_library(
- name = "scanf_config",
- hdrs = ["src/stdio/scanf_core/scanf_config.h"],
-)
-
-libc_support_library(
- name = "scanf_core_structs",
- hdrs = ["src/stdio/scanf_core/core_structs.h"],
- deps = [
- ":scanf_config",
- "//libc/src/__support/CPP:bitset",
- "//libc/src/__support/CPP:string_view",
- "//libc/src/__support/FPUtil:fp_bits",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "scanf_parser",
- hdrs = ["src/stdio/scanf_core/parser.h"],
- deps = [
- ":scanf_config",
- ":scanf_core_structs",
- "//libc/src/__support:arg_list",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/CPP:algorithm",
- "//libc/src/__support/CPP:bitset",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "scanf_reader",
- hdrs = ["src/stdio/scanf_core/reader.h"],
- deps = [
- ":types_FILE",
- "//libc/src/__support/CPP:string_view",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "scanf_string_reader",
- hdrs = ["src/stdio/scanf_core/string_reader.h"],
- deps = [
- ":scanf_reader",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "scanf_converter",
- srcs = [
- "src/stdio/scanf_core/converter_utils.h",
- "src/stdio/scanf_core/current_pos_converter.h",
- "src/stdio/scanf_core/float_converter.h",
- "src/stdio/scanf_core/int_converter.h",
- "src/stdio/scanf_core/ptr_converter.h",
- "src/stdio/scanf_core/string_converter.h",
- ],
- hdrs = ["src/stdio/scanf_core/converter.h"],
- deps = [
- ":scanf_core_structs",
- ":scanf_reader",
- "//libc/src/__support:char_vector",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support:str_to_float",
- "//libc/src/__support/CPP:bitset",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/CPP:string_view",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:vfprintf",
)
-libc_support_library(
- name = "scanf_main",
- hdrs = ["src/stdio/scanf_core/scanf_main.h"],
- deps = [
- ":scanf_config",
- ":scanf_converter",
- ":scanf_core_structs",
- ":scanf_parser",
- ":scanf_reader",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "vfscanf_internal",
- hdrs = ["src/stdio/scanf_core/vfscanf_internal.h"],
- deps = [
- ":scanf_main",
- ":scanf_reader",
- ":types_FILE",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:architectures",
- ],
-)
-
-libc_function(
+alias(
name = "scanf",
- srcs = ["src/stdio/generic/scanf.cpp"],
- hdrs = ["src/stdio/scanf.h"],
- deps = [
- ":stdin",
- ":types_FILE",
- ":vfscanf_internal",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:scanf",
)
-libc_function(
+alias(
name = "vscanf",
- srcs = ["src/stdio/generic/vscanf.cpp"],
- hdrs = ["src/stdio/vscanf.h"],
- deps = [
- ":stdin",
- ":types_FILE",
- ":vfscanf_internal",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:vscanf",
)
-libc_function(
+alias(
name = "fscanf",
- srcs = ["src/stdio/generic/fscanf.cpp"],
- hdrs = ["src/stdio/fscanf.h"],
- deps = [
- ":types_FILE",
- ":vfscanf_internal",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:fscanf",
)
-libc_function(
+alias(
name = "vfscanf",
- srcs = ["src/stdio/generic/vfscanf.cpp"],
- hdrs = ["src/stdio/vfscanf.h"],
- deps = [
- ":types_FILE",
- ":vfscanf_internal",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:vfscanf",
)
-libc_function(
+alias(
name = "sscanf",
- srcs = ["src/stdio/sscanf.cpp"],
- hdrs = ["src/stdio/sscanf.h"],
- deps = [
- ":hdr_stdio_macros",
- ":scanf_main",
- ":scanf_string_reader",
- ":types_FILE",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:sscanf",
)
-libc_function(
+alias(
name = "vsscanf",
- srcs = ["src/stdio/vsscanf.cpp"],
- hdrs = ["src/stdio/vsscanf.h"],
- deps = [
- ":hdr_stdio_macros",
- ":scanf_main",
- ":scanf_string_reader",
- ":types_FILE",
- "//libc/src/__support:arg_list",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/File:file",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdio:vsscanf",
)
-libc_function(
+alias(
name = "remove",
- srcs = ["src/stdio/linux/remove.cpp"],
- hdrs = ["src/stdio/remove.h"],
- deps = [
- ":hdr_errno_macros",
- ":hdr_fcntl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlinkat",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:remove",
)
-libc_function(
+alias(
name = "rename",
- srcs = ["src/stdio/linux/rename.cpp"],
- hdrs = ["src/stdio/rename.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_fcntl_macros",
- ":llvm_libc_macros_fcntl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:rename",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdio:rename",
)
############################### sys/mman targets ###############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/stdio/BUILD.bazel
new file mode 100644
index 0000000000000..ea3cba8fa9533
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/stdio/BUILD.bazel
@@ -0,0 +1,560 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "stdin",
+ srcs = ["linux/stdin.cpp"],
+ hdrs = ["stdin.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:common",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "stdout",
+ srcs = ["linux/stdout.cpp"],
+ hdrs = ["stdout.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:common",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "stderr",
+ srcs = ["linux/stderr.cpp"],
+ hdrs = ["stderr.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:common",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "fflush_internal",
+ srcs = ["generic/fflush_internal.cpp"],
+ hdrs = ["fflush_internal.h"],
+ deps = [
+ ":stderr",
+ ":stdin",
+ ":stdout",
+ "//libc:types_FILE",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fflush",
+ srcs = ["fflush.cpp"],
+ hdrs = ["fflush.h"],
+ deps = [
+ ":fflush_internal",
+ "//libc:hdr_stdio_macros",
+ "//libc:types_FILE",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "fclose",
+ srcs = ["generic/fclose.cpp"],
+ hdrs = ["fclose.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fopen",
+ srcs = ["generic/fopen.cpp"],
+ hdrs = ["fopen.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "fread",
+ srcs = ["generic/fread.cpp"],
+ hdrs = ["fread.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fwrite",
+ srcs = ["generic/fwrite.cpp"],
+ hdrs = ["fwrite.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "feof",
+ srcs = ["generic/feof.cpp"],
+ hdrs = ["feof.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "ferror",
+ srcs = ["generic/ferror.cpp"],
+ hdrs = ["ferror.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/File:platform_file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "asprintf",
+ srcs = ["asprintf.cpp"],
+ hdrs = ["asprintf.h"],
+ deps = [
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:vasprintf_internal",
+ ],
+)
+
+libc_function(
+ name = "sprintf",
+ srcs = ["sprintf.cpp"],
+ hdrs = ["sprintf.h"],
+ deps = [
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:printf_main",
+ "//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "snprintf",
+ srcs = ["snprintf.cpp"],
+ hdrs = ["snprintf.h"],
+ deps = [
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:printf_main",
+ "//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "printf",
+ srcs = ["generic/printf.cpp"],
+ hdrs = ["printf.h"],
+ deps = [
+ ":stdout",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "fprintf",
+ srcs = ["generic/fprintf.cpp"],
+ hdrs = ["fprintf.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "vasprintf",
+ srcs = ["vasprintf.cpp"],
+ hdrs = ["vasprintf.h"],
+ deps = [
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:vasprintf_internal",
+ ],
+)
+
+libc_function(
+ name = "vsprintf",
+ srcs = ["vsprintf.cpp"],
+ hdrs = ["vsprintf.h"],
+ deps = [
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:printf_main",
+ "//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "vsnprintf",
+ srcs = ["vsnprintf.cpp"],
+ hdrs = ["vsnprintf.h"],
+ deps = [
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:printf_main",
+ "//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "vprintf",
+ srcs = ["generic/vprintf.cpp"],
+ hdrs = ["vprintf.h"],
+ deps = [
+ ":stdout",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "vfprintf",
+ srcs = ["generic/vfprintf.cpp"],
+ hdrs = ["vfprintf.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:vfprintf_internal",
+ "//libc/src/errno",
+ ],
+)
+
+libc_support_library(
+ name = "scanf_config",
+ hdrs = ["scanf_core/scanf_config.h"],
+)
+
+libc_support_library(
+ name = "scanf_core_structs",
+ hdrs = ["scanf_core/core_structs.h"],
+ deps = [
+ ":scanf_config",
+ "//libc/src/__support/CPP:bitset",
+ "//libc/src/__support/CPP:string_view",
+ "//libc/src/__support/FPUtil:fp_bits",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "scanf_parser",
+ hdrs = ["scanf_core/parser.h"],
+ deps = [
+ ":scanf_config",
+ ":scanf_core_structs",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/CPP:algorithm",
+ "//libc/src/__support/CPP:bitset",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "scanf_reader",
+ hdrs = ["scanf_core/reader.h"],
+ deps = [
+ "//libc:types_FILE",
+ "//libc/src/__support/CPP:string_view",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "scanf_string_reader",
+ hdrs = ["scanf_core/string_reader.h"],
+ deps = [
+ ":scanf_reader",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "scanf_converter",
+ srcs = [
+ "scanf_core/converter_utils.h",
+ "scanf_core/current_pos_converter.h",
+ "scanf_core/float_converter.h",
+ "scanf_core/int_converter.h",
+ "scanf_core/ptr_converter.h",
+ "scanf_core/string_converter.h",
+ ],
+ hdrs = ["scanf_core/converter.h"],
+ deps = [
+ ":scanf_core_structs",
+ ":scanf_reader",
+ "//libc/src/__support:char_vector",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support:str_to_float",
+ "//libc/src/__support/CPP:bitset",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/CPP:string_view",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "scanf_main",
+ hdrs = ["scanf_core/scanf_main.h"],
+ deps = [
+ ":scanf_config",
+ ":scanf_converter",
+ ":scanf_core_structs",
+ ":scanf_parser",
+ ":scanf_reader",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "vfscanf_internal",
+ hdrs = ["scanf_core/vfscanf_internal.h"],
+ deps = [
+ ":scanf_main",
+ ":scanf_reader",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:architectures",
+ ],
+)
+
+libc_function(
+ name = "scanf",
+ srcs = ["generic/scanf.cpp"],
+ hdrs = ["scanf.h"],
+ deps = [
+ ":stdin",
+ ":vfscanf_internal",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "vscanf",
+ srcs = ["generic/vscanf.cpp"],
+ hdrs = ["vscanf.h"],
+ deps = [
+ ":stdin",
+ ":vfscanf_internal",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fscanf",
+ srcs = ["generic/fscanf.cpp"],
+ hdrs = ["fscanf.h"],
+ deps = [
+ ":vfscanf_internal",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "vfscanf",
+ srcs = ["generic/vfscanf.cpp"],
+ hdrs = ["vfscanf.h"],
+ deps = [
+ ":vfscanf_internal",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "sscanf",
+ srcs = ["sscanf.cpp"],
+ hdrs = ["sscanf.h"],
+ deps = [
+ ":scanf_main",
+ ":scanf_string_reader",
+ "//libc:hdr_stdio_macros",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "vsscanf",
+ srcs = ["vsscanf.cpp"],
+ hdrs = ["vsscanf.h"],
+ deps = [
+ ":scanf_main",
+ ":scanf_string_reader",
+ "//libc:hdr_stdio_macros",
+ "//libc:types_FILE",
+ "//libc/src/__support:arg_list",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/File:file",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "remove",
+ srcs = ["linux/remove.cpp"],
+ hdrs = ["remove.h"],
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:hdr_fcntl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlinkat",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "rename",
+ srcs = ["linux/rename.cpp"],
+ hdrs = ["rename.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:llvm_libc_macros_fcntl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:rename",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index aacf36b0406fb..6577b24d7b434 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -94,7 +94,6 @@ libc_test_library(
"//libc:full_build": [
"//libc:close",
"//libc:exit",
- "//libc:fflush",
"//libc:fork",
"//libc:getenv",
"//libc:llvm_libc_macros_poll_macros",
@@ -103,13 +102,14 @@ libc_test_library(
"//libc:llvm_libc_types_pid_t",
"//libc:llvm_libc_types_struct_pollfd",
"//libc:pipe",
- "//libc:stderr",
- "//libc:stdout",
"//libc:strsignal",
"//libc:waitpid",
"//libc/src/poll",
"//libc/src/signal",
"//libc/src/signal:kill",
+ "//libc/src/stdio:fflush",
+ "//libc/src/stdio:stderr",
+ "//libc/src/stdio:stdout",
],
"//conditions:default": [],
}) + select({
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
index 6fa463903585b..3c30a7f39beb0 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
@@ -14,9 +14,9 @@ libc_test(
name = "asprintf_test",
srcs = ["asprintf_test.cpp"],
deps = [
- "//libc:asprintf",
"//libc:memset",
- "//libc:sprintf",
+ "//libc/src/stdio:asprintf",
+ "//libc/src/stdio:sprintf",
],
)
@@ -25,10 +25,10 @@ libc_test(
srcs = ["sprintf_test.cpp"],
deps = [
"//libc:hdr_wchar_macros",
- "//libc:sprintf",
"//libc:types_wint_t",
"//libc/src/__support/FPUtil:fp_bits",
"//libc/src/__support/printf_core:printf_config",
+ "//libc/src/stdio:sprintf",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -37,8 +37,8 @@ libc_test(
name = "snprintf_test",
srcs = ["snprintf_test.cpp"],
deps = [
- "//libc:snprintf",
"//libc/src/__support/CPP:limits",
+ "//libc/src/stdio:snprintf",
],
)
@@ -46,7 +46,7 @@ libc_test(
name = "printf_test",
srcs = ["printf_test.cpp"],
deps = [
- "//libc:printf",
+ "//libc/src/stdio:printf",
],
)
@@ -54,15 +54,15 @@ libc_test(
name = "fprintf_test",
srcs = ["fprintf_test.cpp"],
deps = [
- "//libc:fprintf",
"//libc/src/__support/CPP:limits",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/stdio:fprintf",
] + select({
"//libc:full_build": [
- "//libc:fclose",
- "//libc:ferror",
- "//libc:fopen",
- "//libc:fread",
+ "//libc/src/stdio:fclose",
+ "//libc/src/stdio:ferror",
+ "//libc/src/stdio:fopen",
+ "//libc/src/stdio:fread",
],
"//conditions:default": [],
}),
@@ -73,7 +73,7 @@ libc_test(
srcs = ["vasprintf_test.cpp"],
deps = [
"//libc:memset",
- "//libc:vasprintf",
+ "//libc/src/stdio:vasprintf",
],
)
@@ -81,7 +81,7 @@ libc_test(
name = "vsprintf_test",
srcs = ["vsprintf_test.cpp"],
deps = [
- "//libc:vsprintf",
+ "//libc/src/stdio:vsprintf",
],
)
@@ -89,7 +89,7 @@ libc_test(
name = "vsnprintf_test",
srcs = ["vsnprintf_test.cpp"],
deps = [
- "//libc:vsnprintf",
+ "//libc/src/stdio:vsnprintf",
],
)
@@ -97,7 +97,7 @@ libc_test(
name = "vprintf_test",
srcs = ["vprintf_test.cpp"],
deps = [
- "//libc:vprintf",
+ "//libc/src/stdio:vprintf",
],
)
@@ -105,13 +105,13 @@ libc_test(
name = "vfprintf_test",
srcs = ["vfprintf_test.cpp"],
deps = [
- "//libc:vfprintf",
+ "//libc/src/stdio:vfprintf",
] + select({
"//libc:full_build": [
- "//libc:fclose",
- "//libc:ferror",
- "//libc:fopen",
- "//libc:fread",
+ "//libc/src/stdio:fclose",
+ "//libc/src/stdio:ferror",
+ "//libc/src/stdio:fopen",
+ "//libc/src/stdio:fread",
],
"//conditions:default": [],
}),
@@ -125,8 +125,8 @@ libc_test(
"//libc:close",
"//libc:hdr_sys_stat_macros",
"//libc:mkdirat",
- "//libc:remove",
"//libc/src/fcntl:open",
+ "//libc/src/stdio:remove",
],
)
@@ -135,9 +135,9 @@ libc_test(
srcs = ["sscanf_test.cpp"],
deps = [
"//libc:hdr_stdio_macros",
- "//libc:sscanf",
"//libc/src/__support/CPP:limits",
"//libc/src/__support/FPUtil:fp_bits",
+ "//libc/src/stdio:sscanf",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -146,16 +146,16 @@ libc_test(
name = "fscanf_test",
srcs = ["fscanf_test.cpp"],
deps = [
- "//libc:fscanf",
"//libc:hdr_stdio_macros",
"//libc/src/__support/CPP:string_view",
+ "//libc/src/stdio:fscanf",
] + select({
"//libc:full_build": [
- "//libc:fclose",
- "//libc:feof",
- "//libc:ferror",
- "//libc:fopen",
- "//libc:fwrite",
+ "//libc/src/stdio:fclose",
+ "//libc/src/stdio:feof",
+ "//libc/src/stdio:ferror",
+ "//libc/src/stdio:fopen",
+ "//libc/src/stdio:fwrite",
],
"//conditions:default": [],
}),
@@ -165,7 +165,7 @@ libc_test(
name = "vsscanf_test",
srcs = ["vsscanf_test.cpp"],
deps = [
- "//libc:vsscanf",
+ "//libc/src/stdio:vsscanf",
],
)
@@ -173,14 +173,14 @@ libc_test(
name = "vfscanf_test",
srcs = ["vfscanf_test.cpp"],
deps = [
- "//libc:vfscanf",
"//libc/src/__support/CPP:string_view",
+ "//libc/src/stdio:vfscanf",
] + select({
"//libc:full_build": [
- "//libc:fclose",
- "//libc:ferror",
- "//libc:fopen",
- "//libc:fwrite",
+ "//libc/src/stdio:fclose",
+ "//libc/src/stdio:ferror",
+ "//libc/src/stdio:fopen",
+ "//libc/src/stdio:fwrite",
],
"//conditions:default": [],
}),
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
index c0c5e3f6be457..e021f5c391b67 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
@@ -41,7 +41,6 @@ libc_test(
"//libc:getsockname",
"//libc:hdr_netinet_in_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:remove",
"//libc:socket",
"//libc:types_sa_family_t",
"//libc:types_struct_sockaddr_in",
@@ -49,6 +48,7 @@ libc_test(
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
"//libc/src/arpa/inet:htonl",
+ "//libc/src/stdio:remove",
],
)
@@ -65,7 +65,6 @@ libc_test(
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
"//libc:listen",
- "//libc:remove",
"//libc:socket",
"//libc:types_sa_family_t",
"//libc:types_size_t",
@@ -73,6 +72,7 @@ libc_test(
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
"//libc/src/fcntl",
+ "//libc/src/stdio:remove",
],
)
@@ -85,10 +85,10 @@ libc_test(
"//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc:listen",
- "//libc:remove",
"//libc:socket",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
+ "//libc/src/stdio:remove",
],
)
@@ -257,11 +257,11 @@ libc_test(
"//libc:getsockname",
"//libc:hdr_sys_socket_macros",
"//libc:listen",
- "//libc:remove",
"//libc:socket",
"//libc:types_sa_family_t",
"//libc:types_socklen_t",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
+ "//libc/src/stdio:remove",
],
)
>From 984c628ba06e21baaaf5e155a79010417aa97499 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:33 -0800
Subject: [PATCH 13/32] [bazel] Add subpackage for libc/src/stdlib
---
.../llvm-project-overlay/libc/BUILD.bazel | 496 +++-------------
.../libc/src/compiler/BUILD.bazel | 2 +-
.../libc/src/stdlib/BUILD.bazel | 544 ++++++++++++++++++
.../libc/startup/linux/BUILD.bazel | 4 +-
.../libc/test/UnitTest/BUILD.bazel | 6 +-
.../libc/test/src/math/BUILD.bazel | 68 +--
.../libc/test/src/stdlib/BUILD.bazel | 62 +-
7 files changed, 679 insertions(+), 503 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index d963eee68c8b7..8e56f0b289a95 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2788,532 +2788,164 @@ bit_prefix_list = [
############################### stdlib targets ###############################
-libc_support_library(
- name = "stdlib_exit_handler",
- hdrs = ["src/stdlib/exit_handler.h"],
- # Full-build only, as overlay mode must use the host libc's cleanup.
- full_build_only = True,
- deps = [
- "//libc/src/__support:blockstore",
- "//libc/src/__support:common",
- "//libc/src/__support:fixedvector",
- "//libc/src/__support/CPP:mutex",
- "//libc/src/__support/CPP:new",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/threads:mutex",
- ],
-)
-
-libc_function(
+alias(
name = "_Exit",
- srcs = ["src/stdlib/_Exit.cpp"],
- hdrs = ["src/stdlib/_Exit.h"],
- # Full-build only, as overlay mode must use the host libc's cleanup.
- full_build_only = True,
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil:exit",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:_Exit",
)
-libc_function(
+alias(
name = "atexit",
- srcs = ["src/stdlib/atexit.cpp"],
- hdrs = ["src/stdlib/atexit.h"],
- # Full-build only, as overlay mode must use the host libc's cleanup.
- full_build_only = True,
- deps = [
- ":stdlib_exit_handler",
- ":types_atexithandler_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:atexit",
)
-libc_function(
+alias(
name = "exit",
- srcs = ["src/stdlib/exit.cpp"],
- hdrs = ["src/stdlib/exit.h"],
- # Full-build only, as overlay mode must use the host libc's cleanup.
- full_build_only = True,
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil:exit",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/threads:thread_headers",
- "//libc/src/stdio:fflush_internal",
- ],
+ actual = "//libc/src/stdlib:exit",
)
-libc_function(
+alias(
name = "abs",
- srcs = ["src/stdlib/abs.cpp"],
- hdrs = ["src/stdlib/abs.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:integer_operations",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:abs",
)
-libc_function(
+alias(
name = "labs",
- srcs = ["src/stdlib/labs.cpp"],
- hdrs = ["src/stdlib/labs.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:integer_operations",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:labs",
)
-libc_function(
+alias(
name = "llabs",
- srcs = ["src/stdlib/llabs.cpp"],
- hdrs = ["src/stdlib/llabs.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:integer_operations",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:llabs",
)
-libc_function(
+alias(
name = "div",
- srcs = ["src/stdlib/div.cpp"],
- hdrs = ["src/stdlib/div.h"],
- deps = [
- ":types_div_t",
- "//libc/src/__support:common",
- "//libc/src/__support:integer_operations",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:div",
)
-libc_function(
+alias(
name = "ldiv",
- srcs = ["src/stdlib/ldiv.cpp"],
- hdrs = ["src/stdlib/ldiv.h"],
- deps = [
- ":types_ldiv_t",
- "//libc/src/__support:common",
- "//libc/src/__support:integer_operations",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:ldiv",
)
-libc_function(
+alias(
name = "lldiv",
- srcs = ["src/stdlib/lldiv.cpp"],
- hdrs = ["src/stdlib/lldiv.h"],
- deps = [
- ":types_lldiv_t",
- "//libc/src/__support:common",
- "//libc/src/__support:integer_operations",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:lldiv",
)
-libc_function(
+alias(
name = "atoi",
- srcs = ["src/stdlib/atoi.cpp"],
- hdrs = ["src/stdlib/atoi.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:atoi",
)
-libc_function(
+alias(
name = "atol",
- srcs = ["src/stdlib/atol.cpp"],
- hdrs = ["src/stdlib/atol.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:atol",
)
-libc_function(
+alias(
name = "atoll",
- srcs = ["src/stdlib/atoll.cpp"],
- hdrs = ["src/stdlib/atoll.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:atoll",
)
-libc_function(
+alias(
name = "atof",
- srcs = ["src/stdlib/atof.cpp"],
- hdrs = ["src/stdlib/atof.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_float",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:atof",
)
-libc_function(
+alias(
name = "bsearch",
- srcs = ["src/stdlib/bsearch.cpp"],
- hdrs = ["src/stdlib/bsearch.h"],
- deps = [
- ":hdr_stdint_proxy",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "stdlib_abort_utils",
- hdrs = ["src/stdlib/abort_utils.h"],
- deps = [
- "//libc/src/__support/macros/properties:architectures",
- ] + select({
- "@platforms//os:linux": [
- ":stdlib_linux_abort_utils",
- ],
- "//conditions:default": [],
- }),
+ actual = "//libc/src/stdlib:bsearch",
)
-libc_support_library(
- name = "stdlib_linux_abort_utils",
- hdrs = ["src/stdlib/linux/abort_utils.h"],
- full_build_only = True,
- # Full-build only, as overlay mode must use the host libc's cleanup.
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_struct_sigaction",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil:exit",
- "//libc/src/__support/OSUtil:linux_sigmask",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:raise",
- "//libc/src/__support/macros:config",
- "//libc/src/signal:__signal_utils",
- ],
-)
-
-libc_function(
+alias(
name = "abort",
- srcs = ["src/stdlib/abort.cpp"],
- hdrs = ["src/stdlib/abort.h"],
- # Full-build only, as overlay mode must use the host libc's abort.
- full_build_only = True,
- deps = [
- ":stdlib_abort_utils",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:abort",
)
-libc_support_library(
- name = "stdlib_environ_internal",
- srcs = ["src/stdlib/environ_internal.cpp"],
- hdrs = ["src/stdlib/environ_internal.h"],
- deps = [
- ":config_app_h",
- ":environ",
- ":string_memory_utils",
- ":types_size_t",
- "//libc/src/__support:checked_ptr",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:new",
- "//libc/src/__support/CPP:optional",
- "//libc/src/__support/CPP:string_view",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_function(
+alias(
name = "getenv",
- srcs = ["src/stdlib/getenv.cpp"],
- hdrs = ["src/stdlib/getenv.h"],
- deps = [
- ":stdlib_environ_internal",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:getenv",
)
-libc_support_library(
- name = "qsort_util",
- hdrs = [
- "src/stdlib/heap_sort.h",
- "src/stdlib/qsort_data.h",
- "src/stdlib/qsort_pivot.h",
- "src/stdlib/qsort_util.h",
- "src/stdlib/quick_sort.h",
- ],
- deps = [
- ":hdr_stdint_proxy",
- ":string_memory_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/CPP:cstddef",
- "//libc/src/__support/CPP:utility",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_function(
+alias(
name = "qsort",
- srcs = ["src/stdlib/qsort.cpp"],
- hdrs = ["src/stdlib/qsort.h"],
- deps = [
- ":hdr_stdint_proxy",
- ":qsort_util",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:qsort",
)
-libc_function(
+alias(
name = "qsort_r",
- srcs = ["src/stdlib/qsort_r.cpp"],
- hdrs = ["src/stdlib/qsort_r.h"],
- deps = [
- ":hdr_stdint_proxy",
- ":qsort_util",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "rand_util",
- srcs = ["src/stdlib/rand_util.cpp"],
- hdrs = ["src/stdlib/rand_util.h"],
- deps = [
- "//libc/src/__support/CPP:atomic",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:qsort_r",
)
-libc_function(
+alias(
name = "rand",
- srcs = ["src/stdlib/rand.cpp"],
- hdrs = ["src/stdlib/rand.h"],
- deps = [
- ":hdr_stdlib_macros",
- ":rand_util",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/threads:sleep",
- ],
+ actual = "//libc/src/stdlib:rand",
)
-libc_function(
+alias(
name = "realpath",
- srcs = ["src/stdlib/linux/realpath.cpp"],
- hdrs = ["src/stdlib/realpath.h"],
- deps = [
- ":hdr_errno_macros",
- ":hdr_fcntl_macros",
- ":hdr_limits_macros",
- ":hdr_sys_stat_macros",
- ":string_memory_utils",
- ":types_mode_t",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:optional",
- "//libc/src/__support/CPP:string",
- "//libc/src/__support/CPP:string_view",
- "//libc/src/__support/OSUtil:linux_stat_kernel_statx_types",
- "//libc/src/__support/OSUtil:path",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcwd",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:readlink",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:statx",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:realpath",
)
-libc_function(
+alias(
name = "srand",
- srcs = ["src/stdlib/srand.cpp"],
- hdrs = ["src/stdlib/srand.h"],
- deps = [
- ":rand_util",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
-)
-
-libc_support_library(
- name = "str_from_util",
- hdrs = ["src/stdlib/str_from_util.h"],
- deps = [
- ":types_size_t",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/CPP:type_traits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/printf_core:printf_converter",
- "//libc/src/__support/printf_core:printf_core_structs",
- "//libc/src/__support/printf_core:printf_error_mapper",
- "//libc/src/__support/printf_core:printf_writer",
- ],
+ actual = "//libc/src/stdlib:srand",
)
-libc_function(
+alias(
name = "strfromf",
- srcs = ["src/stdlib/strfromf.cpp"],
- hdrs = ["src/stdlib/strfromf.h"],
- deps = [
- ":str_from_util",
- ":types_size_t",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:strfromf",
)
-libc_function(
+alias(
name = "strfromf128",
- srcs = ["src/stdlib/strfromf128.cpp"],
- hdrs = ["src/stdlib/strfromf128.h"],
- deps = [
- ":llvm_libc_types_float128",
- ":str_from_util",
- ":types_size_t",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:strfromf128",
)
-libc_function(
+alias(
name = "strfromd",
- srcs = ["src/stdlib/strfromd.cpp"],
- hdrs = ["src/stdlib/strfromd.h"],
- deps = [
- ":str_from_util",
- ":types_size_t",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:strfromd",
)
-libc_function(
+alias(
name = "strfroml",
- srcs = ["src/stdlib/strfroml.cpp"],
- hdrs = ["src/stdlib/strfroml.h"],
- deps = [
- ":str_from_util",
- ":types_size_t",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/stdlib:strfroml",
)
-libc_function(
+alias(
name = "strtol",
- srcs = ["src/stdlib/strtol.cpp"],
- hdrs = ["src/stdlib/strtol.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:strtol",
)
-libc_function(
+alias(
name = "strtoll",
- srcs = ["src/stdlib/strtoll.cpp"],
- hdrs = ["src/stdlib/strtoll.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:strtoll",
)
-libc_function(
+alias(
name = "strtoul",
- srcs = ["src/stdlib/strtoul.cpp"],
- hdrs = ["src/stdlib/strtoul.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:strtoul",
)
-libc_function(
+alias(
name = "strtoull",
- srcs = ["src/stdlib/strtoull.cpp"],
- hdrs = ["src/stdlib/strtoull.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_integer",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:strtoull",
)
-libc_function(
+alias(
name = "strtof",
- srcs = ["src/stdlib/strtof.cpp"],
- hdrs = ["src/stdlib/strtof.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_float",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:strtof",
)
-libc_function(
+alias(
name = "strtod",
- srcs = ["src/stdlib/strtod.cpp"],
- hdrs = ["src/stdlib/strtod.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_float",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:strtod",
)
-libc_function(
+alias(
name = "strtold",
- srcs = ["src/stdlib/strtold.cpp"],
- hdrs = ["src/stdlib/strtold.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support:str_to_float",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/stdlib:strtold",
)
############################### string targets ###############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel
index 682dab88637ef..e247eb254d1fe 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/compiler/BUILD.bazel
@@ -21,7 +21,7 @@ libc_support_library(
hdrs = ["__stack_chk_fail.h"],
deps = [
"//libc:hdr_stdint_proxy",
- "//libc:stdlib_abort_utils",
"//libc/src/__support/OSUtil:io",
+ "//libc/src/stdlib:abort_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
new file mode 100644
index 0000000000000..7d6619afc4a35
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
@@ -0,0 +1,544 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "exit_handler",
+ hdrs = ["exit_handler.h"],
+ # Full-build only, as overlay mode must use the host libc's cleanup.
+ full_build_only = True,
+ deps = [
+ "//libc/src/__support:blockstore",
+ "//libc/src/__support:common",
+ "//libc/src/__support:fixedvector",
+ "//libc/src/__support/CPP:mutex",
+ "//libc/src/__support/CPP:new",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/threads:mutex",
+ ],
+)
+
+libc_function(
+ name = "_Exit",
+ srcs = ["_Exit.cpp"],
+ hdrs = ["_Exit.h"],
+ # Full-build only, as overlay mode must use the host libc's cleanup.
+ full_build_only = True,
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil:exit",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "atexit",
+ srcs = ["atexit.cpp"],
+ hdrs = ["atexit.h"],
+ # Full-build only, as overlay mode must use the host libc's cleanup.
+ full_build_only = True,
+ deps = [
+ ":exit_handler",
+ "//libc:types_atexithandler_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "exit",
+ srcs = ["exit.cpp"],
+ hdrs = ["exit.h"],
+ # Full-build only, as overlay mode must use the host libc's cleanup.
+ full_build_only = True,
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil:exit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/threads:thread_headers",
+ "//libc/src/stdio:fflush_internal",
+ ],
+)
+
+libc_function(
+ name = "abs",
+ srcs = ["abs.cpp"],
+ hdrs = ["abs.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:integer_operations",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "labs",
+ srcs = ["labs.cpp"],
+ hdrs = ["labs.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:integer_operations",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "llabs",
+ srcs = ["llabs.cpp"],
+ hdrs = ["llabs.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:integer_operations",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "div",
+ srcs = ["div.cpp"],
+ hdrs = ["div.h"],
+ deps = [
+ "//libc:types_div_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:integer_operations",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "ldiv",
+ srcs = ["ldiv.cpp"],
+ hdrs = ["ldiv.h"],
+ deps = [
+ "//libc:types_ldiv_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:integer_operations",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "lldiv",
+ srcs = ["lldiv.cpp"],
+ hdrs = ["lldiv.h"],
+ deps = [
+ "//libc:types_lldiv_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:integer_operations",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "atoi",
+ srcs = ["atoi.cpp"],
+ hdrs = ["atoi.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "atol",
+ srcs = ["atol.cpp"],
+ hdrs = ["atol.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "atoll",
+ srcs = ["atoll.cpp"],
+ hdrs = ["atoll.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "atof",
+ srcs = ["atof.cpp"],
+ hdrs = ["atof.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_float",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "bsearch",
+ srcs = ["bsearch.cpp"],
+ hdrs = ["bsearch.h"],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "abort_utils",
+ hdrs = ["abort_utils.h"],
+ deps = [
+ "//libc/src/__support/macros/properties:architectures",
+ ] + select({
+ "@platforms//os:linux": [
+ ":linux_abort_utils",
+ ],
+ "//conditions:default": [],
+ }),
+)
+
+libc_support_library(
+ name = "linux_abort_utils",
+ hdrs = ["linux/abort_utils.h"],
+ full_build_only = True,
+ # Full-build only, as overlay mode must use the host libc's cleanup.
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_struct_sigaction",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil:exit",
+ "//libc/src/__support/OSUtil:linux_sigmask",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:raise",
+ "//libc/src/__support/macros:config",
+ "//libc/src/signal:__signal_utils",
+ ],
+)
+
+libc_function(
+ name = "abort",
+ srcs = ["abort.cpp"],
+ hdrs = ["abort.h"],
+ # Full-build only, as overlay mode must use the host libc's abort.
+ full_build_only = True,
+ deps = [
+ ":abort_utils",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "environ_internal",
+ srcs = ["environ_internal.cpp"],
+ hdrs = ["environ_internal.h"],
+ deps = [
+ "//libc:config_app_h",
+ "//libc:environ",
+ "//libc:string_memory_utils",
+ "//libc:types_size_t",
+ "//libc/src/__support:checked_ptr",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:new",
+ "//libc/src/__support/CPP:optional",
+ "//libc/src/__support/CPP:string_view",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "getenv",
+ srcs = ["getenv.cpp"],
+ hdrs = ["getenv.h"],
+ deps = [
+ ":environ_internal",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "qsort_util",
+ hdrs = [
+ "heap_sort.h",
+ "qsort_data.h",
+ "qsort_pivot.h",
+ "qsort_util.h",
+ "quick_sort.h",
+ ],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc:string_memory_utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/CPP:cstddef",
+ "//libc/src/__support/CPP:utility",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "qsort",
+ srcs = ["qsort.cpp"],
+ hdrs = ["qsort.h"],
+ deps = [
+ ":qsort_util",
+ "//libc:hdr_stdint_proxy",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "qsort_r",
+ srcs = ["qsort_r.cpp"],
+ hdrs = ["qsort_r.h"],
+ deps = [
+ ":qsort_util",
+ "//libc:hdr_stdint_proxy",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "rand_util",
+ srcs = ["rand_util.cpp"],
+ hdrs = ["rand_util.h"],
+ deps = [
+ "//libc/src/__support/CPP:atomic",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "rand",
+ srcs = ["rand.cpp"],
+ hdrs = ["rand.h"],
+ deps = [
+ ":rand_util",
+ "//libc:hdr_stdlib_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/threads:sleep",
+ ],
+)
+
+libc_function(
+ name = "realpath",
+ srcs = ["linux/realpath.cpp"],
+ hdrs = ["realpath.h"],
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:hdr_fcntl_macros",
+ "//libc:hdr_limits_macros",
+ "//libc:hdr_sys_stat_macros",
+ "//libc:string_memory_utils",
+ "//libc:types_mode_t",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:optional",
+ "//libc/src/__support/CPP:string",
+ "//libc/src/__support/CPP:string_view",
+ "//libc/src/__support/OSUtil:linux_stat_kernel_statx_types",
+ "//libc/src/__support/OSUtil:path",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcwd",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:readlink",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:statx",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "srand",
+ srcs = ["srand.cpp"],
+ hdrs = ["srand.h"],
+ deps = [
+ ":rand_util",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_support_library(
+ name = "str_from_util",
+ hdrs = ["str_from_util.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/CPP:type_traits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/printf_core:printf_converter",
+ "//libc/src/__support/printf_core:printf_core_structs",
+ "//libc/src/__support/printf_core:printf_error_mapper",
+ "//libc/src/__support/printf_core:printf_writer",
+ ],
+)
+
+libc_function(
+ name = "strfromf",
+ srcs = ["strfromf.cpp"],
+ hdrs = ["strfromf.h"],
+ deps = [
+ ":str_from_util",
+ "//libc:types_size_t",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strfromf128",
+ srcs = ["strfromf128.cpp"],
+ hdrs = ["strfromf128.h"],
+ deps = [
+ ":str_from_util",
+ "//libc:llvm_libc_types_float128",
+ "//libc:types_size_t",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strfromd",
+ srcs = ["strfromd.cpp"],
+ hdrs = ["strfromd.h"],
+ deps = [
+ ":str_from_util",
+ "//libc:types_size_t",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strfroml",
+ srcs = ["strfroml.cpp"],
+ hdrs = ["strfroml.h"],
+ deps = [
+ ":str_from_util",
+ "//libc:types_size_t",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strtol",
+ srcs = ["strtol.cpp"],
+ hdrs = ["strtol.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "strtoll",
+ srcs = ["strtoll.cpp"],
+ hdrs = ["strtoll.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "strtoul",
+ srcs = ["strtoul.cpp"],
+ hdrs = ["strtoul.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "strtoull",
+ srcs = ["strtoull.cpp"],
+ hdrs = ["strtoull.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_integer",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "strtof",
+ srcs = ["strtof.cpp"],
+ hdrs = ["strtof.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_float",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "strtod",
+ srcs = ["strtod.cpp"],
+ hdrs = ["strtod.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_float",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "strtold",
+ srcs = ["strtold.cpp"],
+ hdrs = ["strtold.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support:str_to_float",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
index 854afd064355d..666c813df911e 100644
--- a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
@@ -51,11 +51,9 @@ libc_startup_library(
deps = [
":gnu_property_section",
":irelative_hdr",
- "//libc:atexit",
"//libc:config_app_h",
"//libc:config_linux_app_h",
"//libc:environ",
- "//libc:exit",
"//libc:hdr_elf_proxy",
"//libc:hdr_link_macros",
"//libc:hdr_pthread_macros",
@@ -76,6 +74,8 @@ libc_startup_library(
"//libc/src/errno:program_invocation_name",
"//libc/src/errno:program_invocation_short_name",
"//libc/src/link:_r_debug",
+ "//libc/src/stdlib:atexit",
+ "//libc/src/stdlib:exit",
] + selects.with_or({
PLATFORM_CPU_X86_64: [
"//libc/startup/linux/x86_64:irelative",
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index 6577b24d7b434..3eaff618f885f 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -93,9 +93,7 @@ libc_test_library(
] + select({
"//libc:full_build": [
"//libc:close",
- "//libc:exit",
"//libc:fork",
- "//libc:getenv",
"//libc:llvm_libc_macros_poll_macros",
"//libc:llvm_libc_macros_signal_macros",
"//libc:llvm_libc_macros_sys_wait_macros",
@@ -110,6 +108,8 @@ libc_test_library(
"//libc/src/stdio:fflush",
"//libc/src/stdio:stderr",
"//libc/src/stdio:stdout",
+ "//libc/src/stdlib:exit",
+ "//libc/src/stdlib:getenv",
],
"//conditions:default": [],
}) + select({
@@ -132,7 +132,6 @@ libc_test_library(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- "//libc:atexit",
"//libc:bcmp",
"//libc:bzero",
"//libc:hdr_errno_macros",
@@ -144,6 +143,7 @@ libc_test_library(
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/macros:config",
+ "//libc/src/stdlib:atexit",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
index d717e94ea61df..416495c9858a8 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
@@ -99,9 +99,9 @@ math_mpfr_test(
name = "bf16fmaf",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
"//libc/src/__support/FPUtil:bfloat16",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -109,9 +109,9 @@ math_mpfr_test(
name = "bf16mulf",
hdrs = ["MulTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
"//libc/src/__support/FPUtil:bfloat16",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -234,8 +234,8 @@ math_mpfr_test(
name = "dfmal",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -243,8 +243,8 @@ math_mpfr_test(
name = "dmull",
hdrs = ["MulTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -437,8 +437,8 @@ math_mpfr_test(
name = "ffma",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -446,8 +446,8 @@ math_mpfr_test(
name = "ffmal",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -483,8 +483,8 @@ math_mpfr_test(
name = "fma",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -492,8 +492,8 @@ math_mpfr_test(
name = "fmaf",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -516,8 +516,8 @@ math_mpfr_test(
name = "fmul",
hdrs = ["MulTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -525,8 +525,8 @@ math_mpfr_test(
name = "fmull",
hdrs = ["MulTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -534,8 +534,8 @@ math_mpfr_test(
name = "f16mul",
hdrs = ["MulTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -543,8 +543,8 @@ math_mpfr_test(
name = "f16mulf",
hdrs = ["MulTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -552,8 +552,8 @@ math_mpfr_test(
name = "f16mull",
hdrs = ["MulTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -561,8 +561,8 @@ math_mpfr_test(
name = "f16fma",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -570,8 +570,8 @@ math_mpfr_test(
name = "f16fmaf",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -579,8 +579,8 @@ math_mpfr_test(
name = "f16fmal",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -588,8 +588,8 @@ math_mpfr_test(
name = "fmaf16",
hdrs = ["FmaTest.h"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
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 b3eba5aefd3c9..9d46a98662d61 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
@@ -13,19 +13,19 @@ licenses(["notice"])
libc_test(
name = "abs_test",
srcs = ["abs_test.cpp"],
- deps = ["//libc:abs"],
+ deps = ["//libc/src/stdlib:abs"],
)
libc_test(
name = "labs_test",
srcs = ["labs_test.cpp"],
- deps = ["//libc:labs"],
+ deps = ["//libc/src/stdlib:labs"],
)
libc_test(
name = "llabs_test",
srcs = ["llabs_test.cpp"],
- deps = ["//libc:llabs"],
+ deps = ["//libc/src/stdlib:llabs"],
)
libc_test_library(
@@ -39,8 +39,8 @@ libc_test(
srcs = ["div_test.cpp"],
deps = [
":div_test_helper",
- "//libc:div",
"//libc:types_div_t",
+ "//libc/src/stdlib:div",
],
)
@@ -49,8 +49,8 @@ libc_test(
srcs = ["ldiv_test.cpp"],
deps = [
":div_test_helper",
- "//libc:ldiv",
"//libc:types_ldiv_t",
+ "//libc/src/stdlib:ldiv",
],
)
@@ -59,8 +59,8 @@ libc_test(
srcs = ["lldiv_test.cpp"],
deps = [
":div_test_helper",
- "//libc:lldiv",
"//libc:types_lldiv_t",
+ "//libc/src/stdlib:lldiv",
],
)
@@ -79,7 +79,7 @@ libc_test(
srcs = ["atoi_test.cpp"],
deps = [
":atoi_test_helper",
- "//libc:atoi",
+ "//libc/src/stdlib:atoi",
],
)
@@ -88,7 +88,7 @@ libc_test(
srcs = ["atol_test.cpp"],
deps = [
":atoi_test_helper",
- "//libc:atol",
+ "//libc/src/stdlib:atol",
],
)
@@ -97,7 +97,7 @@ libc_test(
srcs = ["atoll_test.cpp"],
deps = [
":atoi_test_helper",
- "//libc:atoll",
+ "//libc/src/stdlib:atoll",
],
)
@@ -105,8 +105,8 @@ libc_test(
name = "atof_test",
srcs = ["atof_test.cpp"],
deps = [
- "//libc:atof",
"//libc/src/__support/FPUtil:fp_bits",
+ "//libc/src/stdlib:atof",
],
)
@@ -114,8 +114,8 @@ libc_test(
name = "bsearch_test",
srcs = ["bsearch_test.cpp"],
deps = [
- "//libc:bsearch",
"//libc:types_size_t",
+ "//libc/src/stdlib:bsearch",
],
)
@@ -133,9 +133,9 @@ libc_test(
srcs = ["quick_sort_test.cpp"],
deps = [
":qsort_test_helper",
- "//libc:qsort",
- "//libc:qsort_util",
"//libc:types_size_t",
+ "//libc/src/stdlib:qsort",
+ "//libc/src/stdlib:qsort_util",
],
)
@@ -151,7 +151,6 @@ libc_test(
"//libc:hdr_errno_macros",
"//libc:hdr_limits_macros",
"//libc:mkdirat",
- "//libc:realpath",
"//libc:strdup",
"//libc:symlinkat",
"//libc:types_size_t",
@@ -164,6 +163,7 @@ libc_test(
"//libc/src/__support/CPP:utility",
"//libc/src/__support/OSUtil:path",
"//libc/src/fcntl:openat",
+ "//libc/src/stdlib:realpath",
],
)
@@ -172,9 +172,9 @@ libc_test(
srcs = ["heap_sort_test.cpp"],
deps = [
":qsort_test_helper",
- "//libc:qsort",
- "//libc:qsort_util",
"//libc:types_size_t",
+ "//libc/src/stdlib:qsort",
+ "//libc/src/stdlib:qsort_util",
],
)
@@ -191,8 +191,8 @@ libc_test(
srcs = ["qsort_r_test.cpp"],
deps = [
":qsort_r_test_helper",
- "//libc:qsort_r",
"//libc:types_size_t",
+ "//libc/src/stdlib:qsort_r",
],
)
@@ -200,8 +200,8 @@ libc_test(
name = "rand_test",
srcs = ["rand_test.cpp"],
deps = [
- "//libc:rand",
- "//libc:srand",
+ "//libc/src/stdlib:rand",
+ "//libc/src/stdlib:srand",
],
)
@@ -209,9 +209,9 @@ libc_test(
name = "strfromf_test",
srcs = ["strfromf_test.cpp"],
deps = [
- "//libc:strfromf",
"//libc/src/__support/FPUtil:fp_bits",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/stdlib:strfromf",
],
)
@@ -219,10 +219,10 @@ libc_test(
name = "strfromf128_test",
srcs = ["strfromf128_test.cpp"],
deps = [
- "//libc:strfromf",
- "//libc:strfromf128",
"//libc/src/__support/FPUtil:fp_bits",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/stdlib:strfromf",
+ "//libc/src/stdlib:strfromf128",
],
)
@@ -230,9 +230,9 @@ libc_test(
name = "strfromd_test",
srcs = ["strfromd_test.cpp"],
deps = [
- "//libc:strfromd",
"//libc/src/__support/FPUtil:fp_bits",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/stdlib:strfromd",
],
)
@@ -240,9 +240,9 @@ libc_test(
name = "strfroml_test",
srcs = ["strfroml_test.cpp"],
deps = [
- "//libc:strfroml",
"//libc/src/__support/FPUtil:fp_bits",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/stdlib:strfroml",
],
)
@@ -264,7 +264,7 @@ libc_test(
srcs = ["strtol_test.cpp"],
deps = [
":strtol_test_helper",
- "//libc:strtol",
+ "//libc/src/stdlib:strtol",
],
)
@@ -273,7 +273,7 @@ libc_test(
srcs = ["strtoll_test.cpp"],
deps = [
":strtol_test_helper",
- "//libc:strtoll",
+ "//libc/src/stdlib:strtoll",
],
)
@@ -282,7 +282,7 @@ libc_test(
srcs = ["strtoul_test.cpp"],
deps = [
":strtol_test_helper",
- "//libc:strtoul",
+ "//libc/src/stdlib:strtoul",
],
)
@@ -291,7 +291,7 @@ libc_test(
srcs = ["strtoull_test.cpp"],
deps = [
":strtol_test_helper",
- "//libc:strtoull",
+ "//libc/src/stdlib:strtoull",
],
)
@@ -299,8 +299,8 @@ libc_test(
name = "strtof_test",
srcs = ["strtof_test.cpp"],
deps = [
- "//libc:strtof",
"//libc/src/__support/FPUtil:fp_bits",
+ "//libc/src/stdlib:strtof",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -309,8 +309,8 @@ libc_test(
name = "strtod_test",
srcs = ["strtod_test.cpp"],
deps = [
- "//libc:strtod",
"//libc/src/__support/FPUtil:fp_bits",
+ "//libc/src/stdlib:strtod",
"//libc/test/UnitTest:fp_test_helpers",
],
)
@@ -319,8 +319,8 @@ libc_test(
name = "strtold_test",
srcs = ["strtold_test.cpp"],
deps = [
- "//libc:strtold",
"//libc/src/__support:uint128",
"//libc/src/__support/FPUtil:fp_bits",
+ "//libc/src/stdlib:strtold",
],
)
>From e5684cf4f674f6fc86a213d9027b471133a2521a Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:34 -0800
Subject: [PATCH 14/32] [bazel] Add subpackage for libc/src/string/memory_utils
---
.../llvm-project-overlay/libc/BUILD.bazel | 115 ++++--------------
.../libc/src/__support/BUILD.bazel | 4 +-
.../libc/src/__support/CPP/BUILD.bazel | 2 +-
.../libc/src/__support/FPUtil/BUILD.bazel | 2 +-
.../libc/src/__support/File/BUILD.bazel | 2 +-
.../libc/src/__support/net/BUILD.bazel | 2 +-
.../src/__support/printf_core/BUILD.bazel | 2 +-
.../libc/src/__support/threads/BUILD.bazel | 2 +-
.../libc/src/stdlib/BUILD.bazel | 6 +-
.../libc/src/string/memory_utils/BUILD.bazel | 79 ++++++++++++
.../libc/startup/linux/BUILD.bazel | 2 +-
.../libc/test/src/__support/BUILD.bazel | 2 +-
.../libc/test/src/__support/CPP/BUILD.bazel | 2 +-
.../libc/test/src/arpa/inet/BUILD.bazel | 2 +-
.../libc/test/src/string/BUILD.bazel | 4 +-
15 files changed, 122 insertions(+), 106 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/string/memory_utils/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 8e56f0b289a95..e9b2daa87bc00 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2950,77 +2950,14 @@ alias(
############################### string targets ###############################
-libc_support_library(
- name = "string_memory_utils",
- hdrs = [
- "src/string/memory_utils/op_aarch64.h",
- "src/string/memory_utils/op_builtin.h",
- "src/string/memory_utils/op_generic.h",
- "src/string/memory_utils/op_riscv.h",
- "src/string/memory_utils/op_x86.h",
- "src/string/memory_utils/utils.h",
- ],
- textual_hdrs = [
- "src/string/memory_utils/aarch64/inline_bcmp.h",
- "src/string/memory_utils/aarch64/inline_memcmp.h",
- "src/string/memory_utils/aarch64/inline_memcpy.h",
- "src/string/memory_utils/aarch64/inline_memmove.h",
- "src/string/memory_utils/aarch64/inline_memset.h",
- "src/string/memory_utils/aarch64/inline_strlen.h",
- "src/string/memory_utils/arm/common.h",
- "src/string/memory_utils/arm/inline_memcpy.h",
- "src/string/memory_utils/arm/inline_memset.h",
- "src/string/memory_utils/generic/aligned_access.h",
- "src/string/memory_utils/generic/byte_per_byte.h",
- "src/string/memory_utils/generic/inline_strlen.h",
- "src/string/memory_utils/inline_bcmp.h",
- "src/string/memory_utils/inline_bzero.h",
- "src/string/memory_utils/inline_memcmp.h",
- "src/string/memory_utils/inline_memcpy.h",
- "src/string/memory_utils/inline_memmem.h",
- "src/string/memory_utils/inline_memmove.h",
- "src/string/memory_utils/inline_memset.h",
- "src/string/memory_utils/inline_strcmp.h",
- "src/string/memory_utils/inline_strstr.h",
- "src/string/memory_utils/riscv/inline_bcmp.h",
- "src/string/memory_utils/riscv/inline_memcmp.h",
- "src/string/memory_utils/riscv/inline_memcpy.h",
- "src/string/memory_utils/riscv/inline_memmove.h",
- "src/string/memory_utils/riscv/inline_memset.h",
- "src/string/memory_utils/x86_64/inline_bcmp.h",
- "src/string/memory_utils/x86_64/inline_memcmp.h",
- "src/string/memory_utils/x86_64/inline_memcpy.h",
- "src/string/memory_utils/x86_64/inline_memmove.h",
- "src/string/memory_utils/x86_64/inline_memset.h",
- "src/string/memory_utils/x86_64/inline_strlen.h",
- ],
- deps = [
- ":hdr_stdint_proxy",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:array",
- "//libc/src/__support/CPP:bit",
- "//libc/src/__support/CPP:cstddef",
- "//libc/src/__support/CPP:simd",
- "//libc/src/__support/CPP:type_traits",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:is_defined",
- "//libc/src/__support/macros:optimization",
- "//libc/src/__support/macros/properties:architectures",
- "//libc/src/__support/macros/properties:compiler",
- "//libc/src/__support/macros/properties:cpu_features",
- "//libc/src/__support/macros/properties:types",
- ],
-)
-
libc_support_library(
name = "allocating_string_utils",
hdrs = ["src/string/allocating_string_utils.h"],
deps = [
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:checked_ptr",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -3034,7 +2971,6 @@ libc_support_library(
":hdr_limits_macros",
":hdr_stdint_proxy",
":llvm_libc_types_size_t",
- ":string_memory_utils",
":types_size_t",
"//libc/src/__support:common",
"//libc/src/__support/CPP:bitset",
@@ -3042,6 +2978,7 @@ libc_support_library(
"//libc/src/__support/macros:attributes",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:optimization",
+ "//libc/src/string/memory_utils",
],
)
@@ -3085,10 +3022,10 @@ libc_function(
srcs = ["src/string/memcpy.cpp"],
hdrs = ["src/string/memcpy.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3108,10 +3045,10 @@ libc_function(
srcs = ["src/string/memset.cpp"],
hdrs = ["src/string/memset.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3120,10 +3057,10 @@ libc_function(
srcs = ["src/string/memset_explicit.cpp"],
hdrs = ["src/string/memset_explicit.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3132,10 +3069,10 @@ libc_function(
srcs = ["src/string/memmove.cpp"],
hdrs = ["src/string/memmove.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3144,10 +3081,10 @@ libc_function(
srcs = ["src/string/memmem.cpp"],
hdrs = ["src/string/memmem.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3156,10 +3093,10 @@ libc_function(
srcs = ["src/string/mempcpy.cpp"],
hdrs = ["src/string/mempcpy.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3168,9 +3105,9 @@ libc_function(
srcs = ["src/strings/bcopy.cpp"],
hdrs = ["src/strings/bcopy.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -3179,11 +3116,11 @@ libc_function(
srcs = ["src/string/memcmp.cpp"],
hdrs = ["src/string/memcmp.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support:integer_operations",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3192,9 +3129,9 @@ libc_function(
srcs = ["src/strings/bcmp.cpp"],
hdrs = ["src/strings/bcmp.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -3203,9 +3140,9 @@ libc_function(
srcs = ["src/strings/bzero.cpp"],
hdrs = ["src/strings/bzero.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -3226,11 +3163,11 @@ libc_function(
srcs = ["src/string/stpcpy.cpp"],
hdrs = ["src/string/stpcpy.h"],
deps = [
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3239,11 +3176,11 @@ libc_function(
srcs = ["src/string/stpncpy.cpp"],
hdrs = ["src/string/stpncpy.h"],
deps = [
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3277,11 +3214,11 @@ libc_function(
hdrs = ["src/string/strcpy.h"],
deps = [
":llvm_libc_types_size_t",
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3313,10 +3250,10 @@ libc_function(
srcs = ["src/string/strcmp.cpp"],
hdrs = ["src/string/strcmp.h"],
deps = [
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -3325,11 +3262,11 @@ libc_function(
srcs = ["src/string/strncmp.cpp"],
hdrs = ["src/string/strncmp.h"],
deps = [
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3338,11 +3275,11 @@ libc_function(
srcs = ["src/strings/strcasecmp.cpp"],
hdrs = ["src/strings/strcasecmp.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support:ctype_utils",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3351,11 +3288,11 @@ libc_function(
srcs = ["src/strings/strncasecmp.cpp"],
hdrs = ["src/strings/strncasecmp.h"],
deps = [
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support:ctype_utils",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3398,11 +3335,11 @@ libc_function(
hdrs = ["src/string/strsep.h"],
deps = [
":hdr_signal_macros",
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3411,11 +3348,11 @@ libc_function(
srcs = ["src/string/strstr.cpp"],
hdrs = ["src/string/strstr.h"],
deps = [
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3424,12 +3361,12 @@ libc_function(
srcs = ["src/string/strcasestr.cpp"],
hdrs = ["src/string/strcasestr.h"],
deps = [
- ":string_memory_utils",
":string_utils",
"//libc/src/__support:common",
"//libc/src/__support:ctype_utils",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
@@ -3501,10 +3438,10 @@ libc_function(
":allocating_string_utils",
":hdr_stdlib_macros",
":llvm_libc_types_size_t",
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -4860,12 +4797,12 @@ libc_support_library(
hdrs = ["src/sys/mman/linux/shm_common.h"],
deps = [
":hdr_errno_macros",
- ":string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support:error_or",
"//libc/src/__support/CPP:array",
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -5882,11 +5819,11 @@ libc_function(
srcs = ["src/wchar/wmemcpy.cpp"],
hdrs = ["src/wchar/wmemcpy.h"],
deps = [
- ":string_memory_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -5908,11 +5845,11 @@ libc_function(
srcs = ["src/wchar/wmempcpy.cpp"],
hdrs = ["src/wchar/wmempcpy.h"],
deps = [
- ":string_memory_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/BUILD.bazel
index bd89cd52f97b5..3fc109c0e40a6 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/BUILD.bazel
@@ -53,8 +53,8 @@ libc_support_library(
deps = [
":common",
"//libc:hdr_stdint_proxy",
- "//libc:string_memory_utils",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -74,11 +74,11 @@ libc_support_library(
hdrs = ["fixedvector.h"],
deps = [
":libc_assert",
- "//libc:string_memory_utils",
"//libc/src/__support/CPP:array",
"//libc/src/__support/CPP:iterator",
"//libc/src/__support/CPP:type_traits",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel
index 65f1efb87c916..38a4a199cd1ee 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel
@@ -240,13 +240,13 @@ libc_support_library(
"//libc:func_malloc",
"//libc:func_realloc",
"//libc:hdr_stdint_proxy",
- "//libc:string_memory_utils",
"//libc:string_utils",
"//libc/src/__support:common",
"//libc/src/__support:integer_to_string",
"//libc/src/__support:libc_assert",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/FPUtil/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/FPUtil/BUILD.bazel
index dfe05d645ba3a..43db6251782a1 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/FPUtil/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/FPUtil/BUILD.bazel
@@ -156,7 +156,6 @@ libc_support_library(
"//libc:hdr_fenv_macros",
"//libc:hdr_math_macros",
"//libc:hdr_stdint_proxy",
- "//libc:string_memory_utils",
"//libc:types_fenv_t",
"//libc/src/__support:libc_errno",
"//libc/src/__support/CPP:bit",
@@ -169,6 +168,7 @@ libc_support_library(
"//libc/src/__support/macros/properties:compiler",
"//libc/src/__support/macros/properties:cpu_features",
"//libc/src/__support/macros/properties:types",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/File/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/File/BUILD.bazel
index 2f695eea0900e..b011ef0f478ff 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/File/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/File/BUILD.bazel
@@ -43,7 +43,6 @@ libc_support_library(
"//libc:hdr_stdio_macros",
"//libc:hdr_wchar_macros",
"//libc:llvm_libc_types_off_t",
- "//libc:string_memory_utils",
"//libc:types_char32_t",
"//libc:types_char8_t",
"//libc:types_off_t",
@@ -60,6 +59,7 @@ libc_support_library(
"//libc/src/__support/wchar:character_converter",
"//libc/src/__support/wchar:mbstate",
"//libc/src/__support/wchar:wcrtomb",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/net/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/net/BUILD.bazel
index e64cb4d4a9a19..9d766173a9853 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/net/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/net/BUILD.bazel
@@ -37,7 +37,6 @@ libc_support_library(
":hex",
"//libc:hdr_inet_address_macros",
"//libc:hdr_stdint_proxy",
- "//libc:string_memory_utils",
"//libc:types_in_addr_t",
"//libc:types_struct_in6_addr",
"//libc:types_struct_in_addr",
@@ -50,5 +49,6 @@ libc_support_library(
"//libc/src/__support/CPP:span",
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel
index f89e6e6a5be6b..75906334f143a 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel
@@ -68,10 +68,10 @@ libc_support_library(
textual_hdrs = ["overflow_modes.def"],
deps = [
":printf_core_structs",
- "//libc:string_memory_utils",
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:optimization",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/threads/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/threads/BUILD.bazel
index 4aef25772ad15..aaca0ceed2379 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/threads/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/threads/BUILD.bazel
@@ -358,13 +358,13 @@ libc_support_library(
":tcb",
"//libc:config_app_h",
"//libc:hdr_sys_mman_macros",
- "//libc:string_memory_utils",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:exit",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getrandom",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:mmap",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:munmap",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
index 7d6619afc4a35..5329fb8d003ec 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
@@ -258,7 +258,6 @@ libc_support_library(
deps = [
"//libc:config_app_h",
"//libc:environ",
- "//libc:string_memory_utils",
"//libc:types_size_t",
"//libc/src/__support:checked_ptr",
"//libc/src/__support:common",
@@ -267,6 +266,7 @@ libc_support_library(
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/macros:attributes",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -292,13 +292,13 @@ libc_support_library(
],
deps = [
"//libc:hdr_stdint_proxy",
- "//libc:string_memory_utils",
"//libc/src/__support:common",
"//libc/src/__support/CPP:bit",
"//libc/src/__support/CPP:cstddef",
"//libc/src/__support/CPP:utility",
"//libc/src/__support/macros:attributes",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
@@ -361,7 +361,6 @@ libc_function(
"//libc:hdr_fcntl_macros",
"//libc:hdr_limits_macros",
"//libc:hdr_sys_stat_macros",
- "//libc:string_memory_utils",
"//libc:types_mode_t",
"//libc:types_size_t",
"//libc/src/__support:common",
@@ -376,6 +375,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:readlink",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:statx",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/string/memory_utils/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/string/memory_utils/BUILD.bazel
new file mode 100644
index 0000000000000..7e9784264067a
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/string/memory_utils/BUILD.bazel
@@ -0,0 +1,79 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "memory_utils",
+ hdrs = [
+ "op_aarch64.h",
+ "op_builtin.h",
+ "op_generic.h",
+ "op_riscv.h",
+ "op_x86.h",
+ "utils.h",
+ ],
+ textual_hdrs = [
+ "aarch64/inline_bcmp.h",
+ "aarch64/inline_memcmp.h",
+ "aarch64/inline_memcpy.h",
+ "aarch64/inline_memmove.h",
+ "aarch64/inline_memset.h",
+ "aarch64/inline_strlen.h",
+ "arm/common.h",
+ "arm/inline_memcpy.h",
+ "arm/inline_memset.h",
+ "generic/aligned_access.h",
+ "generic/byte_per_byte.h",
+ "generic/inline_strlen.h",
+ "inline_bcmp.h",
+ "inline_bzero.h",
+ "inline_memcmp.h",
+ "inline_memcpy.h",
+ "inline_memmem.h",
+ "inline_memmove.h",
+ "inline_memset.h",
+ "inline_strcmp.h",
+ "inline_strstr.h",
+ "riscv/inline_bcmp.h",
+ "riscv/inline_memcmp.h",
+ "riscv/inline_memcpy.h",
+ "riscv/inline_memmove.h",
+ "riscv/inline_memset.h",
+ "x86_64/inline_bcmp.h",
+ "x86_64/inline_memcmp.h",
+ "x86_64/inline_memcpy.h",
+ "x86_64/inline_memmove.h",
+ "x86_64/inline_memset.h",
+ "x86_64/inline_strlen.h",
+ ],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:array",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/CPP:cstddef",
+ "//libc/src/__support/CPP:simd",
+ "//libc/src/__support/CPP:type_traits",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:is_defined",
+ "//libc/src/__support/macros:optimization",
+ "//libc/src/__support/macros/properties:architectures",
+ "//libc/src/__support/macros/properties:compiler",
+ "//libc/src/__support/macros/properties:cpu_features",
+ "//libc/src/__support/macros/properties:types",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
index 666c813df911e..3b1d748057d71 100644
--- a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
@@ -25,10 +25,10 @@ libc_support_library(
deps = [
"//libc:hdr_elf_proxy",
"//libc:hdr_link_macros",
- "//libc:string_memory_utils",
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/macros:attributes",
"//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
index f0fb44e30cb63..718d17a2c24b4 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
@@ -141,11 +141,11 @@ libc_test(
name = "printf_writer_test",
srcs = ["printf_core/writer_test.cpp"],
deps = [
- "//libc:string_memory_utils",
"//libc/src/__support:arg_list",
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/printf_core:printf_core_structs",
"//libc/src/__support/printf_core:printf_writer",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/CPP/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/CPP/BUILD.bazel
index e702cbb05b436..18429c4dd9bed 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/CPP/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/CPP/BUILD.bazel
@@ -98,9 +98,9 @@ libc_test(
name = "stringview_test",
srcs = ["stringview_test.cpp"],
deps = [
- "//libc:string_memory_utils",
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/CPP:type_traits",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel
index f2260223b56f6..7737fbba1e9b1 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/arpa/inet/BUILD.bazel
@@ -79,11 +79,11 @@ libc_test(
deps = [
"//libc:hdr_errno_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:string_memory_utils",
"//libc:types_struct_in6_addr",
"//libc:types_struct_in_addr",
"//libc/src/__support:common",
"//libc/src/arpa/inet:inet_pton",
+ "//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
index 0c7494cff560c..a1a505fda7558 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
@@ -224,11 +224,11 @@ libc_test_library(
hdrs = ["memory_utils/memory_check_utils.h"],
deps = [
"//libc:hdr_stdint_proxy",
- "//libc:string_memory_utils",
"//libc/src/__support:libc_assert",
"//libc/src/__support/CPP:span",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:sanitizer",
+ "//libc/src/string/memory_utils",
],
)
@@ -303,7 +303,7 @@ libc_test(
deps = [
":memory_check_utils",
"//libc:memset_explicit",
- "//libc:string_memory_utils",
+ "//libc/src/string/memory_utils",
],
)
>From d30b938e22c6ed78aeec940a891240a92805286c Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:35 -0800
Subject: [PATCH 15/32] [bazel] Add subpackage for libc/src/string
---
.../llvm-project-overlay/libc/BUILD.bazel | 448 +++--------------
.../libc/src/__support/CPP/BUILD.bazel | 2 +-
.../libc/src/__support/OSUtil/BUILD.bazel | 2 +-
.../src/__support/printf_core/BUILD.bazel | 2 +-
.../libc/src/string/BUILD.bazel | 475 ++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 10 +-
.../libc/test/src/stdio/BUILD.bazel | 4 +-
.../libc/test/src/stdlib/BUILD.bazel | 2 +-
.../libc/test/src/string/BUILD.bazel | 70 +--
.../libc/test/src/sys/socket/BUILD.bazel | 10 +-
.../libc/test/src/unistd/BUILD.bazel | 2 +-
11 files changed, 609 insertions(+), 418 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/string/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index e9b2daa87bc00..497fd0d9f2665 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2950,46 +2950,14 @@ alias(
############################### string targets ###############################
-libc_support_library(
- name = "allocating_string_utils",
- hdrs = ["src/string/allocating_string_utils.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:checked_ptr",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
-)
-
-libc_support_library(
- name = "string_utils",
- hdrs = [
- "src/string/string_length.h",
- "src/string/string_utils.h",
- ],
- deps = [
- ":hdr_limits_macros",
- ":hdr_stdint_proxy",
- ":llvm_libc_types_size_t",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:bitset",
- "//libc/src/__support/CPP:type_traits",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:optimization",
- "//libc/src/string/memory_utils",
- ],
-)
-
libc_function(
name = "index",
srcs = ["src/strings/index.cpp"],
hdrs = ["src/strings/index.h"],
deps = [
- ":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -2998,106 +2966,51 @@ libc_function(
srcs = ["src/strings/rindex.cpp"],
hdrs = ["src/strings/rindex.h"],
deps = [
- ":string_utils",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string:utils",
],
)
-libc_function(
+alias(
name = "memchr",
- srcs = ["src/string/memchr.cpp"],
- hdrs = ["src/string/memchr.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:memchr",
)
-libc_function(
+alias(
name = "memcpy",
- srcs = ["src/string/memcpy.cpp"],
- hdrs = ["src/string/memcpy.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:memcpy",
)
-libc_function(
+alias(
name = "memccpy",
- srcs = ["src/string/memccpy.cpp"],
- hdrs = ["src/string/memccpy.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:memccpy",
)
-libc_function(
+alias(
name = "memset",
- srcs = ["src/string/memset.cpp"],
- hdrs = ["src/string/memset.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:memset",
)
-libc_function(
+alias(
name = "memset_explicit",
- srcs = ["src/string/memset_explicit.cpp"],
- hdrs = ["src/string/memset_explicit.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:memset_explicit",
)
-libc_function(
+alias(
name = "memmove",
- srcs = ["src/string/memmove.cpp"],
- hdrs = ["src/string/memmove.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:memmove",
)
-libc_function(
+alias(
name = "memmem",
- srcs = ["src/string/memmem.cpp"],
- hdrs = ["src/string/memmem.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:memmem",
)
-libc_function(
+alias(
name = "mempcpy",
- srcs = ["src/string/mempcpy.cpp"],
- hdrs = ["src/string/mempcpy.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:mempcpy",
)
libc_function(
@@ -3111,17 +3024,9 @@ libc_function(
],
)
-libc_function(
+alias(
name = "memcmp",
- srcs = ["src/string/memcmp.cpp"],
- hdrs = ["src/string/memcmp.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:integer_operations",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:memcmp",
)
libc_function(
@@ -3146,128 +3051,54 @@ libc_function(
],
)
-libc_function(
+alias(
name = "memrchr",
- srcs = ["src/string/memrchr.cpp"],
- hdrs = ["src/string/memrchr.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:memrchr",
)
-libc_function(
+alias(
name = "stpcpy",
- srcs = ["src/string/stpcpy.cpp"],
- hdrs = ["src/string/stpcpy.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:stpcpy",
)
-libc_function(
+alias(
name = "stpncpy",
- srcs = ["src/string/stpncpy.cpp"],
- hdrs = ["src/string/stpncpy.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:stpncpy",
)
-libc_function(
+alias(
name = "strlen",
- srcs = ["src/string/strlen.cpp"],
- hdrs = ["src/string/strlen.h"],
- deps = [
- ":llvm_libc_types_size_t",
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:strlen",
)
-libc_function(
+alias(
name = "strsignal",
- srcs = ["src/string/strsignal.cpp"],
- hdrs = ["src/string/strsignal.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/StringUtil",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strsignal",
)
-libc_function(
+alias(
name = "strcpy",
- srcs = ["src/string/strcpy.cpp"],
- hdrs = ["src/string/strcpy.h"],
- deps = [
- ":llvm_libc_types_size_t",
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:strcpy",
)
-libc_function(
+alias(
name = "strlcpy",
- srcs = ["src/string/strlcpy.cpp"],
- hdrs = ["src/string/strlcpy.h"],
- deps = [
- ":llvm_libc_types_size_t",
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strlcpy",
)
-libc_function(
+alias(
name = "strncpy",
- srcs = ["src/string/strncpy.cpp"],
- hdrs = ["src/string/strncpy.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:strncpy",
)
-libc_function(
+alias(
name = "strcmp",
- srcs = ["src/string/strcmp.cpp"],
- hdrs = ["src/string/strcmp.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:strcmp",
)
-libc_function(
+alias(
name = "strncmp",
- srcs = ["src/string/strncmp.cpp"],
- hdrs = ["src/string/strncmp.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:strncmp",
)
libc_function(
@@ -3296,199 +3127,84 @@ libc_function(
],
)
-libc_function(
+alias(
name = "strchr",
- srcs = ["src/string/strchr.cpp"],
- hdrs = ["src/string/strchr.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strchr",
)
-libc_function(
+alias(
name = "strrchr",
- srcs = ["src/string/strrchr.cpp"],
- hdrs = ["src/string/strrchr.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strrchr",
)
-libc_function(
+alias(
name = "strchrnul",
- srcs = ["src/string/strchrnul.cpp"],
- hdrs = ["src/string/strchrnul.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strchrnul",
)
-libc_function(
+alias(
name = "strsep",
- srcs = ["src/string/strsep.cpp"],
- hdrs = ["src/string/strsep.h"],
- deps = [
- ":hdr_signal_macros",
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:strsep",
)
-libc_function(
+alias(
name = "strstr",
- srcs = ["src/string/strstr.cpp"],
- hdrs = ["src/string/strstr.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:strstr",
)
-libc_function(
+alias(
name = "strcasestr",
- srcs = ["src/string/strcasestr.cpp"],
- hdrs = ["src/string/strcasestr.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:strcasestr",
)
-libc_function(
+alias(
name = "strcat",
- srcs = ["src/string/strcat.cpp"],
- hdrs = ["src/string/strcat.h"],
- deps = [
- ":llvm_libc_types_size_t",
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:strcat",
)
-libc_function(
+alias(
name = "strlcat",
- srcs = ["src/string/strlcat.cpp"],
- hdrs = ["src/string/strlcat.h"],
- deps = [
- ":llvm_libc_types_size_t",
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strlcat",
)
-libc_function(
+alias(
name = "strncat",
- srcs = ["src/string/strncat.cpp"],
- hdrs = ["src/string/strncat.h"],
- deps = [
- ":llvm_libc_types_size_t",
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:strncat",
)
-libc_function(
+alias(
name = "strnlen",
- srcs = ["src/string/strnlen.cpp"],
- hdrs = ["src/string/strnlen.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strnlen",
)
-libc_function(
+alias(
name = "strcspn",
- srcs = ["src/string/strcspn.cpp"],
- hdrs = ["src/string/strcspn.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strcspn",
)
-libc_function(
+alias(
name = "strdup",
- srcs = ["src/string/strdup.cpp"],
- hdrs = ["src/string/strdup.h"],
- deps = [
- ":allocating_string_utils",
- ":hdr_stdlib_macros",
- ":llvm_libc_types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/string:strdup",
)
-libc_function(
+alias(
name = "strspn",
- srcs = ["src/string/strspn.cpp"],
- hdrs = ["src/string/strspn.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/CPP:bitset",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/string:strspn",
)
-libc_function(
+alias(
name = "strpbrk",
- srcs = ["src/string/strpbrk.cpp"],
- hdrs = ["src/string/strpbrk.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strpbrk",
)
-libc_function(
+alias(
name = "strtok",
- srcs = ["src/string/strtok.cpp"],
- hdrs = ["src/string/strtok.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strtok",
)
-libc_function(
+alias(
name = "strtok_r",
- srcs = ["src/string/strtok_r.cpp"],
- hdrs = ["src/string/strtok_r.h"],
- deps = [
- ":string_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/string:strtok_r",
)
################################ fcntl targets #################################
@@ -3778,7 +3494,6 @@ libc_function(
srcs = ["src/unistd/linux/getcwd.cpp"],
hdrs = ["src/unistd/getcwd.h"],
deps = [
- ":allocating_string_utils",
":hdr_unistd_macros",
":types_size_t",
":types_ssize_t",
@@ -3787,6 +3502,7 @@ libc_function(
"//libc/src/__support:libc_errno",
"//libc/src/__support/OSUtil/linux/syscall_wrappers:getcwd",
"//libc/src/__support/macros:config",
+ "//libc/src/string:allocating_string_utils",
],
)
@@ -3812,7 +3528,6 @@ libc_function(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- ":string_utils",
":types_size_t",
":types_struct_utsname",
"//libc/src/__support:common",
@@ -3820,6 +3535,7 @@ libc_function(
"//libc/src/__support/OSUtil/linux/syscall_wrappers:uname",
"//libc/src/__support/macros:config",
"//libc/src/errno",
+ "//libc/src/string:utils",
],
)
@@ -5560,11 +5276,11 @@ libc_function(
srcs = ["src/wchar/wcpcpy.cpp"],
hdrs = ["src/wchar/wcpcpy.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -5586,11 +5302,11 @@ libc_function(
srcs = ["src/wchar/wcscat.cpp"],
hdrs = ["src/wchar/wcscat.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -5625,11 +5341,11 @@ libc_function(
srcs = ["src/wchar/wcscpy.cpp"],
hdrs = ["src/wchar/wcscpy.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -5652,11 +5368,11 @@ libc_function(
srcs = ["src/wchar/wcslcat.cpp"],
hdrs = ["src/wchar/wcslcat.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -5665,11 +5381,11 @@ libc_function(
srcs = ["src/wchar/wcslcpy.cpp"],
hdrs = ["src/wchar/wcslcpy.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -5678,11 +5394,11 @@ libc_function(
srcs = ["src/wchar/wcslen.cpp"],
hdrs = ["src/wchar/wcslen.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -5691,11 +5407,11 @@ libc_function(
srcs = ["src/wchar/wcsncat.cpp"],
hdrs = ["src/wchar/wcsncat.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
@@ -5768,11 +5484,11 @@ libc_function(
srcs = ["src/wchar/wcsstr.cpp"],
hdrs = ["src/wchar/wcsstr.h"],
deps = [
- ":string_utils",
":types_size_t",
":types_wchar_t",
"//libc/src/__support:common",
"//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel
index 38a4a199cd1ee..ccf0347af8bae 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/CPP/BUILD.bazel
@@ -240,12 +240,12 @@ libc_support_library(
"//libc:func_malloc",
"//libc:func_realloc",
"//libc:hdr_stdint_proxy",
- "//libc:string_utils",
"//libc/src/__support:common",
"//libc/src/__support:integer_to_string",
"//libc/src/__support:libc_assert",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros:null_check",
+ "//libc/src/string:utils",
"//libc/src/string/memory_utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/OSUtil/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/OSUtil/BUILD.bazel
index 8c8f8eb8ec20a..dc977662a442c 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/OSUtil/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/OSUtil/BUILD.bazel
@@ -136,11 +136,11 @@ libc_support_library(
}),
deps = [
":syscall",
- "//libc:string_utils",
"//libc/src/__support:common",
"//libc/src/__support/CPP:string_view",
"//libc/src/__support/macros:config",
"//libc/src/__support/macros/properties:architectures",
+ "//libc/src/string:utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel
index 75906334f143a..7a5ad91ccb5b5 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/printf_core/BUILD.bazel
@@ -97,7 +97,6 @@ libc_support_library(
":printf_writer",
"//libc:hdr_limits_macros",
"//libc:hdr_wchar_macros",
- "//libc:string_utils",
"//libc:types_char32_t",
"//libc:types_char8_t",
"//libc:types_size_t",
@@ -123,6 +122,7 @@ libc_support_library(
"//libc/src/__support/wchar:mbstate",
"//libc/src/__support/wchar:string_converter",
"//libc/src/__support/wchar:wcrtomb",
+ "//libc/src/string:utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/string/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/string/BUILD.bazel
new file mode 100644
index 0000000000000..6b0d21af01e6f
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/string/BUILD.bazel
@@ -0,0 +1,475 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "allocating_string_utils",
+ hdrs = ["allocating_string_utils.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:checked_ptr",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_support_library(
+ name = "utils",
+ hdrs = [
+ "string_length.h",
+ "string_utils.h",
+ ],
+ deps = [
+ "//libc:hdr_limits_macros",
+ "//libc:hdr_stdint_proxy",
+ "//libc:llvm_libc_types_size_t",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:bitset",
+ "//libc/src/__support/CPP:type_traits",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:optimization",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "memchr",
+ srcs = ["memchr.cpp"],
+ hdrs = ["memchr.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "memcpy",
+ srcs = ["memcpy.cpp"],
+ hdrs = ["memcpy.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "memccpy",
+ srcs = ["memccpy.cpp"],
+ hdrs = ["memccpy.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "memset",
+ srcs = ["memset.cpp"],
+ hdrs = ["memset.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "memset_explicit",
+ srcs = ["memset_explicit.cpp"],
+ hdrs = ["memset_explicit.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "memmove",
+ srcs = ["memmove.cpp"],
+ hdrs = ["memmove.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "memmem",
+ srcs = ["memmem.cpp"],
+ hdrs = ["memmem.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "mempcpy",
+ srcs = ["mempcpy.cpp"],
+ hdrs = ["mempcpy.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "memcmp",
+ srcs = ["memcmp.cpp"],
+ hdrs = ["memcmp.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:integer_operations",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "memrchr",
+ srcs = ["memrchr.cpp"],
+ hdrs = ["memrchr.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "stpcpy",
+ srcs = ["stpcpy.cpp"],
+ hdrs = ["stpcpy.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "stpncpy",
+ srcs = ["stpncpy.cpp"],
+ hdrs = ["stpncpy.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strlen",
+ srcs = ["strlen.cpp"],
+ hdrs = ["strlen.h"],
+ deps = [
+ ":utils",
+ "//libc:llvm_libc_types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "strsignal",
+ srcs = ["strsignal.cpp"],
+ hdrs = ["strsignal.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/StringUtil",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strcpy",
+ srcs = ["strcpy.cpp"],
+ hdrs = ["strcpy.h"],
+ deps = [
+ ":utils",
+ "//libc:llvm_libc_types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strlcpy",
+ srcs = ["strlcpy.cpp"],
+ hdrs = ["strlcpy.h"],
+ deps = [
+ ":utils",
+ "//libc:llvm_libc_types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strncpy",
+ srcs = ["strncpy.cpp"],
+ hdrs = ["strncpy.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "strcmp",
+ srcs = ["strcmp.cpp"],
+ hdrs = ["strcmp.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strncmp",
+ srcs = ["strncmp.cpp"],
+ hdrs = ["strncmp.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strchr",
+ srcs = ["strchr.cpp"],
+ hdrs = ["strchr.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strrchr",
+ srcs = ["strrchr.cpp"],
+ hdrs = ["strrchr.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strchrnul",
+ srcs = ["strchrnul.cpp"],
+ hdrs = ["strchrnul.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strsep",
+ srcs = ["strsep.cpp"],
+ hdrs = ["strsep.h"],
+ deps = [
+ ":utils",
+ "//libc:hdr_signal_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strstr",
+ srcs = ["strstr.cpp"],
+ hdrs = ["strstr.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strcasestr",
+ srcs = ["strcasestr.cpp"],
+ hdrs = ["strcasestr.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strcat",
+ srcs = ["strcat.cpp"],
+ hdrs = ["strcat.h"],
+ deps = [
+ ":utils",
+ "//libc:llvm_libc_types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "strlcat",
+ srcs = ["strlcat.cpp"],
+ hdrs = ["strlcat.h"],
+ deps = [
+ ":utils",
+ "//libc:llvm_libc_types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strncat",
+ srcs = ["strncat.cpp"],
+ hdrs = ["strncat.h"],
+ deps = [
+ ":utils",
+ "//libc:llvm_libc_types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "strnlen",
+ srcs = ["strnlen.cpp"],
+ hdrs = ["strnlen.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strcspn",
+ srcs = ["strcspn.cpp"],
+ hdrs = ["strcspn.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strdup",
+ srcs = ["strdup.cpp"],
+ hdrs = ["strdup.h"],
+ deps = [
+ ":allocating_string_utils",
+ "//libc:hdr_stdlib_macros",
+ "//libc:llvm_libc_types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strspn",
+ srcs = ["strspn.cpp"],
+ hdrs = ["strspn.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/CPP:bitset",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "strpbrk",
+ srcs = ["strpbrk.cpp"],
+ hdrs = ["strpbrk.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strtok",
+ srcs = ["strtok.cpp"],
+ hdrs = ["strtok.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "strtok_r",
+ srcs = ["strtok_r.cpp"],
+ hdrs = ["strtok_r.h"],
+ deps = [
+ ":utils",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index 3eaff618f885f..a46bf6761ec47 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -100,7 +100,6 @@ libc_test_library(
"//libc:llvm_libc_types_pid_t",
"//libc:llvm_libc_types_struct_pollfd",
"//libc:pipe",
- "//libc:strsignal",
"//libc:waitpid",
"//libc/src/poll",
"//libc/src/signal",
@@ -110,6 +109,7 @@ libc_test_library(
"//libc/src/stdio:stdout",
"//libc/src/stdlib:exit",
"//libc/src/stdlib:getenv",
+ "//libc/src/string:strsignal",
],
"//conditions:default": [],
}) + select({
@@ -136,14 +136,14 @@ libc_test_library(
"//libc:bzero",
"//libc:hdr_errno_macros",
"//libc:hdr_stdint_proxy",
- "//libc:memcmp",
- "//libc:memcpy",
- "//libc:memmove",
- "//libc:memset",
"//libc/src/__support:common",
"//libc/src/__support:libc_errno",
"//libc/src/__support/macros:config",
"//libc/src/stdlib:atexit",
+ "//libc/src/string:memcmp",
+ "//libc/src/string:memcpy",
+ "//libc/src/string:memmove",
+ "//libc/src/string:memset",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
index 3c30a7f39beb0..51e17c1e00e30 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
@@ -14,9 +14,9 @@ libc_test(
name = "asprintf_test",
srcs = ["asprintf_test.cpp"],
deps = [
- "//libc:memset",
"//libc/src/stdio:asprintf",
"//libc/src/stdio:sprintf",
+ "//libc/src/string:memset",
],
)
@@ -72,8 +72,8 @@ libc_test(
name = "vasprintf_test",
srcs = ["vasprintf_test.cpp"],
deps = [
- "//libc:memset",
"//libc/src/stdio:vasprintf",
+ "//libc/src/string:memset",
],
)
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 9d46a98662d61..6a717484719c8 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
@@ -151,7 +151,6 @@ libc_test(
"//libc:hdr_errno_macros",
"//libc:hdr_limits_macros",
"//libc:mkdirat",
- "//libc:strdup",
"//libc:symlinkat",
"//libc:types_size_t",
"//libc:unlinkat",
@@ -164,6 +163,7 @@ libc_test(
"//libc/src/__support/OSUtil:path",
"//libc/src/fcntl:openat",
"//libc/src/stdlib:realpath",
+ "//libc/src/string:strdup",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
index a1a505fda7558..164fb8ecd2c58 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
@@ -14,7 +14,7 @@ libc_test(
name = "strlen_test",
srcs = ["strlen_test.cpp"],
deps = [
- "//libc:strlen",
+ "//libc/src/string:strlen",
],
)
@@ -23,7 +23,7 @@ libc_test(
srcs = ["strcpy_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:strcpy",
+ "//libc/src/string:strcpy",
],
)
@@ -31,7 +31,7 @@ libc_test(
name = "strlcpy_test",
srcs = ["strlcpy_test.cpp"],
deps = [
- "//libc:strlcpy",
+ "//libc/src/string:strlcpy",
],
)
@@ -39,8 +39,8 @@ libc_test(
name = "stpcpy_test",
srcs = ["stpcpy_test.cpp"],
deps = [
- "//libc:stpcpy",
- "//libc:string_utils",
+ "//libc/src/string:stpcpy",
+ "//libc/src/string:utils",
],
)
@@ -49,8 +49,8 @@ libc_test(
srcs = ["stpncpy_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:stpncpy",
"//libc/src/__support/CPP:span",
+ "//libc/src/string:stpncpy",
],
)
@@ -58,7 +58,7 @@ libc_test(
name = "strcmp_test",
srcs = ["strcmp_test.cpp"],
deps = [
- "//libc:strcmp",
+ "//libc/src/string:strcmp",
],
)
@@ -66,7 +66,7 @@ libc_test(
name = "strncmp_test",
srcs = ["strncmp_test.cpp"],
deps = [
- "//libc:strncmp",
+ "//libc/src/string:strncmp",
],
)
@@ -75,7 +75,7 @@ libc_test(
srcs = ["memchr_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:memchr",
+ "//libc/src/string:memchr",
],
)
@@ -90,7 +90,7 @@ libc_test(
srcs = ["strchr_test.cpp"],
deps = [
":strchr_test_helper",
- "//libc:strchr",
+ "//libc/src/string:strchr",
],
)
@@ -98,7 +98,7 @@ libc_test(
name = "strchrnul_test",
srcs = ["strchrnul_test.cpp"],
deps = [
- "//libc:strchrnul",
+ "//libc/src/string:strchrnul",
],
)
@@ -106,7 +106,7 @@ libc_test(
name = "strpbrk_test",
srcs = ["strpbrk_test.cpp"],
deps = [
- "//libc:strpbrk",
+ "//libc/src/string:strpbrk",
],
)
@@ -115,7 +115,7 @@ libc_test(
srcs = ["strsep_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:strsep",
+ "//libc/src/string:strsep",
],
)
@@ -123,7 +123,7 @@ libc_test(
name = "strstr_test",
srcs = ["strstr_test.cpp"],
deps = [
- "//libc:strstr",
+ "//libc/src/string:strstr",
],
)
@@ -131,7 +131,7 @@ libc_test(
name = "strnlen_test",
srcs = ["strnlen_test.cpp"],
deps = [
- "//libc:strnlen",
+ "//libc/src/string:strnlen",
],
)
@@ -140,7 +140,7 @@ libc_test(
srcs = ["memrchr_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:memrchr",
+ "//libc/src/string:memrchr",
],
)
@@ -149,7 +149,7 @@ libc_test(
srcs = ["strrchr_test.cpp"],
deps = [
":strchr_test_helper",
- "//libc:strrchr",
+ "//libc/src/string:strrchr",
],
)
@@ -157,7 +157,7 @@ libc_test(
name = "strcasestr_test",
srcs = ["strcasestr_test.cpp"],
deps = [
- "//libc:strcasestr",
+ "//libc/src/string:strcasestr",
],
)
@@ -166,7 +166,7 @@ libc_test(
srcs = ["strcat_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:strcat",
+ "//libc/src/string:strcat",
],
)
@@ -174,7 +174,7 @@ libc_test(
name = "strlcat_test",
srcs = ["strlcat_test.cpp"],
deps = [
- "//libc:strlcat",
+ "//libc/src/string:strlcat",
],
)
@@ -182,7 +182,7 @@ libc_test(
name = "strncat_test",
srcs = ["strncat_test.cpp"],
deps = [
- "//libc:strncat",
+ "//libc/src/string:strncat",
],
)
@@ -190,7 +190,7 @@ libc_test(
name = "strcspn_test",
srcs = ["strcspn_test.cpp"],
deps = [
- "//libc:strcspn",
+ "//libc/src/string:strcspn",
],
)
@@ -199,7 +199,7 @@ libc_test(
srcs = ["strspn_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:strspn",
+ "//libc/src/string:strspn",
],
)
@@ -207,7 +207,7 @@ libc_test(
name = "strtok_test",
srcs = ["strtok_test.cpp"],
deps = [
- "//libc:strtok",
+ "//libc/src/string:strtok",
],
)
@@ -215,7 +215,7 @@ libc_test(
name = "strtok_r_test",
srcs = ["strtok_r_test.cpp"],
deps = [
- "//libc:strtok_r",
+ "//libc/src/string:strtok_r",
],
)
@@ -253,8 +253,8 @@ libc_test(
deps = [
":memory_check_utils",
"//libc:hdr_signal_macros",
- "//libc:memcpy",
"//libc/src/__support/macros/properties:os",
+ "//libc/src/string:memcpy",
] + select({
"//libc:full_build": [],
"//conditions:default": [
@@ -267,8 +267,8 @@ libc_test(
name = "memccpy_test",
srcs = ["memccpy_test.cpp"],
deps = [
- "//libc:memccpy",
"//libc/src/__support/CPP:span",
+ "//libc/src/string:memccpy",
],
)
@@ -277,7 +277,7 @@ libc_test(
srcs = ["mempcpy_test.cpp"],
deps = [
"//libc:hdr_signal_macros",
- "//libc:mempcpy",
+ "//libc/src/string:mempcpy",
],
)
@@ -287,8 +287,8 @@ libc_test(
deps = [
":memory_check_utils",
"//libc:hdr_signal_macros",
- "//libc:memset",
"//libc/src/__support/macros/properties:os",
+ "//libc/src/string:memset",
] + select({
"//libc:full_build": [],
"//conditions:default": [
@@ -302,7 +302,7 @@ libc_test(
srcs = ["memset_explicit_test.cpp"],
deps = [
":memory_check_utils",
- "//libc:memset_explicit",
+ "//libc/src/string:memset_explicit",
"//libc/src/string/memory_utils",
],
)
@@ -313,9 +313,9 @@ libc_test(
deps = [
":memory_check_utils",
"//libc:hdr_signal_macros",
- "//libc:memcmp",
- "//libc:memmove",
"//libc/src/__support/CPP:span",
+ "//libc/src/string:memcmp",
+ "//libc/src/string:memmove",
"//libc/test/UnitTest:memory_matcher",
],
)
@@ -326,7 +326,7 @@ libc_test(
deps = [
":memory_check_utils",
"//libc:hdr_signal_macros",
- "//libc:memcmp",
+ "//libc/src/string:memcmp",
"//libc/test/UnitTest:test_logger",
],
)
@@ -335,7 +335,7 @@ libc_test(
name = "memmem_test",
srcs = ["memmem_test.cpp"],
deps = [
- "//libc:memmem",
- "//libc:string_utils",
+ "//libc/src/string:memmem",
+ "//libc/src/string:utils",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
index e021f5c391b67..5a5a6a46f2d7f 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
@@ -19,14 +19,14 @@ libc_test_library(
"//libc:fchdir",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:strncpy",
- "//libc:strnlen",
"//libc:types_size_t",
"//libc:types_socklen_t",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support:common",
"//libc/src/__support/CPP:string_view",
"//libc/src/fcntl:open",
+ "//libc/src/string:strncpy",
+ "//libc/src/string:strnlen",
"//libc/test/UnitTest:LibcUnitTest",
],
)
@@ -114,14 +114,14 @@ libc_test(
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
"//libc:llvm_libc_macros_sys_socket_macros",
- "//libc:memcpy",
- "//libc:memset",
"//libc:recvmsg",
"//libc:sendmsg",
"//libc:socketpair",
"//libc:types_struct_cmsghdr",
"//libc/src/__support/CPP:scope",
"//libc/src/fcntl",
+ "//libc/src/string:memcpy",
+ "//libc/src/string:memset",
],
)
@@ -134,11 +134,11 @@ libc_test(
"//libc:recvmmsg",
"//libc:sendmmsg",
"//libc:socketpair",
- "//libc:strlen",
"//libc:types_struct_iovec",
"//libc:types_struct_mmsghdr",
"//libc:types_struct_timespec",
"//libc/src/__support/CPP:scope",
+ "//libc/src/string:strlen",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
index ab3080721d59a..1b3f2a4e0c0d2 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
@@ -129,8 +129,8 @@ libc_test(
name = "swab_test",
srcs = ["swab_test.cpp"],
deps = [
- "//libc:string_utils",
"//libc:swab",
+ "//libc/src/string:utils",
],
)
>From 1bec3ee08923f3ad1a17446b66568a9beddab2ca Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:36 -0800
Subject: [PATCH 16/32] [bazel] Add subpackage for libc/src/strings
---
.../llvm-project-overlay/libc/BUILD.bazel | 75 +++-----------
.../libc/src/strings/BUILD.bazel | 98 +++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 4 +-
.../libc/test/src/strings/BUILD.bazel | 14 +--
4 files changed, 121 insertions(+), 70 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/strings/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 497fd0d9f2665..da9ba7b8c7176 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2950,27 +2950,14 @@ alias(
############################### string targets ###############################
-libc_function(
+alias(
name = "index",
- srcs = ["src/strings/index.cpp"],
- hdrs = ["src/strings/index.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/strings:index",
)
-libc_function(
+alias(
name = "rindex",
- srcs = ["src/strings/rindex.cpp"],
- hdrs = ["src/strings/rindex.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/strings:rindex",
)
alias(
@@ -3013,15 +3000,9 @@ alias(
actual = "//libc/src/string:mempcpy",
)
-libc_function(
+alias(
name = "bcopy",
- srcs = ["src/strings/bcopy.cpp"],
- hdrs = ["src/strings/bcopy.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/strings:bcopy",
)
alias(
@@ -3029,26 +3010,14 @@ alias(
actual = "//libc/src/string:memcmp",
)
-libc_function(
+alias(
name = "bcmp",
- srcs = ["src/strings/bcmp.cpp"],
- hdrs = ["src/strings/bcmp.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/strings:bcmp",
)
-libc_function(
+alias(
name = "bzero",
- srcs = ["src/strings/bzero.cpp"],
- hdrs = ["src/strings/bzero.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/strings:bzero",
)
alias(
@@ -3101,30 +3070,14 @@ alias(
actual = "//libc/src/string:strncmp",
)
-libc_function(
+alias(
name = "strcasecmp",
- srcs = ["src/strings/strcasecmp.cpp"],
- hdrs = ["src/strings/strcasecmp.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/strings:strcasecmp",
)
-libc_function(
+alias(
name = "strncasecmp",
- srcs = ["src/strings/strncasecmp.cpp"],
- hdrs = ["src/strings/strncasecmp.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:ctype_utils",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/strings:strncasecmp",
)
alias(
diff --git a/utils/bazel/llvm-project-overlay/libc/src/strings/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/strings/BUILD.bazel
new file mode 100644
index 0000000000000..faf6edb6adb2d
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/strings/BUILD.bazel
@@ -0,0 +1,98 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "index",
+ srcs = ["index.cpp"],
+ hdrs = ["index.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "rindex",
+ srcs = ["rindex.cpp"],
+ hdrs = ["rindex.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "bcopy",
+ srcs = ["bcopy.cpp"],
+ hdrs = ["bcopy.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "bcmp",
+ srcs = ["bcmp.cpp"],
+ hdrs = ["bcmp.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "bzero",
+ srcs = ["bzero.cpp"],
+ hdrs = ["bzero.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strcasecmp",
+ srcs = ["strcasecmp.cpp"],
+ hdrs = ["strcasecmp.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "strncasecmp",
+ srcs = ["strncasecmp.cpp"],
+ hdrs = ["strncasecmp.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:ctype_utils",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ "//libc/src/string/memory_utils",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index a46bf6761ec47..0830793eef475 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -132,8 +132,6 @@ libc_test_library(
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
- "//libc:bcmp",
- "//libc:bzero",
"//libc:hdr_errno_macros",
"//libc:hdr_stdint_proxy",
"//libc/src/__support:common",
@@ -144,6 +142,8 @@ libc_test_library(
"//libc/src/string:memcpy",
"//libc/src/string:memmove",
"//libc/src/string:memset",
+ "//libc/src/strings:bcmp",
+ "//libc/src/strings:bzero",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
index e3543679ff9ad..37ab5e139ae55 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
@@ -14,8 +14,8 @@ libc_test(
name = "bcopy_test",
srcs = ["bcopy_test.cpp"],
deps = [
- "//libc:bcopy",
"//libc/src/__support/CPP:span",
+ "//libc/src/strings:bcopy",
"//libc/test/UnitTest:memory_matcher",
"//libc/test/src/string:memory_check_utils",
],
@@ -25,7 +25,7 @@ libc_test(
name = "bcmp_test",
srcs = ["bcmp_test.cpp"],
deps = [
- "//libc:bcmp",
+ "//libc/src/strings:bcmp",
"//libc/test/UnitTest:test_logger",
"//libc/test/src/string:memory_check_utils",
],
@@ -35,7 +35,7 @@ libc_test(
name = "bzero_test",
srcs = ["bzero_test.cpp"],
deps = [
- "//libc:bzero",
+ "//libc/src/strings:bzero",
"//libc/test/src/string:memory_check_utils",
],
)
@@ -44,7 +44,7 @@ libc_test(
name = "index_test",
srcs = ["index_test.cpp"],
deps = [
- "//libc:index",
+ "//libc/src/strings:index",
"//libc/test/src/string:strchr_test_helper",
],
)
@@ -53,7 +53,7 @@ libc_test(
name = "rindex_test",
srcs = ["rindex_test.cpp"],
deps = [
- "//libc:rindex",
+ "//libc/src/strings:rindex",
"//libc/test/src/string:strchr_test_helper",
],
)
@@ -62,7 +62,7 @@ libc_test(
name = "strcasecmp_test",
srcs = ["strcasecmp_test.cpp"],
deps = [
- "//libc:strcasecmp",
+ "//libc/src/strings:strcasecmp",
],
)
@@ -70,6 +70,6 @@ libc_test(
name = "strncasecmp_test",
srcs = ["strncasecmp_test.cpp"],
deps = [
- "//libc:strncasecmp",
+ "//libc/src/strings:strncasecmp",
],
)
>From 449b66277f9c83d2fe51b19eb8e1e53ae651fc21 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:38 -0800
Subject: [PATCH 17/32] [bazel] Add subpackage for libc/src/sys/epoll
---
.../llvm-project-overlay/libc/BUILD.bazel | 107 ++-------------
.../libc/src/sys/epoll/BUILD.bazel | 129 ++++++++++++++++++
.../libc/test/src/sys/epoll/BUILD.bazel | 26 ++--
3 files changed, 154 insertions(+), 108 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/epoll/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index da9ba7b8c7176..337acf30abb89 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -5086,117 +5086,34 @@ libc_function(
############################## sys/epoll targets ###############################
-libc_function(
+alias(
name = "epoll_create",
- srcs = ["src/sys/epoll/linux/epoll_create.cpp"],
- hdrs = ["src/sys/epoll/epoll_create.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_create",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/epoll:epoll_create",
)
-libc_function(
+alias(
name = "epoll_create1",
- srcs = ["src/sys/epoll/linux/epoll_create1.cpp"],
- hdrs = ["src/sys/epoll/epoll_create1.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_create1",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/epoll:epoll_create1",
)
-libc_function(
+alias(
name = "epoll_ctl",
- srcs = ["src/sys/epoll/linux/epoll_ctl.cpp"],
- hdrs = ["src/sys/epoll/epoll_ctl.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_sys_epoll_macros",
- ":types_struct_epoll_event",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_ctl",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/epoll:epoll_ctl",
)
-libc_function(
+alias(
name = "epoll_pwait",
- srcs = ["src/sys/epoll/linux/epoll_pwait.cpp"],
- hdrs = ["src/sys/epoll/epoll_pwait.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_sigset_t",
- ":types_struct_epoll_event",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_pwait",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/epoll:epoll_pwait",
)
-libc_function(
+alias(
name = "epoll_pwait2",
- srcs = ["src/sys/epoll/linux/epoll_pwait2.cpp"],
- hdrs = ["src/sys/epoll/epoll_pwait2.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_sigset_t",
- ":types_struct_epoll_event",
- ":types_struct_timespec",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_pwait2",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/epoll:epoll_pwait2",
)
-libc_function(
+alias(
name = "epoll_wait",
- srcs = ["src/sys/epoll/linux/epoll_wait.cpp"],
- hdrs = ["src/sys/epoll/epoll_wait.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_struct_epoll_event",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_wait",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/epoll:epoll_wait",
)
############################## wchar targets ###############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/epoll/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/epoll/BUILD.bazel
new file mode 100644
index 0000000000000..19c1f5cd99cdb
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/epoll/BUILD.bazel
@@ -0,0 +1,129 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "epoll_create",
+ srcs = ["linux/epoll_create.cpp"],
+ hdrs = ["epoll_create.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_create",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "epoll_create1",
+ srcs = ["linux/epoll_create1.cpp"],
+ hdrs = ["epoll_create1.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_create1",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "epoll_ctl",
+ srcs = ["linux/epoll_ctl.cpp"],
+ hdrs = ["epoll_ctl.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_sys_epoll_macros",
+ "//libc:types_struct_epoll_event",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_ctl",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "epoll_pwait",
+ srcs = ["linux/epoll_pwait.cpp"],
+ hdrs = ["epoll_pwait.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_sigset_t",
+ "//libc:types_struct_epoll_event",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_pwait",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "epoll_pwait2",
+ srcs = ["linux/epoll_pwait2.cpp"],
+ hdrs = ["epoll_pwait2.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_sigset_t",
+ "//libc:types_struct_epoll_event",
+ "//libc:types_struct_timespec",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_pwait2",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "epoll_wait",
+ srcs = ["linux/epoll_wait.cpp"],
+ hdrs = ["epoll_wait.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_struct_epoll_event",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:epoll_wait",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel
index e0449d6a6a5bf..3096fdfb9d915 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel
@@ -15,7 +15,7 @@ libc_test(
srcs = ["linux/epoll_create_test.cpp"],
deps = [
"//libc:close",
- "//libc:epoll_create",
+ "//libc/src/sys/epoll:epoll_create",
],
)
@@ -24,8 +24,8 @@ libc_test(
srcs = ["linux/epoll_create1_test.cpp"],
deps = [
"//libc:close",
- "//libc:epoll_create1",
"//libc:hdr_sys_epoll_macros",
+ "//libc/src/sys/epoll:epoll_create1",
],
)
@@ -34,11 +34,11 @@ libc_test(
srcs = ["linux/epoll_ctl_test.cpp"],
deps = [
"//libc:close",
- "//libc:epoll_create1",
- "//libc:epoll_ctl",
"//libc:hdr_sys_epoll_macros",
"//libc:pipe",
"//libc:types_struct_epoll_event",
+ "//libc/src/sys/epoll:epoll_create1",
+ "//libc/src/sys/epoll:epoll_ctl",
],
)
@@ -47,12 +47,12 @@ libc_test(
srcs = ["linux/epoll_wait_test.cpp"],
deps = [
"//libc:close",
- "//libc:epoll_create1",
- "//libc:epoll_ctl",
- "//libc:epoll_wait",
"//libc:hdr_sys_epoll_macros",
"//libc:pipe",
"//libc:types_struct_epoll_event",
+ "//libc/src/sys/epoll:epoll_create1",
+ "//libc/src/sys/epoll:epoll_ctl",
+ "//libc/src/sys/epoll:epoll_wait",
],
)
@@ -61,12 +61,12 @@ libc_test(
srcs = ["linux/epoll_pwait_test.cpp"],
deps = [
"//libc:close",
- "//libc:epoll_create1",
- "//libc:epoll_ctl",
- "//libc:epoll_pwait",
"//libc:hdr_sys_epoll_macros",
"//libc:pipe",
"//libc:types_struct_epoll_event",
+ "//libc/src/sys/epoll:epoll_create1",
+ "//libc/src/sys/epoll:epoll_ctl",
+ "//libc/src/sys/epoll:epoll_pwait",
],
)
@@ -75,12 +75,12 @@ libc_test(
srcs = ["linux/epoll_pwait2_test.cpp"],
deps = [
"//libc:close",
- "//libc:epoll_create1",
- "//libc:epoll_ctl",
- "//libc:epoll_pwait2",
"//libc:hdr_sys_epoll_macros",
"//libc:pipe",
"//libc:types_struct_epoll_event",
"//libc:types_struct_timespec",
+ "//libc/src/sys/epoll:epoll_create1",
+ "//libc/src/sys/epoll:epoll_ctl",
+ "//libc/src/sys/epoll:epoll_pwait2",
],
)
>From b5cb4535aa96f432e242e69f64ff22a693022f09 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:39 -0800
Subject: [PATCH 18/32] [bazel] Add subpackage for libc/src/sys/mman
---
.../llvm-project-overlay/libc/BUILD.bazel | 340 ++--------------
.../libc/src/sys/mman/BUILD.bazel | 377 ++++++++++++++++++
.../test/src/__support/threads/BUILD.bazel | 4 +-
.../libc/test/src/sys/mman/BUILD.bazel | 98 ++---
4 files changed, 472 insertions(+), 347 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/mman/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 337acf30abb89..ed8f05641a64d 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2,8 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-# LLVM libc project.
-load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@rules_cc//cc:defs.bzl", "cc_library")
@@ -17,7 +15,6 @@ load(
"libc_header_library",
"libc_support_library",
)
-load(":platforms.bzl", "PLATFORM_CPU_X86_64")
package(
default_visibility = ["//visibility:public"],
@@ -4147,363 +4144,114 @@ alias(
############################### sys/mman targets ###############################
-libc_function(
+alias(
name = "madvise",
- srcs = ["src/sys/mman/linux/madvise.cpp"],
- hdrs = ["src/sys/mman/madvise.h"],
- deps = [
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:madvise",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:madvise",
)
-libc_function(
+alias(
name = "mincore",
- srcs = ["src/sys/mman/linux/mincore.cpp"],
- hdrs = ["src/sys/mman/mincore.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:mincore",
)
-libc_function(
+alias(
name = "mlock",
- srcs = ["src/sys/mman/linux/mlock.cpp"],
- hdrs = ["src/sys/mman/mlock.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:mlock",
)
-libc_function(
+alias(
name = "mlock2",
- srcs = ["src/sys/mman/linux/mlock2.cpp"],
- hdrs = ["src/sys/mman/mlock2.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:mlock2",
)
-libc_function(
+alias(
name = "mlockall",
- srcs = ["src/sys/mman/linux/mlockall.cpp"],
- hdrs = ["src/sys/mman/mlockall.h"],
- deps = [
- ":hdr_sys_mman_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:mlockall",
)
-libc_function(
+alias(
name = "mmap",
- srcs = ["src/sys/mman/linux/mmap.cpp"],
- hdrs = ["src/sys/mman/mmap.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_off_t",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:mmap",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:mmap",
)
-libc_function(
+alias(
name = "mprotect",
- srcs = ["src/sys/mman/linux/mprotect.cpp"],
- hdrs = ["src/sys/mman/mprotect.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:mprotect",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:mprotect",
)
-libc_function(
+alias(
name = "mremap",
- srcs = ["src/sys/mman/linux/mremap.cpp"],
- hdrs = ["src/sys/mman/mremap.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:mremap",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:mremap",
)
-libc_function(
+alias(
name = "msync",
- srcs = ["src/sys/mman/linux/msync.cpp"],
- hdrs = ["src/sys/mman/msync.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:msync",
)
-libc_function(
+alias(
name = "munlock",
- srcs = ["src/sys/mman/linux/munlock.cpp"],
- hdrs = ["src/sys/mman/munlock.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:munlock",
)
-libc_function(
+alias(
name = "munlockall",
- srcs = ["src/sys/mman/linux/munlockall.cpp"],
- hdrs = ["src/sys/mman/munlockall.h"],
- deps = [
- ":hdr_sys_mman_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:munlockall",
)
-libc_function(
+alias(
name = "munmap",
- srcs = ["src/sys/mman/linux/munmap.cpp"],
- hdrs = ["src/sys/mman/munmap.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:munmap",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:munmap",
)
-libc_function(
+alias(
name = "memfd_create",
- srcs = ["src/sys/mman/linux/memfd_create.cpp"],
- hdrs = ["src/sys/mman/memfd_create.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:memfd_create",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/sys/mman:memfd_create",
)
-libc_function(
+alias(
name = "pkey_alloc",
- srcs = ["src/sys/mman/linux/pkey_alloc.cpp"],
- hdrs = ["src/sys/mman/pkey_alloc.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_alloc",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:pkey_alloc",
)
-libc_function(
+alias(
name = "pkey_free",
- srcs = ["src/sys/mman/linux/pkey_free.cpp"],
- hdrs = ["src/sys/mman/pkey_free.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_free",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:pkey_free",
)
-libc_function(
+alias(
name = "pkey_get",
- srcs = ["src/sys/mman/linux/pkey_get.cpp"],
- hdrs = ["src/sys/mman/pkey_get.h"],
- deps = [
- ":pkey_common",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros/properties:architectures",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:pkey_get",
)
-libc_function(
+alias(
name = "pkey_mprotect",
- srcs = ["src/sys/mman/linux/pkey_mprotect.cpp"],
- hdrs = ["src/sys/mman/pkey_mprotect.h"],
- deps = [
- ":hdr_errno_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:mprotect",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_mprotect",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:pkey_mprotect",
)
-libc_function(
+alias(
name = "pkey_set",
- srcs = ["src/sys/mman/linux/pkey_set.cpp"],
- hdrs = ["src/sys/mman/pkey_set.h"],
- deps = [
- ":pkey_common",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:attributes",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:pkey_set",
)
-libc_support_library(
- name = "pkey_common",
- hdrs = [
- "src/sys/mman/linux/pkey_common.h",
- ] + selects.with_or({
- PLATFORM_CPU_X86_64: ["src/sys/mman/linux/x86_64/pkey_common.h"],
- "//conditions:default": ["src/sys/mman/linux/generic/pkey_common.h"],
- }),
- deps = [
- ":hdr_errno_macros",
- ":hdr_stdint_proxy",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support/macros/properties:architectures",
- ],
-)
-
-libc_function(
+alias(
name = "posix_madvise",
- srcs = ["src/sys/mman/linux/posix_madvise.cpp"],
- hdrs = ["src/sys/mman/posix_madvise.h"],
- deps = [
- ":hdr_sys_mman_macros",
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:madvise",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/sys/mman:posix_madvise",
)
-libc_function(
+alias(
name = "remap_file_pages",
- srcs = ["src/sys/mman/linux/remap_file_pages.cpp"],
- hdrs = ["src/sys/mman/remap_file_pages.h"],
- deps = [
- ":types_size_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:remap_file_pages",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
-)
-
-libc_support_library(
- name = "shm_common",
- hdrs = ["src/sys/mman/linux/shm_common.h"],
- deps = [
- ":hdr_errno_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support/CPP:array",
- "//libc/src/__support/CPP:string_view",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/sys/mman:remap_file_pages",
)
-libc_function(
+alias(
name = "shm_open",
- srcs = ["src/sys/mman/linux/shm_open.cpp"],
- hdrs = ["src/sys/mman/shm_open.h"],
- deps = [
- ":hdr_fcntl_macros",
- ":shm_common",
- ":types_mode_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:shm_open",
)
-libc_function(
+alias(
name = "shm_unlink",
- srcs = ["src/sys/mman/linux/shm_unlink.cpp"],
- hdrs = ["src/sys/mman/shm_unlink.h"],
- deps = [
- ":shm_common",
- ":types_mode_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlink",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/mman:shm_unlink",
)
############################# sys/random targets #############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/mman/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/mman/BUILD.bazel
new file mode 100644
index 0000000000000..4edb41e36b759
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/mman/BUILD.bazel
@@ -0,0 +1,377 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("@bazel_skylib//lib:selects.bzl", "selects")
+load("//libc:libc_build_rules.bzl", "libc_function", "libc_support_library")
+load("//libc:platforms.bzl", "PLATFORM_CPU_X86_64")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "madvise",
+ srcs = ["linux/madvise.cpp"],
+ hdrs = ["madvise.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:madvise",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mincore",
+ srcs = ["linux/mincore.cpp"],
+ hdrs = ["mincore.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mlock",
+ srcs = ["linux/mlock.cpp"],
+ hdrs = ["mlock.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mlock2",
+ srcs = ["linux/mlock2.cpp"],
+ hdrs = ["mlock2.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mlockall",
+ srcs = ["linux/mlockall.cpp"],
+ hdrs = ["mlockall.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mmap",
+ srcs = ["linux/mmap.cpp"],
+ hdrs = ["mmap.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_off_t",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:mmap",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mprotect",
+ srcs = ["linux/mprotect.cpp"],
+ hdrs = ["mprotect.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:mprotect",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mremap",
+ srcs = ["linux/mremap.cpp"],
+ hdrs = ["mremap.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:mremap",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "msync",
+ srcs = ["linux/msync.cpp"],
+ hdrs = ["msync.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "munlock",
+ srcs = ["linux/munlock.cpp"],
+ hdrs = ["munlock.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "munlockall",
+ srcs = ["linux/munlockall.cpp"],
+ hdrs = ["munlockall.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "munmap",
+ srcs = ["linux/munmap.cpp"],
+ hdrs = ["munmap.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:munmap",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "memfd_create",
+ srcs = ["linux/memfd_create.cpp"],
+ hdrs = ["memfd_create.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:memfd_create",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "pkey_alloc",
+ srcs = ["linux/pkey_alloc.cpp"],
+ hdrs = ["pkey_alloc.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_alloc",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "pkey_free",
+ srcs = ["linux/pkey_free.cpp"],
+ hdrs = ["pkey_free.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_free",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "pkey_get",
+ srcs = ["linux/pkey_get.cpp"],
+ hdrs = ["pkey_get.h"],
+ deps = [
+ ":pkey_common",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros/properties:architectures",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "pkey_mprotect",
+ srcs = ["linux/pkey_mprotect.cpp"],
+ hdrs = ["pkey_mprotect.h"],
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:mprotect",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:pkey_mprotect",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "pkey_set",
+ srcs = ["linux/pkey_set.cpp"],
+ hdrs = ["pkey_set.h"],
+ deps = [
+ ":pkey_common",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:attributes",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_support_library(
+ name = "pkey_common",
+ hdrs = [
+ "linux/pkey_common.h",
+ ] + selects.with_or({
+ PLATFORM_CPU_X86_64: ["linux/x86_64/pkey_common.h"],
+ "//conditions:default": ["linux/generic/pkey_common.h"],
+ }),
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:hdr_stdint_proxy",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support/macros/properties:architectures",
+ ],
+)
+
+libc_function(
+ name = "posix_madvise",
+ srcs = ["linux/posix_madvise.cpp"],
+ hdrs = ["posix_madvise.h"],
+ deps = [
+ "//libc:hdr_sys_mman_macros",
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:madvise",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "remap_file_pages",
+ srcs = ["linux/remap_file_pages.cpp"],
+ hdrs = ["remap_file_pages.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:remap_file_pages",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_support_library(
+ name = "shm_common",
+ hdrs = ["linux/shm_common.h"],
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support/CPP:array",
+ "//libc/src/__support/CPP:string_view",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "shm_open",
+ srcs = ["linux/shm_open.cpp"],
+ hdrs = ["shm_open.h"],
+ deps = [
+ ":shm_common",
+ "//libc:hdr_fcntl_macros",
+ "//libc:types_mode_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:open",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "shm_unlink",
+ srcs = ["linux/shm_unlink.cpp"],
+ hdrs = ["shm_unlink.h"],
+ deps = [
+ ":shm_common",
+ "//libc:types_mode_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlink",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/threads/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/threads/BUILD.bazel
index 51aedbaeb0d83..d40128f613c20 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/threads/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/threads/BUILD.bazel
@@ -27,14 +27,14 @@ libc_test(
"//libc:hdr_signal_macros",
"//libc:hdr_sys_mman_macros",
"//libc:llvm_libc_macros_time_macros",
- "//libc:mmap",
- "//libc:munmap",
"//libc/src/__support/CPP:atomic",
"//libc/src/__support/OSUtil:exit",
"//libc/src/__support/OSUtil:syscall",
"//libc/src/__support/threads:raw_mutex",
"//libc/src/__support/threads:sleep",
"//libc/src/__support/time:clock_gettime",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munmap",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
index 5858572d607fc..b70e03e1828ca 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
@@ -15,9 +15,9 @@ libc_test(
srcs = ["linux/madvise_test.cpp"],
deps = [
"//libc:hdr_sys_mman_macros",
- "//libc:madvise",
- "//libc:mmap",
- "//libc:munmap",
+ "//libc/src/sys/mman:madvise",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munmap",
],
)
@@ -27,12 +27,12 @@ libc_test(
deps = [
"//libc:getpagesize",
"//libc:hdr_sys_mman_macros",
- "//libc:madvise",
- "//libc:mincore",
- "//libc:mlock",
- "//libc:mmap",
- "//libc:munlock",
- "//libc:munmap",
+ "//libc/src/sys/mman:madvise",
+ "//libc/src/sys/mman:mincore",
+ "//libc/src/sys/mman:mlock",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munlock",
+ "//libc/src/sys/mman:munmap",
],
)
@@ -44,16 +44,16 @@ libc_test(
"//libc:getrlimit",
"//libc:hdr_sys_mman_macros",
"//libc:hdr_sys_resource_macros",
- "//libc:madvise",
- "//libc:mincore",
- "//libc:mlock",
- "//libc:mlock2",
- "//libc:mlockall",
- "//libc:mmap",
- "//libc:munlock",
- "//libc:munlockall",
- "//libc:munmap",
"//libc/src/__support/OSUtil:syscall",
+ "//libc/src/sys/mman:madvise",
+ "//libc/src/sys/mman:mincore",
+ "//libc/src/sys/mman:mlock",
+ "//libc/src/sys/mman:mlock2",
+ "//libc/src/sys/mman:mlockall",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munlock",
+ "//libc/src/sys/mman:munlockall",
+ "//libc/src/sys/mman:munmap",
],
)
@@ -63,10 +63,10 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_mman_macros",
- "//libc:memfd_create",
- "//libc:mmap",
- "//libc:munmap",
"//libc/src/__support/CPP:scope",
+ "//libc/src/sys/mman:memfd_create",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munmap",
],
)
@@ -76,9 +76,9 @@ libc_test(
deps = [
"//libc:hdr_signal_macros",
"//libc:hdr_sys_mman_macros",
- "//libc:mmap",
- "//libc:mprotect",
- "//libc:munmap",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:mprotect",
+ "//libc/src/sys/mman:munmap",
],
)
@@ -87,9 +87,9 @@ libc_test(
srcs = ["linux/mremap_test.cpp"],
deps = [
"//libc:hdr_sys_mman_macros",
- "//libc:mmap",
- "//libc:mremap",
- "//libc:munmap",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:mremap",
+ "//libc/src/sys/mman:munmap",
],
)
@@ -99,11 +99,11 @@ libc_test(
deps = [
"//libc:getpagesize",
"//libc:hdr_sys_mman_macros",
- "//libc:mlock",
- "//libc:mmap",
- "//libc:msync",
- "//libc:munlock",
- "//libc:munmap",
+ "//libc/src/sys/mman:mlock",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:msync",
+ "//libc/src/sys/mman:munlock",
+ "//libc/src/sys/mman:munmap",
],
)
@@ -114,14 +114,14 @@ libc_test(
"//libc:hdr_errno_macros",
"//libc:hdr_signal_macros",
"//libc:hdr_sys_mman_macros",
- "//libc:mmap",
- "//libc:munmap",
- "//libc:pkey_alloc",
- "//libc:pkey_free",
- "//libc:pkey_get",
- "//libc:pkey_mprotect",
- "//libc:pkey_set",
"//libc:types_size_t",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munmap",
+ "//libc/src/sys/mman:pkey_alloc",
+ "//libc/src/sys/mman:pkey_free",
+ "//libc/src/sys/mman:pkey_get",
+ "//libc/src/sys/mman:pkey_mprotect",
+ "//libc/src/sys/mman:pkey_set",
"//libc/test/UnitTest:test_logger",
],
)
@@ -131,9 +131,9 @@ libc_test(
srcs = ["linux/posix_madvise_test.cpp"],
deps = [
"//libc:hdr_sys_mman_macros",
- "//libc:mmap",
- "//libc:munmap",
- "//libc:posix_madvise",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munmap",
+ "//libc/src/sys/mman:posix_madvise",
],
)
@@ -145,10 +145,10 @@ libc_test(
"//libc:getpagesize",
"//libc:hdr_sys_mman_macros",
"//libc:hdr_sys_stat_macros",
- "//libc:mmap",
- "//libc:munmap",
- "//libc:remap_file_pages",
"//libc/src/fcntl:open",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munmap",
+ "//libc/src/sys/mman:remap_file_pages",
],
)
@@ -160,11 +160,11 @@ libc_test(
"//libc:ftruncate",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_mman_macros",
- "//libc:mmap",
- "//libc:munmap",
- "//libc:shm_open",
- "//libc:shm_unlink",
"//libc/src/fcntl",
"//libc/src/fcntl:open",
+ "//libc/src/sys/mman:mmap",
+ "//libc/src/sys/mman:munmap",
+ "//libc/src/sys/mman:shm_open",
+ "//libc/src/sys/mman:shm_unlink",
],
)
>From e0931f28173559771c2d16f44fdd5e75cebee5ab Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:40 -0800
Subject: [PATCH 19/32] [bazel] Add subpackage for libc/src/sys/prctl
---
.../llvm-project-overlay/libc/BUILD.bazel | 16 ++-------
.../libc/src/sys/prctl/BUILD.bazel | 33 +++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 2 +-
3 files changed, 36 insertions(+), 15 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/prctl/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index ed8f05641a64d..7becc52bf3d6f 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4273,21 +4273,9 @@ libc_function(
############################## sys/prctl targets ##############################
-libc_function(
+alias(
name = "prctl",
- srcs = ["src/sys/prctl/linux/prctl.cpp"],
- hdrs = ["src/sys/prctl/prctl.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/prctl",
)
############################# sys/resource targets #############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/prctl/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/prctl/BUILD.bazel
new file mode 100644
index 0000000000000..e94c60b40da72
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/prctl/BUILD.bazel
@@ -0,0 +1,33 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "prctl",
+ srcs = ["linux/prctl.cpp"],
+ hdrs = ["prctl.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index 0830793eef475..8bc5b0b74b309 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -114,7 +114,7 @@ libc_test_library(
"//conditions:default": [],
}) + select({
"//libc:full_build_linux": [
- "//libc:prctl",
+ "//libc/src/sys/prctl",
],
"//conditions:default": [],
}),
>From 18ca574f65224d9a452321206db64f5be5f05974 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:42 -0800
Subject: [PATCH 20/32] [bazel] Add subpackage for libc/src/sys/random
---
.../llvm-project-overlay/libc/BUILD.bazel | 14 ++-------
.../libc/src/sys/random/BUILD.bazel | 31 +++++++++++++++++++
.../libc/test/src/stdlib/BUILD.bazel | 2 +-
3 files changed, 34 insertions(+), 13 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/random/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 7becc52bf3d6f..ac8eb30f2e808 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4256,19 +4256,9 @@ alias(
############################# sys/random targets #############################
-libc_function(
+alias(
name = "getrandom",
- srcs = ["src/sys/random/linux/getrandom.cpp"],
- hdrs = ["src/sys/random/getrandom.h"],
- deps = [
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:error_or",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getrandom",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/sys/random:getrandom",
)
############################## sys/prctl targets ##############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/random/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/random/BUILD.bazel
new file mode 100644
index 0000000000000..6dda1e4bfe0b9
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/random/BUILD.bazel
@@ -0,0 +1,31 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "getrandom",
+ srcs = ["linux/getrandom.cpp"],
+ hdrs = ["getrandom.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:error_or",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getrandom",
+ "//libc/src/__support/macros:config",
+ ],
+)
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 6a717484719c8..68c1e4ba99aeb 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
@@ -147,7 +147,6 @@ libc_test(
"//libc:close",
"//libc:getcwd",
"//libc:getpid",
- "//libc:getrandom",
"//libc:hdr_errno_macros",
"//libc:hdr_limits_macros",
"//libc:mkdirat",
@@ -164,6 +163,7 @@ libc_test(
"//libc/src/fcntl:openat",
"//libc/src/stdlib:realpath",
"//libc/src/string:strdup",
+ "//libc/src/sys/random:getrandom",
],
)
>From 262a53b451074a85c7ead5fd183b25c1a631405e Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:43 -0800
Subject: [PATCH 21/32] [bazel] Add subpackage for libc/src/sys/resource
---
.../llvm-project-overlay/libc/BUILD.bazel | 28 ++---------
.../libc/src/sys/resource/BUILD.bazel | 46 +++++++++++++++++++
.../libc/test/src/sys/mman/BUILD.bazel | 2 +-
.../libc/test/src/sys/resource/BUILD.bazel | 4 +-
4 files changed, 53 insertions(+), 27 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/resource/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index ac8eb30f2e808..323c91f780278 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4270,34 +4270,14 @@ alias(
############################# sys/resource targets #############################
-libc_function(
+alias(
name = "getrlimit",
- srcs = ["src/sys/resource/linux/getrlimit.cpp"],
- hdrs = ["src/sys/resource/getrlimit.h"],
- deps = [
- ":types_struct_rlimit",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/resource:getrlimit",
)
-libc_function(
+alias(
name = "setrlimit",
- srcs = ["src/sys/resource/linux/setrlimit.cpp"],
- hdrs = ["src/sys/resource/setrlimit.h"],
- deps = [
- ":types_struct_rlimit",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/resource:setrlimit",
)
############################### sys/sem targets ################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/resource/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/resource/BUILD.bazel
new file mode 100644
index 0000000000000..700fca8ba4482
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/resource/BUILD.bazel
@@ -0,0 +1,46 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "getrlimit",
+ srcs = ["linux/getrlimit.cpp"],
+ hdrs = ["getrlimit.h"],
+ deps = [
+ "//libc:types_struct_rlimit",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "setrlimit",
+ srcs = ["linux/setrlimit.cpp"],
+ hdrs = ["setrlimit.h"],
+ deps = [
+ "//libc:types_struct_rlimit",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
index b70e03e1828ca..f1a8d307d1f78 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
@@ -41,7 +41,6 @@ libc_test(
srcs = ["linux/mlock_test.cpp"],
deps = [
"//libc:getpagesize",
- "//libc:getrlimit",
"//libc:hdr_sys_mman_macros",
"//libc:hdr_sys_resource_macros",
"//libc/src/__support/OSUtil:syscall",
@@ -54,6 +53,7 @@ libc_test(
"//libc/src/sys/mman:munlock",
"//libc/src/sys/mman:munlockall",
"//libc/src/sys/mman:munmap",
+ "//libc/src/sys/resource:getrlimit",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
index 3236578f10e6a..c3ccad340615e 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
@@ -15,13 +15,13 @@ libc_test(
srcs = ["getrlimit_setrlimit_test.cpp"],
deps = [
"//libc:close",
- "//libc:getrlimit",
"//libc:hdr_sys_resource_macros",
"//libc:hdr_sys_stat_macros",
- "//libc:setrlimit",
"//libc:types_struct_rlimit",
"//libc:unlink",
"//libc/src/__support/CPP:string_view",
"//libc/src/fcntl:open",
+ "//libc/src/sys/resource:getrlimit",
+ "//libc/src/sys/resource:setrlimit",
],
)
>From b01ccbe388ad8ed31be3763efbb9388505beb217 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:44 -0800
Subject: [PATCH 22/32] [bazel] Add subpackage for libc/src/sys/sem
---
.../llvm-project-overlay/libc/BUILD.bazel | 56 ++------------
.../libc/src/sys/sem/BUILD.bazel | 75 +++++++++++++++++++
2 files changed, 81 insertions(+), 50 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/sem/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 323c91f780278..c6c2f5738bce7 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4282,63 +4282,19 @@ alias(
############################### sys/sem targets ################################
-libc_function(
+alias(
name = "semctl",
- srcs = ["src/sys/sem/linux/semctl.cpp"],
- hdrs = ["src/sys/sem/semctl.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_errno_macros",
- ":hdr_sys_ipc_macros",
- ":hdr_sys_sem_macros",
- ":types_struct_semid_ds",
- ":types_struct_seminfo",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:semctl",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/sem:semctl",
)
-libc_function(
+alias(
name = "semget",
- srcs = ["src/sys/sem/linux/semget.cpp"],
- hdrs = ["src/sys/sem/semget.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_key_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:semget",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/sem:semget",
)
-libc_function(
+alias(
name = "semop",
- srcs = ["src/sys/sem/linux/semop.cpp"],
- hdrs = ["src/sys/sem/semop.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_size_t",
- ":types_struct_sembuf",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:semop",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/sem:semop",
)
############################# sys/sendfile targets #############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/sem/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/sem/BUILD.bazel
new file mode 100644
index 0000000000000..b64e77f2d09fe
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/sem/BUILD.bazel
@@ -0,0 +1,75 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "semctl",
+ srcs = ["linux/semctl.cpp"],
+ hdrs = ["semctl.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_errno_macros",
+ "//libc:hdr_sys_ipc_macros",
+ "//libc:hdr_sys_sem_macros",
+ "//libc:types_struct_semid_ds",
+ "//libc:types_struct_seminfo",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:semctl",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "semget",
+ srcs = ["linux/semget.cpp"],
+ hdrs = ["semget.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_key_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:semget",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "semop",
+ srcs = ["linux/semop.cpp"],
+ hdrs = ["semop.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_struct_sembuf",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:semop",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
>From a4146aaba783e95620c873f8895ac45a08873a37 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:46 -0800
Subject: [PATCH 23/32] [bazel] Add subpackage for libc/src/sys/sendfile
---
.../llvm-project-overlay/libc/BUILD.bazel | 19 ++--------
.../libc/src/sys/sendfile/BUILD.bazel | 36 +++++++++++++++++++
2 files changed, 38 insertions(+), 17 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/sendfile/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c6c2f5738bce7..b5bc1fe3b723f 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4299,24 +4299,9 @@ alias(
############################# sys/sendfile targets #############################
-libc_function(
+alias(
name = "sendfile",
- srcs = ["src/sys/sendfile/linux/sendfile.cpp"],
- hdrs = ["src/sys/sendfile/sendfile.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_off_t",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendfile",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/sendfile",
)
############################### sys/stat targets ###############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/sendfile/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/sendfile/BUILD.bazel
new file mode 100644
index 0000000000000..cee84087c93ec
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/sendfile/BUILD.bazel
@@ -0,0 +1,36 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "sendfile",
+ srcs = ["linux/sendfile.cpp"],
+ hdrs = ["sendfile.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_off_t",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendfile",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
>From 9fe0ab8100e24c61f5eb6f69c5e5d096f39ec4c9 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:47 -0800
Subject: [PATCH 24/32] [bazel] Add subpackage for libc/src/sys/socket
---
.../llvm-project-overlay/libc/BUILD.bazel | 311 +++-------------
.../libc/src/sys/socket/BUILD.bazel | 348 ++++++++++++++++++
.../libc/test/src/sys/socket/BUILD.bazel | 88 ++---
3 files changed, 434 insertions(+), 313 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/socket/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index b5bc1fe3b723f..5e647eb916a1d 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4339,336 +4339,109 @@ libc_function(
############################## sys/socket targets ##############################
-libc_function(
+alias(
name = "accept",
- srcs = ["src/sys/socket/linux/accept.cpp"],
- hdrs = ["src/sys/socket/accept.h"],
- deps = [
- ":types_socklen_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:accept",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:accept",
)
-libc_function(
+alias(
name = "accept4",
- srcs = ["src/sys/socket/linux/accept4.cpp"],
- hdrs = ["src/sys/socket/accept4.h"],
- deps = [
- ":types_socklen_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:accept4",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:accept4",
)
-libc_function(
+alias(
name = "bind",
- srcs = ["src/sys/socket/linux/bind.cpp"],
- hdrs = ["src/sys/socket/bind.h"],
- deps = [
- ":types_socklen_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:bind",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:bind",
)
-libc_function(
+alias(
name = "connect",
- srcs = ["src/sys/socket/linux/connect.cpp"],
- hdrs = ["src/sys/socket/connect.h"],
- deps = [
- ":types_socklen_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:connect",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:connect",
)
-libc_function(
+alias(
name = "getpeername",
- srcs = ["src/sys/socket/linux/getpeername.cpp"],
- hdrs = ["src/sys/socket/getpeername.h"],
- deps = [
- ":types_socklen_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getpeername",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:getpeername",
)
-libc_function(
+alias(
name = "getsockname",
- srcs = ["src/sys/socket/linux/getsockname.cpp"],
- hdrs = ["src/sys/socket/getsockname.h"],
- deps = [
- ":types_socklen_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getsockname",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:getsockname",
)
-libc_function(
+alias(
name = "getsockopt",
- srcs = ["src/sys/socket/linux/getsockopt.cpp"],
- hdrs = ["src/sys/socket/getsockopt.h"],
- deps = [
- ":types_socklen_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getsockopt",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:getsockopt",
)
-libc_function(
+alias(
name = "listen",
- srcs = ["src/sys/socket/linux/listen.cpp"],
- hdrs = ["src/sys/socket/listen.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:listen",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:listen",
)
-libc_function(
+alias(
name = "recv",
- srcs = ["src/sys/socket/linux/recv.cpp"],
- hdrs = ["src/sys/socket/recv.h"],
- deps = [
- ":types_size_t",
- ":types_socklen_t",
- ":types_ssize_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvfrom",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:recv",
)
-libc_function(
+alias(
name = "recvfrom",
- srcs = ["src/sys/socket/linux/recvfrom.cpp"],
- hdrs = ["src/sys/socket/recvfrom.h"],
- deps = [
- ":types_socklen_t",
- ":types_ssize_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvfrom",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:recvfrom",
)
-libc_function(
+alias(
name = "recvmmsg",
- srcs = ["src/sys/socket/linux/recvmmsg.cpp"],
- hdrs = ["src/sys/socket/recvmmsg.h"],
- deps = [
- ":types_struct_mmsghdr",
- ":types_struct_timespec",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvmmsg",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:recvmmsg",
)
-libc_function(
+alias(
name = "recvmsg",
- srcs = ["src/sys/socket/linux/recvmsg.cpp"],
- hdrs = ["src/sys/socket/recvmsg.h"],
- deps = [
- ":types_ssize_t",
- ":types_struct_msghdr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvmsg",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:recvmsg",
)
-libc_function(
+alias(
name = "send",
- srcs = ["src/sys/socket/linux/send.cpp"],
- hdrs = ["src/sys/socket/send.h"],
- deps = [
- ":types_size_t",
- ":types_socklen_t",
- ":types_ssize_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendto",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:send",
)
-libc_function(
+alias(
name = "sendmmsg",
- srcs = ["src/sys/socket/linux/sendmmsg.cpp"],
- hdrs = ["src/sys/socket/sendmmsg.h"],
- deps = [
- ":types_struct_mmsghdr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendmmsg",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:sendmmsg",
)
-libc_function(
+alias(
name = "sendmsg",
- srcs = ["src/sys/socket/linux/sendmsg.cpp"],
- hdrs = ["src/sys/socket/sendmsg.h"],
- deps = [
- ":types_ssize_t",
- ":types_struct_msghdr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendmsg",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:sendmsg",
)
-libc_function(
+alias(
name = "sendto",
- srcs = ["src/sys/socket/linux/sendto.cpp"],
- hdrs = ["src/sys/socket/sendto.h"],
- deps = [
- ":types_socklen_t",
- ":types_ssize_t",
- ":types_struct_sockaddr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendto",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:sendto",
)
-libc_function(
+alias(
name = "setsockopt",
- srcs = ["src/sys/socket/linux/setsockopt.cpp"],
- hdrs = ["src/sys/socket/setsockopt.h"],
- deps = [
- ":types_socklen_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:setsockopt",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:setsockopt",
)
-libc_function(
+alias(
name = "shutdown",
- srcs = ["src/sys/socket/linux/shutdown.cpp"],
- hdrs = ["src/sys/socket/shutdown.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:shutdown",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:shutdown",
)
-libc_function(
+alias(
name = "sockatmark",
- srcs = ["src/sys/socket/linux/sockatmark.cpp"],
- hdrs = ["src/sys/socket/sockatmark.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:ioctl",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:sockatmark",
)
-libc_function(
+alias(
name = "socket",
- srcs = ["src/sys/socket/linux/socket.cpp"],
- hdrs = ["src/sys/socket/socket.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:socket",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket",
)
-libc_function(
+alias(
name = "socketpair",
- srcs = ["src/sys/socket/linux/socketpair.cpp"],
- hdrs = ["src/sys/socket/socketpair.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:socketpair",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/socket:socketpair",
)
############################### sys/uio targets ################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/socket/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/socket/BUILD.bazel
new file mode 100644
index 0000000000000..dd6719c3cc3fd
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/socket/BUILD.bazel
@@ -0,0 +1,348 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "accept",
+ srcs = ["linux/accept.cpp"],
+ hdrs = ["accept.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:accept",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "accept4",
+ srcs = ["linux/accept4.cpp"],
+ hdrs = ["accept4.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:accept4",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "bind",
+ srcs = ["linux/bind.cpp"],
+ hdrs = ["bind.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:bind",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "connect",
+ srcs = ["linux/connect.cpp"],
+ hdrs = ["connect.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:connect",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "getpeername",
+ srcs = ["linux/getpeername.cpp"],
+ hdrs = ["getpeername.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getpeername",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "getsockname",
+ srcs = ["linux/getsockname.cpp"],
+ hdrs = ["getsockname.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getsockname",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "getsockopt",
+ srcs = ["linux/getsockopt.cpp"],
+ hdrs = ["getsockopt.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getsockopt",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "listen",
+ srcs = ["linux/listen.cpp"],
+ hdrs = ["listen.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:listen",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "recv",
+ srcs = ["linux/recv.cpp"],
+ hdrs = ["recv.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_socklen_t",
+ "//libc:types_ssize_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvfrom",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "recvfrom",
+ srcs = ["linux/recvfrom.cpp"],
+ hdrs = ["recvfrom.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_ssize_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvfrom",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "recvmmsg",
+ srcs = ["linux/recvmmsg.cpp"],
+ hdrs = ["recvmmsg.h"],
+ deps = [
+ "//libc:types_struct_mmsghdr",
+ "//libc:types_struct_timespec",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvmmsg",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "recvmsg",
+ srcs = ["linux/recvmsg.cpp"],
+ hdrs = ["recvmsg.h"],
+ deps = [
+ "//libc:types_ssize_t",
+ "//libc:types_struct_msghdr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:recvmsg",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "send",
+ srcs = ["linux/send.cpp"],
+ hdrs = ["send.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_socklen_t",
+ "//libc:types_ssize_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendto",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sendmmsg",
+ srcs = ["linux/sendmmsg.cpp"],
+ hdrs = ["sendmmsg.h"],
+ deps = [
+ "//libc:types_struct_mmsghdr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendmmsg",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sendmsg",
+ srcs = ["linux/sendmsg.cpp"],
+ hdrs = ["sendmsg.h"],
+ deps = [
+ "//libc:types_ssize_t",
+ "//libc:types_struct_msghdr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendmsg",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sendto",
+ srcs = ["linux/sendto.cpp"],
+ hdrs = ["sendto.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc:types_ssize_t",
+ "//libc:types_struct_sockaddr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sendto",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "setsockopt",
+ srcs = ["linux/setsockopt.cpp"],
+ hdrs = ["setsockopt.h"],
+ deps = [
+ "//libc:types_socklen_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:setsockopt",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "shutdown",
+ srcs = ["linux/shutdown.cpp"],
+ hdrs = ["shutdown.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:shutdown",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "sockatmark",
+ srcs = ["linux/sockatmark.cpp"],
+ hdrs = ["sockatmark.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:ioctl",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "socket",
+ srcs = ["linux/socket.cpp"],
+ hdrs = ["socket.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:socket",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "socketpair",
+ srcs = ["linux/socketpair.cpp"],
+ hdrs = ["socketpair.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:socketpair",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
index 5a5a6a46f2d7f..1aa25dc6c5e67 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
@@ -36,12 +36,9 @@ libc_test(
srcs = ["linux/bind_test.cpp"],
deps = [
":socket_test_support",
- "//libc:bind",
"//libc:close",
- "//libc:getsockname",
"//libc:hdr_netinet_in_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:socket",
"//libc:types_sa_family_t",
"//libc:types_struct_sockaddr_in",
"//libc:types_struct_sockaddr_in6",
@@ -49,6 +46,9 @@ libc_test(
"//libc/src/__support/CPP:scope",
"//libc/src/arpa/inet:htonl",
"//libc/src/stdio:remove",
+ "//libc/src/sys/socket",
+ "//libc/src/sys/socket:bind",
+ "//libc/src/sys/socket:getsockname",
],
)
@@ -57,15 +57,9 @@ libc_test(
srcs = ["linux/connect_accept_test.cpp"],
deps = [
":socket_test_support",
- "//libc:accept",
- "//libc:accept4",
- "//libc:bind",
"//libc:close",
- "//libc:connect",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
- "//libc:listen",
- "//libc:socket",
"//libc:types_sa_family_t",
"//libc:types_size_t",
"//libc:types_socklen_t",
@@ -73,6 +67,12 @@ libc_test(
"//libc/src/__support/CPP:scope",
"//libc/src/fcntl",
"//libc/src/stdio:remove",
+ "//libc/src/sys/socket",
+ "//libc/src/sys/socket:accept",
+ "//libc/src/sys/socket:accept4",
+ "//libc/src/sys/socket:bind",
+ "//libc/src/sys/socket:connect",
+ "//libc/src/sys/socket:listen",
],
)
@@ -81,14 +81,14 @@ libc_test(
srcs = ["linux/listen_test.cpp"],
deps = [
":socket_test_support",
- "//libc:bind",
"//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:listen",
- "//libc:socket",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
"//libc/src/stdio:remove",
+ "//libc/src/sys/socket",
+ "//libc/src/sys/socket:bind",
+ "//libc/src/sys/socket:listen",
],
)
@@ -98,10 +98,10 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:recv",
- "//libc:send",
- "//libc:socketpair",
"//libc/src/__support/CPP:scope",
+ "//libc/src/sys/socket:recv",
+ "//libc/src/sys/socket:send",
+ "//libc/src/sys/socket:socketpair",
],
)
@@ -110,18 +110,18 @@ libc_test(
srcs = ["linux/sendmsg_recvmsg_test.cpp"],
deps = [
"//libc:close",
- "//libc:getsockopt",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
"//libc:llvm_libc_macros_sys_socket_macros",
- "//libc:recvmsg",
- "//libc:sendmsg",
- "//libc:socketpair",
"//libc:types_struct_cmsghdr",
"//libc/src/__support/CPP:scope",
"//libc/src/fcntl",
"//libc/src/string:memcpy",
"//libc/src/string:memset",
+ "//libc/src/sys/socket:getsockopt",
+ "//libc/src/sys/socket:recvmsg",
+ "//libc/src/sys/socket:sendmsg",
+ "//libc/src/sys/socket:socketpair",
],
)
@@ -131,14 +131,14 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:recvmmsg",
- "//libc:sendmmsg",
- "//libc:socketpair",
"//libc:types_struct_iovec",
"//libc:types_struct_mmsghdr",
"//libc:types_struct_timespec",
"//libc/src/__support/CPP:scope",
"//libc/src/string:strlen",
+ "//libc/src/sys/socket:recvmmsg",
+ "//libc/src/sys/socket:sendmmsg",
+ "//libc/src/sys/socket:socketpair",
],
)
@@ -148,10 +148,10 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:recvfrom",
- "//libc:sendto",
- "//libc:socketpair",
"//libc/src/__support/CPP:scope",
+ "//libc/src/sys/socket:recvfrom",
+ "//libc/src/sys/socket:sendto",
+ "//libc/src/sys/socket:socketpair",
],
)
@@ -162,10 +162,10 @@ libc_test(
"//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc:read",
- "//libc:shutdown",
- "//libc:socketpair",
"//libc:types_ssize_t",
"//libc/src/__support/CPP:scope",
+ "//libc/src/sys/socket:shutdown",
+ "//libc/src/sys/socket:socketpair",
],
)
@@ -189,8 +189,8 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:socket",
"//libc/src/__support/CPP:scope",
+ "//libc/src/sys/socket",
],
)
@@ -199,22 +199,22 @@ libc_test(
srcs = ["linux/socketopt_test.cpp"],
deps = [
"//libc:close",
- "//libc:getsockopt",
"//libc:hdr_netinet_in_macros",
"//libc:hdr_netinet_tcp_macros",
"//libc:hdr_sys_socket_macros",
"//libc:hdr_time_macros",
"//libc:pipe",
- "//libc:recv",
- "//libc:setsockopt",
- "//libc:socket",
- "//libc:socketpair",
"//libc:types_socklen_t",
"//libc:types_struct_linger",
"//libc:types_struct_timespec",
"//libc:types_struct_timeval",
"//libc/src/__support/CPP:scope",
"//libc/src/__support/time:clock_gettime",
+ "//libc/src/sys/socket",
+ "//libc/src/sys/socket:getsockopt",
+ "//libc/src/sys/socket:recv",
+ "//libc/src/sys/socket:setsockopt",
+ "//libc/src/sys/socket:socketpair",
],
)
@@ -225,10 +225,10 @@ libc_test(
"//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc:pipe",
- "//libc:send",
- "//libc:sockatmark",
- "//libc:socketpair",
"//libc/src/__support/CPP:scope",
+ "//libc/src/sys/socket:send",
+ "//libc/src/sys/socket:sockatmark",
+ "//libc/src/sys/socket:socketpair",
"//libc/test/UnitTest:test_logger",
],
)
@@ -239,8 +239,8 @@ libc_test(
deps = [
"//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:socketpair",
"//libc/src/__support/CPP:scope",
+ "//libc/src/sys/socket:socketpair",
],
)
@@ -249,19 +249,19 @@ libc_test(
srcs = ["linux/sockname_test.cpp"],
deps = [
":socket_test_support",
- "//libc:accept",
- "//libc:bind",
"//libc:close",
- "//libc:connect",
- "//libc:getpeername",
- "//libc:getsockname",
"//libc:hdr_sys_socket_macros",
- "//libc:listen",
- "//libc:socket",
"//libc:types_sa_family_t",
"//libc:types_socklen_t",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
"//libc/src/stdio:remove",
+ "//libc/src/sys/socket",
+ "//libc/src/sys/socket:accept",
+ "//libc/src/sys/socket:bind",
+ "//libc/src/sys/socket:connect",
+ "//libc/src/sys/socket:getpeername",
+ "//libc/src/sys/socket:getsockname",
+ "//libc/src/sys/socket:listen",
],
)
>From ed75ef059b91422b6a067c201beab05ff3eaf887 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:48 -0800
Subject: [PATCH 25/32] [bazel] Add subpackage for libc/src/sys/stat
---
.../llvm-project-overlay/libc/BUILD.bazel | 29 ++----------
.../libc/src/sys/stat/BUILD.bazel | 47 +++++++++++++++++++
.../libc/test/src/stdio/BUILD.bazel | 2 +-
.../libc/test/src/stdlib/BUILD.bazel | 2 +-
4 files changed, 53 insertions(+), 27 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/stat/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 5e647eb916a1d..a51c9a8fa6d49 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4306,35 +4306,14 @@ alias(
############################### sys/stat targets ###############################
-libc_function(
+alias(
name = "mkdir",
- srcs = ["src/sys/stat/linux/mkdir.cpp"],
- hdrs = ["src/sys/stat/mkdir.h"],
- deps = [
- ":hdr_fcntl_macros",
- ":types_mode_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:mkdir",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/stat:mkdir",
)
-libc_function(
+alias(
name = "mkdirat",
- srcs = ["src/sys/stat/linux/mkdirat.cpp"],
- hdrs = ["src/sys/stat/mkdirat.h"],
- deps = [
- ":types_mode_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:mkdirat",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/stat:mkdirat",
)
############################## sys/socket targets ##############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/stat/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/stat/BUILD.bazel
new file mode 100644
index 0000000000000..e7138c4dc7b52
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/stat/BUILD.bazel
@@ -0,0 +1,47 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "mkdir",
+ srcs = ["linux/mkdir.cpp"],
+ hdrs = ["mkdir.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:types_mode_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:mkdir",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "mkdirat",
+ srcs = ["linux/mkdirat.cpp"],
+ hdrs = ["mkdirat.h"],
+ deps = [
+ "//libc:types_mode_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:mkdirat",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
index 51e17c1e00e30..05365b23b999a 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
@@ -124,9 +124,9 @@ libc_test(
"//libc:access",
"//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:mkdirat",
"//libc/src/fcntl:open",
"//libc/src/stdio:remove",
+ "//libc/src/sys/stat:mkdirat",
],
)
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 68c1e4ba99aeb..96f99187450d9 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
@@ -149,7 +149,6 @@ libc_test(
"//libc:getpid",
"//libc:hdr_errno_macros",
"//libc:hdr_limits_macros",
- "//libc:mkdirat",
"//libc:symlinkat",
"//libc:types_size_t",
"//libc:unlinkat",
@@ -164,6 +163,7 @@ libc_test(
"//libc/src/stdlib:realpath",
"//libc/src/string:strdup",
"//libc/src/sys/random:getrandom",
+ "//libc/src/sys/stat:mkdirat",
],
)
>From 1c81c91e4c2a02ac34a5474b14a9e55d8868c063 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:49 -0800
Subject: [PATCH 26/32] [bazel] Add subpackage for libc/src/sys/uio
---
.../llvm-project-overlay/libc/BUILD.bazel | 36 ++-----------
.../libc/src/sys/uio/BUILD.bazel | 54 +++++++++++++++++++
2 files changed, 58 insertions(+), 32 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/uio/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index a51c9a8fa6d49..12563c4e0b3b0 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4425,42 +4425,14 @@ alias(
############################### sys/uio targets ################################
-libc_function(
+alias(
name = "readv",
- srcs = ["src/sys/uio/linux/readv.cpp"],
- hdrs = ["src/sys/uio/readv.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_ssize_t",
- ":types_struct_iovec",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:readv",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/uio:readv",
)
-libc_function(
+alias(
name = "writev",
- srcs = ["src/sys/uio/linux/writev.cpp"],
- hdrs = ["src/sys/uio/writev.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_ssize_t",
- ":types_struct_iovec",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:writev",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/uio:writev",
)
############################# sys/utsname targets ##############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/uio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/uio/BUILD.bazel
new file mode 100644
index 0000000000000..61895a08e15e8
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/uio/BUILD.bazel
@@ -0,0 +1,54 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "readv",
+ srcs = ["linux/readv.cpp"],
+ hdrs = ["readv.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_ssize_t",
+ "//libc:types_struct_iovec",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:readv",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "writev",
+ srcs = ["linux/writev.cpp"],
+ hdrs = ["writev.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_ssize_t",
+ "//libc:types_struct_iovec",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:writev",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
>From b39aa3f8547e041630e07b905a3ad9169421f6fb Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:51 -0800
Subject: [PATCH 27/32] [bazel] Add subpackage for libc/src/sys/utsname
---
.../llvm-project-overlay/libc/BUILD.bazel | 17 ++--------
.../libc/src/sys/utsname/BUILD.bazel | 34 +++++++++++++++++++
2 files changed, 36 insertions(+), 15 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/utsname/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 12563c4e0b3b0..108ed7f566db4 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4437,22 +4437,9 @@ alias(
############################# sys/utsname targets ##############################
-libc_function(
+alias(
name = "uname",
- srcs = ["src/sys/utsname/linux/uname.cpp"],
- hdrs = ["src/sys/utsname/uname.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_struct_utsname",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:uname",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/utsname:uname",
)
############################## sys/epoll targets ###############################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/utsname/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/utsname/BUILD.bazel
new file mode 100644
index 0000000000000..242301041cdf7
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/utsname/BUILD.bazel
@@ -0,0 +1,34 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "uname",
+ srcs = ["linux/uname.cpp"],
+ hdrs = ["uname.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_struct_utsname",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:uname",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
>From 82e6983e2bb3b994200e8d1864df556092393ee6 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:52 -0800
Subject: [PATCH 28/32] [bazel] Add subpackage for libc/src/sys/wait
---
.../llvm-project-overlay/libc/BUILD.bazel | 18 ++--------
.../libc/src/sys/wait/BUILD.bazel | 35 +++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 2 +-
3 files changed, 38 insertions(+), 17 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/sys/wait/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 108ed7f566db4..f3cfdabfdd157 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3576,23 +3576,9 @@ alias(
actual = "//libc/src/signal",
)
-libc_function(
+alias(
name = "waitpid",
- srcs = ["src/sys/wait/linux/waitpid.cpp"],
- hdrs = ["src/sys/wait/waitpid.h"],
- deps = [
- ":hdr_signal_macros",
- ":hdr_sys_wait_macros",
- ":types_pid_t",
- ":types_siginfo_t",
- ":types_struct_rusage",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_assert",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:wait4",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/sys/wait:waitpid",
)
libc_function(
diff --git a/utils/bazel/llvm-project-overlay/libc/src/sys/wait/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/sys/wait/BUILD.bazel
new file mode 100644
index 0000000000000..ee9cfab1d0b21
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/sys/wait/BUILD.bazel
@@ -0,0 +1,35 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "waitpid",
+ srcs = ["linux/waitpid.cpp"],
+ hdrs = ["waitpid.h"],
+ deps = [
+ "//libc:hdr_signal_macros",
+ "//libc:hdr_sys_wait_macros",
+ "//libc:types_pid_t",
+ "//libc:types_siginfo_t",
+ "//libc:types_struct_rusage",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_assert",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:wait4",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index 8bc5b0b74b309..85482b665363a 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -100,7 +100,6 @@ libc_test_library(
"//libc:llvm_libc_types_pid_t",
"//libc:llvm_libc_types_struct_pollfd",
"//libc:pipe",
- "//libc:waitpid",
"//libc/src/poll",
"//libc/src/signal",
"//libc/src/signal:kill",
@@ -110,6 +109,7 @@ libc_test_library(
"//libc/src/stdlib:exit",
"//libc/src/stdlib:getenv",
"//libc/src/string:strsignal",
+ "//libc/src/sys/wait:waitpid",
],
"//conditions:default": [],
}) + select({
>From d291d71cc5fad84ed44f21f87ae0eb60ec19d318 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:53 -0800
Subject: [PATCH 29/32] [bazel] Add subpackage for libc/src/time
---
.../llvm-project-overlay/libc/BUILD.bazel | 18 +++--------
.../libc/src/time/BUILD.bazel | 32 +++++++++++++++++++
.../libc/test/UnitTest/BUILD.bazel | 2 +-
3 files changed, 37 insertions(+), 15 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/time/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index f3cfdabfdd157..4b07fd388a704 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3181,22 +3181,12 @@ alias(
################################ time targets ##################################
-libc_function(
+################################ unistd targets ################################
+
+alias(
name = "clock",
- srcs = ["src/time/linux/clock.cpp"],
- hdrs = ["src/time/clock.h"],
- deps = [
- ":hdr_time_macros",
- ":types_clock_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/CPP:limits",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/time",
- "//libc/src/__support/time:clock_gettime",
- ],
+ actual = "//libc/src/time:clock",
)
-################################ unistd targets ################################
libc_function(
name = "access",
diff --git a/utils/bazel/llvm-project-overlay/libc/src/time/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/time/BUILD.bazel
new file mode 100644
index 0000000000000..6bc1ec6c315d9
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/time/BUILD.bazel
@@ -0,0 +1,32 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "clock",
+ srcs = ["linux/clock.cpp"],
+ hdrs = ["clock.h"],
+ deps = [
+ "//libc:hdr_time_macros",
+ "//libc:types_clock_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/CPP:limits",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/time",
+ "//libc/src/__support/time:clock_gettime",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index 85482b665363a..b610d4066ecf5 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -57,7 +57,6 @@ libc_test_library(
deps = [
":string_utils",
":test_logger",
- "//libc:clock",
"//libc:func_aligned_alloc",
"//libc:func_free",
"//libc:func_malloc",
@@ -90,6 +89,7 @@ libc_test_library(
"//libc/src/__support/macros/properties:types",
"//libc/src/__support/wchar:string_converter",
"//libc/src/errno",
+ "//libc/src/time:clock",
] + select({
"//libc:full_build": [
"//libc:close",
>From 37151a67f63689f3eb9e5d9376221ee4fbad6f56 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:54 -0800
Subject: [PATCH 30/32] [bazel] Add subpackage for libc/src/unistd
---
.../llvm-project-overlay/libc/BUILD.bazel | 645 +++-------------
.../libc/src/stdlib/BUILD.bazel | 2 +-
.../libc/src/unistd/BUILD.bazel | 704 ++++++++++++++++++
.../libc/startup/linux/BUILD.bazel | 2 +-
.../libc/test/BUILD.bazel | 2 +-
.../libc/test/UnitTest/BUILD.bazel | 6 +-
.../libc/test/src/stdio/BUILD.bazel | 4 +-
.../libc/test/src/stdlib/BUILD.bazel | 12 +-
.../libc/test/src/sys/epoll/BUILD.bazel | 20 +-
.../libc/test/src/sys/mman/BUILD.bazel | 16 +-
.../libc/test/src/sys/resource/BUILD.bazel | 4 +-
.../libc/test/src/sys/socket/BUILD.bazel | 38 +-
.../libc/test/src/unistd/BUILD.bazel | 110 +--
13 files changed, 898 insertions(+), 667 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/unistd/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 4b07fd388a704..c67e914b03626 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3188,140 +3188,49 @@ alias(
actual = "//libc/src/time:clock",
)
-libc_function(
+alias(
name = "access",
- srcs = ["src/unistd/linux/access.cpp"],
- hdrs = ["src/unistd/access.h"],
- deps = [
- ":hdr_fcntl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:access",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:access",
)
-libc_function(
+alias(
name = "chdir",
- srcs = ["src/unistd/linux/chdir.cpp"],
- hdrs = ["src/unistd/chdir.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:chdir",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:chdir",
)
-libc_function(
+alias(
name = "chown",
- srcs = ["src/unistd/linux/chown.cpp"],
- hdrs = ["src/unistd/chown.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_gid_t",
- ":types_uid_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:chown",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:chown",
)
-libc_function(
+alias(
name = "close",
- srcs = ["src/unistd/linux/close.cpp"],
- hdrs = ["src/unistd/close.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:close",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:close",
)
-libc_function(
+alias(
name = "dup",
- srcs = ["src/unistd/linux/dup.cpp"],
- hdrs = ["src/unistd/dup.h"],
- deps = [
- ":hdr_unistd_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:dup",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:dup",
)
-libc_function(
+alias(
name = "dup2",
- srcs = ["src/unistd/linux/dup2.cpp"],
- hdrs = ["src/unistd/dup2.h"],
- deps = [
- ":hdr_fcntl_macros",
- ":hdr_unistd_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:dup2",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:dup2",
)
-libc_function(
+alias(
name = "dup3",
- srcs = ["src/unistd/linux/dup3.cpp"],
- hdrs = ["src/unistd/dup3.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_unistd_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:dup3",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:dup3",
)
-libc_function(
+alias(
name = "environ",
- srcs = ["src/unistd/environ.cpp"],
- hdrs = ["src/unistd/environ.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:environ",
)
-libc_function(
+alias(
name = "fchdir",
- srcs = ["src/unistd/linux/fchdir.cpp"],
- hdrs = ["src/unistd/fchdir.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:fchdir",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:fchdir",
)
alias(
@@ -3379,166 +3288,54 @@ alias(
actual = "//libc/src/sched:sched_yield",
)
-libc_function(
+alias(
name = "fchown",
- srcs = ["src/unistd/linux/fchown.cpp"],
- hdrs = ["src/unistd/fchown.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_gid_t",
- ":types_uid_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:fchown",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:fchown",
)
-libc_function(
+alias(
name = "fsync",
- srcs = ["src/unistd/linux/fsync.cpp"],
- hdrs = ["src/unistd/fsync.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:fsync",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:fsync",
)
-libc_function(
+alias(
name = "ftruncate",
- srcs = ["src/unistd/linux/ftruncate.cpp"],
- hdrs = ["src/unistd/ftruncate.h"],
- deps = [
- ":hdr_stdint_proxy",
- ":hdr_unistd_macros",
- ":types_off_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:ftruncate",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:ftruncate",
)
-libc_function(
+alias(
name = "getcwd",
- srcs = ["src/unistd/linux/getcwd.cpp"],
- hdrs = ["src/unistd/getcwd.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:checked_ptr",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcwd",
- "//libc/src/__support/macros:config",
- "//libc/src/string:allocating_string_utils",
- ],
+ actual = "//libc/src/unistd:getcwd",
)
-libc_function(
+alias(
name = "geteuid",
- srcs = ["src/unistd/linux/geteuid.cpp"],
- hdrs = ["src/unistd/geteuid.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_uid_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:geteuid",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:geteuid",
)
-libc_function(
+alias(
name = "gethostname",
- srcs = ["src/unistd/linux/gethostname.cpp"],
- hdrs = ["src/unistd/gethostname.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_size_t",
- ":types_struct_utsname",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:uname",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/unistd:gethostname",
)
-libc_function(
+alias(
name = "getpagesize",
- srcs = ["src/unistd/linux/getpagesize.cpp"],
- hdrs = ["src/unistd/getpagesize.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil:linux_auxv",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:getpagesize",
)
-libc_function(
+alias(
name = "getpid",
- srcs = ["src/unistd/linux/getpid.cpp"],
- hdrs = ["src/unistd/getpid.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_pid_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getpid",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:getpid",
)
-libc_function(
+alias(
name = "getppid",
- srcs = ["src/unistd/linux/getppid.cpp"],
- hdrs = ["src/unistd/getppid.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_pid_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getppid",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:getppid",
)
-libc_function(
+alias(
name = "fork",
- srcs = ["src/unistd/linux/fork.cpp"],
- hdrs = ["src/unistd/fork.h"],
- full_build_only = True,
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_signal_macros",
- ":hdr_unistd_macros",
- ":types_pid_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/threads:fork_callbacks",
- "//libc/src/__support/threads:identifier",
- "//libc/src/__support/threads:thread",
- "//libc/src/__support/threads:thread_headers",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:fork",
)
alias(
@@ -3571,60 +3368,24 @@ alias(
actual = "//libc/src/sys/wait:waitpid",
)
-libc_function(
+alias(
name = "getsid",
- srcs = ["src/unistd/linux/getsid.cpp"],
- hdrs = ["src/unistd/getsid.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_pid_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getsid",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:getsid",
)
-libc_function(
+alias(
name = "getuid",
- srcs = ["src/unistd/linux/getuid.cpp"],
- hdrs = ["src/unistd/getuid.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_uid_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getuid",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:getuid",
)
-libc_function(
+alias(
name = "getegid",
- srcs = ["src/unistd/linux/getegid.cpp"],
- hdrs = ["src/unistd/getegid.h"],
- deps = [
- ":types_gid_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getegid",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:getegid",
)
-libc_function(
+alias(
name = "getgid",
- srcs = ["src/unistd/linux/getgid.cpp"],
- hdrs = ["src/unistd/getgid.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_gid_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:getgid",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:getgid",
)
# libc_function(
@@ -3642,236 +3403,74 @@ libc_function(
# ],
# )
-libc_function(
+alias(
name = "isatty",
- srcs = ["src/unistd/linux/isatty.cpp"],
- hdrs = ["src/unistd/isatty.h"],
- deps = [
- ":hdr_unistd_macros",
- ":sys_ioctl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:ioctl",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:isatty",
)
-libc_function(
+alias(
name = "link",
- srcs = ["src/unistd/linux/link.cpp"],
- hdrs = ["src/unistd/link.h"],
- deps = [
- ":hdr_fcntl_macros",
- ":hdr_unistd_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:link",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:link",
)
-libc_function(
+alias(
name = "linkat",
- srcs = ["src/unistd/linux/linkat.cpp"],
- hdrs = ["src/unistd/linkat.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:linkat",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:linkat",
)
-libc_function(
+alias(
name = "pipe",
- srcs = ["src/unistd/linux/pipe.cpp"],
- hdrs = ["src/unistd/pipe.h"],
- deps = [
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:pipe",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:pipe",
)
-libc_function(
+alias(
name = "lseek",
- srcs = ["src/unistd/linux/lseek.cpp"],
- hdrs = ["src/unistd/lseek.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_off_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:lseek",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:lseek",
)
-libc_function(
+alias(
name = "pread",
- srcs = ["src/unistd/linux/pread.cpp"],
- hdrs = ["src/unistd/pread.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_unistd_macros",
- ":types_off_t",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:pread",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:pread",
)
-libc_function(
+alias(
name = "pwrite",
- srcs = ["src/unistd/linux/pwrite.cpp"],
- hdrs = ["src/unistd/pwrite.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_unistd_macros",
- ":types_off_t",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:pwrite",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:pwrite",
)
-libc_function(
+alias(
name = "read",
- srcs = ["src/unistd/linux/read.cpp"],
- hdrs = ["src/unistd/read.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:read",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:sanitizer",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:read",
)
-libc_function(
+alias(
name = "readlink",
- srcs = ["src/unistd/linux/readlink.cpp"],
- hdrs = ["src/unistd/readlink.h"],
- deps = [
- ":hdr_fcntl_macros",
- ":hdr_unistd_macros",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:readlink",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:readlink",
)
-libc_function(
+alias(
name = "readlinkat",
- srcs = ["src/unistd/linux/readlinkat.cpp"],
- hdrs = ["src/unistd/readlinkat.h"],
- deps = [
- ":hdr_fcntl_macros",
- ":hdr_unistd_macros",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:readlinkat",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:readlinkat",
)
-libc_function(
+alias(
name = "rmdir",
- srcs = ["src/unistd/linux/rmdir.cpp"],
- hdrs = ["src/unistd/rmdir.h"],
- deps = [
- ":hdr_fcntl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:rmdir",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:rmdir",
)
-libc_function(
+alias(
name = "setsid",
- srcs = ["src/unistd/linux/setsid.cpp"],
- hdrs = ["src/unistd/setsid.h"],
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":types_pid_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:setsid",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:setsid",
)
-libc_function(
+alias(
name = "symlink",
- srcs = ["src/unistd/linux/symlink.cpp"],
- hdrs = ["src/unistd/symlink.h"],
- deps = [
- ":hdr_unistd_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:symlink",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:symlink",
)
-libc_function(
+alias(
name = "symlinkat",
- srcs = ["src/unistd/linux/symlinkat.cpp"],
- hdrs = ["src/unistd/symlinkat.h"],
- deps = [
- ":hdr_unistd_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:symlinkat",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:symlinkat",
)
#TODO: Enable once fullbuild is added to bazel, since this depends on a macro
@@ -3889,106 +3488,34 @@ libc_function(
# ],
# )
-libc_function(
+alias(
name = "swab",
- srcs = ["src/unistd/swab.cpp"],
- hdrs = ["src/unistd/swab.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/unistd:swab",
)
-libc_function(
+alias(
name = "truncate",
- srcs = ["src/unistd/linux/truncate.cpp"],
- hdrs = ["src/unistd/truncate.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_off_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:truncate",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:truncate",
)
-libc_function(
+alias(
name = "unlink",
- srcs = ["src/unistd/linux/unlink.cpp"],
- hdrs = ["src/unistd/unlink.h"],
- deps = [
- ":hdr_fcntl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlink",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:unlink",
)
-libc_function(
+alias(
name = "unlinkat",
- srcs = ["src/unistd/linux/unlinkat.cpp"],
- hdrs = ["src/unistd/unlinkat.h"],
- deps = [
- ":hdr_fcntl_macros",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:syscall",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlinkat",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:unlinkat",
)
-# WARNING: NOT FULLY IMPLEMENTED, FOR TESTING USE ONLY
-libc_function(
+alias(
name = "sysconf",
- srcs = ["src/unistd/linux/sysconf.cpp"],
- hdrs = ["src/unistd/sysconf.h"],
- full_build_only = True,
- target_compatible_with = select({
- "@platforms//os:linux": [],
- "//conditions:default": ["@platforms//:incompatible"],
- }),
- deps = [
- ":hdr_limits_macros",
- ":hdr_sys_auxv_macros",
- ":hdr_sys_resource_macros",
- ":hdr_unistd_macros",
- ":types_struct_rlimit",
- ":types_struct_sysinfo",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil:linux_auxv",
- "//libc/src/__support/OSUtil:linux_sysinfo",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:sysinfo",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:sysconf",
)
-libc_function(
+alias(
name = "write",
- srcs = ["src/unistd/linux/write.cpp"],
- hdrs = ["src/unistd/write.h"],
- deps = [
- ":hdr_unistd_macros",
- ":types_size_t",
- ":types_ssize_t",
- "//libc/src/__support:common",
- "//libc/src/__support:libc_errno",
- "//libc/src/__support/OSUtil/linux/syscall_wrappers:write",
- "//libc/src/__support/macros:config",
- "//libc/src/errno",
- ],
+ actual = "//libc/src/unistd:write",
)
################################ stdio targets #################################
diff --git a/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
index 5329fb8d003ec..d23bee35e6e8f 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/stdlib/BUILD.bazel
@@ -257,7 +257,6 @@ libc_support_library(
hdrs = ["environ_internal.h"],
deps = [
"//libc:config_app_h",
- "//libc:environ",
"//libc:types_size_t",
"//libc/src/__support:checked_ptr",
"//libc/src/__support:common",
@@ -267,6 +266,7 @@ libc_support_library(
"//libc/src/__support/macros:attributes",
"//libc/src/__support/macros:config",
"//libc/src/string/memory_utils",
+ "//libc/src/unistd:environ",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/unistd/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/unistd/BUILD.bazel
new file mode 100644
index 0000000000000..0e297e7093e3b
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/unistd/BUILD.bazel
@@ -0,0 +1,704 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_function(
+ name = "access",
+ srcs = ["linux/access.cpp"],
+ hdrs = ["access.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:access",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "chdir",
+ srcs = ["linux/chdir.cpp"],
+ hdrs = ["chdir.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:chdir",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "chown",
+ srcs = ["linux/chown.cpp"],
+ hdrs = ["chown.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_gid_t",
+ "//libc:types_uid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:chown",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "close",
+ srcs = ["linux/close.cpp"],
+ hdrs = ["close.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:close",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "dup",
+ srcs = ["linux/dup.cpp"],
+ hdrs = ["dup.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:dup",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "dup2",
+ srcs = ["linux/dup2.cpp"],
+ hdrs = ["dup2.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:hdr_unistd_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:dup2",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "dup3",
+ srcs = ["linux/dup3.cpp"],
+ hdrs = ["dup3.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:dup3",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "environ",
+ srcs = ["environ.cpp"],
+ hdrs = ["environ.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fchdir",
+ srcs = ["linux/fchdir.cpp"],
+ hdrs = ["fchdir.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:fchdir",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "fchown",
+ srcs = ["linux/fchown.cpp"],
+ hdrs = ["fchown.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_gid_t",
+ "//libc:types_uid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:fchown",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "fsync",
+ srcs = ["linux/fsync.cpp"],
+ hdrs = ["fsync.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:fsync",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "ftruncate",
+ srcs = ["linux/ftruncate.cpp"],
+ hdrs = ["ftruncate.h"],
+ deps = [
+ "//libc:hdr_stdint_proxy",
+ "//libc:hdr_unistd_macros",
+ "//libc:types_off_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:ftruncate",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "getcwd",
+ srcs = ["linux/getcwd.cpp"],
+ hdrs = ["getcwd.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:checked_ptr",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getcwd",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:allocating_string_utils",
+ ],
+)
+
+libc_function(
+ name = "geteuid",
+ srcs = ["linux/geteuid.cpp"],
+ hdrs = ["geteuid.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_uid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:geteuid",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "gethostname",
+ srcs = ["linux/gethostname.cpp"],
+ hdrs = ["gethostname.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_struct_utsname",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:uname",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "getpagesize",
+ srcs = ["linux/getpagesize.cpp"],
+ hdrs = ["getpagesize.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil:linux_auxv",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "getpid",
+ srcs = ["linux/getpid.cpp"],
+ hdrs = ["getpid.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_pid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getpid",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "getppid",
+ srcs = ["linux/getppid.cpp"],
+ hdrs = ["getppid.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_pid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getppid",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "fork",
+ srcs = ["linux/fork.cpp"],
+ hdrs = ["fork.h"],
+ full_build_only = True,
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_signal_macros",
+ "//libc:hdr_unistd_macros",
+ "//libc:types_pid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/threads:fork_callbacks",
+ "//libc/src/__support/threads:identifier",
+ "//libc/src/__support/threads:thread",
+ "//libc/src/__support/threads:thread_headers",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "getsid",
+ srcs = ["linux/getsid.cpp"],
+ hdrs = ["getsid.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_pid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getsid",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "getuid",
+ srcs = ["linux/getuid.cpp"],
+ hdrs = ["getuid.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_uid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getuid",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "getegid",
+ srcs = ["linux/getegid.cpp"],
+ hdrs = ["getegid.h"],
+ deps = [
+ "//libc:types_gid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getegid",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "getgid",
+ srcs = ["linux/getgid.cpp"],
+ hdrs = ["getgid.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_gid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:getgid",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "isatty",
+ srcs = ["linux/isatty.cpp"],
+ hdrs = ["isatty.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:sys_ioctl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:ioctl",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "link",
+ srcs = ["linux/link.cpp"],
+ hdrs = ["link.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:hdr_unistd_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:link",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "linkat",
+ srcs = ["linux/linkat.cpp"],
+ hdrs = ["linkat.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:linkat",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "pipe",
+ srcs = ["linux/pipe.cpp"],
+ hdrs = ["pipe.h"],
+ deps = [
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:pipe",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "lseek",
+ srcs = ["linux/lseek.cpp"],
+ hdrs = ["lseek.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_off_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:lseek",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "pread",
+ srcs = ["linux/pread.cpp"],
+ hdrs = ["pread.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_off_t",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:pread",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "pwrite",
+ srcs = ["linux/pwrite.cpp"],
+ hdrs = ["pwrite.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_off_t",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:pwrite",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "read",
+ srcs = ["linux/read.cpp"],
+ hdrs = ["read.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:read",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:sanitizer",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "readlink",
+ srcs = ["linux/readlink.cpp"],
+ hdrs = ["readlink.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:hdr_unistd_macros",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:readlink",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "readlinkat",
+ srcs = ["linux/readlinkat.cpp"],
+ hdrs = ["readlinkat.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc:hdr_unistd_macros",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:readlinkat",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "rmdir",
+ srcs = ["linux/rmdir.cpp"],
+ hdrs = ["rmdir.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:rmdir",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "setsid",
+ srcs = ["linux/setsid.cpp"],
+ hdrs = ["setsid.h"],
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:types_pid_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:setsid",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "symlink",
+ srcs = ["linux/symlink.cpp"],
+ hdrs = ["symlink.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:symlink",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "symlinkat",
+ srcs = ["linux/symlinkat.cpp"],
+ hdrs = ["symlinkat.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:symlinkat",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "swab",
+ srcs = ["swab.cpp"],
+ hdrs = ["swab.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "truncate",
+ srcs = ["linux/truncate.cpp"],
+ hdrs = ["truncate.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_off_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:truncate",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "unlink",
+ srcs = ["linux/unlink.cpp"],
+ hdrs = ["unlink.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlink",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "unlinkat",
+ srcs = ["linux/unlinkat.cpp"],
+ hdrs = ["unlinkat.h"],
+ deps = [
+ "//libc:hdr_fcntl_macros",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:syscall",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:unlinkat",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+# WARNING: NOT FULLY IMPLEMENTED, FOR TESTING USE ONLY
+libc_function(
+ name = "sysconf",
+ srcs = ["linux/sysconf.cpp"],
+ hdrs = ["sysconf.h"],
+ full_build_only = True,
+ target_compatible_with = select({
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [
+ "//libc:hdr_limits_macros",
+ "//libc:hdr_sys_auxv_macros",
+ "//libc:hdr_sys_resource_macros",
+ "//libc:hdr_unistd_macros",
+ "//libc:types_struct_rlimit",
+ "//libc:types_struct_sysinfo",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil:linux_auxv",
+ "//libc/src/__support/OSUtil:linux_sysinfo",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:prlimit",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:sysinfo",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
+
+libc_function(
+ name = "write",
+ srcs = ["linux/write.cpp"],
+ hdrs = ["write.h"],
+ deps = [
+ "//libc:hdr_unistd_macros",
+ "//libc:types_size_t",
+ "//libc:types_ssize_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support:libc_errno",
+ "//libc/src/__support/OSUtil/linux/syscall_wrappers:write",
+ "//libc/src/__support/macros:config",
+ "//libc/src/errno",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
index 3b1d748057d71..762bc45aa82f8 100644
--- a/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
@@ -53,7 +53,6 @@ libc_startup_library(
":irelative_hdr",
"//libc:config_app_h",
"//libc:config_linux_app_h",
- "//libc:environ",
"//libc:hdr_elf_proxy",
"//libc:hdr_link_macros",
"//libc:hdr_pthread_macros",
@@ -76,6 +75,7 @@ libc_startup_library(
"//libc/src/link:_r_debug",
"//libc/src/stdlib:atexit",
"//libc/src/stdlib:exit",
+ "//libc/src/unistd:environ",
] + selects.with_or({
PLATFORM_CPU_X86_64: [
"//libc/startup/linux/x86_64:irelative",
diff --git a/utils/bazel/llvm-project-overlay/libc/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/BUILD.bazel
index 0a2c3a2ad3dee..e35228203cd4e 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/BUILD.bazel
@@ -23,7 +23,7 @@ libc_release_library(
name = "libc_release_test",
libc_functions = [
"//libc:acosf",
- "//libc:read",
+ "//libc/src/unistd:read",
],
weak_symbols = [
"read",
diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
index b610d4066ecf5..5b0947b2d0661 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
@@ -92,14 +92,11 @@ libc_test_library(
"//libc/src/time:clock",
] + select({
"//libc:full_build": [
- "//libc:close",
- "//libc:fork",
"//libc:llvm_libc_macros_poll_macros",
"//libc:llvm_libc_macros_signal_macros",
"//libc:llvm_libc_macros_sys_wait_macros",
"//libc:llvm_libc_types_pid_t",
"//libc:llvm_libc_types_struct_pollfd",
- "//libc:pipe",
"//libc/src/poll",
"//libc/src/signal",
"//libc/src/signal:kill",
@@ -110,6 +107,9 @@ libc_test_library(
"//libc/src/stdlib:getenv",
"//libc/src/string:strsignal",
"//libc/src/sys/wait:waitpid",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:fork",
+ "//libc/src/unistd:pipe",
],
"//conditions:default": [],
}) + select({
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
index 05365b23b999a..f27b092fff9d9 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
@@ -121,12 +121,12 @@ libc_test(
name = "remove_test",
srcs = ["remove_test.cpp"],
deps = [
- "//libc:access",
- "//libc:close",
"//libc:hdr_sys_stat_macros",
"//libc/src/fcntl:open",
"//libc/src/stdio:remove",
"//libc/src/sys/stat:mkdirat",
+ "//libc/src/unistd:access",
+ "//libc/src/unistd:close",
],
)
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 96f99187450d9..8ec0dd7ac0cc8 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
@@ -143,15 +143,9 @@ libc_test(
name = "realpath_test",
srcs = ["realpath_test.cpp"],
deps = [
- "//libc:chdir",
- "//libc:close",
- "//libc:getcwd",
- "//libc:getpid",
"//libc:hdr_errno_macros",
"//libc:hdr_limits_macros",
- "//libc:symlinkat",
"//libc:types_size_t",
- "//libc:unlinkat",
"//libc/src/__support:c_string",
"//libc/src/__support:fixedvector",
"//libc/src/__support:libc_assert",
@@ -164,6 +158,12 @@ libc_test(
"//libc/src/string:strdup",
"//libc/src/sys/random:getrandom",
"//libc/src/sys/stat:mkdirat",
+ "//libc/src/unistd:chdir",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:getcwd",
+ "//libc/src/unistd:getpid",
+ "//libc/src/unistd:symlinkat",
+ "//libc/src/unistd:unlinkat",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel
index 3096fdfb9d915..775e0dd09b684 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel
@@ -14,8 +14,8 @@ libc_test(
name = "epoll_create_test",
srcs = ["linux/epoll_create_test.cpp"],
deps = [
- "//libc:close",
"//libc/src/sys/epoll:epoll_create",
+ "//libc/src/unistd:close",
],
)
@@ -23,9 +23,9 @@ libc_test(
name = "epoll_create1_test",
srcs = ["linux/epoll_create1_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_epoll_macros",
"//libc/src/sys/epoll:epoll_create1",
+ "//libc/src/unistd:close",
],
)
@@ -33,12 +33,12 @@ libc_test(
name = "epoll_ctl_test",
srcs = ["linux/epoll_ctl_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_epoll_macros",
- "//libc:pipe",
"//libc:types_struct_epoll_event",
"//libc/src/sys/epoll:epoll_create1",
"//libc/src/sys/epoll:epoll_ctl",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:pipe",
],
)
@@ -46,13 +46,13 @@ libc_test(
name = "epoll_wait_test",
srcs = ["linux/epoll_wait_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_epoll_macros",
- "//libc:pipe",
"//libc:types_struct_epoll_event",
"//libc/src/sys/epoll:epoll_create1",
"//libc/src/sys/epoll:epoll_ctl",
"//libc/src/sys/epoll:epoll_wait",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:pipe",
],
)
@@ -60,13 +60,13 @@ libc_test(
name = "epoll_pwait_test",
srcs = ["linux/epoll_pwait_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_epoll_macros",
- "//libc:pipe",
"//libc:types_struct_epoll_event",
"//libc/src/sys/epoll:epoll_create1",
"//libc/src/sys/epoll:epoll_ctl",
"//libc/src/sys/epoll:epoll_pwait",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:pipe",
],
)
@@ -74,13 +74,13 @@ libc_test(
name = "epoll_pwait2_test",
srcs = ["linux/epoll_pwait2_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_epoll_macros",
- "//libc:pipe",
"//libc:types_struct_epoll_event",
"//libc:types_struct_timespec",
"//libc/src/sys/epoll:epoll_create1",
"//libc/src/sys/epoll:epoll_ctl",
"//libc/src/sys/epoll:epoll_pwait2",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:pipe",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
index f1a8d307d1f78..2c9ac9478334a 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/mman/BUILD.bazel
@@ -25,7 +25,6 @@ libc_test(
name = "mincore_test",
srcs = ["linux/mincore_test.cpp"],
deps = [
- "//libc:getpagesize",
"//libc:hdr_sys_mman_macros",
"//libc/src/sys/mman:madvise",
"//libc/src/sys/mman:mincore",
@@ -33,6 +32,7 @@ libc_test(
"//libc/src/sys/mman:mmap",
"//libc/src/sys/mman:munlock",
"//libc/src/sys/mman:munmap",
+ "//libc/src/unistd:getpagesize",
],
)
@@ -40,7 +40,6 @@ libc_test(
name = "mlock_test",
srcs = ["linux/mlock_test.cpp"],
deps = [
- "//libc:getpagesize",
"//libc:hdr_sys_mman_macros",
"//libc:hdr_sys_resource_macros",
"//libc/src/__support/OSUtil:syscall",
@@ -54,6 +53,7 @@ libc_test(
"//libc/src/sys/mman:munlockall",
"//libc/src/sys/mman:munmap",
"//libc/src/sys/resource:getrlimit",
+ "//libc/src/unistd:getpagesize",
],
)
@@ -61,12 +61,12 @@ libc_test(
name = "mmap_test",
srcs = ["linux/mmap_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_mman_macros",
"//libc/src/__support/CPP:scope",
"//libc/src/sys/mman:memfd_create",
"//libc/src/sys/mman:mmap",
"//libc/src/sys/mman:munmap",
+ "//libc/src/unistd:close",
],
)
@@ -97,13 +97,13 @@ libc_test(
name = "msync_test",
srcs = ["linux/msync_test.cpp"],
deps = [
- "//libc:getpagesize",
"//libc:hdr_sys_mman_macros",
"//libc/src/sys/mman:mlock",
"//libc/src/sys/mman:mmap",
"//libc/src/sys/mman:msync",
"//libc/src/sys/mman:munlock",
"//libc/src/sys/mman:munmap",
+ "//libc/src/unistd:getpagesize",
],
)
@@ -141,14 +141,14 @@ libc_test(
name = "remap_file_pages_test",
srcs = ["linux/remap_file_pages_test.cpp"],
deps = [
- "//libc:close",
- "//libc:getpagesize",
"//libc:hdr_sys_mman_macros",
"//libc:hdr_sys_stat_macros",
"//libc/src/fcntl:open",
"//libc/src/sys/mman:mmap",
"//libc/src/sys/mman:munmap",
"//libc/src/sys/mman:remap_file_pages",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:getpagesize",
],
)
@@ -156,8 +156,6 @@ libc_test(
name = "shm_test",
srcs = ["linux/shm_test.cpp"],
deps = [
- "//libc:close",
- "//libc:ftruncate",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_mman_macros",
"//libc/src/fcntl",
@@ -166,5 +164,7 @@ libc_test(
"//libc/src/sys/mman:munmap",
"//libc/src/sys/mman:shm_open",
"//libc/src/sys/mman:shm_unlink",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:ftruncate",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
index c3ccad340615e..70d0d3830dd48 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/resource/BUILD.bazel
@@ -14,14 +14,14 @@ libc_test(
name = "getrlimit_setrlimit_test",
srcs = ["getrlimit_setrlimit_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_resource_macros",
"//libc:hdr_sys_stat_macros",
"//libc:types_struct_rlimit",
- "//libc:unlink",
"//libc/src/__support/CPP:string_view",
"//libc/src/fcntl:open",
"//libc/src/sys/resource:getrlimit",
"//libc/src/sys/resource:setrlimit",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:unlink",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
index 1aa25dc6c5e67..157fd7d8a9933 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/sys/socket/BUILD.bazel
@@ -14,9 +14,6 @@ libc_test_library(
name = "socket_test_support",
hdrs = ["linux/socket_test_support.h"],
deps = [
- "//libc:chdir",
- "//libc:close",
- "//libc:fchdir",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
"//libc:types_size_t",
@@ -27,6 +24,9 @@ libc_test_library(
"//libc/src/fcntl:open",
"//libc/src/string:strncpy",
"//libc/src/string:strnlen",
+ "//libc/src/unistd:chdir",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:fchdir",
"//libc/test/UnitTest:LibcUnitTest",
],
)
@@ -36,7 +36,6 @@ libc_test(
srcs = ["linux/bind_test.cpp"],
deps = [
":socket_test_support",
- "//libc:close",
"//libc:hdr_netinet_in_macros",
"//libc:hdr_sys_socket_macros",
"//libc:types_sa_family_t",
@@ -49,6 +48,7 @@ libc_test(
"//libc/src/sys/socket",
"//libc/src/sys/socket:bind",
"//libc/src/sys/socket:getsockname",
+ "//libc/src/unistd:close",
],
)
@@ -57,7 +57,6 @@ libc_test(
srcs = ["linux/connect_accept_test.cpp"],
deps = [
":socket_test_support",
- "//libc:close",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
"//libc:types_sa_family_t",
@@ -73,6 +72,7 @@ libc_test(
"//libc/src/sys/socket:bind",
"//libc/src/sys/socket:connect",
"//libc/src/sys/socket:listen",
+ "//libc/src/unistd:close",
],
)
@@ -81,7 +81,6 @@ libc_test(
srcs = ["linux/listen_test.cpp"],
deps = [
":socket_test_support",
- "//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc:types_struct_sockaddr_un",
"//libc/src/__support/CPP:scope",
@@ -89,6 +88,7 @@ libc_test(
"//libc/src/sys/socket",
"//libc/src/sys/socket:bind",
"//libc/src/sys/socket:listen",
+ "//libc/src/unistd:close",
],
)
@@ -96,12 +96,12 @@ libc_test(
name = "send_recv_test",
srcs = ["linux/send_recv_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc/src/__support/CPP:scope",
"//libc/src/sys/socket:recv",
"//libc/src/sys/socket:send",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
],
)
@@ -109,7 +109,6 @@ libc_test(
name = "sendmsg_recvmsg_test",
srcs = ["linux/sendmsg_recvmsg_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_fcntl_macros",
"//libc:hdr_sys_socket_macros",
"//libc:llvm_libc_macros_sys_socket_macros",
@@ -122,6 +121,7 @@ libc_test(
"//libc/src/sys/socket:recvmsg",
"//libc/src/sys/socket:sendmsg",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
],
)
@@ -129,7 +129,6 @@ libc_test(
name = "sendrecvmmsg_test",
srcs = ["linux/sendrecvmmsg_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc:types_struct_iovec",
"//libc:types_struct_mmsghdr",
@@ -139,6 +138,7 @@ libc_test(
"//libc/src/sys/socket:recvmmsg",
"//libc/src/sys/socket:sendmmsg",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
],
)
@@ -146,12 +146,12 @@ libc_test(
name = "sendto_recvfrom_test",
srcs = ["linux/sendto_recvfrom_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc/src/__support/CPP:scope",
"//libc/src/sys/socket:recvfrom",
"//libc/src/sys/socket:sendto",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
],
)
@@ -159,13 +159,13 @@ libc_test(
name = "shutdown_test",
srcs = ["linux/shutdown_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:read",
"//libc:types_ssize_t",
"//libc/src/__support/CPP:scope",
"//libc/src/sys/socket:shutdown",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:read",
],
)
@@ -187,10 +187,10 @@ libc_test(
name = "socket_test",
srcs = ["linux/socket_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc/src/__support/CPP:scope",
"//libc/src/sys/socket",
+ "//libc/src/unistd:close",
],
)
@@ -198,12 +198,10 @@ libc_test(
name = "socketopt_test",
srcs = ["linux/socketopt_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_netinet_in_macros",
"//libc:hdr_netinet_tcp_macros",
"//libc:hdr_sys_socket_macros",
"//libc:hdr_time_macros",
- "//libc:pipe",
"//libc:types_socklen_t",
"//libc:types_struct_linger",
"//libc:types_struct_timespec",
@@ -215,6 +213,8 @@ libc_test(
"//libc/src/sys/socket:recv",
"//libc/src/sys/socket:setsockopt",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:pipe",
],
)
@@ -222,13 +222,13 @@ libc_test(
name = "sockatmark_test",
srcs = ["linux/sockatmark_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_socket_macros",
- "//libc:pipe",
"//libc/src/__support/CPP:scope",
"//libc/src/sys/socket:send",
"//libc/src/sys/socket:sockatmark",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:pipe",
"//libc/test/UnitTest:test_logger",
],
)
@@ -237,10 +237,10 @@ libc_test(
name = "socketpair_test",
srcs = ["linux/socketpair_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc/src/__support/CPP:scope",
"//libc/src/sys/socket:socketpair",
+ "//libc/src/unistd:close",
],
)
@@ -249,7 +249,6 @@ libc_test(
srcs = ["linux/sockname_test.cpp"],
deps = [
":socket_test_support",
- "//libc:close",
"//libc:hdr_sys_socket_macros",
"//libc:types_sa_family_t",
"//libc:types_socklen_t",
@@ -263,5 +262,6 @@ libc_test(
"//libc/src/sys/socket:getpeername",
"//libc/src/sys/socket:getsockname",
"//libc/src/sys/socket:listen",
+ "//libc/src/unistd:close",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
index 1b3f2a4e0c0d2..70277d532ddea 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel
@@ -14,11 +14,11 @@ libc_test(
name = "access_test",
srcs = ["access_test.cpp"],
deps = [
- "//libc:access",
- "//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:unlink",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:access",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:unlink",
],
)
@@ -26,13 +26,13 @@ libc_test(
name = "dup_test",
srcs = ["dup_test.cpp"],
deps = [
- "//libc:close",
- "//libc:dup",
"//libc:hdr_sys_stat_macros",
- "//libc:read",
- "//libc:unlink",
- "//libc:write",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:dup",
+ "//libc/src/unistd:read",
+ "//libc/src/unistd:unlink",
+ "//libc/src/unistd:write",
],
)
@@ -40,13 +40,13 @@ libc_test(
name = "dup2_test",
srcs = ["dup2_test.cpp"],
deps = [
- "//libc:close",
- "//libc:dup2",
"//libc:hdr_sys_stat_macros",
- "//libc:read",
- "//libc:unlink",
- "//libc:write",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:dup2",
+ "//libc/src/unistd:read",
+ "//libc/src/unistd:unlink",
+ "//libc/src/unistd:write",
],
)
@@ -54,13 +54,13 @@ libc_test(
name = "dup3_test",
srcs = ["dup3_test.cpp"],
deps = [
- "//libc:close",
- "//libc:dup3",
"//libc:hdr_sys_stat_macros",
- "//libc:read",
- "//libc:unlink",
- "//libc:write",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:dup3",
+ "//libc/src/unistd:read",
+ "//libc/src/unistd:unlink",
+ "//libc/src/unistd:write",
],
)
@@ -68,14 +68,14 @@ libc_test(
name = "ftruncate_test",
srcs = ["ftruncate_test.cpp"],
deps = [
- "//libc:close",
- "//libc:ftruncate",
"//libc:hdr_sys_stat_macros",
- "//libc:read",
- "//libc:unlink",
- "//libc:write",
"//libc/src/__support/CPP:string_view",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:ftruncate",
+ "//libc/src/unistd:read",
+ "//libc/src/unistd:unlink",
+ "//libc/src/unistd:write",
],
)
@@ -83,7 +83,7 @@ libc_test(
name = "getpagesize_test",
srcs = ["getpagesize_test.cpp"],
deps = [
- "//libc:getpagesize",
+ "//libc/src/unistd:getpagesize",
],
)
@@ -91,14 +91,14 @@ libc_test(
name = "pread_pwrite_test",
srcs = ["pread_pwrite_test.cpp"],
deps = [
- "//libc:close",
- "//libc:fsync",
"//libc:hdr_sys_stat_macros",
- "//libc:pread",
- "//libc:pwrite",
- "//libc:unlink",
- "//libc:write",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:fsync",
+ "//libc/src/unistd:pread",
+ "//libc/src/unistd:pwrite",
+ "//libc/src/unistd:unlink",
+ "//libc/src/unistd:write",
],
)
@@ -106,10 +106,10 @@ libc_test(
name = "read_write_test",
srcs = ["read_write_test.cpp"],
deps = [
- "//libc:close",
- "//libc:pipe",
- "//libc:read",
- "//libc:write",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:pipe",
+ "//libc/src/unistd:read",
+ "//libc/src/unistd:write",
],
)
@@ -117,11 +117,11 @@ libc_test(
name = "link_test",
srcs = ["link_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:link",
- "//libc:unlink",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:link",
+ "//libc/src/unistd:unlink",
],
)
@@ -129,8 +129,8 @@ libc_test(
name = "swab_test",
srcs = ["swab_test.cpp"],
deps = [
- "//libc:swab",
"//libc/src/string:utils",
+ "//libc/src/unistd:swab",
],
)
@@ -138,11 +138,11 @@ libc_test(
name = "symlink_test",
srcs = ["symlink_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:symlink",
- "//libc:unlink",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:symlink",
+ "//libc/src/unistd:unlink",
],
)
@@ -150,14 +150,14 @@ libc_test(
name = "truncate_test",
srcs = ["truncate_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:read",
- "//libc:truncate",
- "//libc:unlink",
- "//libc:write",
"//libc/src/__support/CPP:string_view",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:read",
+ "//libc/src/unistd:truncate",
+ "//libc/src/unistd:unlink",
+ "//libc/src/unistd:write",
],
)
@@ -165,10 +165,10 @@ libc_test(
name = "unlink_test",
srcs = ["unlink_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:unlink",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:unlink",
],
)
@@ -176,7 +176,7 @@ libc_test(
name = "getppid_test",
srcs = ["getppid_test.cpp"],
deps = [
- "//libc:getppid",
+ "//libc/src/unistd:getppid",
],
)
@@ -184,7 +184,7 @@ libc_test(
name = "getuid_test",
srcs = ["getuid_test.cpp"],
deps = [
- "//libc:getuid",
+ "//libc/src/unistd:getuid",
],
)
@@ -192,10 +192,10 @@ libc_test(
name = "isatty_test",
srcs = ["isatty_test.cpp"],
deps = [
- "//libc:close",
"//libc:hdr_sys_stat_macros",
- "//libc:isatty",
"//libc/src/fcntl:open",
+ "//libc/src/unistd:close",
+ "//libc/src/unistd:isatty",
],
)
@@ -203,7 +203,7 @@ libc_test(
name = "geteuid_test",
srcs = ["geteuid_test.cpp"],
deps = [
- "//libc:geteuid",
+ "//libc/src/unistd:geteuid",
],
)
@@ -211,7 +211,7 @@ libc_test(
name = "getgid_test",
srcs = ["getgid_test.cpp"],
deps = [
- "//libc:getgid",
+ "//libc/src/unistd:getgid",
],
)
@@ -219,7 +219,7 @@ libc_test(
name = "getegid_test",
srcs = ["getegid_test.cpp"],
deps = [
- "//libc:getegid",
+ "//libc/src/unistd:getegid",
],
)
>From 75613ca66d6ac6c343d794092e0f3f871b838498 Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:56:55 -0800
Subject: [PATCH 31/32] [bazel] Add subpackage for libc/src/wchar
---
.../llvm-project-overlay/libc/BUILD.bazel | 309 +++-------------
.../libc/src/wchar/BUILD.bazel | 349 ++++++++++++++++++
.../libc/test/src/wchar/BUILD.bazel | 50 +--
3 files changed, 424 insertions(+), 284 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/wchar/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c67e914b03626..08ba5f4f41206 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -9,7 +9,6 @@ load("@rules_python//python:defs.bzl", "py_binary")
load(
":libc_build_rules.bzl",
"libc_common_copts",
- "libc_function",
"libc_generated_header",
"libc_header_info",
"libc_header_library",
@@ -3979,335 +3978,127 @@ alias(
############################## wchar targets ###############################
-libc_support_library(
- name = "wchar_utils",
- hdrs = ["src/wchar/wchar_utils.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:attributes",
- ],
-)
-
-libc_function(
+alias(
name = "btowc",
- srcs = ["src/wchar/btowc.cpp"],
- hdrs = ["src/wchar/btowc.h"],
- deps = [
- ":hdr_wchar_macros",
- ":types_wint_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/wchar:btowc",
)
-libc_function(
+alias(
name = "wcpcpy",
- srcs = ["src/wchar/wcpcpy.cpp"],
- hdrs = ["src/wchar/wcpcpy.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcpcpy",
)
-libc_function(
+alias(
name = "wcpncpy",
- srcs = ["src/wchar/wcpncpy.cpp"],
- hdrs = ["src/wchar/wcpncpy.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcpncpy",
)
-libc_function(
+alias(
name = "wcscat",
- srcs = ["src/wchar/wcscat.cpp"],
- hdrs = ["src/wchar/wcscat.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcscat",
)
-libc_function(
+alias(
name = "wcschr",
- srcs = ["src/wchar/wcschr.cpp"],
- hdrs = ["src/wchar/wcschr.h"],
- deps = [
- ":types_wchar_t",
- ":wchar_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcschr",
)
-libc_function(
+alias(
name = "wcscmp",
- srcs = ["src/wchar/wcscmp.cpp"],
- hdrs = ["src/wchar/wcscmp.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcscmp",
)
-libc_function(
+alias(
name = "wcscpy",
- srcs = ["src/wchar/wcscpy.cpp"],
- hdrs = ["src/wchar/wcscpy.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcscpy",
)
-libc_function(
+alias(
name = "wcscspn",
- srcs = ["src/wchar/wcscspn.cpp"],
- hdrs = ["src/wchar/wcscspn.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- ":wchar_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcscspn",
)
-libc_function(
+alias(
name = "wcslcat",
- srcs = ["src/wchar/wcslcat.cpp"],
- hdrs = ["src/wchar/wcslcat.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcslcat",
)
-libc_function(
+alias(
name = "wcslcpy",
- srcs = ["src/wchar/wcslcpy.cpp"],
- hdrs = ["src/wchar/wcslcpy.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcslcpy",
)
-libc_function(
+alias(
name = "wcslen",
- srcs = ["src/wchar/wcslen.cpp"],
- hdrs = ["src/wchar/wcslen.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcslen",
)
-libc_function(
+alias(
name = "wcsncat",
- srcs = ["src/wchar/wcsncat.cpp"],
- hdrs = ["src/wchar/wcsncat.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcsncat",
)
-libc_function(
+alias(
name = "wcsncmp",
- srcs = ["src/wchar/wcsncmp.cpp"],
- hdrs = ["src/wchar/wcsncmp.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcsncmp",
)
-libc_function(
+alias(
name = "wcsncpy",
- srcs = ["src/wchar/wcsncpy.cpp"],
- hdrs = ["src/wchar/wcsncpy.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/wchar:wcsncpy",
)
-libc_function(
+alias(
name = "wcspbrk",
- srcs = ["src/wchar/wcspbrk.cpp"],
- hdrs = ["src/wchar/wcspbrk.h"],
- deps = [
- ":types_wchar_t",
- ":wchar_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcspbrk",
)
-libc_function(
+alias(
name = "wcsrchr",
- srcs = ["src/wchar/wcsrchr.cpp"],
- hdrs = ["src/wchar/wcsrchr.h"],
- deps = [
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcsrchr",
)
-libc_function(
+alias(
name = "wcsspn",
- srcs = ["src/wchar/wcsspn.cpp"],
- hdrs = ["src/wchar/wcsspn.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- ":wchar_utils",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wcsspn",
)
-libc_function(
+alias(
name = "wcsstr",
- srcs = ["src/wchar/wcsstr.cpp"],
- hdrs = ["src/wchar/wcsstr.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string:utils",
- ],
+ actual = "//libc/src/wchar:wcsstr",
)
-libc_function(
+alias(
name = "wctob",
- srcs = ["src/wchar/wctob.cpp"],
- hdrs = ["src/wchar/wctob.h"],
- deps = [
- ":hdr_stdio_macros",
- ":types_wint_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wctob",
)
-libc_function(
+alias(
name = "wmemchr",
- srcs = ["src/wchar/wmemchr.cpp"],
- hdrs = ["src/wchar/wmemchr.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/wchar:wmemchr",
)
-libc_function(
+alias(
name = "wmemcmp",
- srcs = ["src/wchar/wmemcmp.cpp"],
- hdrs = ["src/wchar/wmemcmp.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wmemcmp",
)
-libc_function(
+alias(
name = "wmemcpy",
- srcs = ["src/wchar/wmemcpy.cpp"],
- hdrs = ["src/wchar/wmemcpy.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/wchar:wmemcpy",
)
-libc_function(
+alias(
name = "wmemmove",
- srcs = ["src/wchar/wmemmove.cpp"],
- hdrs = ["src/wchar/wmemmove.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/__support/macros:null_check",
- ],
+ actual = "//libc/src/wchar:wmemmove",
)
-libc_function(
+alias(
name = "wmempcpy",
- srcs = ["src/wchar/wmempcpy.cpp"],
- hdrs = ["src/wchar/wmempcpy.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- "//libc/src/string/memory_utils",
- ],
+ actual = "//libc/src/wchar:wmempcpy",
)
-libc_function(
+alias(
name = "wmemset",
- srcs = ["src/wchar/wmemset.cpp"],
- hdrs = ["src/wchar/wmemset.h"],
- deps = [
- ":types_size_t",
- ":types_wchar_t",
- "//libc/src/__support:common",
- "//libc/src/__support/macros:config",
- ],
+ actual = "//libc/src/wchar:wmemset",
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/wchar/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/wchar/BUILD.bazel
new file mode 100644
index 0000000000000..bba4a86c498b8
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/wchar/BUILD.bazel
@@ -0,0 +1,349 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//libc:libc_build_rules.bzl", "libc_function", "libc_support_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "parse_headers",
+ "-use_header_modules",
+ "layering_check",
+ ],
+)
+
+licenses(["notice"])
+
+libc_support_library(
+ name = "utils",
+ hdrs = ["wchar_utils.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:attributes",
+ ],
+)
+
+libc_function(
+ name = "btowc",
+ srcs = ["btowc.cpp"],
+ hdrs = ["btowc.h"],
+ deps = [
+ "//libc:hdr_wchar_macros",
+ "//libc:types_wint_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "wcpcpy",
+ srcs = ["wcpcpy.cpp"],
+ hdrs = ["wcpcpy.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wcpncpy",
+ srcs = ["wcpncpy.cpp"],
+ hdrs = ["wcpncpy.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcscat",
+ srcs = ["wcscat.cpp"],
+ hdrs = ["wcscat.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wcschr",
+ srcs = ["wcschr.cpp"],
+ hdrs = ["wcschr.h"],
+ deps = [
+ ":utils",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcscmp",
+ srcs = ["wcscmp.cpp"],
+ hdrs = ["wcscmp.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcscpy",
+ srcs = ["wcscpy.cpp"],
+ hdrs = ["wcscpy.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wcscspn",
+ srcs = ["wcscspn.cpp"],
+ hdrs = ["wcscspn.h"],
+ deps = [
+ ":utils",
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcslcat",
+ srcs = ["wcslcat.cpp"],
+ hdrs = ["wcslcat.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wcslcpy",
+ srcs = ["wcslcpy.cpp"],
+ hdrs = ["wcslcpy.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wcslen",
+ srcs = ["wcslen.cpp"],
+ hdrs = ["wcslen.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wcsncat",
+ srcs = ["wcsncat.cpp"],
+ hdrs = ["wcsncat.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wcsncmp",
+ srcs = ["wcsncmp.cpp"],
+ hdrs = ["wcsncmp.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcsncpy",
+ srcs = ["wcsncpy.cpp"],
+ hdrs = ["wcsncpy.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "wcspbrk",
+ srcs = ["wcspbrk.cpp"],
+ hdrs = ["wcspbrk.h"],
+ deps = [
+ ":utils",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcsrchr",
+ srcs = ["wcsrchr.cpp"],
+ hdrs = ["wcsrchr.h"],
+ deps = [
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcsspn",
+ srcs = ["wcsspn.cpp"],
+ hdrs = ["wcsspn.h"],
+ deps = [
+ ":utils",
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wcsstr",
+ srcs = ["wcsstr.cpp"],
+ hdrs = ["wcsstr.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string:utils",
+ ],
+)
+
+libc_function(
+ name = "wctob",
+ srcs = ["wctob.cpp"],
+ hdrs = ["wctob.h"],
+ deps = [
+ "//libc:hdr_stdio_macros",
+ "//libc:types_wint_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wmemchr",
+ srcs = ["wmemchr.cpp"],
+ hdrs = ["wmemchr.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
+
+libc_function(
+ name = "wmemcmp",
+ srcs = ["wmemcmp.cpp"],
+ hdrs = ["wmemcmp.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wmemcpy",
+ srcs = ["wmemcpy.cpp"],
+ hdrs = ["wmemcpy.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "wmemmove",
+ srcs = ["wmemmove.cpp"],
+ hdrs = ["wmemmove.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/__support/macros:null_check",
+ ],
+)
+
+libc_function(
+ name = "wmempcpy",
+ srcs = ["wmempcpy.cpp"],
+ hdrs = ["wmempcpy.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ "//libc/src/string/memory_utils",
+ ],
+)
+
+libc_function(
+ name = "wmemset",
+ srcs = ["wmemset.cpp"],
+ hdrs = ["wmemset.h"],
+ deps = [
+ "//libc:types_size_t",
+ "//libc:types_wchar_t",
+ "//libc/src/__support:common",
+ "//libc/src/__support/macros:config",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel
index dbe069f6e60f3..e8c75323d5eac 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel
@@ -14,8 +14,8 @@ libc_test(
name = "btowc_test",
srcs = ["btowc_test.cpp"],
deps = [
- "//libc:btowc",
"//libc:hdr_wchar_macros",
+ "//libc/src/wchar:btowc",
],
)
@@ -24,7 +24,7 @@ libc_test(
srcs = ["wcpcpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcpcpy",
+ "//libc/src/wchar:wcpcpy",
],
)
@@ -33,7 +33,7 @@ libc_test(
srcs = ["wcpncpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcpncpy",
+ "//libc/src/wchar:wcpncpy",
],
)
@@ -42,7 +42,7 @@ libc_test(
srcs = ["wcscat_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcscat",
+ "//libc/src/wchar:wcscat",
],
)
@@ -51,7 +51,7 @@ libc_test(
srcs = ["wcschr_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcschr",
+ "//libc/src/wchar:wcschr",
],
)
@@ -60,7 +60,7 @@ libc_test(
srcs = ["wcscmp_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcscmp",
+ "//libc/src/wchar:wcscmp",
],
)
@@ -69,7 +69,7 @@ libc_test(
srcs = ["wcscpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcscpy",
+ "//libc/src/wchar:wcscpy",
],
)
@@ -79,7 +79,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wcscspn",
+ "//libc/src/wchar:wcscspn",
],
)
@@ -89,7 +89,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wcslcat",
+ "//libc/src/wchar:wcslcat",
],
)
@@ -99,7 +99,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wcslcpy",
+ "//libc/src/wchar:wcslcpy",
],
)
@@ -109,7 +109,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wcslen",
+ "//libc/src/wchar:wcslen",
],
)
@@ -118,7 +118,7 @@ libc_test(
srcs = ["wcsncat_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcsncat",
+ "//libc/src/wchar:wcsncat",
],
)
@@ -127,7 +127,7 @@ libc_test(
srcs = ["wcsncmp_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcsncmp",
+ "//libc/src/wchar:wcsncmp",
],
)
@@ -136,7 +136,7 @@ libc_test(
srcs = ["wcsncpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcsncpy",
+ "//libc/src/wchar:wcsncpy",
],
)
@@ -145,7 +145,7 @@ libc_test(
srcs = ["wcsrchr_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcsrchr",
+ "//libc/src/wchar:wcsrchr",
],
)
@@ -154,7 +154,7 @@ libc_test(
srcs = ["wcspbrk_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcspbrk",
+ "//libc/src/wchar:wcspbrk",
],
)
@@ -164,7 +164,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wcsspn",
+ "//libc/src/wchar:wcsspn",
],
)
@@ -173,7 +173,7 @@ libc_test(
srcs = ["wcsstr_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wcsstr",
+ "//libc/src/wchar:wcsstr",
],
)
@@ -182,7 +182,7 @@ libc_test(
srcs = ["wctob_test.cpp"],
deps = [
"//libc:hdr_stdio_macros",
- "//libc:wctob",
+ "//libc/src/wchar:wctob",
],
)
@@ -191,7 +191,7 @@ libc_test(
srcs = ["wmemchr_test.cpp"],
deps = [
"//libc:types_wchar_t",
- "//libc:wmemchr",
+ "//libc/src/wchar:wmemchr",
],
)
@@ -201,7 +201,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wmemcmp",
+ "//libc/src/wchar:wmemcmp",
],
)
@@ -211,7 +211,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wmemcpy",
+ "//libc/src/wchar:wmemcpy",
],
)
@@ -221,7 +221,7 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wmemmove",
+ "//libc/src/wchar:wmemmove",
],
)
@@ -229,7 +229,7 @@ libc_test(
name = "wmempcpy_test",
srcs = ["wmempcpy_test.cpp"],
deps = [
- "//libc:wmempcpy",
+ "//libc/src/wchar:wmempcpy",
],
)
@@ -239,6 +239,6 @@ libc_test(
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
- "//libc:wmemset",
+ "//libc/src/wchar:wmemset",
],
)
>From 44a7008a01fb9562a229529e032aa7fa2dbe4d8a Mon Sep 17 00:00:00 2001
From: jtstogel <jtstogel at gmail.com>
Date: Fri, 13 Nov 2026 12:57:48 -0800
Subject: [PATCH 32/32] [bazel] Add subpackage for libc/src
---
utils/bazel/llvm-project-overlay/libc/src/BUILD.bazel | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 utils/bazel/llvm-project-overlay/libc/src/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/src/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/BUILD.bazel
new file mode 100644
index 0000000000000..3bf42014831d9
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/src/BUILD.bazel
@@ -0,0 +1,7 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+package(
+ default_visibility = ["//visibility:public"],
+)
More information about the llvm-branch-commits
mailing list