1 //===-- Implementation of quick_exit --------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "src/stdlib/quick_exit.h"
10 #include "src/__support/OSUtil/exit.h"
11 #include "src/__support/common.h"
12 #include "src/__support/macros/config.h"
13 #include "src/stdlib/exit_handler.h"
15 // extern "C" void __cxa_finalize(void *);
16 namespace LIBC_NAMESPACE_DECL
{
18 extern ExitCallbackList at_quick_exit_callbacks
;
19 [[gnu::weak
]] extern void teardown_main_tls();
21 [[noreturn
]] LLVM_LIBC_FUNCTION(void, quick_exit
, (int status
)) {
22 call_exit_callbacks(at_quick_exit_callbacks
);
23 if (teardown_main_tls
)
25 internal::exit(status
);
28 } // namespace LIBC_NAMESPACE_DECL