mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-27 19:54:38 +00:00
26 lines
1001 B
Diff
26 lines
1001 B
Diff
diff --git a/src/private_typeinfo.cpp b/src/private_typeinfo.cpp
|
|
index 86e187f..11db349 100644
|
|
--- a/src/private_typeinfo.cpp
|
|
+++ b/src/private_typeinfo.cpp
|
|
@@ -53,12 +53,20 @@ static inline
|
|
bool
|
|
is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp)
|
|
{
|
|
+#ifdef DARLING
|
|
+ // Guest executables can retain weak RTTI definitions alongside the
|
|
+ // runtime's strong definition. Until dyld coalesces those definitions,
|
|
+ // pointer-only comparison misses otherwise matching exception handlers.
|
|
+ // Compare the ABI type names as well, retaining the pointer fast path.
|
|
+ return *x == *y || strcmp(x->name(), y->name()) == 0;
|
|
+#else
|
|
// Use std::type_info's default comparison unless we've explicitly asked
|
|
// for strcmp.
|
|
if (!use_strcmp)
|
|
return *x == *y;
|
|
// Still allow pointer equality to short circut.
|
|
return x == y || strcmp(x->name(), y->name()) == 0;
|
|
+#endif
|
|
}
|
|
|
|
static inline ptrdiff_t update_offset_to_base(const char* vtable,
|