[libc-commits] [libc] [libc][i386] setjmp/longjmp (PR #112437)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Oct 15 15:56:35 PDT 2024


================
@@ -7,15 +7,34 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/setjmp/longjmp.h"
+#include "include/llvm-libc-macros/offsetof-macro.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
-#if !defined(LIBC_TARGET_ARCH_IS_X86_64)
+#if !defined(LIBC_TARGET_ARCH_IS_X86)
 #error "Invalid file include"
 #endif
 
 namespace LIBC_NAMESPACE_DECL {
 
+#ifdef __i386__
+[[noreturn]]
+LLVM_LIBC_FUNCTION(void, longjmp, (jmp_buf buf, int val)) {
+  asm(R"(
----------------
nickdesaulniers wrote:

> the input values could be referring to the registers you're writing in the asm body

Inputs are constrained via "m", not "r" or "rm".

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


More information about the libc-commits mailing list