Skip to content

Conversation

@bassiounix
Copy link
Contributor

@bassiounix bassiounix commented Oct 13, 2025

RFC https://discourse.llvm.org/t/rfc-bounds-checking-interfaces-for-llvm-libc/87685

Add rsize_t type required by Annex K interface in LLVM libc.

Copy link
Contributor Author

bassiounix commented Oct 13, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@bassiounix bassiounix added the libc label Oct 13, 2025 — with Graphite App
@bassiounix bassiounix marked this pull request as ready for review October 13, 2025 18:16
@llvmbot
Copy link
Member

llvmbot commented Oct 13, 2025

@llvm/pr-subscribers-libc

Author: Muhammad Bassiouni (bassiounix)

Changes

RFC https://discourse.llvm.org/t/rfc-bounds-checking-interfaces-for-llvm-libc/87685

Add rsize_t type required by Annex K interface in LLVM libc.


Full diff: https://github.com/llvm/llvm-project/pull/163238.diff

4 Files Affected:

  • (modified) libc/hdr/types/CMakeLists.txt (+8)
  • (added) libc/hdr/types/rsize_t.h (+23)
  • (modified) libc/include/llvm-libc-types/CMakeLists.txt (+1)
  • (added) libc/include/llvm-libc-types/rsize_t.h (+18)
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 89414f419a7f0..1ef1a2bee6f80 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -135,6 +135,14 @@ add_proxy_header_library(
     libc.include.llvm-libc-types.struct_tm
 )
 
+add_proxy_header_library(
+  rsize_t
+  HDRS
+    rsize_t.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-types.rsize_t
+)
+
 add_proxy_header_library(
   size_t
   HDRS
diff --git a/libc/hdr/types/rsize_t.h b/libc/hdr/types/rsize_t.h
new file mode 100644
index 0000000000000..130e6c308e264
--- /dev/null
+++ b/libc/hdr/types/rsize_t.h
@@ -0,0 +1,23 @@
+//===-- Proxy for rsize_t -------------------------------------------------===//
+//
+// Part of the LLVM Project, 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
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_LIBC_HDR_TYPES_SIZE_T_H
+#define LLVM_LIBC_HDR_TYPES_SIZE_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/rsize_t.h"
+
+#else
+
+#define __need_rsize_t
+#include <stddef.h>
+#undef __need_rsize_t
+
+#endif // LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index 670ab71468661..8e22baa8dfba1 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_header(off64_t HDR off64_t.h)
+add_header(rsize_t HDR rsize_t.h)
 add_header(size_t HDR size_t.h)
 add_header(ssize_t HDR ssize_t.h)
 add_header(__atfork_callback_t HDR __atfork_callback_t.h)
diff --git a/libc/include/llvm-libc-types/rsize_t.h b/libc/include/llvm-libc-types/rsize_t.h
new file mode 100644
index 0000000000000..dc8be02bee592
--- /dev/null
+++ b/libc/include/llvm-libc-types/rsize_t.h
@@ -0,0 +1,18 @@
+//===-- Definition of size_t types ----------------------------------------===//
+//
+// Part of the LLVM Project, 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TYPES_RSIZE_T_H
+#define LLVM_LIBC_TYPES_RSIZE_T_H
+
+#ifdef LIBC_HAS_ANNEX_K
+
+typedef __SIZE_TYPE__ rsize_t;
+
+#endif // LIBC_HAS_ANNEX_K
+
+#endif // LLVM_LIBC_TYPES_RSIZE_T_H

@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-12-_libc_annex_k_add_annex_k_support_macros branch from f71d62a to 6230cba Compare October 13, 2025 21:52
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch from 9f0d7dd to 5383561 Compare October 13, 2025 21:52
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-12-_libc_annex_k_add_annex_k_support_macros branch from 6230cba to 5215358 Compare October 16, 2025 21:54
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch from 5383561 to c74da0b Compare October 16, 2025 21:54
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-12-_libc_annex_k_add_annex_k_support_macros branch from 5215358 to 11870cc Compare October 16, 2025 22:17
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch from c74da0b to aa63b69 Compare October 16, 2025 22:17
@bassiounix bassiounix changed the base branch from users/bassiounix/spr/10-12-_libc_annex_k_add_annex_k_support_macros to users/bassiounix/spr/10-12-_libc_annex_k_add_errno_t October 16, 2025 22:40
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-12-_libc_annex_k_add_errno_t branch from be83e0f to d405dd7 Compare October 16, 2025 23:01
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch 3 times, most recently from e411bb5 to db9669f Compare October 17, 2025 13:13
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-12-_libc_annex_k_add_errno_t branch 2 times, most recently from 9b69087 to 5c7b9a7 Compare October 18, 2025 13:50
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch from db9669f to 02bef79 Compare October 18, 2025 13:50
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch from 02bef79 to 90cf101 Compare October 18, 2025 14:40
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-12-_libc_annex_k_add_errno_t branch from 5c7b9a7 to 6442985 Compare October 18, 2025 14:40
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch from 90cf101 to 061abfe Compare October 18, 2025 15:02
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-12-_libc_annex_k_add_errno_t branch 2 times, most recently from 8bcde7f to 370104d Compare October 22, 2025 18:27
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-13-_libc_annex_k_add_rsize_t branch from 061abfe to bc3482b Compare October 22, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants