aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiyoung Kim <kiyoungkim@google.com>2020-02-26 13:36:48 +0900
committerGarfield Tan <xutan@google.com>2020-02-26 17:07:42 -0800
commitc016d99023ae6560c1833b91b134ef1e15c2f3eb (patch)
tree5b7aa37cbe564b6b59d1cce13b61946559fc56dd
parent3a9d1a7fbdcab0e1f794519daf5b2c5c2723d922 (diff)
downloadlinkerconfig-c016d99023ae6560c1833b91b134ef1e15c2f3eb.tar.gz
Make sphal and vndk namespace available from legacy devices
linkerconfig failed to complete the execution from ARC++ which was caused by missing vndk variables because ARC++ is legacy device. This change allows linkerconfig to generate ld.config.txt for SWCodec by allowing SPHal and VNDK namespaces even from legacy devices Bug: 149914078 Test: m -j passed Test: Tested from ARC++ w/ betty Change-Id: I5412434f0d2b3b69b916ca512828498a7eba72a3
-rw-r--r--contents/namespace/sphal.cc16
-rw-r--r--contents/section/apexdefault.cc5
2 files changed, 13 insertions, 8 deletions
diff --git a/contents/namespace/sphal.cc b/contents/namespace/sphal.cc
index 74858fb..71f41a7 100644
--- a/contents/namespace/sphal.cc
+++ b/contents/namespace/sphal.cc
@@ -45,13 +45,15 @@ Namespace BuildSphalNamespace([[maybe_unused]] const Context& ctx) {
ns.AddPermittedPath("/system/vendor/${LIB}", AsanPath::NONE);
if (ctx.IsApexBinaryConfig()) {
- ns.GetLink("vndk").AddSharedLib(
- Var("VNDK_SAMEPROCESS_LIBRARIES_VENDOR", ""));
- ns.GetLink(ctx.GetSystemNamespaceName())
- .AddSharedLib(Var("LLNDK_LIBRARIES_VENDOR", ""),
- // Add a link for libz.so which is llndk on
- // devices where VNDK is not enforced.
- "libz.so");
+ if (ctx.IsVndkAvailable()) {
+ ns.GetLink("vndk").AddSharedLib(
+ Var("VNDK_SAMEPROCESS_LIBRARIES_VENDOR", ""));
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib(Var("LLNDK_LIBRARIES_VENDOR", ""));
+ }
+
+ // 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/contents/section/apexdefault.cc b/contents/section/apexdefault.cc
index 041fe80..24b2834 100644
--- a/contents/section/apexdefault.cc
+++ b/contents/section/apexdefault.cc
@@ -43,7 +43,10 @@ Section BuildApexDefaultSection(Context& ctx, const ApexInfo& apex_info) {
// namespace(s)
if (apex_info.name == "com.android.media.swcodec") {
namespaces.emplace_back(BuildSphalNamespace(ctx));
- namespaces.emplace_back(BuildVndkNamespace(ctx, VndkUserPartition::Vendor));
+ if (ctx.IsVndkAvailable()) {
+ namespaces.emplace_back(
+ BuildVndkNamespace(ctx, VndkUserPartition::Vendor));
+ }
}
return BuildSection(ctx, apex_info.name, std::move(namespaces), {});