Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libc/config/darwin/aarch64/config.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
11 changes: 11 additions & 0 deletions libc/config/darwin/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions libc/config/darwin/aarch64/headers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions libc/src/setjmp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions libc/src/setjmp/darwin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion libc/test/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
Loading