| //===----------------------------------------------------------------------===// | |
| // | |
| // 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 | |
| // | |
| //===----------------------------------------------------------------------===// | |
| /// | |
| /// \file | |
| /// Helper compiled with -mgeneral-regs-only on AArch64 to check jmp_buf layout. | |
| /// | |
| //===----------------------------------------------------------------------===// | |
| #include "src/__support/macros/config.h" | |
| #include "test/include/jmp_buf_test.h" | |
| #if !defined(__riscv_float_abi_single) | |
| #include "include/llvm-libc-macros/offsetof-macro.h" | |
| #include "include/llvm-libc-types/__jmp_buf.h" | |
| #include "include/llvm-libc-types/jmp_buf.h" | |
| #include "include/llvm-libc-types/sigjmp_buf.h" | |
| #endif | |
| #if defined(__aarch64__) && !defined(_MSC_VER) && defined(__ARM_FP) | |
| #error "Expected jmp_buf_nofp.cpp to be compiled without __ARM_FP on AArch64." | |
| #endif | |
| namespace LIBC_NAMESPACE_DECL { | |
| JmpBufLayout get_nofp_jmp_buf_layout() { | |
| JmpBufLayout layout{}; | |
| #if !defined(__riscv_float_abi_single) | |
| layout.jmp_buf_size = sizeof(jmp_buf); | |
| layout.jmp_buf_align = alignof(jmp_buf); | |
| layout.sigjmp_buf_size = sizeof(sigjmp_buf); | |
| layout.sigjmp_buf_align = alignof(sigjmp_buf); | |
| #if (defined(__linux__) || defined(__APPLE__)) && \ | |
| (defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \ | |
| defined(__arm__) || defined(__riscv)) | |
| layout.sigmask_offset = offsetof(__jmp_buf, sigmask); | |
| layout.has_sigmask = true; | |
| #endif | |
| #endif // !defined(__riscv_float_abi_single) | |
| return layout; | |
| } | |
| } // namespace LIBC_NAMESPACE_DECL |