Improve standalone bcc for on-device compilation.

Bug: 7342767

This adds functionality for driver-writers to dynamically load plugins.
If such a plugin is loaded, we then execute any function called
rsCompilerDriverInit() from it. This function can initialize any other
state the driver-writer wants.

Change-Id: I733a6a3fc59c429a542cfcaf59a57ad231a19d01
diff --git a/lib/Renderscript/RSCompilerDriver.cpp b/lib/Renderscript/RSCompilerDriver.cpp
index 7da3420..346bd2f 100644
--- a/lib/Renderscript/RSCompilerDriver.cpp
+++ b/lib/Renderscript/RSCompilerDriver.cpp
@@ -46,7 +46,7 @@
 
 RSCompilerDriver::RSCompilerDriver(bool pUseCompilerRT) :
     mConfig(NULL), mCompiler(), mCompilerRuntime(NULL), mDebugContext(false),
-    mEnableGlobalMerge(true) {
+    mLinkRuntimeCallback(NULL), mEnableGlobalMerge(true) {
   init::Initialize();
   // Chain the symbol resolvers for compiler_rt and RS runtimes.
   if (pUseCompilerRT) {
@@ -390,8 +390,11 @@
     delete source;
     return false;
   }
+  if (pLinkRuntimeCallback) {
+    setLinkRuntimeCallback(pLinkRuntimeCallback);
+  }
 
-  script->setLinkRuntimeCallback(pLinkRuntimeCallback);
+  script->setLinkRuntimeCallback(getLinkRuntimeCallback());
 
   // Read information from bitcode wrapper.
   bcinfo::BitcodeWrapper wrapper(pBitcode, pBitcodeSize);