summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-10-08 22:48:20 -0700
committerChristopher Ferris <cferris@google.com>2014-10-09 11:10:23 -0700
commitc9734d24d92f4737f5ab3808c77d816a1b084582 (patch)
tree74841ad18635138afec4ebb71d20c4dee77e4e28 /libc
parent1543fdf616ddebee7819214437527f380e5c743b (diff)
downloadbionic-c9734d24d92f4737f5ab3808c77d816a1b084582.zip
bionic-c9734d24d92f4737f5ab3808c77d816a1b084582.tar.gz
bionic-c9734d24d92f4737f5ab3808c77d816a1b084582.tar.bz2
Re-add dlmalloc for 32 bit.
It turns out that appportable has a version that calls dlmalloc directly. Re-add the dlmalloc symbol for 32 bit only as a compatibility shim that calls malloc. Bug: 17881362 Change-Id: I8f20963b0b8d323489dc083e4063779e0d1d7447
Diffstat (limited to 'libc')
-rw-r--r--libc/bionic/dlmalloc.h9
-rw-r--r--libc/bionic/ndk_cruft.cpp6
2 files changed, 12 insertions, 3 deletions
diff --git a/libc/bionic/dlmalloc.h b/libc/bionic/dlmalloc.h
index ef78814..2f53c1b 100644
--- a/libc/bionic/dlmalloc.h
+++ b/libc/bionic/dlmalloc.h
@@ -34,11 +34,14 @@
#define malloc_getpagesize getpagesize()
-/* dlmalloc_usable_size was exposed in the NDK, so change the name
- * of the function on 32 bit architectures.
- */
#if !defined(__LP64__)
+/* dlmalloc_usable_size and dlmalloc were exposed in the NDK and some
+ * apps actually used them. Rename these functions out of the way
+ * for 32 bit architectures so that ndk_cruft.cpp can expose
+ * compatibility shims with these names.
+ */
#define dlmalloc_usable_size dlmalloc_usable_size_real
+#define dlmalloc dlmalloc_real
#endif
/* Export two symbols used by the VM. */
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 829e8f3..7600817 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -320,4 +320,10 @@ extern "C" size_t dlmalloc_usable_size(void* ptr) {
return malloc_usable_size(ptr);
}
+// Older versions of appportable used dlmalloc directly instead of malloc,
+// so export this compatibility shim that simply calls malloc.
+extern "C" void* dlmalloc(size_t size) {
+ return malloc(size);
+}
+
#endif