From: Kiyoung Kim Date: Wed, 19 Feb 2020 07:26:03 +0000 (+0900) Subject: Rename APEX Namespace X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=50f1616db36c40652772cc40f283ac268a883639;p=android-x86%2Fsystem-linkerconfig.git Rename APEX Namespace Current APEX Namespace is named with APEX name itself, which also uses .(dot) so linker configuration can keep the syntax safe. Update name of namespace from APEX by replacing '_' with '.' so keep configuration safe for future syntax update. Bug: 148826508 Test: m -j passed Test: boot succeeded from cuttlefish and walleye Change-Id: I9185c909678e2e39d539622d51d8f378b819b466 --- diff --git a/contents/namespace/apexartdefault.cc b/contents/namespace/apexartdefault.cc index 8f4c7f2..2153bd4 100644 --- a/contents/namespace/apexartdefault.cc +++ b/contents/namespace/apexartdefault.cc @@ -28,7 +28,7 @@ Namespace BuildApexArtDefaultNamespace([[maybe_unused]] const Context& ctx) { // The default namespace here only links to other namespaces, in particular // "art" where the real library loading takes place. Any outgoing links from // "art" also need to be present here. - ns.GetLink("com.android.art").AllowAllSharedLibs(); + ns.GetLink("com_android_art").AllowAllSharedLibs(); ns.GetLink("system").AllowAllSharedLibs(); ns.AddRequires(std::vector{"libadbconnection_client.so"}); diff --git a/contents/namespace/art.cc b/contents/namespace/art.cc index d0bc869..0d0b982 100644 --- a/contents/namespace/art.cc +++ b/contents/namespace/art.cc @@ -32,7 +32,7 @@ Namespace BuildArtNamespace([[maybe_unused]] const Context& ctx, // Make the namespace visible to allow links to be created at runtime, e.g. // through android_link_namespaces in libnativeloader. That is not applicable // to the vendor section. - Namespace ns(apex.name, + Namespace ns(apex.namespace_name, /*is_isolated=*/true, /*is_visible=*/!ctx.IsVendorSection()); diff --git a/modules/basecontext.cc b/modules/basecontext.cc index 0c85a31..997c86b 100644 --- a/modules/basecontext.cc +++ b/modules/basecontext.cc @@ -40,7 +40,7 @@ bool BaseContext::IsStrictMode() const { Namespace BaseContext::BuildApexNamespace(const ApexInfo& apex_info, bool visible) const { - Namespace ns(apex_info.name, + Namespace ns(apex_info.namespace_name, /*is_isolated=*/true, visible); InitializeWithApex(ns, apex_info); diff --git a/modules/include/linkerconfig/apex.h b/modules/include/linkerconfig/apex.h index 8b0838e..4e0a6dc 100644 --- a/modules/include/linkerconfig/apex.h +++ b/modules/include/linkerconfig/apex.h @@ -15,6 +15,7 @@ */ #pragma once +#include #include #include #include @@ -24,6 +25,7 @@ namespace linkerconfig { namespace modules { struct ApexInfo { std::string name; + std::string namespace_name; std::string path; std::vector provide_libs; std::vector require_libs; @@ -40,6 +42,9 @@ struct ApexInfo { require_libs(std::move(require_libs)), has_bin(has_bin), has_lib(has_lib) { + this->namespace_name = this->name; + std::replace( + this->namespace_name.begin(), this->namespace_name.end(), '.', '_'); } };