Merge "Revert "Enable the scudo native allocator.""

This commit is contained in:
Treehugger Robot 2019-12-19 20:52:02 +00:00 committed by Gerrit Code Review
commit f4e03ef45b
2 changed files with 10 additions and 1 deletions

View file

@ -94,7 +94,7 @@ cc_defaults {
cc_defaults {
name: "libc_native_allocator_defaults",
defaults: ["libc_scudo_defaults"],
defaults: ["libc_jemalloc5_defaults"],
}
cc_defaults {
@ -2607,6 +2607,7 @@ cc_defaults {
cc_library_shared {
name: "libc_scudo",
defaults: ["libc_scudo_wrapper_defaults"],
vendor_available: true,
stl: "none",
system_shared_libs: [],

View file

@ -283,10 +283,17 @@ bool InitSharedLibrary(void* impl_handle, const char* shared_lib, const char* pr
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.
//
@ -305,6 +312,7 @@ void* LoadSharedLibrary(const char* shared_lib, const char* prefix, MallocDispat
};
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);