From b38d2f5ff392ed33e540ebb879c976614b7c8a2f Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Tue, 31 Mar 2020 14:47:32 +0900 Subject: [PATCH] Move libz from VNDKSP to LLNDK in case of VNDK Lite In case of VNDK Lite libz should be listed in LLNDK rather than VNDKSP. This process has been missed while we move the logic to linkerconfig. This change updates library list based on the library file name in case of VNDK lite device. Bug: 141908078 Test: m -j passed Change-Id: I22eb76619c1242ab26c1d611a08b98177b08285c --- contents/namespace/sphal.cc | 6 +++--- generator/librarylistloader.cc | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/contents/namespace/sphal.cc b/contents/namespace/sphal.cc index 71f41a7..07bf2a8 100644 --- a/contents/namespace/sphal.cc +++ b/contents/namespace/sphal.cc @@ -50,10 +50,10 @@ Namespace BuildSphalNamespace([[maybe_unused]] const Context& ctx) { Var("VNDK_SAMEPROCESS_LIBRARIES_VENDOR", "")); ns.GetLink(ctx.GetSystemNamespaceName()) .AddSharedLib(Var("LLNDK_LIBRARIES_VENDOR", "")); + } else { + // Add a link for libz.so which is llndk on devices where VNDK is not enforced. + ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("libz.so"); } - - // Add a link for libz.so which is llndk on devices where VNDK is not enforced. - ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("libz.so"); } else { // Once in this namespace, access to libraries in /system/lib is restricted. // Only libs listed here can be used. Order is important here as the diff --git a/generator/librarylistloader.cc b/generator/librarylistloader.cc index 7ee7262..7481e8d 100644 --- a/generator/librarylistloader.cc +++ b/generator/librarylistloader.cc @@ -25,6 +25,7 @@ #include #include +#include "linkerconfig/environment.h" #include "linkerconfig/log.h" using LibraryList = std::set; @@ -54,6 +55,17 @@ Result GetLibrariesFromFile(std::string file_path) { } } + // TODO (b/122954981) : Remove this part when VNDK Lite is deprecated + // In case of VNDK-lite devices, libz should be included in LLNDK rather than + // VNDK-SP libraries + if (android::linkerconfig::modules::IsVndkLiteDevice()) { + if (file_path.find("llndk") != std::string::npos) { + library_list.insert("libz.so"); + } else if (file_path.find("vndksp") != std::string::npos) { + library_list.erase("libz.so"); + } + } + library_file_cache.insert({file_path, library_list}); return library_list; -- 2.11.0