Release Cosmopolitan v3.6.0

This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
Justine Tunney 2024-07-23 03:16:17 -07:00
parent 62ace3623a
commit 5660ec4741
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
1585 changed files with 117353 additions and 271644 deletions

View file

@ -90,9 +90,6 @@ $(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
# ttypeIndex is initialized and used only when native_old_exception is true.
# GCC does not seem to allow this.

View file

@ -17,7 +17,7 @@
#include "third_party/libcxxabi/cxa_handlers.h"
#include "third_party/libcxxabi/cxa_exception.h"
#include "third_party/libcxxabi/private_typeinfo.h"
#include "third_party/libcxx/src/include/atomic_support.h" // from libc++
#include "third_party/libcxx/atomic_support.h" // from libc++
#if !defined(LIBCXXABI_SILENT_TERMINATE)

View file

@ -11,13 +11,14 @@
//===----------------------------------------------------------------------===//
#include "third_party/libcxxabi/include/cxxabi.h"
#include "third_party/libcxx/__thread/support.h"
#include "third_party/libcxx/exception" // for std::terminate
#include "libc/isystem/string.h" // for memset
#include "third_party/libcxxabi/cxa_exception.h"
#include "third_party/libcxxabi/cxa_handlers.h"
#include "third_party/libcxxabi/fallback_malloc.h"
#include "third_party/libcxx/src/include/atomic_support.h" // from libc++
#include <exception> // for std::terminate
#include <string.h> // for memset
#include "cxa_exception.h"
#include "cxa_handlers.h"
#include "fallback_malloc.h"
#include "third_party/libcxx/atomic_support.h" // from libc++
#if __has_feature(address_sanitizer)
#include <sanitizer/asan_interface.h>
@ -206,6 +207,24 @@ void __cxa_free_exception(void *thrown_object) throw() {
__aligned_free_with_fallback((void *)raw_buffer);
}
__cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinfo,
#ifdef __wasm__
// In Wasm, a destructor returns its argument
void *(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
#else
void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
#endif
__cxa_exception* exception_header = cxa_exception_from_thrown_object(object);
exception_header->referenceCount = 0;
exception_header->unexpectedHandler = std::get_unexpected();
exception_header->terminateHandler = std::get_terminate();
exception_header->exceptionType = tinfo;
exception_header->exceptionDestructor = dest;
setOurExceptionClass(&exception_header->unwindHeader);
exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
return exception_header;
}
// This function shall allocate a __cxa_dependent_exception and
// return a pointer to it. (Really to the object, not past its' end).
@ -254,23 +273,21 @@ will call terminate, assuming that there was no handler for the
exception.
*/
void
#ifdef __wasm__
// In Wasm, a destructor returns its argument
__cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
#else
__cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
__cxa_eh_globals *globals = __cxa_get_globals();
__cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object);
#endif
__cxa_eh_globals* globals = __cxa_get_globals();
globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local
exception_header->unexpectedHandler = std::get_unexpected();
exception_header->terminateHandler = std::get_terminate();
exception_header->exceptionType = tinfo;
exception_header->exceptionDestructor = dest;
setOurExceptionClass(&exception_header->unwindHeader);
exception_header->referenceCount = 1; // This is a newly allocated exception, no need for thread safety.
globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local
exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
__cxa_exception* exception_header = __cxa_init_primary_exception(thrown_object, tinfo, dest);
exception_header->referenceCount = 1; // This is a newly allocated exception, no need for thread safety.
#if __has_feature(address_sanitizer)
// Inform the ASan runtime that now might be a good time to clean stuff up.
__asan_handle_no_return();
// Inform the ASan runtime that now might be a good time to clean stuff up.
__asan_handle_no_return();
#endif
#ifdef __USING_SJLJ_EXCEPTIONS__
@ -573,6 +590,11 @@ void __cxa_end_catch() {
}
}
void __cxa_call_terminate(void* unwind_arg) throw() {
__cxa_begin_catch(unwind_arg);
std::terminate();
}
// Note: exception_header may be masquerading as a __cxa_dependent_exception
// and that's ok. exceptionType is there too.
// However watch out for foreign exceptions. Return null for them.
@ -771,6 +793,6 @@ __cxa_uncaught_exceptions() throw()
return globals->uncaughtExceptions;
}
} // extern "C"
} // extern "C"
} // abi

