summaryrefslogtreecommitdiff
path: root/cpu_ref/rsCpuScript.cpp
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2015-06-22 14:51:30 -0700
committerStephen Hines <srhines@google.com>2015-06-22 14:51:30 -0700
commit6a236ad3a3760e8124b68a1b6220ed6e4fbfb152 (patch)
treeb672f909af13611367cd745619bc1530038ff703 /cpu_ref/rsCpuScript.cpp
parent31f95369d605fdd0d6ef66c8d0fc411f848c3daf (diff)
downloadrs-6a236ad3a3760e8124b68a1b6220ed6e4fbfb152.tar.gz
Skip the checksum if we have precompiled code on the /system/ partition.
Bug: 20894664 The system partition is read-only, and can/should be compiled correctly during the offline creation of the system image. Since we cannot replace these precompiled blobs (short of app update/OTA), there is no reason or correct way to validate/replace the checksum. Change-Id: Ia66bfdbe178bf215e146c3699f5bc7804222e978
Diffstat (limited to 'cpu_ref/rsCpuScript.cpp')
-rw-r--r--cpu_ref/rsCpuScript.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 8c6e5843..b95d8f79 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -46,12 +46,6 @@
#include <iostream>
#include <sstream>
-#ifdef __LP64__
-#define SYSLIBPATH "/system/lib64"
-#else
-#define SYSLIBPATH "/system/lib"
-#endif
-
namespace {
static const bool kDebugGlobalVariables = false;
@@ -153,7 +147,20 @@ static bool compileBitcode(const std::string &bcFileName,
compileArguments.size()-1, compileArguments.data());
}
-bool isChecksumNeeded() {
+// The checksum is unnecessary under a few conditions, since the primary
+// use-case for it is debugging. If we are loading something from the
+// system partition (read-only), we know that it was precompiled as part of
+// application ahead of time (and thus the checksum is completely
+// unnecessary). The checksum is also unnecessary on release (non-debug)
+// builds, as the only way to get a shared object is to have compiled the
+// script once already. On a release build, there is no way to adjust the
+// other libraries/dependencies, and so the only reason to recompile would
+// be for a source APK change or an OTA. In either case, the APK would be
+// reinstalled, which would already clear the code_cache/ directory.
+bool isChecksumNeeded(const char *cacheDir) {
+ if ((::strcmp(SYSLIBPATH, cacheDir) == 0) ||
+ (::strcmp(SYSLIBPATH_VENDOR, cacheDir) == 0))
+ return false;
char buf[PROPERTY_VALUE_MAX];
property_get("ro.debuggable", buf, "");
return (buf[0] == '1');
@@ -322,7 +329,7 @@ bool RsdCpuScriptImpl::init(char const *resName, char const *cacheDir,
useRSDebugContext, bccPluginName, emitGlobalInfo,
emitGlobalInfoSkipConstant);
- mChecksumNeeded = isChecksumNeeded();
+ mChecksumNeeded = isChecksumNeeded(cacheDir);
if (mChecksumNeeded) {
std::vector<const char *> bccFiles = { BCC_EXE_PATH,
core_lib,