authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-23 02:31:37+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-19 18:20:21-07:00
logd13bc04cb4c4c2f0806b9d9c676cb013ea888828
treefce89240022df2234865aac80c53030bee741932
parent70a1805e46b66955b52ba5ac46914f212d99d19c

libcxxabi: Update to LLVM 19.


11 files changed, 84 insertions(+), 55 deletions(-)

lib/libcxxabi/include/cxxabi.h+11-2
......@@ -48,13 +48,17 @@ extern _LIBCXXABI_FUNC_VIS void
4848__cxa_free_exception(void *thrown_exception) throw();
4949// This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt
5050extern _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
5155__cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw();
56#endif
5257
5358// 2.4.3 Throwing the Exception Object
5459extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
5560__cxa_throw(void *thrown_exception, std::type_info *tinfo,
56#ifdef __USING_WASM_EXCEPTIONS__
57 // In Wasm, a destructor returns its argument
61#ifdef __wasm__
5862 void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));
5963#else
6064 void (_LIBCXXABI_DTOR_FUNC *dest)(void *));
......@@ -73,6 +77,11 @@ extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup();
7377#endif
7478extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type();
7579
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.
83extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) throw();
84
7685// 2.5.4 Rethrowing Exceptions
7786extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow();
7887
lib/libcxxabi/src/aix_state_tab_eh.inc+8-8
......@@ -102,8 +102,6 @@ static bool state_tab_dbg() {
102102
103103namespace __state_table_eh {
104104
105using destruct_f = void (*)(void*);
106
107105// Definition of flags for the state table entry field 'action flag'.
108106enum FSMEntryCount : intptr_t { beginCatch = -1, endCatch = -2, deleteObject = -3, cleanupLabel = -4, terminate = -5 };
109107
......@@ -145,8 +143,10 @@ struct FSMEntry {
145143 intptr_t nextStatePtr;
146144 };
147145 union {
148 // Address of the destructor function.
149 void (*destructor)(void*, size_t);
146 // Address of the destructor function with 1 argument.
147 void (*destructor)(void*);
148 // Address of the destructor function with 2 arguments.
149 void (*xlCDestructor)(void*, size_t);
150150 // The address of the catch block or cleanup code.
151151 void* landingPad;
152152 };
......@@ -191,12 +191,12 @@ static void invoke_destructor(FSMEntry* fsmEntry, void* addr) {
191191 try {
192192 if (fsmEntry->elementCount == 1) {
193193 _LIBCXXABI_TRACE_STATETAB0("calling scalar destructor\n");
194 (*fsmEntry->destructor)(addr, dtorArgument);
194 (*fsmEntry->xlCDestructor)(addr, dtorArgument);
195195 _LIBCXXABI_TRACE_STATETAB0("returned from scalar destructor\n");
196196 } else {
197197 _LIBCXXABI_TRACE_STATETAB0("calling vector destructor\n");
198198 __cxa_vec_cleanup(addr, reinterpret_cast<size_t>(fsmEntry->elementCount), fsmEntry->elemSize,
199 reinterpret_cast<destruct_f>(fsmEntry->destructor));
199 fsmEntry->destructor);
200200 _LIBCXXABI_TRACE_STATETAB0("returned from vector destructor\n");
201201 }
202202 } catch (...) {
......@@ -213,7 +213,7 @@ static void invoke_delete(FSMEntry* fsmEntry, void* addr) {
213213 try {
214214 _LIBCXXABI_TRACE_STATETAB0("..calling delete()\n");
215215 // 'destructor' holds a function pointer to delete().
216 (*fsmEntry->destructor)(objectAddress, fsmEntry->elemSize);
216 (*fsmEntry->xlCDestructor)(objectAddress, fsmEntry->elemSize);
217217 _LIBCXXABI_TRACE_STATETAB0("..returned from delete()\n");
218218 } catch (...) {
219219 _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) {
681681// xlclang++ compiled code. If __xlc_exception_handle() is called by
682682// non-C++ EH aware functions, their frames are skipped until a C++ EH aware
683683// 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
685685// it calls skip_non_cxx_eh_aware_frames(), which in turn calls abort().
686686_LIBCXXABI_FUNC_VIS uintptr_t __xlc_exception_handle() {
687687 // 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() {
207207}
208208
209209__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
210214 void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
215#endif
211216 __cxa_exception* exception_header = cxa_exception_from_thrown_object(object);
212217 exception_header->referenceCount = 0;
213218 exception_header->unexpectedHandler = std::get_unexpected();
......@@ -267,7 +272,7 @@ will call terminate, assuming that there was no handler for the
267272exception.
268273*/
269274void
270#ifdef __USING_WASM_EXCEPTIONS__
275#ifdef __wasm__
271276// In Wasm, a destructor returns its argument
272277__cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
273278#else
......@@ -584,6 +589,11 @@ void __cxa_end_catch() {
584589 }
585590}
586591
592void __cxa_call_terminate(void* unwind_arg) throw() {
593 __cxa_begin_catch(unwind_arg);
594 std::terminate();
595}
596
587597// Note: exception_header may be masquerading as a __cxa_dependent_exception
588598// and that's ok. exceptionType is there too.
589599// 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 {
4343
4444 // Manage the exception object itself.
4545 std::type_info *exceptionType;
46#ifdef __USING_WASM_EXCEPTIONS__
46#ifdef __wasm__
4747 // In Wasm, a destructor returns its argument
4848 void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
4949#else
lib/libcxxabi/src/cxa_exception_storage.cpp+2-2
......@@ -12,7 +12,7 @@
1212
1313#include "cxa_exception.h"
1414
15#include <__threading_support>
15#include <__thread/support.h>
1616
1717#if defined(_LIBCXXABI_HAS_NO_THREADS)
1818
......@@ -24,7 +24,7 @@ extern "C" {
2424} // extern "C"
2525} // namespace __cxxabiv1
2626
27#elif defined(HAS_THREAD_LOCAL)
27#elif __has_feature(cxx_thread_local)
2828
2929namespace __cxxabiv1 {
3030namespace {
lib/libcxxabi/src/cxa_guard_impl.h+1-1
......@@ -58,7 +58,7 @@
5858# endif
5959#endif
6060
61#include <__threading_support>
61#include <__thread/support.h>
6262#include <cstdint>
6363#include <cstring>
6464#include <limits.h>
lib/libcxxabi/src/cxa_personality.cpp+19-21
......@@ -70,7 +70,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD,
7070+------------------+--+-----+-----+------------------------+--------------------------+
7171| callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table |
7272+---------------------+-----------+---------------------------------------------------+
73#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__)
73#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
7474+---------------------+-----------+------------------------------------------------+
7575| Beginning of Call Site Table The current ip lies within the |
7676| ... (start, length) range of one of these |
......@@ -84,7 +84,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD,
8484| +-------------+---------------------------------+------------------------------+ |
8585| ... |
8686+----------------------------------------------------------------------------------+
87#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
87#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
8888+---------------------+-----------+------------------------------------------------+
8989| Beginning of Call Site Table The current ip is a 1-based index into |
9090| ... this table. Or it is -1 meaning no |
......@@ -97,7 +97,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD,
9797| +-------------+---------------------------------+------------------------------+ |
9898| ... |
9999+----------------------------------------------------------------------------------+
100#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
100#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
101101+---------------------------------------------------------------------+
102102| Beginning of Action Table ttypeIndex == 0 : cleanup |
103103| ... ttypeIndex > 0 : catch |
......@@ -547,7 +547,7 @@ void
547547set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context,
548548 const scan_results& results)
549549{
550#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__)
550#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__)
551551#define __builtin_eh_return_data_regno(regno) regno
552552#elif defined(__ibmxl__)
553553// 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,
642642 // Get beginning current frame's code (as defined by the
643643 // emitted dwarf code)
644644 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__)
646646 if (ip == uintptr_t(-1))
647647 {
648648 // no action
......@@ -652,9 +652,9 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
652652 else if (ip == 0)
653653 call_terminate(native_exception, unwind_exception);
654654 // ip is 1-based index into call site table
655#else // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__
655#else // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__
656656 uintptr_t ipOffset = ip - funcStart;
657#endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__
657#endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__
658658 const uint8_t* classInfo = NULL;
659659 // Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding
660660 // dwarf emission
......@@ -675,7 +675,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
675675 // Walk call-site table looking for range that
676676 // includes current PC.
677677 uint8_t callSiteEncoding = *lsda++;
678#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__)
678#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__)
679679 (void)callSiteEncoding; // When using SjLj/Wasm exceptions, callSiteEncoding is never used
680680#endif
681681 uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda));
......@@ -686,7 +686,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
686686 while (callSitePtr < callSiteTableEnd)
687687 {
688688 // 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__)
690690 // The call sites are non-overlapping in [start, start+length)
691691 // The call sites are ordered in increasing value of start
692692 uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding);
......@@ -694,15 +694,15 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
694694 uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding);
695695 uintptr_t actionEntry = readULEB128(&callSitePtr);
696696 if ((start <= ipOffset) && (ipOffset < (start + length)))
697#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
697#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
698698 // ip is 1-based index into this table
699699 uintptr_t landingPad = readULEB128(&callSitePtr);
700700 uintptr_t actionEntry = readULEB128(&callSitePtr);
701701 if (--ip == 0)
702#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
702#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
703703 {
704704 // 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__)
706706 if (landingPad == 0)
707707 {
708708 // No handler here
......@@ -710,16 +710,14 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
710710 return;
711711 }
712712 landingPad = (uintptr_t)lpStart + landingPad;
713#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
713#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
714714 ++landingPad;
715#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
715#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
716716 results.landingPad = landingPad;
717717 if (actionEntry == 0)
718718 {
719719 // Found a cleanup
720 results.reason = actions & _UA_SEARCH_PHASE
721 ? _URC_CONTINUE_UNWIND
722 : _URC_HANDLER_FOUND;
720 results.reason = (actions & _UA_SEARCH_PHASE) ? _URC_CONTINUE_UNWIND : _URC_HANDLER_FOUND;
723721 return;
724722 }
725723 // Convert 1-based byte offset into
......@@ -840,7 +838,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
840838 action += actionOffset;
841839 } // there is no break out of this loop, only return
842840 }
843#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__)
841#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
844842 else if (ipOffset < start)
845843 {
846844 // There is no call site for this ip
......@@ -848,7 +846,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
848846 // Possible stack corruption.
849847 call_terminate(native_exception, unwind_exception);
850848 }
851#endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__
849#endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__
852850 } // there might be some tricky cases which break out of this loop
853851
854852 // It is possible that no eh table entry specify how to handle
......@@ -905,7 +903,7 @@ _UA_CLEANUP_PHASE
905903*/
906904
907905#if !defined(_LIBCXXABI_ARM_EHABI)
908#ifdef __USING_WASM_EXCEPTIONS__
906#ifdef __WASM_EXCEPTIONS__
909907_Unwind_Reason_Code __gxx_personality_wasm0
910908#elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
911909static _Unwind_Reason_Code __gxx_personality_imp
......@@ -974,7 +972,7 @@ __gxx_personality_v0
974972 exc->languageSpecificData = results.languageSpecificData;
975973 exc->catchTemp = reinterpret_cast<void*>(results.landingPad);
976974 exc->adjustedPtr = results.adjustedPtr;
977#ifdef __USING_WASM_EXCEPTIONS__
975#ifdef __WASM_EXCEPTIONS__
978976 // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the
979977 // results here.
980978 set_registers(unwind_exception, context, results);
lib/libcxxabi/src/cxa_thread_atexit.cpp+1-1
......@@ -8,7 +8,7 @@
88
99#include "abort_message.h"
1010#include "cxxabi.h"
11#include <__threading_support>
11#include <__thread/support.h>
1212#ifndef _LIBCXXABI_HAS_NO_THREADS
1313#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
1414#pragma comment(lib, "pthread")
lib/libcxxabi/src/demangle/ItaniumDemangle.h+6-6
......@@ -39,13 +39,12 @@
3939DEMANGLE_NAMESPACE_BEGIN
4040
4141template <class T, size_t N> class PODSmallVector {
42 static_assert(std::is_pod<T>::value,
43 "T is required to be a plain old data type");
44
42 static_assert(std::is_trivial<T>::value,
43 "T is required to be a trivial type");
4544 T *First = nullptr;
4645 T *Last = nullptr;
4746 T *Cap = nullptr;
48 T Inline[N] = {0};
47 T Inline[N] = {};
4948
5049 bool isInline() const { return First == Inline; }
5150
......@@ -5542,7 +5541,7 @@ Node *AbstractManglingParser<Alloc, Derived>::parseFloatingLiteral() {
55425541 return nullptr;
55435542 std::string_view Data(First, N);
55445543 for (char C : Data)
5545 if (!std::isxdigit(C))
5544 if (!(C >= '0' && C <= '9') && !(C >= 'a' && C <= 'f'))
55465545 return nullptr;
55475546 First += N;
55485547 if (!consumeIf('E'))
......@@ -5716,6 +5715,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() {
57165715}
57175716
57185717// <template-param-decl> ::= Ty # type parameter
5718// ::= Tk <concept name> [<template-args>] # constrained type parameter
57195719// ::= Tn <type> # non-type parameter
57205720// ::= Tt <template-param-decl>* E # template parameter
57215721// ::= Tp <template-param-decl> # parameter pack
......@@ -5847,7 +5847,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateArg() {
58475847 }
58485848}
58495849
5850// <template-args> ::= I <template-arg>* E
5850// <template-args> ::= I <template-arg>* [Q <requires-clause expr>] E
58515851// extension, the abi says <template-arg>+
58525852template <typename Derived, typename Alloc>
58535853Node *
lib/libcxxabi/src/fallback_malloc.cpp+1-1
......@@ -9,7 +9,7 @@
99#include "fallback_malloc.h"
1010#include "abort_message.h"
1111
12#include <__threading_support>
12#include <__thread/support.h>
1313#ifndef _LIBCXXABI_HAS_NO_THREADS
1414#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
1515#pragma comment(lib, "pthread")
lib/libcxxabi/src/private_typeinfo.cpp+23-11
......@@ -44,13 +44,25 @@
4444#include <cstdint>
4545#include <cassert>
4646#include <string.h>
47#include "abort_message.h"
4748
4849#ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST
49#include "abort_message.h"
5050#include <sys/syslog.h>
5151#include <atomic>
5252#endif
5353
54#if __has_feature(ptrauth_calls)
55#include <ptrauth.h>
56#endif
57
58template <typename T>
59static 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
5466static inline
5567bool
5668is_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
102114 reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy;
103115 info->dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy));
104116#else
105 void **vtable = *static_cast<void ** const *>(static_ptr);
106 info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]);
107 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]);
117 void** vtable = strip_vtable(*static_cast<void** const*>(static_ptr));
118 info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]);
119 info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived;
120 info->dynamic_type = static_cast<const __class_type_info*>(vtable[-1]);
109121#endif
110122}
111123
......@@ -470,7 +482,7 @@ __class_type_info::can_catch(const __shim_type_info* thrown_type,
470482 if (thrown_class_type == 0)
471483 return false;
472484 // bullet 2
473 assert(adjustedPtr && "catching a class without an object?");
485 _LIBCXXABI_ASSERT(adjustedPtr, "catching a class without an object?");
474486 __dynamic_cast_info info = {thrown_class_type, 0, this, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, nullptr};
475487 info.number_of_dst_type = 1;
476488 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,
560572 find the layout. */
561573 offset_to_base = __offset_flags >> __offset_shift;
562574 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));
564576 offset_to_base = update_offset_to_base(vtable, offset_to_base);
565577 }
566578 } else if (!is_virtual) {
......@@ -1500,8 +1512,8 @@ __base_class_type_info::search_above_dst(__dynamic_cast_info* info,
15001512 ptrdiff_t offset_to_base = __offset_flags >> __offset_shift;
15011513 if (__offset_flags & __virtual_mask)
15021514 {
1503 const char* vtable = *static_cast<const char*const*>(current_ptr);
1504 offset_to_base = update_offset_to_base(vtable, offset_to_base);
1515 const char* vtable = strip_vtable(*static_cast<const char* const*>(current_ptr));
1516 offset_to_base = update_offset_to_base(vtable, offset_to_base);
15051517 }
15061518 __base_type->search_above_dst(info, dst_ptr,
15071519 static_cast<const char*>(current_ptr) + offset_to_base,
......@@ -1520,8 +1532,8 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info,
15201532 ptrdiff_t offset_to_base = __offset_flags >> __offset_shift;
15211533 if (__offset_flags & __virtual_mask)
15221534 {
1523 const char* vtable = *static_cast<const char*const*>(current_ptr);
1524 offset_to_base = update_offset_to_base(vtable, offset_to_base);
1535 const char* vtable = strip_vtable(*static_cast<const char* const*>(current_ptr));
1536 offset_to_base = update_offset_to_base(vtable, offset_to_base);
15251537 }
15261538 __base_type->search_below_dst(info,
15271539 static_cast<const char*>(current_ptr) + offset_to_base,