bcc vendor plugin must be loaded from the sphal namespace
bcc loads vendor plugin in its address space. Since bcc is a system
process, the vendor plugin must be loaded from the sphal namespace where
VNDK-SP libraries are provided. This is to ensure that the vendor plugin
is linked against to the VNDK-SP version of libraries. It also prevents
the vendor plugin from using non-VNDK-SP libs such as libLLVM.so.
Bug: 62517583
Test: a sample renderscript app (CameraScript) runs well
Change-Id: Id014cc4f3ea2d3980b11ef219422457e356124a5
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 60d08be..f2f3d2e 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -108,7 +108,13 @@
// Only load additional libraries for compiles that don't use
// the debug context.
if (bccPluginName && strlen(bccPluginName) > 0) {
+#ifdef __ANDROID__
+ // For Android, -plugin option must be used in order to load the
+ // vendor plugin from the sphal namespace.
+ args->push_back("-plugin");
+#else
args->push_back("-load");
+#endif
args->push_back(bccPluginName);
}
}