Implement sigsetjmp and siglongjmp for darwin/aarch64 (#139555)
This commit is contained in:
8
libc/config/darwin/aarch64/config.json
Normal file
8
libc/config/darwin/aarch64/config.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"setjmp": {
|
||||
"LIBC_CONF_SETJMP_AARCH64_RESTORE_PLATFORM_REGISTER": {
|
||||
"value": false,
|
||||
"doc": "Avoid setjmp saving the value of x18, and longjmp restoring it. The Apple AArch64 ABI specifies that this register is reserved and should not be used"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,17 @@ set(TARGET_LIBC_ENTRYPOINTS
|
||||
libc.src.stdlib.free
|
||||
)
|
||||
|
||||
if(LLVM_LIBC_FULL_BUILD)
|
||||
list(APPEND TARGET_LIBC_ENTRYPOINTS
|
||||
# setjmp.h entrypoints
|
||||
libc.src.setjmp.longjmp
|
||||
libc.src.setjmp.setjmp
|
||||
libc.src.setjmp.siglongjmp
|
||||
libc.src.setjmp.sigsetjmp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
set(TARGET_LIBM_ENTRYPOINTS
|
||||
# complex.h entrypoints
|
||||
libc.src.complex.creal
|
||||
|
||||
@@ -7,6 +7,7 @@ set(TARGET_PUBLIC_HEADERS
|
||||
libc.include.inttypes
|
||||
libc.include.limits
|
||||
libc.include.math
|
||||
libc.include.setjmp
|
||||
libc.include.stdlib
|
||||
libc.include.string
|
||||
libc.include.strings
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
# Process architecture-specific subdirectory FIRST to avoid missing targets.
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
|
||||
endif()
|
||||
|
||||
# Then process OS-specific subdirectory
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
|
||||
add_object_library(
|
||||
@@ -8,10 +14,6 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
|
||||
)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
|
||||
endif()
|
||||
|
||||
add_entrypoint_object(
|
||||
setjmp
|
||||
ALIAS
|
||||
|
||||
12
libc/src/setjmp/darwin/CMakeLists.txt
Normal file
12
libc/src/setjmp/darwin/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
add_object_library(
|
||||
sigsetjmp_epilogue
|
||||
HDRS
|
||||
../sigsetjmp_epilogue.h
|
||||
SRCS
|
||||
sigsetjmp_epilogue.cpp
|
||||
DEPENDS
|
||||
libc.src.__support.common
|
||||
libc.src.__support.OSUtil.osutil
|
||||
libc.hdr.types.jmp_buf
|
||||
libc.hdr.types.sigset_t
|
||||
)
|
||||
21
libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp
Normal file
21
libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//===-- Implementation of sigsetjmp_epilogue ------------------------------===//
|
||||
//
|
||||
// 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_epilogue.h"
|
||||
#include "src/__support/OSUtil/syscall.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/signal/sigprocmask.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
[[gnu::returns_twice]] int sigsetjmp_epilogue(jmp_buf buffer, int retval) {
|
||||
syscall_impl<long>(sigprocmask, SIG_SETMASK,
|
||||
/* set= */ retval ? &buffer->sigmask : nullptr,
|
||||
/* old_set= */ retval ? nullptr : &buffer->sigmask);
|
||||
return retval;
|
||||
}
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
@@ -62,6 +62,7 @@ add_subdirectory(errno)
|
||||
add_subdirectory(fenv)
|
||||
add_subdirectory(math)
|
||||
add_subdirectory(search)
|
||||
add_subdirectory(setjmp)
|
||||
add_subdirectory(stdbit)
|
||||
add_subdirectory(stdfix)
|
||||
add_subdirectory(stdio)
|
||||
@@ -92,7 +93,6 @@ add_subdirectory(assert)
|
||||
add_subdirectory(compiler)
|
||||
add_subdirectory(dirent)
|
||||
add_subdirectory(locale)
|
||||
add_subdirectory(setjmp)
|
||||
add_subdirectory(signal)
|
||||
add_subdirectory(spawn)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user