diff options
author | Simon Tatham <simon.tatham@arm.com> | 2024-07-31 17:09:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-31 09:09:52 -0700 |
commit | 2a6268d8f999d56a557079e7fd8ee8c4a4e9ac0c (patch) | |
tree | d8ccb7cf166a01f9878db5addd2c33388fb18697 /llvm/unittests/Support/ErrorTest.cpp | |
parent | fa842970027b6d2f0160ad42fa82a872bf8d8600 (diff) | |
download | llvm-2a6268d8f999d56a557079e7fd8ee8c4a4e9ac0c.zip llvm-2a6268d8f999d56a557079e7fd8ee8c4a4e9ac0c.tar.gz llvm-2a6268d8f999d56a557079e7fd8ee8c4a4e9ac0c.tar.bz2 |
[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.
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
0 files changed, 0 insertions, 0 deletions