View file

@ -11,8 +11,7 @@
//===----------------------------------------------------------------------===//
#include "third_party/libcxxabi/cxa_exception.h"
#include "third_party/libcxx/__threading_support"
#include "third_party/libcxx/__thread/support.h"
#if defined(_LIBCXXABI_HAS_NO_THREADS)

View file

@ -8,6 +8,7 @@
#include "third_party/libcxxabi/include/__cxxabi_config.h"
#include "third_party/libcxxabi/include/cxxabi.h"
#include "third_party/libcxx/__thread/support.h"
// Tell the implementation that we're building the actual implementation
// (and not testing it)

View file

@ -45,7 +45,8 @@
*/
#include "third_party/libcxxabi/include/__cxxabi_config.h"
#include "third_party/libcxx/src/include/atomic_support.h" // from libc++
#include "third_party/libcxx/__thread/support.h"
#include "third_party/libcxx/atomic_support.h" // from libc++
#if defined(__has_include)
# if __has_include(<sys/syscall.h>)
# include <sys/syscall.h>
@ -55,7 +56,6 @@
# endif
#endif
#include "third_party/libcxx/__threading_support"
#include "third_party/libcxx/cstdint"
#include "third_party/libcxx/cstring"
#include "libc/isystem/limits.h"

View file

@ -17,7 +17,7 @@
#include "third_party/libcxxabi/cxa_handlers.h"
#include "third_party/libcxxabi/cxa_exception.h"
#include "third_party/libcxxabi/private_typeinfo.h"
#include "third_party/libcxx/src/include/atomic_support.h" // from libc++
#include "third_party/libcxx/atomic_support.h" // from libc++
namespace std
{

View file

@ -8,7 +8,7 @@
#include "third_party/libcxxabi/abort_message.h"
#include "third_party/libcxxabi/include/cxxabi.h"
#include "third_party/libcxx/__threading_support"
#include "third_party/libcxx/__thread/support.h"
#ifndef _LIBCXXABI_HAS_NO_THREADS
#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
#pragma comment(lib, "pthread")

View file

@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "third_party/libcxxabi/fallback_malloc.h"
#include "third_party/libcxx/__thread/support.h"
#include "third_party/libcxx/__threading_support"
#ifndef _LIBCXXABI_HAS_NO_THREADS
#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
#pragma comment(lib, "pthread")

View file

@ -12,7 +12,7 @@
#include "third_party/libcxx/cstring"
#include "third_party/libcxx/cstdint"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/src/include/refstring.h" // from libc++
#include "third_party/libcxx/refstring.h" // from libc++
static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char *), "");

View file

@ -133,8 +133,7 @@ $(THIRD_PARTY_LIBCXXABI_TEST_OBJS): private \
-fexceptions \
-frtti \
-D_LIBCXXABI_BUILDING_LIBRARY \
-D_LIBCPP_BUILDING_LIBRARY \
-D_LIBCPP_CONSTINIT=__constinit
-D_LIBCPP_BUILDING_LIBRARY
$(THIRD_PARTY_LIBCXXABI_TEST_OBJS): private CONFIG_CPPFLAGS += -UNDEBUG
o/$(MODE)/third_party/libcxxabi/test/catch_multi_level_pointer.pass.o: private COPTS += -O0

View file

@ -17,6 +17,8 @@
#pragma clang diagnostic ignored "-Wexceptions"
#endif
#pragma GCC diagnostic ignored "-Wexceptions"
#if __has_feature(cxx_nullptr)
struct A {};

View file

@ -9,7 +9,6 @@
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/cstdio"
#include "third_party/libcxx/cstdlib"
#include "third_party/libcxx/__threading_support"
#include "libc/isystem/unistd.h"
#include "third_party/libcxxabi/cxa_exception.h"

View file

@ -11,8 +11,6 @@
#include "third_party/libcxx/cassert"
#include "libc/isystem/inttypes.h"
#include "third_party/libcxx/__threading_support"
// UNSUPPORTED: c++03
// UNSUPPORTED: modules-build && no-threads