summaryrefslogtreecommitdiff
path: root/cpu_ref
diff options
context:
space:
mode:
authorLuke Drummond <luke.drummond@codeplay.com>2016-12-15 12:40:55 +0000
committerDavid Gross <dgross@google.com>2017-04-12 13:30:52 -0700
commit341f30630d310f52297cf2d9867618cb7a1e8969 (patch)
treeace179c6ae0761e75c9aff6ca0f144a0a14ec6e0 /cpu_ref
parent588f7ed70496a440ba69ea2991ea52b63c50d333 (diff)
downloadrs-341f30630d310f52297cf2d9867618cb7a1e8969.tar.gz
Add .rs.info versionInfo parser to the cpu_ref driver
This is used by lldb to check for a versioning mismatch between the frontent and backend, but is not used by libRS. However, libRS should not fail in its presence, so this CL enables the runtime to skip this section if it is present. This field is not checked for by the compatibility lib. Test: aosp_x86_64-eng (emulator) - libbcc/tests - RsTest (32-bit, 64-bit) - cts -m RenderscriptTest - rs/lldb (required various other pending CLs) Change-Id: I3056dd08e7e14ff1094ead60756fd568131bcf4d Signed-off-by: Luke Drummond <luke.drummond@codeplay.com>
Diffstat (limited to 'cpu_ref')
-rw-r--r--cpu_ref/rsCpuExecutable.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/cpu_ref/rsCpuExecutable.cpp b/cpu_ref/rsCpuExecutable.cpp
index 400a465d..ad45eba9 100644
--- a/cpu_ref/rsCpuExecutable.cpp
+++ b/cpu_ref/rsCpuExecutable.cpp
@@ -272,6 +272,7 @@ void* SharedLibraryUtils::loadSOHelper(const char *origName, const char *cacheDi
#define PRAGMA_STR "pragmaCount: "
#define THREADABLE_STR "isThreadable: "
#define CHECKSUM_STR "buildChecksum: "
+#define VERSIONINFO_STR "versionInfo: "
// Copy up to a newline or size chars from str -> s, updating str
// Returns s when successful and nullptr when '\0' is finally reached.
@@ -666,6 +667,26 @@ ScriptExecutable* ScriptExecutable::createFromSharedObject(
goto error;
}
+ {
+ // Parse the version info string, but ignore its contents as it's only
+ // used by the debugger
+ size_t nLines = 0;
+ if (strgets(line, MAXLINE, &rsInfo) != nullptr) {
+ if (sscanf(line, VERSIONINFO_STR "%zu", &nLines) != 1) {
+ ALOGE("invalid versionInfo count");
+ goto error;
+ } else {
+ // skip the versionInfo packet as libRs doesn't use it
+ while (nLines--) {
+ if (strgets(line, MAXLINE, &rsInfo) == nullptr)
+ goto error;
+ }
+ }
+ } else {
+ ALOGE(".rs.info is missing versionInfo section");
+ }
+ }
+
#endif // RS_COMPATIBILITY_LIB
// Read in information about mutable global variables provided by bcc's