From 9e11b2414e83ba9410b50e5061dee6b1ab84c0a3 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Mon, 16 Dec 2024 11:13:41 -0800 Subject: [PATCH] [libc] Fix bazel and ssize_t for unistd This patch fixes the bazel build after https://github.com/llvm/llvm-project/pull/119312 lands. Also fixes where ssize_t is requested from in overlay mode. --- libc/hdr/types/ssize_t.h | 4 +- .../llvm-project-overlay/libc/BUILD.bazel | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/libc/hdr/types/ssize_t.h b/libc/hdr/types/ssize_t.h index 4d2000780ee11..7eff98f33c2bb 100644 --- a/libc/hdr/types/ssize_t.h +++ b/libc/hdr/types/ssize_t.h @@ -14,9 +14,7 @@ #else -#define __need_ssize_t -#include -#undef __need_ssize_t +#include #endif // LIBC_FULL_BUILD diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index 5331a0409d2a2..91c7db9029a66 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -180,6 +180,14 @@ libc_support_library( ], ) +libc_support_library( + name = "hdr_unistd_macros", + hdrs = ["hdr/unistd_macros.h"], + deps = [ + ":hdr_unistd_overlay", + ], +) + libc_support_library( name = "hdr_limits_macros", hdrs = ["hdr/limits_macros.h"], @@ -195,6 +203,11 @@ libc_support_library( hdrs = ["hdr/stdlib_overlay.h"], ) +libc_support_library( + name = "hdr_unistd_overlay", + hdrs = ["hdr/unistd_overlay.h"], +) + ############################ Type Proxy Header Files ########################### libc_support_library( @@ -300,6 +313,11 @@ libc_support_library( hdrs = ["hdr/types/pid_t.h"], ) +libc_support_library( + name = "types_uid_t", + hdrs = ["hdr/types/uid_t.h"], +) + libc_support_library( name = "types_off_t", hdrs = ["hdr/types/off_t.h"], @@ -3996,6 +4014,7 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", ], ) @@ -4008,6 +4027,7 @@ libc_function( ":__support_osutil_syscall", ":errno", ":hdr_fcntl_macros", + ":hdr_unistd_macros", ], ) @@ -4023,6 +4043,7 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", ], ) @@ -4067,6 +4088,8 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_off_t", ], ) @@ -4078,6 +4101,8 @@ libc_function( # ":__support_common", # ":__support_osutil_syscall", # ":errno", +# ":hdr_unistd_macros", +# ":types_size_t", # ], # ) @@ -4089,6 +4114,9 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_size_t", + ":types_uid_t", ], ) @@ -4100,6 +4128,8 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_pid_t", ], ) @@ -4111,6 +4141,8 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_uid_t", ], ) @@ -4125,6 +4157,7 @@ libc_function( # ":__support_file_file", # ":__support_osutil_syscall", # ":errno", +# ":hdr_unistd_macros", # ], # ) @@ -4136,6 +4169,7 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", ], ) @@ -4148,6 +4182,7 @@ libc_function( ":__support_osutil_syscall", ":errno", ":hdr_fcntl_macros", + ":hdr_unistd_macros", ], ) @@ -4160,6 +4195,7 @@ libc_function( ":__support_osutil_syscall", ":errno", ":hdr_fcntl_macros", + ":hdr_unistd_macros", ], ) @@ -4184,6 +4220,8 @@ libc_function( ":__support_file_linux_lseekimpl", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_off_t", ], ) @@ -4200,6 +4238,10 @@ libc_function( ":__support_macros_sanitizer", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_off_t", + ":types_size_t", + ":types_ssize_t", ], ) @@ -4215,6 +4257,10 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_off_t", + ":types_size_t", + ":types_ssize_t", ], ) @@ -4228,6 +4274,9 @@ libc_function( ":__support_macros_sanitizer", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_size_t", + ":types_ssize_t", ], ) @@ -4240,6 +4289,9 @@ libc_function( ":__support_osutil_syscall", ":errno", ":hdr_fcntl_macros", + ":hdr_unistd_macros", + ":types_size_t", + ":types_ssize_t", ], ) @@ -4252,6 +4304,9 @@ libc_function( ":__support_osutil_syscall", ":errno", ":hdr_fcntl_macros", + ":hdr_unistd_macros", + ":types_size_t", + ":types_ssize_t", ], ) @@ -4276,6 +4331,7 @@ libc_function( ":__support_osutil_syscall", ":errno", ":hdr_fcntl_macros", + ":hdr_unistd_macros", ], ) @@ -4288,6 +4344,7 @@ libc_function( ":__support_osutil_syscall", ":errno", ":hdr_fcntl_macros", + ":hdr_unistd_macros", ], ) @@ -4302,6 +4359,7 @@ libc_function( # ":__support_common", # ":__support_osutil_syscall", # ":errno", +# ":hdr_unistd_macros", # ], # ) @@ -4313,6 +4371,8 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_ssize_t", ], ) @@ -4324,6 +4384,8 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_off_t", ], ) @@ -4360,6 +4422,9 @@ libc_function( ":__support_common", ":__support_osutil_syscall", ":errno", + ":hdr_unistd_macros", + ":types_size_t", + ":types_ssize_t", ], )