diff --git a/src/crt/cxxabi.cpp b/src/crt/cxxabi.cpp index e20bd04..3921125 100644 --- a/src/crt/cxxabi.cpp +++ b/src/crt/cxxabi.cpp @@ -2,6 +2,8 @@ #include #include #include +extern "C" void* malloc(size_t); +extern "C" void free(void*); //#define DEBUG_HEAP #ifdef DEBUG_HEAP @@ -33,6 +35,15 @@ void operator delete[](void* ptr) HPRINT("operator delete[]: %p\n", ptr); free(ptr); } +// C++14 sized deallocation +void operator delete(void* ptr, std::size_t) +{ + free(ptr); +} +void operator delete [](void* ptr, std::size_t) +{ + free(ptr); +} extern "C" void __cxa_pure_virtual() { diff --git a/src/crt/malloc.c b/src/crt/malloc.c index de3f47a..90a3b1e 100644 --- a/src/crt/malloc.c +++ b/src/crt/malloc.c @@ -5,7 +5,7 @@ #include static inline size_t word_align(size_t size) { - return size + (sizeof(size_t) - 1) & ~(sizeof(size_t) - 1); + return size + ((sizeof(size_t) - 1) & ~(sizeof(size_t) - 1)); } struct chunk {