[all-commits] [llvm/llvm-project] 9ebaa9: [libc] implement aarch64 sigsetjmp (#136706)

Schrodinger ZHU Yifan via All-commits all-commits at lists.llvm.org
Tue Apr 29 13:37:47 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ebaa9d483740b1e9a796e9e3b40a2ab70a4efb5
      https://github.com/llvm/llvm-project/commit/9ebaa9d483740b1e9a796e9e3b40a2ab70a4efb5
  Author: Schrodinger ZHU Yifan <yifanzhu at rochester.edu>
  Date:   2025-04-29 (Tue, 29 Apr 2025)

  Changed paths:
    M libc/config/linux/aarch64/entrypoints.txt
    M libc/include/llvm-libc-types/jmp_buf.h
    M libc/src/setjmp/aarch64/CMakeLists.txt
    A libc/src/setjmp/aarch64/sigsetjmp.cpp

  Log Message:
  -----------
  [libc] implement aarch64 sigsetjmp (#136706)

- **[libc][aarch64] implement sigsetjmp**

On top of https://github.com/llvm/llvm-project/pull/136072
See also https://github.com/llvm/llvm-project/issues/137055 for remarks
on naked attributes.

```c++
//===-- Implementation of setjmp ------------------------------------------===//
//
// 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/sigsetjmp.h"
#include "hdr/offsetof_macros.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/setjmp/setjmp_impl.h"
#include "src/setjmp/sigsetjmp_epilogue.h"

namespace LIBC_NAMESPACE_DECL {
[[gnu::naked]]
LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf, int)) {
  asm(R"(
      cbz w1, %c[setjmp]
      str x30, [x0, %c[retaddr]]
      str x19, [x0, %c[extra]]
      mov x19, x0
      bl %c[setjmp]
      mov w1, w0
      mov x0, x19
      ldr x30, [x0, %c[retaddr]]
      ldr x19, [x0, %c[extra]]
      b %c[epilogue])" ::[retaddr] "i"(offsetof(__jmp_buf, sig_retaddr)),
      [extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "i"(setjmp),
      [epilogue] "i"(sigsetjmp_epilogue)
      : "x0", "x1", "x19", "x30");
}
} // namespace LIBC_NAMESPACE_DECL
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list