[libc-commits] [libc] [libc][annex_k] Add abort_handler_s. (PR #164089)
Muhammad Bassiouni via libc-commits
libc-commits at lists.llvm.org
Mon Apr 13 01:16:59 PDT 2026
================
@@ -0,0 +1,20 @@
+//===-- Implementation for abort_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/abort_handler_s.h"
+#include "src/__support/annex_k/abort_handler_s.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(void, abort_handler_s,
+ (const char *__restrict msg, void *__restrict ptr,
+ errno_t error)) {
+ return annex_k::abort_handler_s(msg, ptr, error);
----------------
bassiounix wrote:
Later in the PRs I'm adding the constraint handler itself and it needs to have a default value for a handler, and what I went with is the abort handler.
The handler is used in so many places and is platform independent, so I need a common place to put it to share between all modules, so I decided to use `__support`. And since I need to have a default value for the handler in `__support`, it makes sense to move the declaration there in `__support` as well.
The only concern I'm having is the dependence on a public api (`src/stdlib/abort.h`) in `libc/src/__support/annex_k/abort_handler_s.h`, that I can't find a workaround for. I'm thinking of switching to `__builtin_trap` but it's not the same as `exit` IIRC.
https://github.com/llvm/llvm-project/pull/164089
More information about the libc-commits
mailing list