[libc-commits] [libc] [libc] update abort implementation and lift it for internal usage (PR #189756)

via libc-commits libc-commits at lists.llvm.org
Fri Apr 3 13:33:04 PDT 2026


================
@@ -0,0 +1,54 @@
+//===-- Internal header for Linux abort -------------------------*- 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_LINUX_ABORT_UTILS_H
+#define LLVM_LIBC_SRC_STDLIB_LINUX_ABORT_UTILS_H
+
+#include "hdr/types/sigset_t.h"
+#include "hdr/types/struct_sigaction.h"
+#include "src/__support/OSUtil/exit.h"
+#include "src/__support/OSUtil/linux/syscall_wrappers/raise.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/signal/linux/signal_utils.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace abort_utils {
+[[noreturn]] LIBC_INLINE void abort() {
+  // Try to raise SIGABRT.
+  // If this fails, or if a handler returns, keep going with the hard-abort
+  // sequence below.
+  LIBC_NAMESPACE::linux_syscalls::raise(SIGABRT);
----------------
lntue wrote:

nit: remove `LIBC_NAMESPACE::` in this function.

https://github.com/llvm/llvm-project/pull/189756


More information about the libc-commits mailing list