[all-commits] [llvm/llvm-project] 2a6268: [libc][AArch64] Add an AArch64 setjmp/longjmp. (#1...

Simon Tatham via All-commits all-commits at lists.llvm.org
Wed Jul 31 09:10:13 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a6268d8f999d56a557079e7fd8ee8c4a4e9ac0c
      https://github.com/llvm/llvm-project/commit/2a6268d8f999d56a557079e7fd8ee8c4a4e9ac0c
  Author: Simon Tatham <simon.tatham at arm.com>
  Date:   2024-07-31 (Wed, 31 Jul 2024)

  Changed paths:
    M libc/config/config.json
    M libc/config/linux/aarch64/entrypoints.txt
    M libc/docs/configure.rst
    M libc/include/llvm-libc-types/jmp_buf.h
    A libc/src/setjmp/aarch64/CMakeLists.txt
    A libc/src/setjmp/aarch64/longjmp.cpp
    A libc/src/setjmp/aarch64/setjmp.cpp

  Log Message:
  -----------
  [libc][AArch64] Add an AArch64 setjmp/longjmp. (#101177)

Previously, building libc for AArch64 in `LLVM_LIBC_FULL_BUILD` mode
would fail because no implementation of setjmp/longjmp was available.
This was the only obstacle, so now a full AArch64 build of libc is
possible.

This implementation automatically supports PAC and BTI if compiled with
the appropriate options. I would have liked to do the same for MTE stack
tagging, but as far as I can see there's currently no predefined macro
that allows detection of `-fsanitize=memtag-stack`, so I've left that
one as a TODO.

AAPCS64 delegates the x18 register to individual platform ABIs, and
allows them to choose what it's used for, which may or may not require
setjmp and longjmp to save and restore it. To accommodate this, I've
introduced a libc configuration option. The default is on, because the
only use of x18 I've so far encountered uses it to store information
specific to the current stack frame (so longjmp does need to restore
it), and this is also safe behavior in the default situation where the
platform ABI specifies no use of x18 and it becomes a temporary register
(restoring it to its previous value is no worse than any _other_ way for
a function call to clobber it). But if a platform ABI needs to use x18
in a way that requires longjmp to leave it alone, they can turn the
option off.



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