diff options
author | Dimitry Ivanov <dimitry@google.com> | 2017-02-11 19:26:48 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-02-11 19:26:50 +0000 |
commit | fd87c062abb0c1600e068f477699530e9c6758ed (patch) | |
tree | 42fa68c0ce3fa59bbd932a010bc4d5254c59f8be /libnativeloader | |
parent | e499403bf4b9ad717345e37dc4e85477f64d9640 (diff) | |
parent | 26e1a846ef6b3bda9386fba405ea4485056b4e62 (diff) | |
download | system_core-fd87c062abb0c1600e068f477699530e9c6758ed.tar.gz system_core-fd87c062abb0c1600e068f477699530e9c6758ed.tar.bz2 system_core-fd87c062abb0c1600e068f477699530e9c6758ed.zip |
Merge "Replace public library list with shared lib sonames"
Diffstat (limited to 'libnativeloader')
-rw-r--r-- | libnativeloader/include/nativeloader/dlext_namespaces.h | 15 | ||||
-rw-r--r-- | libnativeloader/native_loader.cpp | 9 |
2 files changed, 16 insertions, 8 deletions
diff --git a/libnativeloader/include/nativeloader/dlext_namespaces.h b/libnativeloader/include/nativeloader/dlext_namespaces.h index 02e7075d7..73d0be8f7 100644 --- a/libnativeloader/include/nativeloader/dlext_namespaces.h +++ b/libnativeloader/include/nativeloader/dlext_namespaces.h @@ -22,16 +22,15 @@ __BEGIN_DECLS /* - * Initializes public and anonymous namespaces. The public_ns_sonames is the list of sonames - * to be included into public namespace separated by colon. Example: "libc.so:libm.so:libdl.so". - * The libraries in this list should be loaded prior to this call. + * Initializes anonymous namespaces. The shared_libs_sonames is the list of sonames + * to be shared by default namespace separated by colon. Example: "libc.so:libm.so:libdl.so". * - * The anon_ns_library_path is the search path for anonymous namespace. The anonymous namespace + * The library_search_path is the search path for anonymous namespace. The anonymous namespace * is used in the case when linker cannot identify the caller of dlopen/dlsym. This happens * for the code not loaded by dynamic linker; for example calls from the mono-compiled code. */ -extern bool android_init_namespaces(const char* public_ns_sonames, - const char* anon_ns_library_path); +extern bool android_init_anonymous_namespace(const char* shared_libs_sonames, + const char* library_search_path); enum { @@ -86,6 +85,10 @@ extern struct android_namespace_t* android_create_namespace(const char* name, const char* permitted_when_isolated_path, android_namespace_t* parent); +extern bool android_link_namespaces(android_namespace_t* from, + android_namespace_t* to, + const char* shared_libs_sonames); + /* * Get the default library search path. * The path will be copied into buffer, which must have space for at least diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 2f23c2c97..74f2f1d31 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -165,6 +165,11 @@ class LibraryNamespaces { return false; } + if (!android_link_namespaces(ns, nullptr, public_libraries_.c_str())) { + *error_msg = dlerror(); + return false; + } + native_loader_ns = NativeLoaderNamespace(ns); } else { native_bridge_namespace_t* ns = NativeBridgeCreateNamespace("classloader-namespace", @@ -310,8 +315,8 @@ class LibraryNamespaces { // code is one example) unknown to linker in which case linker uses anonymous // namespace. The second argument specifies the search path for the anonymous // namespace which is the library_path of the classloader. - initialized_ = android_init_namespaces(public_libraries_.c_str(), - is_native_bridge ? nullptr : library_path); + initialized_ = android_init_anonymous_namespace(public_libraries_.c_str(), + is_native_bridge ? nullptr : library_path); if (!initialized_) { *error_msg = dlerror(); return false; |