diff options
author | Stephen Hines <srhines@google.com> | 2015-06-22 14:51:30 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2015-06-23 15:45:31 -0700 |
commit | 7427a2546ecfa904cb4e580981f0419c628fc416 (patch) | |
tree | 30d69778a9edad36b5ba9f5cb30a1b436a38edb9 | |
parent | ea2e4d37418c6ada5d3c8cd08b8e60348dd46790 (diff) | |
download | android_frameworks_rs-7427a2546ecfa904cb4e580981f0419c628fc416.tar.gz android_frameworks_rs-7427a2546ecfa904cb4e580981f0419c628fc416.tar.bz2 android_frameworks_rs-7427a2546ecfa904cb4e580981f0419c628fc416.zip |
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
(cherry picked from commit 6a236ad3a3760e8124b68a1b6220ed6e4fbfb152)
-rw-r--r-- | cpu_ref/rsCpuScript.cpp | 23 | ||||
-rw-r--r-- | cpu_ref/rsCpuScript.h | 6 |
2 files changed, 18 insertions, 11 deletions
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp index decafc6c..ea577bc8 100644 --- a/cpu_ref/rsCpuScript.cpp +++ b/cpu_ref/rsCpuScript.cpp @@ -48,12 +48,6 @@ #include <iostream> #include <sstream> -#ifdef __LP64__ -#define SYSLIBPATH "/system/lib64" -#else -#define SYSLIBPATH "/system/lib" -#endif - namespace { static const bool kDebugGlobalVariables = false; @@ -155,7 +149,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'); @@ -346,7 +353,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, diff --git a/cpu_ref/rsCpuScript.h b/cpu_ref/rsCpuScript.h index efbb39f9..29df27ab 100644 --- a/cpu_ref/rsCpuScript.h +++ b/cpu_ref/rsCpuScript.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef RSD_BCC_H -#define RSD_BCC_H +#ifndef RSD_CPU_SCRIPT_H +#define RSD_CPU_SCRIPT_H #include <rs_hal.h> #include <rsRuntime.h> @@ -168,4 +168,4 @@ uint32_t constructBuildChecksum(uint8_t const *bitcode, size_t bitcodeSize, } -#endif +#endif // RSD_CPU_SCRIPT_H |