[libc-commits] [libc] [libc][i386] setjmp/longjmp (PR #112437)
James Y Knight via libc-commits
libc-commits at lists.llvm.org
Wed Oct 16 07:52:36 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"(
----------------
jyknight wrote:
"m" constraint means that the operand is passed as an address, and emits the operand using syntax which specifies a memory load/store of that address (e.g. `(%rax)` vs `%rax`). It may either provide the address in a register, or with some more complex target-specific address expression (e.g. base+offset*scale on x86). But in any case, it has to use at least one register, unless the address is of a global with a load-time-constant address (not the case here), and your target supports arbitrary relocatable symbols in its memory access operands (which x86 does, but most other architectures don't).
https://github.com/llvm/llvm-project/pull/112437
More information about the libc-commits
mailing list