Index: libunwind/src/AddressSpace.hpp =================================================================== --- libunwind/src/AddressSpace.hpp +++ libunwind/src/AddressSpace.hpp @@ -712,6 +712,7 @@ struct unw_addr_space_i386 : public unw_addr_space { unw_addr_space_i386(task_t task) : oas(task) {} RemoteAddressSpace> oas; + static void *operator new(size_t, unw_addr_space_i386 *p) { return p; } }; /// unw_addr_space_x86_64 is the concrete instance that a unw_addr_space_t @@ -720,6 +721,7 @@ struct unw_addr_space_x86_64 : public unw_addr_space { unw_addr_space_x86_64(task_t task) : oas(task) {} RemoteAddressSpace> oas; + static void *operator new(size_t, unw_addr_space_x86_64 *p) { return p; } }; /// unw_addr_space_ppc is the concrete instance that a unw_addr_space_t points @@ -728,6 +730,7 @@ struct unw_addr_space_ppc : public unw_addr_space { unw_addr_space_ppc(task_t task) : oas(task) {} RemoteAddressSpace> oas; + static void *operator new(size_t, unw_addr_space_ppc *p) { return p; } }; /// unw_addr_space_ppc is the concrete instance that a unw_addr_space_t points @@ -735,6 +738,7 @@ struct unw_addr_space_ppc64 : public unw_addr_space { unw_addr_space_ppc64(task_t task) : oas(task) {} RemoteAddressSpace> oas; + static void *operator new(size_t, unw_addr_space_ppc64 *p) { return p; } }; #endif // UNW_REMOTE Index: libunwind/src/Unwind-seh.cpp =================================================================== --- libunwind/src/Unwind-seh.cpp +++ libunwind/src/Unwind-seh.cpp @@ -49,10 +49,6 @@ /// Class of foreign exceptions based on unrecognized SEH exceptions. static const uint64_t kSEHExceptionClass = 0x434C4E4753454800; // CLNGSEH\0 -// libunwind does not and should not depend on C++ library which means that we -// need our own declaration of global placement new. -void *operator new(size_t, void*); - /// Exception cleanup routine used by \c _GCC_specific_handler to /// free foreign exceptions. static void seh_exc_cleanup(_Unwind_Reason_Code urc, _Unwind_Exception *exc) { @@ -452,20 +448,23 @@ static int _unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) { #ifdef _LIBUNWIND_TARGET_X86_64 - new ((void *)cursor) UnwindCursor( - context, LocalAddressSpace::sThisAddressSpace); + new (reinterpret_cast *>(cursor)) + UnwindCursor( + context, LocalAddressSpace::sThisAddressSpace); auto *co = reinterpret_cast(cursor); co->setInfoBasedOnIPRegister(); return UNW_ESUCCESS; #elif defined(_LIBUNWIND_TARGET_ARM) - new ((void *)cursor) UnwindCursor( - context, LocalAddressSpace::sThisAddressSpace); + new (reinterpret_cast *>(cursor)) + UnwindCursor( + context, LocalAddressSpace::sThisAddressSpace); auto *co = reinterpret_cast(cursor); co->setInfoBasedOnIPRegister(); return UNW_ESUCCESS; #elif defined(_LIBUNWIND_TARGET_AARCH64) - new ((void *)cursor) UnwindCursor( - context, LocalAddressSpace::sThisAddressSpace); + new (reinterpret_cast *>(cursor)) + UnwindCursor( + context, LocalAddressSpace::sThisAddressSpace); auto *co = reinterpret_cast(cursor); co->setInfoBasedOnIPRegister(); return UNW_ESUCCESS; Index: libunwind/src/UnwindCursor.hpp =================================================================== --- libunwind/src/UnwindCursor.hpp +++ libunwind/src/UnwindCursor.hpp @@ -894,6 +894,10 @@ virtual void saveVFPAsX(); #endif + // libunwind does not and should not depend on C++ library which means that we + // need our own defition of inline placement new. + static void *operator new(size_t, UnwindCursor *p) { return p; } + private: #if defined(_LIBUNWIND_ARM_EHABI) Index: libunwind/src/libunwind.cpp =================================================================== --- libunwind/src/libunwind.cpp +++ libunwind/src/libunwind.cpp @@ -23,10 +23,6 @@ using namespace libunwind; -// libunwind does not and should not depend on C++ library which means that we -// need our own declaration of global placement new. -void *operator new(size_t, void*); - /// internal object to represent this processes address space LocalAddressSpace LocalAddressSpace::sThisAddressSpace; @@ -70,8 +66,9 @@ # error Architecture not supported #endif // Use "placement new" to allocate UnwindCursor in the cursor buffer. - new ((void *)cursor) UnwindCursor( - context, LocalAddressSpace::sThisAddressSpace); + new (reinterpret_cast *>(cursor)) + UnwindCursor( + context, LocalAddressSpace::sThisAddressSpace); #undef REGISTER_KIND AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; co->setInfoBasedOnIPRegister(); @@ -91,17 +88,17 @@ // use "placement new" to allocate UnwindCursor in the cursor buffer switch (as->cpuType) { case CPU_TYPE_I386: - new ((void *)cursor) + new (reinterpret_cast *>(cursor)) UnwindCursor>, Registers_x86>(((unw_addr_space_i386 *)as)->oas, arg); break; case CPU_TYPE_X86_64: - new ((void *)cursor) + new (reinterpret_cast *>(cursor)) UnwindCursor>, Registers_x86_64>(((unw_addr_space_x86_64 *)as)->oas, arg); break; case CPU_TYPE_POWERPC: - new ((void *)cursor) + new (reinterpret_cast *>(cursor)) UnwindCursor>, Registers_ppc>(((unw_addr_space_ppc *)as)->oas, arg); break;