Merge "Revert "Enable the scudo native allocator.""
am: c8226ec23d
Change-Id: Ic33afc3fdfe25284b777520b87b79d5b037a2b68
diff --git a/libc/Android.bp b/libc/Android.bp
index daca9c4..c764cb9 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -94,7 +94,7 @@
cc_defaults {
name: "libc_native_allocator_defaults",
- defaults: ["libc_scudo_defaults"],
+ defaults: ["libc_jemalloc5_defaults"],
}
cc_defaults {
@@ -2629,6 +2629,7 @@
cc_library_shared {
name: "libc_scudo",
+ defaults: ["libc_scudo_wrapper_defaults"],
vendor_available: true,
stl: "none",
system_shared_libs: [],
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index 020cd23..2cb1e8a 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -294,10 +294,17 @@
return true;
}
+// Note about USE_SCUDO. This file is compiled into libc.so and libc_scudo.so.
+// When compiled into libc_scudo.so, the libc_malloc_* libraries don't need
+// to be loaded from the runtime namespace since libc_scudo.so is not from
+// the runtime APEX, but is copied to any APEX that needs it.
+#ifndef USE_SCUDO
extern "C" struct android_namespace_t* android_get_exported_namespace(const char* name);
+#endif
void* LoadSharedLibrary(const char* shared_lib, const char* prefix, MallocDispatch* dispatch_table) {
void* impl_handle = nullptr;
+#ifndef USE_SCUDO
// Try to load the libc_malloc_* libs from the "runtime" namespace and then
// fall back to dlopen() to load them from the default namespace.
//
@@ -316,6 +323,7 @@
};
impl_handle = android_dlopen_ext(shared_lib, RTLD_NOW | RTLD_LOCAL, &dlextinfo);
}
+#endif
if (impl_handle == nullptr) {
impl_handle = dlopen(shared_lib, RTLD_NOW | RTLD_LOCAL);