Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd87c062 authored by Dimitry Ivanov's avatar Dimitry Ivanov Committed by Gerrit Code Review
Browse files

Merge "Replace public library list with shared lib sonames"

parents e499403b 26e1a846
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -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
+7 −2
Original line number Diff line number Diff line
@@ -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,7 +315,7 @@ 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(),
    initialized_ = android_init_anonymous_namespace(public_libraries_.c_str(),
                                                    is_native_bridge ? nullptr : library_path);
    if (!initialized_) {
      *error_msg = dlerror();