-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[libc][stdlib][annex_k] Add ignore_handler_s. #163313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@llvm/pr-subscribers-backend-risc-v @llvm/pr-subscribers-libc Author: Muhammad Bassiouni (bassiounix) ChangesRFC https://discourse.llvm.org/t/rfc-bounds-checking-interfaces-for-llvm-libc/87685 Add Full diff: https://github.com/llvm/llvm-project/pull/163313.diff 8 Files Affected:
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index d7bdfe117d286..48b7ca45157a6 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1080,6 +1080,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.atexit
libc.src.stdlib.exit
libc.src.stdlib.getenv
+ libc.src.stdlib.ignore_handler_s
libc.src.stdlib.quick_exit
# signal.h entrypoints
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 9064e7df400de..0d3ff77d29b74 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1207,6 +1207,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.atexit
libc.src.stdlib.exit
libc.src.stdlib.getenv
+ libc.src.stdlib.ignore_handler_s
libc.src.stdlib.quick_exit
# signal.h entrypoints
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 0c825bdb19f35..dd94ffb30fa9a 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1246,6 +1246,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.atexit
libc.src.stdlib.exit
libc.src.stdlib.getenv
+ libc.src.stdlib.ignore_handler_s
libc.src.stdlib.quick_exit
# signal.h entrypoints
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 88ebd527a0a69..1834c2c687c99 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -360,6 +360,7 @@ add_header_macro(
../libc/include/stdlib.yaml
stdlib.h
DEPENDS
+ .llvm-libc-macros.annex_k_macros
.llvm-libc-macros.null_macro
.llvm-libc-macros.stdlib_macros
.llvm-libc-types.__atexithandler_t
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 7eafe3e966a82..7c3b113a62415 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -7,7 +7,7 @@ merge_yaml_files:
macros:
- macro_name: 'LIBC_HAS_ANNEX_K'
macro_header: annex-k-macros.h
- - macro_name: NULL
+ - macro_name: 'NULL'
macro_header: null-macro.h
types:
- type_name: __atexithandler_t
@@ -113,6 +113,15 @@ functions:
return_type: char *
arguments:
- type: const char *
+ - name: ignore_handler_s
+ standards:
+ - stdc
+ return_type: void
+ arguments:
+ - type: const char *__restrict
+ - type: void *__restrict
+ - type: errno_t
+ guard: 'LIBC_HAS_ANNEX_K'
- name: labs
standards:
- stdc
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 8fd149880e2d5..5efd7f13ff3ee 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -663,3 +663,16 @@ add_entrypoint_object(
DEPENDS
.${LIBC_TARGET_OS}.system
)
+
+add_entrypoint_object(
+ ignore_handler_s
+ HDRS
+ ignore_handler_s.h
+ SRCS
+ ignore_handler_s.cpp
+ DEPENDS
+ libc.hdr.types.errno_t
+ libc.src.__support.libc_errno
+ libc.src.__support.macros.config
+ libc.src.__support.macros.attributes
+)
diff --git a/libc/src/stdlib/ignore_handler_s.cpp b/libc/src/stdlib/ignore_handler_s.cpp
new file mode 100644
index 0000000000000..172b1bcdb7b30
--- /dev/null
+++ b/libc/src/stdlib/ignore_handler_s.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation header for ignore_handler_s --------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/stdlib/ignore_handler_s.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(void, ignore_handler_s,
+ (const char *__restrict, void *__restrict, errno_t)) {}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdlib/ignore_handler_s.h b/libc/src/stdlib/ignore_handler_s.h
new file mode 100644
index 0000000000000..07328d4be01ce
--- /dev/null
+++ b/libc/src/stdlib/ignore_handler_s.h
@@ -0,0 +1,22 @@
+//===-- Implementation header for ignore_handler_s --------------*- 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_STDLIB_IGNORE_HANDLER_S_H
+#define LLVM_LIBC_SRC_STDLIB_IGNORE_HANDLER_S_H
+
+#include "hdr/types/errno_t.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+void ignore_handler_s(const char *__restrict msg, void *__restrict ptr,
+ errno_t error);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_STDLIB_IGNORE_HANDLER_S_H
|
802ad1f to
ae59b27
Compare
8a2fcfe to
21baacc
Compare
21baacc to
b6ef5ea
Compare
ae59b27 to
bb85614
Compare
bb85614 to
ed8c6c8
Compare
b6ef5ea to
09542d7
Compare
ed8c6c8 to
51c1e50
Compare
09542d7 to
160556f
Compare
08051a7 to
d31d3d6
Compare
eb52178 to
d4fdba1
Compare
d31d3d6 to
55a25d4
Compare
55a25d4 to
f39a558
Compare
d4fdba1 to
51d4e0f
Compare
51d4e0f to
40610f5
Compare
f39a558 to
83d512d
Compare
83d512d to
8649eea
Compare
40610f5 to
611fd5f
Compare

RFC https://discourse.llvm.org/t/rfc-bounds-checking-interfaces-for-llvm-libc/87685
Add
ignore_handler_srequired by Annex K interface in LLVM libc.