diff options
author | thegeorg <thegeorg@yandex-team.com> | 2025-01-22 20:01:01 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2025-01-22 21:13:31 +0300 |
commit | fc137cea4b1d0f1fa01ebc5e7d1e8cfcf13edebc (patch) | |
tree | f957806f8385cbe10bdad60379bacdb43e06002d /contrib | |
parent | efe6bab8b41e05a17489f6240740e7de34f83e16 (diff) | |
download | ydb-fc137cea4b1d0f1fa01ebc5e7d1e8cfcf13edebc.tar.gz |
Update contrib/libs/cxxsupp/libcxxabi to 19.1.6
commit_hash:012c9a2da3515aa4edf342b0f61582b45de17309
Diffstat (limited to 'contrib')
15 files changed, 177 insertions, 151 deletions
diff --git a/contrib/libs/cxxsupp/libcxxabi-parts/ya.make b/contrib/libs/cxxsupp/libcxxabi-parts/ya.make index 5425e9f654..ec313a38f5 100644 --- a/contrib/libs/cxxsupp/libcxxabi-parts/ya.make +++ b/contrib/libs/cxxsupp/libcxxabi-parts/ya.make @@ -6,9 +6,9 @@ LICENSE( Apache-2.0 WITH LLVM-exception ) -VERSION(18.1.8) +VERSION(19.1.6) -ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/llvmorg-18.1.8.tar.gz) +ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/llvmorg-19.1.6.tar.gz) ADDINCL( contrib/libs/cxxsupp/libcxxabi/include diff --git a/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/__init__.py b/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/__init__.py index 0e45bb48bf..b825ca2ce9 100644 --- a/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/__init__.py +++ b/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/__init__.py @@ -63,13 +63,13 @@ def post_install(self): CFLAGS( -D_LIBCPP_SAFE_STATIC= -D_LIBCXXABI_DTOR_FUNC= - -D__USING_WASM_EXCEPTIONS__ + -D__WASM_EXCEPTIONS__ ) ELSEIF (OS_EMSCRIPTEN AND ARCH_WASM32) CFLAGS( -D_LIBCPP_SAFE_STATIC= -D_LIBCXXABI_DTOR_FUNC= - -D__USING_WASM_EXCEPTIONS__ + -D__WASM_EXCEPTIONS__ ) ENDIF() """, @@ -97,6 +97,7 @@ libcxxabi = NixSourceProject( ], disable_includes=[ "aix_state_tab_eh.inc", + "ptrauth.h", "sys/futex.h", ], post_install=post_install, diff --git a/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/override.nix b/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/override.nix index 0ff1b8277f..1930bcf60d 100644 --- a/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/override.nix +++ b/contrib/libs/cxxsupp/libcxxabi/.yandex_meta/override.nix @@ -1,11 +1,11 @@ pkgs: attrs: with pkgs; with attrs; rec { - version = "18.1.8"; + version = "19.1.6"; src = fetchFromGitHub { owner = "llvm"; repo = "llvm-project"; rev = "llvmorg-${version}"; - hash = "sha256-iiZKMRo/WxJaBXct9GdAcAT3cz9d9pnAcO1mmR6oPNE="; + hash = "sha256-LD4nIjZTSZJtbgW6tZopbTF5Mq0Tenj2gbuPXhtOeUI="; }; patches = []; diff --git a/contrib/libs/cxxsupp/libcxxabi/include/cxxabi.h b/contrib/libs/cxxsupp/libcxxabi/include/cxxabi.h index 211d4a5021..8d1b5c9b55 100644 --- a/contrib/libs/cxxsupp/libcxxabi/include/cxxabi.h +++ b/contrib/libs/cxxsupp/libcxxabi/include/cxxabi.h @@ -58,8 +58,7 @@ __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXAB // 2.4.3 Throwing the Exception Object extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw(void *thrown_exception, std::type_info *tinfo, -#ifdef __USING_WASM_EXCEPTIONS__ - // In Wasm, a destructor returns its argument +#ifdef __wasm__ void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)); #else void (_LIBCXXABI_DTOR_FUNC *dest)(void *)); @@ -78,6 +77,11 @@ extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup(); #endif extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type(); +// GNU extension +// Calls `terminate` with the current exception being caught. This function is used by GCC when a `noexcept` function +// throws an exception inside a try/catch block and doesn't catch it. +extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) throw(); + // 2.5.4 Rethrowing Exceptions extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow(); diff --git a/contrib/libs/cxxsupp/libcxxabi/patches/01-emscripten.patch b/contrib/libs/cxxsupp/libcxxabi/patches/01-emscripten.patch index 11ab3d48ad..986c064bb5 100644 --- a/contrib/libs/cxxsupp/libcxxabi/patches/01-emscripten.patch +++ b/contrib/libs/cxxsupp/libcxxabi/patches/01-emscripten.patch @@ -1,20 +1,5 @@ ---- contrib/libs/cxxsupp/libcxxabi/include/cxxabi.h (index) -+++ contrib/libs/cxxsupp/libcxxabi/include/cxxabi.h (working tree) -@@ -48,7 +48,12 @@ extern _LIBCXXABI_FUNC_VIS void - __cxa_free_exception(void *thrown_exception) throw(); - // This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt - extern _LIBCXXABI_FUNC_VIS __cxa_exception* -+#ifdef __wasm__ -+// In Wasm, a destructor returns its argument -+__cxa_init_primary_exception(void* object, std::type_info* tinfo, void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw(); -+#else - __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw(); -+#endif - - // 2.4.3 Throwing the Exception Object - extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void ---- contrib/libs/cxxsupp/libcxxabi/src/abort_message.cpp (index) -+++ contrib/libs/cxxsupp/libcxxabi/src/abort_message.cpp (working tree) +--- contrib/libs/cxxsupp/libcxxabi/src/abort_message.cpp (d1f0c42a1f66211dc9b8b0cd7a0560228ddbc65c) ++++ contrib/libs/cxxsupp/libcxxabi/src/abort_message.cpp (index) @@ -33,12 +33,21 @@ void abort_message(const char* format, ...) // formatting into the variable-sized buffer fails. #if !defined(NDEBUG) || !defined(LIBCXXABI_BAREMETAL) @@ -37,76 +22,66 @@ } #endif ---- contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp (index) -+++ contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp (working tree) -@@ -207,7 +207,12 @@ void __cxa_free_exception(void *thrown_object) throw() { - } - - __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinfo, -+#ifdef __USING_WASM_EXCEPTIONS__ -+// 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(); -@@ -266,6 +271,13 @@ handler, _Unwind_RaiseException may return. In that case, __cxa_throw +--- contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp (d1f0c42a1f66211dc9b8b0cd7a0560228ddbc65c) ++++ contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp (index) +@@ -271,6 +271,13 @@ handler, _Unwind_RaiseException may return. In that case, __cxa_throw will call terminate, assuming that there was no handler for the exception. */ + -+#if defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) ++#if defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) +extern "C" { +void __throw_exception_with_stack_trace(_Unwind_Exception*); +} // extern "C" +#endif + void - #ifdef __USING_WASM_EXCEPTIONS__ + #ifdef __wasm__ // In Wasm, a destructor returns its argument -@@ -286,6 +298,10 @@ __cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FU +@@ -291,6 +298,10 @@ __cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FU #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); -+#elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) ++#elif defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) + // In debug mode, call a JS library function to use WebAssembly.Exception JS + // API, which enables us to include stack traces + __throw_exception_with_stack_trace(&exception_header->unwindHeader); #else _Unwind_RaiseException(&exception_header->unwindHeader); #endif -@@ -635,6 +651,10 @@ void __cxa_rethrow() { +@@ -645,6 +656,10 @@ void __cxa_rethrow() { } #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); -+#elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) ++#elif defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) + // In debug mode, call a JS library function to use WebAssembly.Exception JS + // API, which enables us to include stack traces + __throw_exception_with_stack_trace(&exception_header->unwindHeader); #else _Unwind_RaiseException(&exception_header->unwindHeader); #endif -@@ -760,6 +780,11 @@ __cxa_rethrow_primary_exception(void* thrown_object) +@@ -770,8 +785,13 @@ __cxa_rethrow_primary_exception(void* thrown_object) dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup; #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader); -+#elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) ++#elif defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) + // In debug mode, call a JS library function to use + // WebAssembly.Exception JS API, which enables us to include stack + // traces + __throw_exception_with_stack_trace(&exception_header->unwindHeader); #else - _Unwind_RaiseException(&dep_exception_header->unwindHeader); +- _Unwind_RaiseException(&dep_exception_header->unwindHeader); ++ _Unwind_RaiseException(&exception_header->unwindHeader); #endif ---- contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h (index) -+++ contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h (working tree) + // Some sort of unwinding error. Note that terminate is a handler. + __cxa_begin_catch(&dep_exception_header->unwindHeader); +--- contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h (d1f0c42a1f66211dc9b8b0cd7a0560228ddbc65c) ++++ contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h (index) @@ -19,6 +19,26 @@ namespace __cxxabiv1 { -+#ifdef __USING_EMSCRIPTEN_EXCEPTIONS__ ++#ifdef __EMSCRIPTEN_EXCEPTIONS__ + +struct _LIBCXXABI_HIDDEN __cxa_exception { + size_t referenceCount; @@ -133,24 +108,24 @@ extern "C" _LIBCXXABI_FUNC_VIS void * __cxa_allocate_dependent_exception (); extern "C" _LIBCXXABI_FUNC_VIS void __cxa_free_dependent_exception (void * dependent_exception); -+#endif // !__USING_EMSCRIPTEN_EXCEPTIONS__ ++#endif // !__EMSCRIPTEN_EXCEPTIONS__ + } // namespace __cxxabiv1 #endif // _CXA_EXCEPTION_H ---- contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp (index) -+++ contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp (working tree) +--- contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp (d1f0c42a1f66211dc9b8b0cd7a0560228ddbc65c) ++++ contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp (index) @@ -73,7 +73,7 @@ __attribute__((noreturn)) void terminate() noexcept { -#ifndef _LIBCXXABI_NO_EXCEPTIONS -+#if !defined(_LIBCXXABI_NO_EXCEPTIONS) && !defined(__USING_EMSCRIPTEN_EXCEPTIONS__) ++#if !defined(_LIBCXXABI_NO_EXCEPTIONS) && !defined(__EMSCRIPTEN_EXCEPTIONS__) // If there might be an uncaught exception using namespace __cxxabiv1; __cxa_eh_globals* globals = __cxa_get_globals_fast(); ---- contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp (index) -+++ contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp (working tree) +--- contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp (d1f0c42a1f66211dc9b8b0cd7a0560228ddbc65c) ++++ contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp (index) @@ -663,6 +663,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, const uint8_t* lpStart = lpStartEncoding == DW_EH_PE_omit ? (const uint8_t*)funcStart @@ -162,14 +137,14 @@ @@ -676,7 +677,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, // includes current PC. uint8_t callSiteEncoding = *lsda++; - #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__) + #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__) - (void)callSiteEncoding; // When using SjLj/Wasm exceptions, callSiteEncoding is never used + (void)callSiteEncoding; // Unused when using SjLj/Wasm exceptions #endif uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda)); const uint8_t* callSiteTableStart = lsda; ---- contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp (index) -+++ contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp (working tree) +--- contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp (d1f0c42a1f66211dc9b8b0cd7a0560228ddbc65c) ++++ contrib/libs/cxxsupp/libcxxabi/src/cxa_thread_atexit.cpp (index) @@ -112,9 +112,14 @@ extern "C" { #ifdef HAVE___CXA_THREAD_ATEXIT_IMPL return __cxa_thread_atexit_impl(dtor, obj, dso_symbol); @@ -186,15 +161,22 @@ // Initialize the dtors std::__libcpp_tls_key (uses __cxa_guard_*() for // one-time initialization and __cxa_atexit() for destruction) static DtorsManager manager; ---- contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp (index) -+++ contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp (working tree) -@@ -1531,4 +1531,35 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info, +--- contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp (d1f0c42a1f66211dc9b8b0cd7a0560228ddbc65c) ++++ contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp (index) +@@ -1542,5 +1542,64 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info, + not_public_path, use_strcmp); } - ++} // __cxxabiv1 ++ ++ +// XXX EMSCRIPTEN ++#ifndef __WASM_EXCEPTIONS__ + -+#ifndef __USING_WASM_EXCEPTIONS__ ++#include "cxa_exception.h" ++ ++namespace __cxxabiv1 ++{ + +// These functions are used by the emscripten-style exception handling +// mechanism. @@ -216,11 +198,33 @@ + return ret; +} + -+int __cxa_is_pointer_type(__shim_type_info* type) { -+ return !!dynamic_cast<__pointer_type_info*>(type); ++static ++inline ++__cxa_exception* ++cxa_exception_from_thrown_object(void* thrown_object) ++{ ++ return static_cast<__cxa_exception*>(thrown_object) - 1; +} + ++void *__cxa_get_exception_ptr(void *thrown_object) throw() { ++ // Get pointer which is expected to be received by catch clause in C++ code. ++ // It may be adjusted when the pointer is casted to some of the exception ++ // object base classes (e.g. when virtual inheritance is used). When a pointer ++ // is thrown this method should return the thrown pointer itself. ++ // Work around a fastcomp bug, this code is still included for some reason in ++ // a build without exceptions support. ++ __cxa_exception* ex = cxa_exception_from_thrown_object(thrown_object); ++ bool is_pointer = !!dynamic_cast<__pointer_type_info*>(ex->exceptionType); ++ if (is_pointer) ++ return *(void**)thrown_object; ++ if (ex->adjustedPtr) ++ return ex->adjustedPtr; ++ return ex; +} -+#endif // __USING_EMSCRIPTEN_EXCEPTIONS__ + ++} + } // __cxxabiv1 ++ ++#endif // !__WASM_EXCEPTIONS__ ++ diff --git a/contrib/libs/cxxsupp/libcxxabi/patches/05-fix-deprecated-pod.patch b/contrib/libs/cxxsupp/libcxxabi/patches/05-fix-deprecated-pod.patch deleted file mode 100644 index 4874261075..0000000000 --- a/contrib/libs/cxxsupp/libcxxabi/patches/05-fix-deprecated-pod.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/demangle/ItaniumDemangle.h b/src/demangle/ItaniumDemangle.h ---- a/src/demangle/ItaniumDemangle.h -+++ b/src/demangle/ItaniumDemangle.h -@@ -115,13 +115,13 @@ - DEMANGLE_NAMESPACE_BEGIN - - template <class T, size_t N> class PODSmallVector { -- static_assert(std::is_pod<T>::value, -- "T is required to be a plain old data type"); -+ static_assert(std::is_trivial<T>::value, -+ "T is required to be a trivial type"); - - T *First = nullptr; - T *Last = nullptr; - T *Cap = nullptr; -- T Inline[N] = {0}; -+ T Inline[N] = {}; - - bool isInline() const { return First == Inline; } - diff --git a/contrib/libs/cxxsupp/libcxxabi/patches/07-__threading_support.sh b/contrib/libs/cxxsupp/libcxxabi/patches/07-__threading_support.sh deleted file mode 100644 index a32602a55a..0000000000 --- a/contrib/libs/cxxsupp/libcxxabi/patches/07-__threading_support.sh +++ /dev/null @@ -1,6 +0,0 @@ -( - find . -type f -name '*.cpp' - find . -type f -name '*.h' -) | while read l; do - sed -i 's|#include <__threading_support>|#include <__thread/support.h>|g' ${l} -done diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp index 4a792e0851..06dd9a8f2b 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.cpp @@ -207,7 +207,7 @@ void __cxa_free_exception(void *thrown_object) throw() { } __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinfo, -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __wasm__ // In Wasm, a destructor returns its argument void *(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() { #else @@ -272,14 +272,14 @@ will call terminate, assuming that there was no handler for the exception. */ -#if defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) +#if defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) extern "C" { void __throw_exception_with_stack_trace(_Unwind_Exception*); } // extern "C" #endif void -#ifdef __USING_WASM_EXCEPTIONS__ +#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 @@ -298,7 +298,7 @@ __cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FU #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); -#elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) +#elif defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) // In debug mode, call a JS library function to use WebAssembly.Exception JS // API, which enables us to include stack traces __throw_exception_with_stack_trace(&exception_header->unwindHeader); @@ -600,6 +600,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. @@ -651,7 +656,7 @@ void __cxa_rethrow() { } #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); -#elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) +#elif defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) // In debug mode, call a JS library function to use WebAssembly.Exception JS // API, which enables us to include stack traces __throw_exception_with_stack_trace(&exception_header->unwindHeader); @@ -780,13 +785,13 @@ __cxa_rethrow_primary_exception(void* thrown_object) dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup; #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader); -#elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG) +#elif defined(__EMSCRIPTEN__) && defined(__WASM_EXCEPTIONS__) && !defined(NDEBUG) // In debug mode, call a JS library function to use // WebAssembly.Exception JS API, which enables us to include stack // traces __throw_exception_with_stack_trace(&exception_header->unwindHeader); #else - _Unwind_RaiseException(&dep_exception_header->unwindHeader); + _Unwind_RaiseException(&exception_header->unwindHeader); #endif // Some sort of unwinding error. Note that terminate is a handler. __cxa_begin_catch(&dep_exception_header->unwindHeader); diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h index 098e0bf95a..527fc57086 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception.h @@ -19,7 +19,7 @@ namespace __cxxabiv1 { -#ifdef __USING_EMSCRIPTEN_EXCEPTIONS__ +#ifdef __EMSCRIPTEN_EXCEPTIONS__ struct _LIBCXXABI_HIDDEN __cxa_exception { size_t referenceCount; @@ -63,7 +63,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { // Manage the exception object itself. std::type_info *exceptionType; -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __wasm__ // In Wasm, a destructor returns its argument void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); #else @@ -184,7 +184,7 @@ extern "C" _LIBCXXABI_FUNC_VIS __cxa_eh_globals * __cxa_get_globals_fast (); extern "C" _LIBCXXABI_FUNC_VIS void * __cxa_allocate_dependent_exception (); extern "C" _LIBCXXABI_FUNC_VIS void __cxa_free_dependent_exception (void * dependent_exception); -#endif // !__USING_EMSCRIPTEN_EXCEPTIONS__ +#endif // !__EMSCRIPTEN_EXCEPTIONS__ } // namespace __cxxabiv1 diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp index 2479f550e0..c842da195a 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_exception_storage.cpp @@ -24,7 +24,7 @@ extern "C" { } // extern "C" } // namespace __cxxabiv1 -#elif defined(HAS_THREAD_LOCAL) +#elif __has_feature(cxx_thread_local) namespace __cxxabiv1 { namespace { diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp b/contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp index 07913fba39..92b203c2bf 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_handlers.cpp @@ -73,7 +73,7 @@ __attribute__((noreturn)) void terminate() noexcept { -#if !defined(_LIBCXXABI_NO_EXCEPTIONS) && !defined(__USING_EMSCRIPTEN_EXCEPTIONS__) +#if !defined(_LIBCXXABI_NO_EXCEPTIONS) && !defined(__EMSCRIPTEN_EXCEPTIONS__) // If there might be an uncaught exception using namespace __cxxabiv1; __cxa_eh_globals* globals = __cxa_get_globals_fast(); diff --git a/contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp b/contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp index 501bc75a8c..3310930d91 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/cxa_personality.cpp @@ -70,7 +70,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, +------------------+--+-----+-----+------------------------+--------------------------+ | callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table | +---------------------+-----------+---------------------------------------------------+ -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) +---------------------+-----------+------------------------------------------------+ | Beginning of Call Site Table The current ip lies within the | | ... (start, length) range of one of these | @@ -84,7 +84,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | +-------------+---------------------------------+------------------------------+ | | ... | +----------------------------------------------------------------------------------+ -#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ +---------------------+-----------+------------------------------------------------+ | Beginning of Call Site Table The current ip is a 1-based index into | | ... this table. Or it is -1 meaning no | @@ -97,7 +97,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | +-------------+---------------------------------+------------------------------+ | | ... | +----------------------------------------------------------------------------------+ -#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ +---------------------------------------------------------------------+ | Beginning of Action Table ttypeIndex == 0 : cleanup | | ... ttypeIndex > 0 : catch | @@ -547,7 +547,7 @@ void set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, const scan_results& results) { -#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__) +#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__) #define __builtin_eh_return_data_regno(regno) regno #elif defined(__ibmxl__) // IBM xlclang++ compiler does not support __builtin_eh_return_data_regno. @@ -642,7 +642,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, // Get beginning current frame's code (as defined by the // emitted dwarf code) uintptr_t funcStart = _Unwind_GetRegionStart(context); -#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__) +#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__) if (ip == uintptr_t(-1)) { // no action @@ -652,9 +652,9 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, else if (ip == 0) call_terminate(native_exception, unwind_exception); // ip is 1-based index into call site table -#else // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__ +#else // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__ uintptr_t ipOffset = ip - funcStart; -#endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__ +#endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__ const uint8_t* classInfo = NULL; // Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding // dwarf emission @@ -676,7 +676,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, // Walk call-site table looking for range that // includes current PC. uint8_t callSiteEncoding = *lsda++; -#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__) +#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__) (void)callSiteEncoding; // Unused when using SjLj/Wasm exceptions #endif uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda)); @@ -687,7 +687,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, while (callSitePtr < callSiteTableEnd) { // There is one entry per call site. -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) // The call sites are non-overlapping in [start, start+length) // The call sites are ordered in increasing value of start uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding); @@ -695,15 +695,15 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding); uintptr_t actionEntry = readULEB128(&callSitePtr); if ((start <= ipOffset) && (ipOffset < (start + length))) -#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ // ip is 1-based index into this table uintptr_t landingPad = readULEB128(&callSitePtr); uintptr_t actionEntry = readULEB128(&callSitePtr); if (--ip == 0) -#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ { // Found the call site containing ip. -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) if (landingPad == 0) { // No handler here @@ -711,16 +711,14 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, return; } landingPad = (uintptr_t)lpStart + landingPad; -#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ ++landingPad; -#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ results.landingPad = landingPad; if (actionEntry == 0) { // Found a cleanup - results.reason = actions & _UA_SEARCH_PHASE - ? _URC_CONTINUE_UNWIND - : _URC_HANDLER_FOUND; + results.reason = (actions & _UA_SEARCH_PHASE) ? _URC_CONTINUE_UNWIND : _URC_HANDLER_FOUND; return; } // Convert 1-based byte offset into @@ -841,7 +839,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, action += actionOffset; } // there is no break out of this loop, only return } -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) else if (ipOffset < start) { // There is no call site for this ip @@ -849,7 +847,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, // Possible stack corruption. call_terminate(native_exception, unwind_exception); } -#endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__ +#endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__ } // there might be some tricky cases which break out of this loop // It is possible that no eh table entry specify how to handle @@ -906,7 +904,7 @@ _UA_CLEANUP_PHASE */ #if !defined(_LIBCXXABI_ARM_EHABI) -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ _Unwind_Reason_Code __gxx_personality_wasm0 #elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) static _Unwind_Reason_Code __gxx_personality_imp @@ -975,7 +973,7 @@ __gxx_personality_v0 exc->languageSpecificData = results.languageSpecificData; exc->catchTemp = reinterpret_cast<void*>(results.landingPad); exc->adjustedPtr = results.adjustedPtr; -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the // results here. set_registers(unwind_exception, context, results); diff --git a/contrib/libs/cxxsupp/libcxxabi/src/demangle/ItaniumDemangle.h b/contrib/libs/cxxsupp/libcxxabi/src/demangle/ItaniumDemangle.h index 03282ac68c..36bf454636 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/demangle/ItaniumDemangle.h +++ b/contrib/libs/cxxsupp/libcxxabi/src/demangle/ItaniumDemangle.h @@ -41,7 +41,6 @@ DEMANGLE_NAMESPACE_BEGIN template <class T, size_t N> class PODSmallVector { static_assert(std::is_trivial<T>::value, "T is required to be a trivial type"); - T *First = nullptr; T *Last = nullptr; T *Cap = nullptr; @@ -5542,7 +5541,7 @@ Node *AbstractManglingParser<Alloc, Derived>::parseFloatingLiteral() { return nullptr; std::string_view Data(First, N); for (char C : Data) - if (!std::isxdigit(C)) + if (!(C >= '0' && C <= '9') && !(C >= 'a' && C <= 'f')) return nullptr; First += N; if (!consumeIf('E')) @@ -5716,6 +5715,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() { } // <template-param-decl> ::= Ty # type parameter +// ::= Tk <concept name> [<template-args>] # constrained type parameter // ::= Tn <type> # non-type parameter // ::= Tt <template-param-decl>* E # template parameter // ::= Tp <template-param-decl> # parameter pack @@ -5847,7 +5847,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateArg() { } } -// <template-args> ::= I <template-arg>* E +// <template-args> ::= I <template-arg>* [Q <requires-clause expr>] E // extension, the abi says <template-arg>+ template <typename Derived, typename Alloc> Node * diff --git a/contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp b/contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp index 88fa7b5d65..12b727f1da 100644 --- a/contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp +++ b/contrib/libs/cxxsupp/libcxxabi/src/private_typeinfo.cpp @@ -44,13 +44,25 @@ #include <cstdint> #include <cassert> #include <string.h> +#include "abort_message.h" #ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST -#include "abort_message.h" #include <sys/syslog.h> #include <atomic> #endif +#if __has_feature(ptrauth_calls) +#error #include <ptrauth.h> +#endif + +template <typename T> +static inline T* strip_vtable(T* vtable) { +#if __has_feature(ptrauth_calls) + vtable = ptrauth_strip(vtable, ptrauth_key_cxx_vtable_pointer); +#endif + return vtable; +} + static inline bool is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp) @@ -102,10 +114,10 @@ void dyn_cast_get_derived_info(derived_object_info* info, const void* static_ptr reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy; info->dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy)); #else - void **vtable = *static_cast<void ** const *>(static_ptr); - info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]); - info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived; - info->dynamic_type = static_cast<const __class_type_info*>(vtable[-1]); + void** vtable = strip_vtable(*static_cast<void** const*>(static_ptr)); + info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]); + info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived; + info->dynamic_type = static_cast<const __class_type_info*>(vtable[-1]); #endif } @@ -470,7 +482,7 @@ __class_type_info::can_catch(const __shim_type_info* thrown_type, if (thrown_class_type == 0) return false; // bullet 2 - assert(adjustedPtr && "catching a class without an object?"); + _LIBCXXABI_ASSERT(adjustedPtr, "catching a class without an object?"); __dynamic_cast_info info = {thrown_class_type, 0, this, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, nullptr}; info.number_of_dst_type = 1; thrown_class_type->has_unambiguous_public_base(&info, adjustedPtr, public_path); @@ -560,7 +572,7 @@ __base_class_type_info::has_unambiguous_public_base(__dynamic_cast_info* info, find the layout. */ offset_to_base = __offset_flags >> __offset_shift; if (is_virtual) { - const char* vtable = *static_cast<const char* const*>(adjustedPtr); + const char* vtable = strip_vtable(*static_cast<const char* const*>(adjustedPtr)); offset_to_base = update_offset_to_base(vtable, offset_to_base); } } else if (!is_virtual) { @@ -1500,8 +1512,8 @@ __base_class_type_info::search_above_dst(__dynamic_cast_info* info, ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; if (__offset_flags & __virtual_mask) { - const char* vtable = *static_cast<const char*const*>(current_ptr); - offset_to_base = update_offset_to_base(vtable, offset_to_base); + const char* vtable = strip_vtable(*static_cast<const char* const*>(current_ptr)); + offset_to_base = update_offset_to_base(vtable, offset_to_base); } __base_type->search_above_dst(info, dst_ptr, static_cast<const char*>(current_ptr) + offset_to_base, @@ -1520,8 +1532,8 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info, ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; if (__offset_flags & __virtual_mask) { - const char* vtable = *static_cast<const char*const*>(current_ptr); - offset_to_base = update_offset_to_base(vtable, offset_to_base); + const char* vtable = strip_vtable(*static_cast<const char* const*>(current_ptr)); + offset_to_base = update_offset_to_base(vtable, offset_to_base); } __base_type->search_below_dst(info, static_cast<const char*>(current_ptr) + offset_to_base, @@ -1530,10 +1542,16 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info, not_public_path, use_strcmp); } +} // __cxxabiv1 + // XXX EMSCRIPTEN +#ifndef __WASM_EXCEPTIONS__ + +#include "cxa_exception.h" -#ifndef __USING_WASM_EXCEPTIONS__ +namespace __cxxabiv1 +{ // These functions are used by the emscripten-style exception handling // mechanism. @@ -1555,11 +1573,33 @@ int __cxa_can_catch(__shim_type_info* catchType, __shim_type_info* excpType, voi return ret; } -int __cxa_is_pointer_type(__shim_type_info* type) { - return !!dynamic_cast<__pointer_type_info*>(type); +static +inline +__cxa_exception* +cxa_exception_from_thrown_object(void* thrown_object) +{ + return static_cast<__cxa_exception*>(thrown_object) - 1; +} + +void *__cxa_get_exception_ptr(void *thrown_object) throw() { + // Get pointer which is expected to be received by catch clause in C++ code. + // It may be adjusted when the pointer is casted to some of the exception + // object base classes (e.g. when virtual inheritance is used). When a pointer + // is thrown this method should return the thrown pointer itself. + // Work around a fastcomp bug, this code is still included for some reason in + // a build without exceptions support. + __cxa_exception* ex = cxa_exception_from_thrown_object(thrown_object); + bool is_pointer = !!dynamic_cast<__pointer_type_info*>(ex->exceptionType); + if (is_pointer) + return *(void**)thrown_object; + if (ex->adjustedPtr) + return ex->adjustedPtr; + return ex; } } -#endif // __USING_EMSCRIPTEN_EXCEPTIONS__ } // __cxxabiv1 + +#endif // !__WASM_EXCEPTIONS__ + diff --git a/contrib/libs/cxxsupp/libcxxabi/ya.make b/contrib/libs/cxxsupp/libcxxabi/ya.make index ea3a68d892..94a7b1e5dd 100644 --- a/contrib/libs/cxxsupp/libcxxabi/ya.make +++ b/contrib/libs/cxxsupp/libcxxabi/ya.make @@ -11,9 +11,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(18.1.8) +VERSION(19.1.6) -ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/llvmorg-18.1.8.tar.gz) +ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/llvmorg-19.1.6.tar.gz) PEERDIR( contrib/libs/libunwind @@ -68,13 +68,13 @@ IF (OS_EMSCRIPTEN AND ARCH_WASM64) CFLAGS( -D_LIBCPP_SAFE_STATIC= -D_LIBCXXABI_DTOR_FUNC= - -D__USING_WASM_EXCEPTIONS__ + -D__WASM_EXCEPTIONS__ ) ELSEIF (OS_EMSCRIPTEN AND ARCH_WASM32) CFLAGS( -D_LIBCPP_SAFE_STATIC= -D_LIBCXXABI_DTOR_FUNC= - -D__USING_WASM_EXCEPTIONS__ + -D__WASM_EXCEPTIONS__ ) ENDIF() |