Bug 799849: Wrap nothrow libstdc++ allocators. r=glandium
authorChris Jones <jones.chris.g@gmail.com>
Sat, 13 Oct 2012 03:16:53 -0700
changeset 110325 9cabc319f7ff447ab70bf6a2bfc51a18af05996d
parent 110324 b78108ed9da38e40bb935fe37f79e348e9b40da1
child 110326 97e4d66bc5fca0ec908d0158ea11110a4cfb5411
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersglandium
bugs799849
milestone19.0a1
Bug 799849: Wrap nothrow libstdc++ allocators. r=glandium
configure.in
memory/build/extraMallocFuncs.c
--- a/configure.in
+++ b/configure.in
@@ -7134,16 +7134,18 @@ if test -n "$_WRAP_MALLOC"; then
     if test -n "$GNU_CC"; then
         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
         dnl Wrap operator new and operator delete on Android.
         if test "$OS_TARGET" = "Android"; then
             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
+            dnl Wrap the nothrow variants too.
+            WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
         fi
     else
         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
     fi
 fi
 
 dnl ========================================================
 dnl = Location of malloc wrapper lib
--- a/memory/build/extraMallocFuncs.c
+++ b/memory/build/extraMallocFuncs.c
@@ -38,16 +38,40 @@ wrap(_ZdlPv)(void *ptr)
   wrap(free)(ptr);
 }
 /* operator delete[](void*) */
 MOZ_EXPORT_API(void)
 wrap(_ZdaPv)(void *ptr)
 {
   wrap(free)(ptr);
 }
+/*operator new(unsigned int, std::nothrow_t const&)*/
+MOZ_EXPORT_API(void *)
+wrap(_ZnwjRKSt9nothrow_t)(unsigned int size)
+{
+  return wrap(malloc)(size);
+}
+/*operator new[](unsigned int, std::nothrow_t const&)*/
+MOZ_EXPORT_API(void *)
+wrap(_ZnajRKSt9nothrow_t)(unsigned int size)
+{
+  return wrap(malloc)(size);
+}
+/* operator delete(void*, std::nothrow_t const&) */
+MOZ_EXPORT_API(void)
+wrap(_ZdlPvRKSt9nothrow_t)(void *ptr)
+{
+  wrap(free)(ptr);
+}
+/* operator delete[](void*, std::nothrow_t const&) */
+MOZ_EXPORT_API(void)
+wrap(_ZdaPvRKSt9nothrow_t)(void *ptr)
+{
+  wrap(free)(ptr);
+}
 #endif
 
 #ifdef wrap
 MOZ_EXPORT_API(char *)
 wrap(strndup)(const char *src, size_t len)
 {
   char* dst = (char*) wrap(malloc)(len + 1);
   if (dst)