Bug 799849: Wrap nothrow libstdc++ allocators. r=glandium
authorChris Jones <jones.chris.g@gmail.com>
Sat, 13 Oct 2012 03:16:53 -0700
changeset 118128 9cabc319f7ff447ab70bf6a2bfc51a18af05996d
parent 118127 b78108ed9da38e40bb935fe37f79e348e9b40da1
child 118129 97e4d66bc5fca0ec908d0158ea11110a4cfb5411
push id1997
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 21:25:26 +0000
treeherdermozilla-beta@4baf45cdcf21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs799849
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)