[libc-commits] [libc] [libc] implement sigsetjmp/siglongjmp for x86-64 (PR #136072)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Thu Apr 17 10:29:20 PDT 2025


================
@@ -0,0 +1,21 @@
+//===-- Implementation of siglongjmp --------------------------------------===//
+//
+// 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/setjmp/siglongjmp.h"
+#include "src/__support/common.h"
+#include "src/setjmp/longjmp.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+// siglongjmp is the same as longjmp. The additional recovery work is done in
+// the epilogue of the sigsetjmp function.
+LLVM_LIBC_FUNCTION(void, siglongjmp, (jmp_buf buf, int val)) {
+  return longjmp(buf, val);
----------------
SchrodingerZhu wrote:

I tried just not but it is a bit complicated here. 
The common function `longjmp_impl` (assume I make  `longjmp` into `longjmp_impl`) is a naked asm function (not inlinable), introducing that as a common routine will be adding an unavoidable indirection for `longjmp`. 

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


More information about the libc-commits mailing list