1 //===-- Implementation of quick_exit --------------------------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 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" 14 15 // extern "C" void __cxa_finalize(void *); 16 namespace LIBC_NAMESPACE_DECL { 17 18 extern ExitCallbackList at_quick_exit_callbacks; 19 [[gnu::weak]] extern void teardown_main_tls(); 20 21 [[noreturn]] LLVM_LIBC_FUNCTION(void, quick_exit, (int status)) { 22 call_exit_callbacks(at_quick_exit_callbacks); 23 if (teardown_main_tls) 24 teardown_main_tls(); 25 internal::exit(status); 26 } 27 28 } // namespace LIBC_NAMESPACE_DECL 29