summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-09-06 20:17:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-09-06 20:17:02 +0000
commitb4673c41025f3a16804aff8438c2810c739a11ef (patch)
treeff853a0853b1bc53190df1e9cad3b47bc2c27f4d
parente07b4da53ddcb34939c1b5a88db36dec34352add (diff)
parentf90355844663b85dd57c3adcd9e92c2ee6850412 (diff)
downloadbionic-b4673c41025f3a16804aff8438c2810c739a11ef.zip
bionic-b4673c41025f3a16804aff8438c2810c739a11ef.tar.gz
bionic-b4673c41025f3a16804aff8438c2810c739a11ef.tar.bz2
Merge "Add dlmalloc_usable_size for 32 bit arches."
-rw-r--r--libc/bionic/dlmalloc.h7
-rw-r--r--libc/bionic/ndk_cruft.cpp7
2 files changed, 14 insertions, 0 deletions
diff --git a/libc/bionic/dlmalloc.h b/libc/bionic/dlmalloc.h
index 46efa91..ef78814 100644
--- a/libc/bionic/dlmalloc.h
+++ b/libc/bionic/dlmalloc.h
@@ -34,6 +34,13 @@
#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__)
+#define dlmalloc_usable_size dlmalloc_usable_size_real
+#endif
+
/* Export two symbols used by the VM. */
__BEGIN_DECLS
int dlmalloc_trim(size_t) __LIBC_ABI_PUBLIC__;
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 45ead62..7879b7f 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -308,4 +308,11 @@ extern "C" void arc4random_stir(void) {
// The current implementation stirs itself as needed.
}
+// Old versions of the NDK did not export malloc_usable_size, but did
+// export dlmalloc_usable_size. We are moving away from dlmalloc in L
+// so make this call malloc_usable_size.
+extern "C" size_t dlmalloc_usable_size(void* ptr) {
+ return malloc_usable_size(ptr);
+}
+
#endif