Skip to content

Conversation

bassiounix
Copy link
Contributor

@bassiounix bassiounix commented Oct 18, 2025

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

Add internal libc_constraint_handler required by Annex K interface in LLVM libc.

Copy link
Contributor Author

bassiounix commented Oct 18, 2025

@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2025

@llvm/pr-subscribers-libc

@llvm/pr-subscribers-backend-risc-v

Author: Muhammad Bassiouni (bassiounix)

Changes

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

Add internal libc_constraint_handler required by Annex K interface in LLVM libc.


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

2 Files Affected:

  • (added) libc/src/__support/annex_k/CMakeLists.txt (+21)
  • (added) libc/src/__support/annex_k/libc_constraint_handler.h (+26)
diff --git a/libc/src/__support/annex_k/CMakeLists.txt b/libc/src/__support/annex_k/CMakeLists.txt
new file mode 100644
index 0000000000000..8eb65f2469b4f
--- /dev/null
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -0,0 +1,21 @@
+add_header_library(
+  abort_handler_s
+  HDRS
+    abort_handler_s.h
+  DEPENDS
+    libc.hdr.stdio_macros
+    libc.hdr.types.errno_t
+    libc.src.__support.macros.config
+    libc.src.__support.macros.attributes
+    libc.src.__support.OSUtil.osutil
+    libc.src.stdlib.abort
+)
+
+add_header_library(
+  libc_constraint_handler
+  HDRS
+    libc_constraint_handler.h
+  DEPENDS
+    .abort_handler_s
+    libc.hdr.types.constraint_handler_t
+)
diff --git a/libc/src/__support/annex_k/libc_constraint_handler.h b/libc/src/__support/annex_k/libc_constraint_handler.h
new file mode 100644
index 0000000000000..9b0a45d09cb32
--- /dev/null
+++ b/libc/src/__support/annex_k/libc_constraint_handler.h
@@ -0,0 +1,26 @@
+//===-- Static header for libc_constraint_handler ---------------*- C++ -*-===//
+//
+// 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_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+
+#include "abort_handler_s.h"
+#include "hdr/types/constraint_handler_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace annex_k {
+
+LIBC_INLINE static constraint_handler_t libc_constraint_handler =
+    &abort_handler_s;
+
+} // namespace annex_k
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H

@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-14-_libc_annex_k_add_libc_constraint_handler branch from fa8b27c to a372a7e Compare October 18, 2025 14:40
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-14-_libc_stdlib_annex_k_add_ignore_handler_s branch from 0b20953 to 5d96de6 Compare October 18, 2025 14:40
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-14-_libc_annex_k_add_libc_constraint_handler branch from a372a7e to cb13be4 Compare October 18, 2025 15:02
@bassiounix bassiounix force-pushed the users/bassiounix/spr/10-14-_libc_stdlib_annex_k_add_ignore_handler_s branch from 5d96de6 to ab947f3 Compare October 18, 2025 15:02
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