am 38ed337c
: Merge "Hide dlmalloc symbols."
* commit '38ed337c1343af1aa55487777ed80de6b0d33638': Hide dlmalloc symbols.
This commit is contained in:
commit
9a2aba176a
@ -500,11 +500,9 @@ endif
|
||||
|
||||
ifeq ($(MALLOC_IMPL),jemalloc)
|
||||
libc_common_cflags += -DUSE_JEMALLOC
|
||||
|
||||
libc_malloc_src := bionic/jemalloc.cpp
|
||||
else
|
||||
libc_common_cflags += -DUSE_DLMALLOC
|
||||
|
||||
libc_malloc_src := bionic/dlmalloc.c
|
||||
endif
|
||||
|
||||
@ -821,6 +819,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
libc_dns \
|
||||
libc_freebsd \
|
||||
libc_gdtoa \
|
||||
libc_malloc \
|
||||
libc_netbsd \
|
||||
libc_openbsd \
|
||||
libc_stack_protector \
|
||||
@ -828,8 +827,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
libc_tzcode \
|
||||
|
||||
ifeq ($(MALLOC_IMPL),jemalloc)
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += \
|
||||
libjemalloc
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
|
||||
endif
|
||||
|
||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||
@ -878,6 +876,24 @@ $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# ========================================================
|
||||
# libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
|
||||
# ========================================================
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := $(libc_malloc_src)
|
||||
LOCAL_CFLAGS := $(libc_common_cflags) \
|
||||
-Werror \
|
||||
-fvisibility=hidden \
|
||||
|
||||
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
|
||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
|
||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||
LOCAL_MODULE := libc_malloc
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# ========================================================
|
||||
# libc.a
|
||||
# ========================================================
|
||||
@ -886,7 +902,6 @@ include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := \
|
||||
$(libc_arch_static_src_files) \
|
||||
$(libc_static_common_src_files) \
|
||||
$(libc_malloc_src) \
|
||||
bionic/malloc_debug_common.cpp \
|
||||
bionic/libc_init_static.cpp \
|
||||
|
||||
@ -919,7 +934,6 @@ LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||
LOCAL_SRC_FILES := \
|
||||
$(libc_arch_dynamic_src_files) \
|
||||
$(libc_static_common_src_files) \
|
||||
$(libc_malloc_src) \
|
||||
bionic/malloc_debug_common.cpp \
|
||||
bionic/debug_mapinfo.cpp \
|
||||
bionic/debug_stacktrace.cpp \
|
||||
|
@ -46,14 +46,11 @@ static void __bionic_heap_usage_error(const char* function, void* address) {
|
||||
*((int**) 0xdeadbaad) = (int*) address;
|
||||
}
|
||||
|
||||
static void* named_anonymous_mmap(size_t length)
|
||||
{
|
||||
void* ret;
|
||||
ret = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
if (ret == MAP_FAILED)
|
||||
return ret;
|
||||
|
||||
__bionic_name_mem(ret, length, "libc_malloc");
|
||||
|
||||
return ret;
|
||||
static void* named_anonymous_mmap(size_t length) {
|
||||
void* map = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
return map;
|
||||
}
|
||||
__bionic_name_mem(map, length, "libc_malloc");
|
||||
return map;
|
||||
}
|
||||
|
@ -17,6 +17,9 @@
|
||||
#ifndef LIBC_BIONIC_DLMALLOC_H_
|
||||
#define LIBC_BIONIC_DLMALLOC_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Configure dlmalloc. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
#define MALLOC_INSPECT_ALL 1
|
||||
@ -29,6 +32,12 @@
|
||||
#define USE_SPIN_LOCKS 0
|
||||
#define DEFAULT_MMAP_THRESHOLD (64U * 1024U)
|
||||
|
||||
/* Export two symbols used by the VM. */
|
||||
__BEGIN_DECLS
|
||||
int dlmalloc_trim(size_t) __LIBC_ABI_PUBLIC__;
|
||||
void dlmalloc_inspect_all(void (*handler)(void*, void*, size_t, void*), void*) __LIBC_ABI_PUBLIC__;
|
||||
__END_DECLS
|
||||
|
||||
/* Include the proper definitions. */
|
||||
#include "../upstream-dlmalloc/malloc.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user