mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 11:02:04 +08:00
[libc][darwin] add internal::exit (#166357)
Add internal::exit for MacOS/Darwin
This commit is contained in:
@@ -111,6 +111,7 @@ if(LLVM_LIBC_FULL_BUILD)
|
||||
libc.src.setjmp.setjmp
|
||||
libc.src.setjmp.siglongjmp
|
||||
libc.src.setjmp.sigsetjmp
|
||||
libc.src.stdlib._Exit
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -4,13 +4,16 @@ endif()
|
||||
|
||||
add_subdirectory(${LIBC_TARGET_ARCHITECTURE})
|
||||
|
||||
add_header_library(
|
||||
add_object_library(
|
||||
darwin_util
|
||||
SRCS
|
||||
exit.cpp
|
||||
HDRS
|
||||
io.h
|
||||
syscall.h
|
||||
DEPENDS
|
||||
.${LIBC_TARGET_ARCHITECTURE}.darwin_util
|
||||
.${LIBC_TARGET_ARCHITECTURE}.darwin_${LIBC_TARGET_ARCHITECTURE}_util
|
||||
libc.src.__support.common
|
||||
libc.src.__support.CPP.string_view
|
||||
libc.include.sys_syscall
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
add_header_library(
|
||||
darwin_util
|
||||
darwin_aarch64_util
|
||||
HDRS
|
||||
syscall.h
|
||||
DEPENDS
|
||||
|
||||
24
libc/src/__support/OSUtil/darwin/exit.cpp
Normal file
24
libc/src/__support/OSUtil/darwin/exit.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
//===------------ MacOS implementation of an exit function ------*- C++ -*-===//
|
||||
//
|
||||
// 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/__support/OSUtil/darwin/syscall.h" // syscall_impl
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "sys/syscall.h" // For syscall numbers.
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace internal {
|
||||
|
||||
[[noreturn]] void exit(int status) {
|
||||
for (;;) {
|
||||
LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, status);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
Reference in New Issue
Block a user