summaryrefslogtreecommitdiff
path: root/libnativeloader/library_namespaces.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libnativeloader/library_namespaces.cpp')
-rw-r--r--libnativeloader/library_namespaces.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp
index 59369eee43..79fee060cf 100644
--- a/libnativeloader/library_namespaces.cpp
+++ b/libnativeloader/library_namespaces.cpp
@@ -122,18 +122,16 @@ void LibraryNamespaces::Initialize() {
return;
}
- // Load the preloadable public libraries. Since libnativeloader is in the
- // com_android_art namespace, use OpenSystemLibrary rather than dlopen to
- // ensure the libraries are loaded in the system namespace.
+ // android_init_namespaces() expects all the public libraries
+ // to be loaded so that they can be found by soname alone.
//
// TODO(dimitry): this is a bit misleading since we do not know
// if the vendor public library is going to be opened from /vendor/lib
// we might as well end up loading them from /system/lib or /product/lib
// For now we rely on CTS test to catch things like this but
// it should probably be addressed in the future.
- for (const std::string& soname : android::base::Split(preloadable_public_libraries(), ":")) {
- void* handle = OpenSystemLibrary(soname.c_str(), RTLD_NOW | RTLD_NODELETE);
- LOG_ALWAYS_FATAL_IF(handle == nullptr,
+ for (const auto& soname : android::base::Split(preloadable_public_libraries(), ":")) {
+ LOG_ALWAYS_FATAL_IF(dlopen(soname.c_str(), RTLD_NOW | RTLD_NODELETE) == nullptr,
"Error preloading public library %s: %s", soname.c_str(), dlerror());
}
}