third_party/libcxxabi: Enable __cxa_thread_atexit

Enable `__cxa_thread_atexit` from libcxxabi.
`__cxa_thread_atexit_impl` is still implemented by the cosmo libc.
The original `__cxa_thread_atexit` has been removed.
This commit is contained in:
Trung Nguyen 2024-01-07 13:17:34 +00:00 committed by GitHub
parent d06eeb2c8e
commit 9387ace326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 24 deletions

View file

@ -1,23 +0,0 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2023 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/cxaatexit.internal.h"
int __cxa_thread_atexit(void *fun, void *arg, void *dso_symbol) {
return __cxa_thread_atexit_impl(fun, arg, dso_symbol);
}

View file

@ -41,6 +41,7 @@ TEST_LIBC_THREAD_DIRECTDEPS = \
LIBC_THREAD \
LIBC_TIME \
LIBC_X \
THIRD_PARTY_LIBCXXABI \
THIRD_PARTY_NSYNC \
THIRD_PARTY_NSYNC_MEM

View file

@ -90,6 +90,7 @@ $(THIRD_PARTY_LIBCXXABI_A_OBJS): private \
-frtti \
-D_LIBCXXABI_BUILDING_LIBRARY \
-D_LIBCPP_BUILDING_LIBRARY \
-DHAVE___CXA_THREAD_ATEXIT_IMPL \
-D_LIBCPP_CONSTINIT=__constinit \
-Dconstinit=__constinit

View file

@ -15,3 +15,4 @@ LOCAL CHANGES
- Add <__memory/aligned_alloc.h> (contains a few inline functions) from
upstream libcxx.
- Enable __cxa_thread_atexit for Cosmopolitan.

View file

@ -160,7 +160,7 @@ __cxa_decrement_exception_refcount(void *primary_exception) throw();
extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() throw();
extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() throw();
#if defined(__linux__) || defined(__Fuchsia__)
#if defined(__linux__) || defined(__Fuchsia__) || defined(__COSMOPOLITAN__)
// Linux and Fuchsia TLS support. Not yet an official part of the Itanium ABI.
// https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables
extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*)(void *), void *,