mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 758010 - Wrap operator new/delete on Android. r=khuey
This commit is contained in:
parent
fddcae6618
commit
11b04e4bcf
@ -7295,6 +7295,10 @@ if test -n "$_WRAP_MALLOC"; then
|
||||
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"
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
|
||||
fi
|
||||
|
@ -4058,6 +4058,10 @@ if test -n "$_WRAP_MALLOC"; then
|
||||
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"
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
|
||||
fi
|
||||
|
@ -7,6 +7,32 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#define wrap(a) __wrap_ ## a
|
||||
|
||||
/* operator new wrapper implementation */
|
||||
static void *
|
||||
new(unsigned int size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
/* operator new(unsigned int) */
|
||||
MOZ_EXPORT_API(void *)
|
||||
wrap(_Znwj)(unsigned int) __attribute__((alias("new")));
|
||||
/* operator new[](unsigned int) */
|
||||
MOZ_EXPORT_API(void *)
|
||||
wrap(_Znaj)(unsigned int) __attribute__((alias("new")));
|
||||
|
||||
/* operator delete wrapper implementation */
|
||||
static void
|
||||
delete(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
/* operator delete(void*) */
|
||||
MOZ_EXPORT_API(void)
|
||||
wrap(_ZdlPv)(void *ptr) __attribute__((alias("delete")));
|
||||
/* operator delete[](void*) */
|
||||
MOZ_EXPORT_API(void)
|
||||
wrap(_ZdaPv)(void *ptr) __attribute__((alias("delete")));
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user