| author | |
| committer | |
| log | d13bc04cb4c4c2f0806b9d9c676cb013ea888828 |
| tree | fce89240022df2234865aac80c53030bee741932 |
| parent | 70a1805e46b66955b52ba5ac46914f212d99d19c |
11 files changed, 84 insertions(+), 55 deletions(-)
lib/libcxxabi/include/cxxabi.h+11-2| ... | @@ -48,13 +48,17 @@ extern _LIBCXXABI_FUNC_VIS void | ... | @@ -48,13 +48,17 @@ extern _LIBCXXABI_FUNC_VIS void |
| 48 | __cxa_free_exception(void *thrown_exception) throw(); | 48 | __cxa_free_exception(void *thrown_exception) throw(); |
| 49 | // This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt | 49 | // This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt |
| 50 | extern _LIBCXXABI_FUNC_VIS __cxa_exception* | 50 | extern _LIBCXXABI_FUNC_VIS __cxa_exception* |
| 51 | #ifdef __wasm__ | ||
| 52 | // In Wasm, a destructor returns its argument | ||
| 53 | __cxa_init_primary_exception(void* object, std::type_info* tinfo, void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw(); | ||
| 54 | #else | ||
| 51 | __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw(); | 55 | __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw(); |
| 56 | #endif | ||
| 52 | 57 | ||
| 53 | // 2.4.3 Throwing the Exception Object | 58 | // 2.4.3 Throwing the Exception Object |
| 54 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void | 59 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void |
| 55 | __cxa_throw(void *thrown_exception, std::type_info *tinfo, | 60 | __cxa_throw(void *thrown_exception, std::type_info *tinfo, |
| 56 | #ifdef __USING_WASM_EXCEPTIONS__ | 61 | #ifdef __wasm__ |
| 57 | // In Wasm, a destructor returns its argument | ||
| 58 | void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)); | 62 | void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)); |
| 59 | #else | 63 | #else |
| 60 | void (_LIBCXXABI_DTOR_FUNC *dest)(void *)); | 64 | void (_LIBCXXABI_DTOR_FUNC *dest)(void *)); |
| ... | @@ -73,6 +77,11 @@ extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup(); | ... | @@ -73,6 +77,11 @@ extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup(); |
| 73 | #endif | 77 | #endif |
| 74 | extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type(); | 78 | extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type(); |
| 75 | 79 | ||
| 80 | // GNU extension | ||
| 81 | // Calls `terminate` with the current exception being caught. This function is used by GCC when a `noexcept` function | ||
| 82 | // throws an exception inside a try/catch block and doesn't catch it. | ||
| 83 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) throw(); | ||
| 84 | |||
| 76 | // 2.5.4 Rethrowing Exceptions | 85 | // 2.5.4 Rethrowing Exceptions |
| 77 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow(); | 86 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow(); |
| 78 | 87 |
lib/libcxxabi/src/aix_state_tab_eh.inc+8-8| ... | @@ -102,8 +102,6 @@ static bool state_tab_dbg() { | ... | @@ -102,8 +102,6 @@ static bool state_tab_dbg() { |
| 102 | 102 | ||
| 103 | namespace __state_table_eh { | 103 | namespace __state_table_eh { |
| 104 | 104 | ||
| 105 | using destruct_f = void (*)(void*); | ||
| 106 | |||
| 107 | // Definition of flags for the state table entry field 'action flag'. | 105 | // Definition of flags for the state table entry field 'action flag'. |
| 108 | enum FSMEntryCount : intptr_t { beginCatch = -1, endCatch = -2, deleteObject = -3, cleanupLabel = -4, terminate = -5 }; | 106 | enum FSMEntryCount : intptr_t { beginCatch = -1, endCatch = -2, deleteObject = -3, cleanupLabel = -4, terminate = -5 }; |
| 109 | 107 | ||
| ... | @@ -145,8 +143,10 @@ struct FSMEntry { | ... | @@ -145,8 +143,10 @@ struct FSMEntry { |
| 145 | intptr_t nextStatePtr; | 143 | intptr_t nextStatePtr; |
| 146 | }; | 144 | }; |
| 147 | union { | 145 | union { |
| 148 | // Address of the destructor function. | 146 | // Address of the destructor function with 1 argument. |
| 149 | void (*destructor)(void*, size_t); | 147 | void (*destructor)(void*); |
| 148 | // Address of the destructor function with 2 arguments. | ||
| 149 | void (*xlCDestructor)(void*, size_t); | ||
| 150 | // The address of the catch block or cleanup code. | 150 | // The address of the catch block or cleanup code. |
| 151 | void* landingPad; | 151 | void* landingPad; |
| 152 | }; | 152 | }; |
| ... | @@ -191,12 +191,12 @@ static void invoke_destructor(FSMEntry* fsmEntry, void* addr) { | ... | @@ -191,12 +191,12 @@ static void invoke_destructor(FSMEntry* fsmEntry, void* addr) { |
| 191 | try { | 191 | try { |
| 192 | if (fsmEntry->elementCount == 1) { | 192 | if (fsmEntry->elementCount == 1) { |
| 193 | _LIBCXXABI_TRACE_STATETAB0("calling scalar destructor\n"); | 193 | _LIBCXXABI_TRACE_STATETAB0("calling scalar destructor\n"); |
| 194 | (*fsmEntry->destructor)(addr, dtorArgument); | 194 | (*fsmEntry->xlCDestructor)(addr, dtorArgument); |
| 195 | _LIBCXXABI_TRACE_STATETAB0("returned from scalar destructor\n"); | 195 | _LIBCXXABI_TRACE_STATETAB0("returned from scalar destructor\n"); |
| 196 | } else { | 196 | } else { |
| 197 | _LIBCXXABI_TRACE_STATETAB0("calling vector destructor\n"); | 197 | _LIBCXXABI_TRACE_STATETAB0("calling vector destructor\n"); |
| 198 | __cxa_vec_cleanup(addr, reinterpret_cast<size_t>(fsmEntry->elementCount), fsmEntry->elemSize, | 198 | __cxa_vec_cleanup(addr, reinterpret_cast<size_t>(fsmEntry->elementCount), fsmEntry->elemSize, |
| 199 | reinterpret_cast<destruct_f>(fsmEntry->destructor)); | 199 | fsmEntry->destructor); |
| 200 | _LIBCXXABI_TRACE_STATETAB0("returned from vector destructor\n"); | 200 | _LIBCXXABI_TRACE_STATETAB0("returned from vector destructor\n"); |
| 201 | } | 201 | } |
| 202 | } catch (...) { | 202 | } catch (...) { |
| ... | @@ -213,7 +213,7 @@ static void invoke_delete(FSMEntry* fsmEntry, void* addr) { | ... | @@ -213,7 +213,7 @@ static void invoke_delete(FSMEntry* fsmEntry, void* addr) { |
| 213 | try { | 213 | try { |
| 214 | _LIBCXXABI_TRACE_STATETAB0("..calling delete()\n"); | 214 | _LIBCXXABI_TRACE_STATETAB0("..calling delete()\n"); |
| 215 | // 'destructor' holds a function pointer to delete(). | 215 | // 'destructor' holds a function pointer to delete(). |
| 216 | (*fsmEntry->destructor)(objectAddress, fsmEntry->elemSize); | 216 | (*fsmEntry->xlCDestructor)(objectAddress, fsmEntry->elemSize); |
| 217 | _LIBCXXABI_TRACE_STATETAB0("..returned from delete()\n"); | 217 | _LIBCXXABI_TRACE_STATETAB0("..returned from delete()\n"); |
| 218 | } catch (...) { | 218 | } catch (...) { |
| 219 | _LIBCXXABI_TRACE_STATETAB0("Uncaught exception in delete(), terminating\n"); | 219 | _LIBCXXABI_TRACE_STATETAB0("Uncaught exception in delete(), terminating\n"); |
| ... | @@ -681,7 +681,7 @@ static uintptr_t* skip_non_cxx_eh_aware_frames(uint32_t* Pc, uintptr_t* Sp) { | ... | @@ -681,7 +681,7 @@ static uintptr_t* skip_non_cxx_eh_aware_frames(uint32_t* Pc, uintptr_t* Sp) { |
| 681 | // xlclang++ compiled code. If __xlc_exception_handle() is called by | 681 | // xlclang++ compiled code. If __xlc_exception_handle() is called by |
| 682 | // non-C++ EH aware functions, their frames are skipped until a C++ EH aware | 682 | // non-C++ EH aware functions, their frames are skipped until a C++ EH aware |
| 683 | // frame is found. | 683 | // frame is found. |
| 684 | // Note: make sure __xlc_excpetion_handle() is a non-leaf function. Currently | 684 | // Note: make sure __xlc_exception_handle() is a non-leaf function. Currently |
| 685 | // it calls skip_non_cxx_eh_aware_frames(), which in turn calls abort(). | 685 | // it calls skip_non_cxx_eh_aware_frames(), which in turn calls abort(). |
| 686 | _LIBCXXABI_FUNC_VIS uintptr_t __xlc_exception_handle() { | 686 | _LIBCXXABI_FUNC_VIS uintptr_t __xlc_exception_handle() { |
| 687 | // Get the SP of this function, i.e., __xlc_exception_handle(). | 687 | // Get the SP of this function, i.e., __xlc_exception_handle(). |
lib/libcxxabi/src/cxa_exception.cpp+11-1| ... | @@ -207,7 +207,12 @@ void __cxa_free_exception(void *thrown_object) throw() { | ... | @@ -207,7 +207,12 @@ void __cxa_free_exception(void *thrown_object) throw() { |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinfo, | 209 | __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinfo, |
| 210 | #ifdef __wasm__ | ||
| 211 | // In Wasm, a destructor returns its argument | ||
| 212 | void *(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() { | ||
| 213 | #else | ||
| 210 | void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() { | 214 | void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() { |
| 215 | #endif | ||
| 211 | __cxa_exception* exception_header = cxa_exception_from_thrown_object(object); | 216 | __cxa_exception* exception_header = cxa_exception_from_thrown_object(object); |
| 212 | exception_header->referenceCount = 0; | 217 | exception_header->referenceCount = 0; |
| 213 | exception_header->unexpectedHandler = std::get_unexpected(); | 218 | exception_header->unexpectedHandler = std::get_unexpected(); |
| ... | @@ -267,7 +272,7 @@ will call terminate, assuming that there was no handler for the | ... | @@ -267,7 +272,7 @@ will call terminate, assuming that there was no handler for the |
| 267 | exception. | 272 | exception. |
| 268 | */ | 273 | */ |
| 269 | void | 274 | void |
| 270 | #ifdef __USING_WASM_EXCEPTIONS__ | 275 | #ifdef __wasm__ |
| 271 | // In Wasm, a destructor returns its argument | 276 | // In Wasm, a destructor returns its argument |
| 272 | __cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) { | 277 | __cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) { |
| 273 | #else | 278 | #else |
| ... | @@ -584,6 +589,11 @@ void __cxa_end_catch() { | ... | @@ -584,6 +589,11 @@ void __cxa_end_catch() { |
| 584 | } | 589 | } |
| 585 | } | 590 | } |
| 586 | 591 | ||
| 592 | void __cxa_call_terminate(void* unwind_arg) throw() { | ||
| 593 | __cxa_begin_catch(unwind_arg); | ||
| 594 | std::terminate(); | ||
| 595 | } | ||
| 596 | |||
| 587 | // Note: exception_header may be masquerading as a __cxa_dependent_exception | 597 | // Note: exception_header may be masquerading as a __cxa_dependent_exception |
| 588 | // and that's ok. exceptionType is there too. | 598 | // and that's ok. exceptionType is there too. |
| 589 | // However watch out for foreign exceptions. Return null for them. | 599 | // However watch out for foreign exceptions. Return null for them. |
lib/libcxxabi/src/cxa_exception.h+1-1| ... | @@ -43,7 +43,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { | ... | @@ -43,7 +43,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { |
| 43 | 43 | ||
| 44 | // Manage the exception object itself. | 44 | // Manage the exception object itself. |
| 45 | std::type_info *exceptionType; | 45 | std::type_info *exceptionType; |
| 46 | #ifdef __USING_WASM_EXCEPTIONS__ | 46 | #ifdef __wasm__ |
| 47 | // In Wasm, a destructor returns its argument | 47 | // In Wasm, a destructor returns its argument |
| 48 | void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); | 48 | void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); |
| 49 | #else | 49 | #else |
lib/libcxxabi/src/cxa_exception_storage.cpp+2-2| ... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | ||
| 13 | #include "cxa_exception.h" | 13 | #include "cxa_exception.h" |
| 14 | 14 | ||
| 15 | #include <__threading_support> | 15 | #include <__thread/support.h> |
| 16 | 16 | ||
| 17 | #if defined(_LIBCXXABI_HAS_NO_THREADS) | 17 | #if defined(_LIBCXXABI_HAS_NO_THREADS) |
| 18 | 18 | ||
| ... | @@ -24,7 +24,7 @@ extern "C" { | ... | @@ -24,7 +24,7 @@ extern "C" { |
| 24 | } // extern "C" | 24 | } // extern "C" |
| 25 | } // namespace __cxxabiv1 | 25 | } // namespace __cxxabiv1 |
| 26 | 26 | ||
| 27 | #elif defined(HAS_THREAD_LOCAL) | 27 | #elif __has_feature(cxx_thread_local) |
| 28 | 28 | ||
| 29 | namespace __cxxabiv1 { | 29 | namespace __cxxabiv1 { |
| 30 | namespace { | 30 | namespace { |
lib/libcxxabi/src/cxa_guard_impl.h+1-1| ... | @@ -58,7 +58,7 @@ | ... | @@ -58,7 +58,7 @@ |
| 58 | # endif | 58 | # endif |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | #include <__threading_support> | 61 | #include <__thread/support.h> |
| 62 | #include <cstdint> | 62 | #include <cstdint> |
| 63 | #include <cstring> | 63 | #include <cstring> |
| 64 | #include <limits.h> | 64 | #include <limits.h> |
lib/libcxxabi/src/cxa_personality.cpp+19-21| ... | @@ -70,7 +70,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | ... | @@ -70,7 +70,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, |
| 70 | +------------------+--+-----+-----+------------------------+--------------------------+ | 70 | +------------------+--+-----+-----+------------------------+--------------------------+ |
| 71 | | callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table | | 71 | | callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table | |
| 72 | +---------------------+-----------+---------------------------------------------------+ | 72 | +---------------------+-----------+---------------------------------------------------+ |
| 73 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) | 73 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) |
| 74 | +---------------------+-----------+------------------------------------------------+ | 74 | +---------------------+-----------+------------------------------------------------+ |
| 75 | | Beginning of Call Site Table The current ip lies within the | | 75 | | Beginning of Call Site Table The current ip lies within the | |
| 76 | | ... (start, length) range of one of these | | 76 | | ... (start, length) range of one of these | |
| ... | @@ -84,7 +84,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | ... | @@ -84,7 +84,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, |
| 84 | | +-------------+---------------------------------+------------------------------+ | | 84 | | +-------------+---------------------------------+------------------------------+ | |
| 85 | | ... | | 85 | | ... | |
| 86 | +----------------------------------------------------------------------------------+ | 86 | +----------------------------------------------------------------------------------+ |
| 87 | #else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ | 87 | #else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| 88 | +---------------------+-----------+------------------------------------------------+ | 88 | +---------------------+-----------+------------------------------------------------+ |
| 89 | | Beginning of Call Site Table The current ip is a 1-based index into | | 89 | | Beginning of Call Site Table The current ip is a 1-based index into | |
| 90 | | ... this table. Or it is -1 meaning no | | 90 | | ... this table. Or it is -1 meaning no | |
| ... | @@ -97,7 +97,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | ... | @@ -97,7 +97,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, |
| 97 | | +-------------+---------------------------------+------------------------------+ | | 97 | | +-------------+---------------------------------+------------------------------+ | |
| 98 | | ... | | 98 | | ... | |
| 99 | +----------------------------------------------------------------------------------+ | 99 | +----------------------------------------------------------------------------------+ |
| 100 | #endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ | 100 | #endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| 101 | +---------------------------------------------------------------------+ | 101 | +---------------------------------------------------------------------+ |
| 102 | | Beginning of Action Table ttypeIndex == 0 : cleanup | | 102 | | Beginning of Action Table ttypeIndex == 0 : cleanup | |
| 103 | | ... ttypeIndex > 0 : catch | | 103 | | ... ttypeIndex > 0 : catch | |
| ... | @@ -547,7 +547,7 @@ void | ... | @@ -547,7 +547,7 @@ void |
| 547 | set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, | 547 | set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, |
| 548 | const scan_results& results) | 548 | const scan_results& results) |
| 549 | { | 549 | { |
| 550 | #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__) | 550 | #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__) |
| 551 | #define __builtin_eh_return_data_regno(regno) regno | 551 | #define __builtin_eh_return_data_regno(regno) regno |
| 552 | #elif defined(__ibmxl__) | 552 | #elif defined(__ibmxl__) |
| 553 | // IBM xlclang++ compiler does not support __builtin_eh_return_data_regno. | 553 | // 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, | ... | @@ -642,7 +642,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 642 | // Get beginning current frame's code (as defined by the | 642 | // Get beginning current frame's code (as defined by the |
| 643 | // emitted dwarf code) | 643 | // emitted dwarf code) |
| 644 | uintptr_t funcStart = _Unwind_GetRegionStart(context); | 644 | uintptr_t funcStart = _Unwind_GetRegionStart(context); |
| 645 | #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__) | 645 | #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__) |
| 646 | if (ip == uintptr_t(-1)) | 646 | if (ip == uintptr_t(-1)) |
| 647 | { | 647 | { |
| 648 | // no action | 648 | // no action |
| ... | @@ -652,9 +652,9 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -652,9 +652,9 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 652 | else if (ip == 0) | 652 | else if (ip == 0) |
| 653 | call_terminate(native_exception, unwind_exception); | 653 | call_terminate(native_exception, unwind_exception); |
| 654 | // ip is 1-based index into call site table | 654 | // ip is 1-based index into call site table |
| 655 | #else // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__ | 655 | #else // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__ |
| 656 | uintptr_t ipOffset = ip - funcStart; | 656 | uintptr_t ipOffset = ip - funcStart; |
| 657 | #endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__ | 657 | #endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__ |
| 658 | const uint8_t* classInfo = NULL; | 658 | const uint8_t* classInfo = NULL; |
| 659 | // Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding | 659 | // Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding |
| 660 | // dwarf emission | 660 | // dwarf emission |
| ... | @@ -675,7 +675,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -675,7 +675,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 675 | // Walk call-site table looking for range that | 675 | // Walk call-site table looking for range that |
| 676 | // includes current PC. | 676 | // includes current PC. |
| 677 | uint8_t callSiteEncoding = *lsda++; | 677 | uint8_t callSiteEncoding = *lsda++; |
| 678 | #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__) | 678 | #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__) |
| 679 | (void)callSiteEncoding; // When using SjLj/Wasm exceptions, callSiteEncoding is never used | 679 | (void)callSiteEncoding; // When using SjLj/Wasm exceptions, callSiteEncoding is never used |
| 680 | #endif | 680 | #endif |
| 681 | uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda)); | 681 | uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda)); |
| ... | @@ -686,7 +686,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -686,7 +686,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 686 | while (callSitePtr < callSiteTableEnd) | 686 | while (callSitePtr < callSiteTableEnd) |
| 687 | { | 687 | { |
| 688 | // There is one entry per call site. | 688 | // There is one entry per call site. |
| 689 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) | 689 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) |
| 690 | // The call sites are non-overlapping in [start, start+length) | 690 | // The call sites are non-overlapping in [start, start+length) |
| 691 | // The call sites are ordered in increasing value of start | 691 | // The call sites are ordered in increasing value of start |
| 692 | uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding); | 692 | uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding); |
| ... | @@ -694,15 +694,15 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -694,15 +694,15 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 694 | uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding); | 694 | uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding); |
| 695 | uintptr_t actionEntry = readULEB128(&callSitePtr); | 695 | uintptr_t actionEntry = readULEB128(&callSitePtr); |
| 696 | if ((start <= ipOffset) && (ipOffset < (start + length))) | 696 | if ((start <= ipOffset) && (ipOffset < (start + length))) |
| 697 | #else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ | 697 | #else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| 698 | // ip is 1-based index into this table | 698 | // ip is 1-based index into this table |
| 699 | uintptr_t landingPad = readULEB128(&callSitePtr); | 699 | uintptr_t landingPad = readULEB128(&callSitePtr); |
| 700 | uintptr_t actionEntry = readULEB128(&callSitePtr); | 700 | uintptr_t actionEntry = readULEB128(&callSitePtr); |
| 701 | if (--ip == 0) | 701 | if (--ip == 0) |
| 702 | #endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ | 702 | #endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| 703 | { | 703 | { |
| 704 | // Found the call site containing ip. | 704 | // Found the call site containing ip. |
| 705 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) | 705 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) |
| 706 | if (landingPad == 0) | 706 | if (landingPad == 0) |
| 707 | { | 707 | { |
| 708 | // No handler here | 708 | // No handler here |
| ... | @@ -710,16 +710,14 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -710,16 +710,14 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 710 | return; | 710 | return; |
| 711 | } | 711 | } |
| 712 | landingPad = (uintptr_t)lpStart + landingPad; | 712 | landingPad = (uintptr_t)lpStart + landingPad; |
| 713 | #else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ | 713 | #else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| 714 | ++landingPad; | 714 | ++landingPad; |
| 715 | #endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ | 715 | #endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| 716 | results.landingPad = landingPad; | 716 | results.landingPad = landingPad; |
| 717 | if (actionEntry == 0) | 717 | if (actionEntry == 0) |
| 718 | { | 718 | { |
| 719 | // Found a cleanup | 719 | // Found a cleanup |
| 720 | results.reason = actions & _UA_SEARCH_PHASE | 720 | results.reason = (actions & _UA_SEARCH_PHASE) ? _URC_CONTINUE_UNWIND : _URC_HANDLER_FOUND; |
| 721 | ? _URC_CONTINUE_UNWIND | ||
| 722 | : _URC_HANDLER_FOUND; | ||
| 723 | return; | 721 | return; |
| 724 | } | 722 | } |
| 725 | // Convert 1-based byte offset into | 723 | // Convert 1-based byte offset into |
| ... | @@ -840,7 +838,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -840,7 +838,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 840 | action += actionOffset; | 838 | action += actionOffset; |
| 841 | } // there is no break out of this loop, only return | 839 | } // there is no break out of this loop, only return |
| 842 | } | 840 | } |
| 843 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) | 841 | #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) |
| 844 | else if (ipOffset < start) | 842 | else if (ipOffset < start) |
| 845 | { | 843 | { |
| 846 | // There is no call site for this ip | 844 | // There is no call site for this ip |
| ... | @@ -848,7 +846,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -848,7 +846,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 848 | // Possible stack corruption. | 846 | // Possible stack corruption. |
| 849 | call_terminate(native_exception, unwind_exception); | 847 | call_terminate(native_exception, unwind_exception); |
| 850 | } | 848 | } |
| 851 | #endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__ | 849 | #endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__ |
| 852 | } // there might be some tricky cases which break out of this loop | 850 | } // there might be some tricky cases which break out of this loop |
| 853 | 851 | ||
| 854 | // It is possible that no eh table entry specify how to handle | 852 | // It is possible that no eh table entry specify how to handle |
| ... | @@ -905,7 +903,7 @@ _UA_CLEANUP_PHASE | ... | @@ -905,7 +903,7 @@ _UA_CLEANUP_PHASE |
| 905 | */ | 903 | */ |
| 906 | 904 | ||
| 907 | #if !defined(_LIBCXXABI_ARM_EHABI) | 905 | #if !defined(_LIBCXXABI_ARM_EHABI) |
| 908 | #ifdef __USING_WASM_EXCEPTIONS__ | 906 | #ifdef __WASM_EXCEPTIONS__ |
| 909 | _Unwind_Reason_Code __gxx_personality_wasm0 | 907 | _Unwind_Reason_Code __gxx_personality_wasm0 |
| 910 | #elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) | 908 | #elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) |
| 911 | static _Unwind_Reason_Code __gxx_personality_imp | 909 | static _Unwind_Reason_Code __gxx_personality_imp |
| ... | @@ -974,7 +972,7 @@ __gxx_personality_v0 | ... | @@ -974,7 +972,7 @@ __gxx_personality_v0 |
| 974 | exc->languageSpecificData = results.languageSpecificData; | 972 | exc->languageSpecificData = results.languageSpecificData; |
| 975 | exc->catchTemp = reinterpret_cast<void*>(results.landingPad); | 973 | exc->catchTemp = reinterpret_cast<void*>(results.landingPad); |
| 976 | exc->adjustedPtr = results.adjustedPtr; | 974 | exc->adjustedPtr = results.adjustedPtr; |
| 977 | #ifdef __USING_WASM_EXCEPTIONS__ | 975 | #ifdef __WASM_EXCEPTIONS__ |
| 978 | // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the | 976 | // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the |
| 979 | // results here. | 977 | // results here. |
| 980 | set_registers(unwind_exception, context, results); | 978 | set_registers(unwind_exception, context, results); |
lib/libcxxabi/src/cxa_thread_atexit.cpp+1-1| ... | @@ -8,7 +8,7 @@ | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | ||
| 9 | #include "abort_message.h" | 9 | #include "abort_message.h" |
| 10 | #include "cxxabi.h" | 10 | #include "cxxabi.h" |
| 11 | #include <__threading_support> | 11 | #include <__thread/support.h> |
| 12 | #ifndef _LIBCXXABI_HAS_NO_THREADS | 12 | #ifndef _LIBCXXABI_HAS_NO_THREADS |
| 13 | #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) | 13 | #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) |
| 14 | #pragma comment(lib, "pthread") | 14 | #pragma comment(lib, "pthread") |
lib/libcxxabi/src/demangle/ItaniumDemangle.h+6-6| ... | @@ -39,13 +39,12 @@ | ... | @@ -39,13 +39,12 @@ |
| 39 | DEMANGLE_NAMESPACE_BEGIN | 39 | DEMANGLE_NAMESPACE_BEGIN |
| 40 | 40 | ||
| 41 | template <class T, size_t N> class PODSmallVector { | 41 | template <class T, size_t N> class PODSmallVector { |
| 42 | static_assert(std::is_pod<T>::value, | 42 | static_assert(std::is_trivial<T>::value, |
| 43 | "T is required to be a plain old data type"); | 43 | "T is required to be a trivial type"); |
| 44 | |||
| 45 | T *First = nullptr; | 44 | T *First = nullptr; |
| 46 | T *Last = nullptr; | 45 | T *Last = nullptr; |
| 47 | T *Cap = nullptr; | 46 | T *Cap = nullptr; |
| 48 | T Inline[N] = {0}; | 47 | T Inline[N] = {}; |
| 49 | 48 | ||
| 50 | bool isInline() const { return First == Inline; } | 49 | bool isInline() const { return First == Inline; } |
| 51 | 50 | ||
| ... | @@ -5542,7 +5541,7 @@ Node *AbstractManglingParser<Alloc, Derived>::parseFloatingLiteral() { | ... | @@ -5542,7 +5541,7 @@ Node *AbstractManglingParser<Alloc, Derived>::parseFloatingLiteral() { |
| 5542 | return nullptr; | 5541 | return nullptr; |
| 5543 | std::string_view Data(First, N); | 5542 | std::string_view Data(First, N); |
| 5544 | for (char C : Data) | 5543 | for (char C : Data) |
| 5545 | if (!std::isxdigit(C)) | 5544 | if (!(C >= '0' && C <= '9') && !(C >= 'a' && C <= 'f')) |
| 5546 | return nullptr; | 5545 | return nullptr; |
| 5547 | First += N; | 5546 | First += N; |
| 5548 | if (!consumeIf('E')) | 5547 | if (!consumeIf('E')) |
| ... | @@ -5716,6 +5715,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() { | ... | @@ -5716,6 +5715,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() { |
| 5716 | } | 5715 | } |
| 5717 | 5716 | ||
| 5718 | // <template-param-decl> ::= Ty # type parameter | 5717 | // <template-param-decl> ::= Ty # type parameter |
| 5718 | // ::= Tk <concept name> [<template-args>] # constrained type parameter | ||
| 5719 | // ::= Tn <type> # non-type parameter | 5719 | // ::= Tn <type> # non-type parameter |
| 5720 | // ::= Tt <template-param-decl>* E # template parameter | 5720 | // ::= Tt <template-param-decl>* E # template parameter |
| 5721 | // ::= Tp <template-param-decl> # parameter pack | 5721 | // ::= Tp <template-param-decl> # parameter pack |
| ... | @@ -5847,7 +5847,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateArg() { | ... | @@ -5847,7 +5847,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateArg() { |
| 5847 | } | 5847 | } |
| 5848 | } | 5848 | } |
| 5849 | 5849 | ||
| 5850 | // <template-args> ::= I <template-arg>* E | 5850 | // <template-args> ::= I <template-arg>* [Q <requires-clause expr>] E |
| 5851 | // extension, the abi says <template-arg>+ | 5851 | // extension, the abi says <template-arg>+ |
| 5852 | template <typename Derived, typename Alloc> | 5852 | template <typename Derived, typename Alloc> |
| 5853 | Node * | 5853 | Node * |
lib/libcxxabi/src/fallback_malloc.cpp+1-1| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
| 9 | #include "fallback_malloc.h" | 9 | #include "fallback_malloc.h" |
| 10 | #include "abort_message.h" | 10 | #include "abort_message.h" |
| 11 | 11 | ||
| 12 | #include <__threading_support> | 12 | #include <__thread/support.h> |
| 13 | #ifndef _LIBCXXABI_HAS_NO_THREADS | 13 | #ifndef _LIBCXXABI_HAS_NO_THREADS |
| 14 | #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) | 14 | #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) |
| 15 | #pragma comment(lib, "pthread") | 15 | #pragma comment(lib, "pthread") |
lib/libcxxabi/src/private_typeinfo.cpp+23-11| ... | @@ -44,13 +44,25 @@ | ... | @@ -44,13 +44,25 @@ |
| 44 | #include <cstdint> | 44 | #include <cstdint> |
| 45 | #include <cassert> | 45 | #include <cassert> |
| 46 | #include <string.h> | 46 | #include <string.h> |
| 47 | #include "abort_message.h" | ||
| 47 | 48 | ||
| 48 | #ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST | 49 | #ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST |
| 49 | #include "abort_message.h" | ||
| 50 | #include <sys/syslog.h> | 50 | #include <sys/syslog.h> |
| 51 | #include <atomic> | 51 | #include <atomic> |
| 52 | #endif | 52 | #endif |
| 53 | 53 | ||
| 54 | #if __has_feature(ptrauth_calls) | ||
| 55 | #include <ptrauth.h> | ||
| 56 | #endif | ||
| 57 | |||
| 58 | template <typename T> | ||
| 59 | static inline T* strip_vtable(T* vtable) { | ||
| 60 | #if __has_feature(ptrauth_calls) | ||
| 61 | vtable = ptrauth_strip(vtable, ptrauth_key_cxx_vtable_pointer); | ||
| 62 | #endif | ||
| 63 | return vtable; | ||
| 64 | } | ||
| 65 | |||
| 54 | static inline | 66 | static inline |
| 55 | bool | 67 | bool |
| 56 | is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp) | 68 | 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 | ... | @@ -102,10 +114,10 @@ void dyn_cast_get_derived_info(derived_object_info* info, const void* static_ptr |
| 102 | reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy; | 114 | reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy; |
| 103 | info->dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy)); | 115 | info->dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy)); |
| 104 | #else | 116 | #else |
| 105 | void **vtable = *static_cast<void ** const *>(static_ptr); | 117 | void** vtable = strip_vtable(*static_cast<void** const*>(static_ptr)); |
| 106 | info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]); | 118 | info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]); |
| 107 | info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived; | 119 | info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived; |
| 108 | info->dynamic_type = static_cast<const __class_type_info*>(vtable[-1]); | 120 | info->dynamic_type = static_cast<const __class_type_info*>(vtable[-1]); |
| 109 | #endif | 121 | #endif |
| 110 | } | 122 | } |
| 111 | 123 | ||
| ... | @@ -470,7 +482,7 @@ __class_type_info::can_catch(const __shim_type_info* thrown_type, | ... | @@ -470,7 +482,7 @@ __class_type_info::can_catch(const __shim_type_info* thrown_type, |
| 470 | if (thrown_class_type == 0) | 482 | if (thrown_class_type == 0) |
| 471 | return false; | 483 | return false; |
| 472 | // bullet 2 | 484 | // bullet 2 |
| 473 | assert(adjustedPtr && "catching a class without an object?"); | 485 | _LIBCXXABI_ASSERT(adjustedPtr, "catching a class without an object?"); |
| 474 | __dynamic_cast_info info = {thrown_class_type, 0, this, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, nullptr}; | 486 | __dynamic_cast_info info = {thrown_class_type, 0, this, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, nullptr}; |
| 475 | info.number_of_dst_type = 1; | 487 | info.number_of_dst_type = 1; |
| 476 | thrown_class_type->has_unambiguous_public_base(&info, adjustedPtr, public_path); | 488 | 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, | ... | @@ -560,7 +572,7 @@ __base_class_type_info::has_unambiguous_public_base(__dynamic_cast_info* info, |
| 560 | find the layout. */ | 572 | find the layout. */ |
| 561 | offset_to_base = __offset_flags >> __offset_shift; | 573 | offset_to_base = __offset_flags >> __offset_shift; |
| 562 | if (is_virtual) { | 574 | if (is_virtual) { |
| 563 | const char* vtable = *static_cast<const char* const*>(adjustedPtr); | 575 | const char* vtable = strip_vtable(*static_cast<const char* const*>(adjustedPtr)); |
| 564 | offset_to_base = update_offset_to_base(vtable, offset_to_base); | 576 | offset_to_base = update_offset_to_base(vtable, offset_to_base); |
| 565 | } | 577 | } |
| 566 | } else if (!is_virtual) { | 578 | } else if (!is_virtual) { |
| ... | @@ -1500,8 +1512,8 @@ __base_class_type_info::search_above_dst(__dynamic_cast_info* info, | ... | @@ -1500,8 +1512,8 @@ __base_class_type_info::search_above_dst(__dynamic_cast_info* info, |
| 1500 | ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; | 1512 | ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; |
| 1501 | if (__offset_flags & __virtual_mask) | 1513 | if (__offset_flags & __virtual_mask) |
| 1502 | { | 1514 | { |
| 1503 | const char* vtable = *static_cast<const char*const*>(current_ptr); | 1515 | const char* vtable = strip_vtable(*static_cast<const char* const*>(current_ptr)); |
| 1504 | offset_to_base = update_offset_to_base(vtable, offset_to_base); | 1516 | offset_to_base = update_offset_to_base(vtable, offset_to_base); |
| 1505 | } | 1517 | } |
| 1506 | __base_type->search_above_dst(info, dst_ptr, | 1518 | __base_type->search_above_dst(info, dst_ptr, |
| 1507 | static_cast<const char*>(current_ptr) + offset_to_base, | 1519 | static_cast<const char*>(current_ptr) + offset_to_base, |
| ... | @@ -1520,8 +1532,8 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info, | ... | @@ -1520,8 +1532,8 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info, |
| 1520 | ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; | 1532 | ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; |
| 1521 | if (__offset_flags & __virtual_mask) | 1533 | if (__offset_flags & __virtual_mask) |
| 1522 | { | 1534 | { |
| 1523 | const char* vtable = *static_cast<const char*const*>(current_ptr); | 1535 | const char* vtable = strip_vtable(*static_cast<const char* const*>(current_ptr)); |
| 1524 | offset_to_base = update_offset_to_base(vtable, offset_to_base); | 1536 | offset_to_base = update_offset_to_base(vtable, offset_to_base); |
| 1525 | } | 1537 | } |
| 1526 | __base_type->search_below_dst(info, | 1538 | __base_type->search_below_dst(info, |
| 1527 | static_cast<const char*>(current_ptr) + offset_to_base, | 1539 | static_cast<const char*>(current_ptr) + offset_to_base, |