diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-23 00:26:22 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:53:27 +0200 |
commit | ec2daa8dc96bfc275b1d13a7ac880940f506f71e (patch) | |
tree | 401d750381d6cb45082d885a72f75c50e0c74ba5 /memory/build | |
parent | 44c169c9be3cec6957d5b04272a3564cf9137109 (diff) | |
download | UXP-ec2daa8dc96bfc275b1d13a7ac880940f506f71e.tar UXP-ec2daa8dc96bfc275b1d13a7ac880940f506f71e.tar.gz UXP-ec2daa8dc96bfc275b1d13a7ac880940f506f71e.tar.lz UXP-ec2daa8dc96bfc275b1d13a7ac880940f506f71e.tar.xz UXP-ec2daa8dc96bfc275b1d13a7ac880940f506f71e.zip |
Issue #1053 - Remove android support from memory
Diffstat (limited to 'memory/build')
-rw-r--r-- | memory/build/moz.build | 2 | ||||
-rw-r--r-- | memory/build/mozmemory_wrap.c | 54 | ||||
-rw-r--r-- | memory/build/mozmemory_wrap.h | 25 | ||||
-rw-r--r-- | memory/build/replace_malloc.c | 25 | ||||
-rw-r--r-- | memory/build/replace_malloc.h | 2 |
5 files changed, 4 insertions, 104 deletions
diff --git a/memory/build/moz.build b/memory/build/moz.build index f4fd82878..c43e85192 100644 --- a/memory/build/moz.build +++ b/memory/build/moz.build @@ -36,6 +36,6 @@ if CONFIG['MOZ_GLUE_IN_PROGRAM']: DIST_INSTALL = True # Keep jemalloc separated when mozglue is statically linked -if CONFIG['MOZ_MEMORY'] and CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'): +if CONFIG['MOZ_MEMORY'] and CONFIG['OS_TARGET'] in ('WINNT', 'Darwin'): FINAL_LIBRARY = 'mozglue' diff --git a/memory/build/mozmemory_wrap.c b/memory/build/mozmemory_wrap.c index dba3ace56..fdb8447d3 100644 --- a/memory/build/mozmemory_wrap.c +++ b/memory/build/mozmemory_wrap.c @@ -88,60 +88,6 @@ strdup_impl(const char *src) } #endif /* XP_DARWIN */ -#ifdef ANDROID -#include <stdarg.h> -#include <stdio.h> - -MOZ_MEMORY_API int -vasprintf_impl(char **str, const char *fmt, va_list ap) -{ - char* ptr, *_ptr; - int ret; - - if (str == NULL || fmt == NULL) { - return -1; - } - - ptr = (char*)malloc_impl(128); - if (ptr == NULL) { - *str = NULL; - return -1; - } - - ret = vsnprintf(ptr, 128, fmt, ap); - if (ret < 0) { - free_impl(ptr); - *str = NULL; - return -1; - } - - _ptr = realloc_impl(ptr, ret + 1); - if (_ptr == NULL) { - free_impl(ptr); - *str = NULL; - return -1; - } - - *str = _ptr; - - return ret; -} - -MOZ_MEMORY_API int -asprintf_impl(char **str, const char *fmt, ...) -{ - int ret; - va_list ap; - va_start(ap, fmt); - - ret = vasprintf_impl(str, fmt, ap); - - va_end(ap); - - return ret; -} -#endif - #ifdef XP_WIN /* * There's a fun allocator mismatch in (at least) the VS 2010 CRT diff --git a/memory/build/mozmemory_wrap.h b/memory/build/mozmemory_wrap.h index bb1d339ba..da4fd27bb 100644 --- a/memory/build/mozmemory_wrap.h +++ b/memory/build/mozmemory_wrap.h @@ -58,13 +58,8 @@ * zone allocator anyways. Jemalloc-specific functions are also left * unprefixed. * - * - On Android and Gonk, all functions are left unprefixed. Additionally, - * C++ allocation functions (operator new/delete) are also exported and - * unprefixed. - * * - On other systems (mostly Linux), all functions are left unprefixed. * - * Only Android and Gonk add C++ allocation functions. * * Proper exporting of the various functions is done with the MOZ_MEMORY_API * and MOZ_JEMALLOC_API macros. MOZ_MEMORY_API is meant to be used for malloc @@ -72,14 +67,6 @@ * dedicated to jemalloc specific functions. * * - * All these functions are meant to be called with no prefix from Gecko code. - * In most cases, this is because that's how they are available at runtime. - * However, on Android, this relies on faulty.lib (the custom dynamic linker) - * resolving mozglue symbols before libc symbols, which is guaranteed by the - * way faulty.lib works (it respects the DT_NEEDED order, and libc always - * appears after mozglue ; which we double check when building anyways) - * - * * Within libmozglue (when MOZ_MEMORY_IMPL is defined), all the functions * should be suffixed with "_impl" both for declarations and use. * That is, the implementation declaration for e.g. strdup would look like: @@ -133,9 +120,6 @@ # endif # else # define MOZ_MEMORY_API MFBT_API -# if defined(MOZ_WIDGET_ANDROID) -# define MOZ_WRAP_NEW_DELETE -# endif # endif # endif # ifdef XP_WIN @@ -184,15 +168,6 @@ # define wcsdup_impl mozmem_dup_impl(wcsdup) #endif -/* String functions */ -#ifdef ANDROID -/* Bug 801571 and Bug 879668, libstagefright uses vasprintf, causing malloc()/ - * free() to be mismatched between bionic and mozglue implementation. - */ -#define vasprintf_impl mozmem_dup_impl(vasprintf) -#define asprintf_impl mozmem_dup_impl(asprintf) -#endif - /* Jemalloc specific function */ #define jemalloc_stats_impl mozmem_jemalloc_impl(jemalloc_stats) #define jemalloc_purge_freed_pages_impl mozmem_jemalloc_impl(jemalloc_purge_freed_pages) diff --git a/memory/build/replace_malloc.c b/memory/build/replace_malloc.c index f4c7eb878..91f86497c 100644 --- a/memory/build/replace_malloc.c +++ b/memory/build/replace_malloc.c @@ -24,14 +24,11 @@ * LD_PRELOAD or DYLD_INSERT_LIBRARIES on Linux/OSX. On this platform, * the replacement functions are defined as variable pointers to the * function resolved with GetProcAddress() instead of weak definitions - * of functions. On Android, the same needs to happen as well, because - * the Android linker doesn't handle weak linking with non LD_PRELOADed - * libraries, but LD_PRELOADing is not very convenient on Android, with - * the zygote. + * of functions. */ #ifdef XP_DARWIN # define MOZ_REPLACE_WEAK __attribute__((weak_import)) -#elif defined(XP_WIN) || defined(MOZ_WIDGET_ANDROID) +#elif defined(XP_WIN) # define MOZ_NO_REPLACE_FUNC_DECL #elif defined(__GNUC__) # define MOZ_REPLACE_WEAK __attribute__((weak)) @@ -71,24 +68,6 @@ replace_malloc_init_funcs() } } } -# elif defined(MOZ_WIDGET_ANDROID) -# include <dlfcn.h> -# include <stdlib.h> -static void -replace_malloc_init_funcs() -{ - const char *replace_malloc_lib = getenv("MOZ_REPLACE_MALLOC_LIB"); - if (replace_malloc_lib && *replace_malloc_lib) { - void *handle = dlopen(replace_malloc_lib, RTLD_LAZY); - if (handle) { -#define MALLOC_DECL(name, ...) \ - replace_ ## name = (replace_ ## name ## _impl_t *) dlsym(handle, "replace_" # name); - -# define MALLOC_FUNCS MALLOC_FUNCS_ALL -#include "malloc_decls.h" - } - } -} # else # error No implementation for replace_malloc_init_funcs() # endif diff --git a/memory/build/replace_malloc.h b/memory/build/replace_malloc.h index a61744f60..3e592749a 100644 --- a/memory/build/replace_malloc.h +++ b/memory/build/replace_malloc.h @@ -13,7 +13,7 @@ * environment variables to the library path: * - LD_PRELOAD on Linux, * - DYLD_INSERT_LIBRARIES on OSX, - * - MOZ_REPLACE_MALLOC_LIB on Windows and Android. + * - MOZ_REPLACE_MALLOC_LIB on Windows. * * An initialization function is called before any malloc replacement * function, and has the following declaration: |