From 1ef9da8571fbab4b8c60c2c4a5a2e7213e4e1c76 Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Fri, 15 May 2020 14:26:23 +0900 Subject: [PATCH] Do not link stub libraries from all namespaces In current linkerconfig from all namespaces stub libraries are linked to system namespace, which was required for APEX namespaces. However, as linkerconfig checks dependencies from APEX namespaces now, this link is excessive and can create unexpected interface from system. This change removes redundant stub library link so namespaces can link to system image with minimum set of libraries. Bug: 156563692 Test: m -j passed && crosshatch_hwasasn booted Change-Id: If43c954f376ede65bd2c3f682be6ae5d6866d3df --- contents/common/system_links.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/contents/common/system_links.cc b/contents/common/system_links.cc index 08c88f7..5dc9953 100644 --- a/contents/common/system_links.cc +++ b/contents/common/system_links.cc @@ -13,17 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "linkerconfig/common.h" #include #include #include -#include "linkerconfig/common.h" #include "linkerconfig/context.h" #include "linkerconfig/section.h" #include "linkerconfig/variables.h" +namespace { +const std::vector kBionicLibs = { + "libc.so", + "libdl.so", + "libdl_android.so", + "libm.so", +}; +} // namespace + namespace android { namespace linkerconfig { namespace contents { @@ -36,10 +45,10 @@ void AddStandardSystemLinks(const Context& ctx, Section* section) { const bool is_section_vndk_enabled = ctx.IsSectionVndkEnabled(); section->ForEachNamespaces([&](Namespace& ns) { if (ns.GetName() != system_ns_name) { + ns.GetLink(system_ns_name).AddSharedLib(kBionicLibs); if (!is_section_vndk_enabled || ns.GetName() != "default") { ns.GetLink(system_ns_name) - .AddSharedLib(Var("STUB_LIBRARIES"), - Var("SANITIZER_RUNTIME_LIBRARIES")); + .AddSharedLib(Var("SANITIZER_RUNTIME_LIBRARIES")); } } }); -- 2.11.0