Update RS prebuilts and add x86 support.

Change-Id: I0b6a5312d6d76482586d651eaaf6651bed3a1627
diff --git a/renderscript/Android.mk b/renderscript/Android.mk
index 2bc9c5d..76b405a 100644
--- a/renderscript/Android.mk
+++ b/renderscript/Android.mk
@@ -22,7 +22,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := librsjni
-LOCAL_SRC_FILES := lib/$(LOCAL_MODULE).so
+LOCAL_SRC_FILES := lib/$(TARGET_ARCH)/$(LOCAL_MODULE).so
 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_SUFFIX := .so
@@ -33,7 +33,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := libRSSupport
-LOCAL_SRC_FILES := lib/$(LOCAL_MODULE).so
+LOCAL_SRC_FILES := lib/$(TARGET_ARCH)/$(LOCAL_MODULE).so
 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_SUFFIX := .so
diff --git a/renderscript/include/rs_allocation.rsh b/renderscript/include/rs_allocation.rsh
index 46ff3cf..cefd09f 100644
--- a/renderscript/include/rs_allocation.rsh
+++ b/renderscript/include/rs_allocation.rsh
@@ -147,19 +147,29 @@
     rsGetElementAt(rs_allocation, uint32_t x, uint32_t y, uint32_t z);
 
 
-#define GET_ELEMENT_AT(T) \
-static inline T __attribute__((overloadable)) \
-        rsGetElementAt_##T(rs_allocation a, uint32_t x) {  \
-    return ((T *)rsGetElementAt(a, x))[0]; \
-} \
-static inline T __attribute__((overloadable)) \
-        rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y) {  \
-    return ((T *)rsGetElementAt(a, x, y))[0]; \
-} \
-static inline T __attribute__((overloadable)) \
-        rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {  \
-    return ((T *)rsGetElementAt(a, x, y, z))[0]; \
-}
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+    #define GET_ELEMENT_AT(T) \
+    extern T __attribute__((overloadable)) \
+            rsGetElementAt_##T(rs_allocation a, uint32_t x); \
+    extern T __attribute__((overloadable)) \
+            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y);  \
+    extern T __attribute__((overloadable)) \
+            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#else
+    #define GET_ELEMENT_AT(T) \
+    static inline T __attribute__((overloadable)) \
+            rsGetElementAt_##T(rs_allocation a, uint32_t x) {  \
+        return ((T *)rsGetElementAt(a, x))[0]; \
+    } \
+    static inline T __attribute__((overloadable)) \
+            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y) {  \
+        return ((T *)rsGetElementAt(a, x, y))[0]; \
+    } \
+    static inline T __attribute__((overloadable)) \
+            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {  \
+        return ((T *)rsGetElementAt(a, x, y, z))[0]; \
+    }
+#endif
 
 GET_ELEMENT_AT(char)
 GET_ELEMENT_AT(char2)
@@ -289,18 +299,12 @@
 
 #define SET_ELEMENT_AT(T)                                               \
     extern void __attribute__((overloadable))                           \
-    __rsSetElementAt_##T(rs_allocation a, T val, uint32_t x);           \
+    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x);             \
     extern void __attribute__((overloadable))                           \
-    __rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y); \
-                                                                        \
-    static inline void __attribute__((overloadable))                    \
-    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x) {            \
-        __rsSetElementAt_##T(a, val, x);                                \
-    }                                                                   \
-    static inline void __attribute__((overloadable))                    \
-    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y) { \
-        __rsSetElementAt_##T(a, val, x, y);                     \
-    }                                                           \
+    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y); \
+    extern void __attribute__((overloadable))                           \
+    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y, uint32_t z);
+
 
 SET_ELEMENT_AT(char)
 SET_ELEMENT_AT(char2)
diff --git a/renderscript/lib/arm/libRSSupport.so b/renderscript/lib/arm/libRSSupport.so
new file mode 100755
index 0000000..d3a5f0b
--- /dev/null
+++ b/renderscript/lib/arm/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/arm/libclcore.bc b/renderscript/lib/arm/libclcore.bc
new file mode 100644
index 0000000..bc5cf4f
--- /dev/null
+++ b/renderscript/lib/arm/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/arm/libcompiler_rt.a b/renderscript/lib/arm/libcompiler_rt.a
new file mode 100644
index 0000000..8074fc7
--- /dev/null
+++ b/renderscript/lib/arm/libcompiler_rt.a
Binary files differ
diff --git a/renderscript/lib/arm/librsjni.so b/renderscript/lib/arm/librsjni.so
new file mode 100755
index 0000000..5cc5364
--- /dev/null
+++ b/renderscript/lib/arm/librsjni.so
Binary files differ
diff --git a/renderscript/lib/javalib.jar b/renderscript/lib/javalib.jar
index 4002039..693c26c 100644
--- a/renderscript/lib/javalib.jar
+++ b/renderscript/lib/javalib.jar
Binary files differ
diff --git a/renderscript/lib/libRSSupport.so b/renderscript/lib/libRSSupport.so
deleted file mode 100755
index 16736cf..0000000
--- a/renderscript/lib/libRSSupport.so
+++ /dev/null
Binary files differ
diff --git a/renderscript/lib/libclcore.bc b/renderscript/lib/libclcore.bc
deleted file mode 100644
index 9dd4bf3..0000000
--- a/renderscript/lib/libclcore.bc
+++ /dev/null
Binary files differ
diff --git a/renderscript/lib/libcompiler_rt.a b/renderscript/lib/libcompiler_rt.a
deleted file mode 100644
index cd76289..0000000
--- a/renderscript/lib/libcompiler_rt.a
+++ /dev/null
Binary files differ
diff --git a/renderscript/lib/librsjni.so b/renderscript/lib/librsjni.so
deleted file mode 100755
index 0d4020e..0000000
--- a/renderscript/lib/librsjni.so
+++ /dev/null
Binary files differ
diff --git a/renderscript/lib/x86/libRSSupport.so b/renderscript/lib/x86/libRSSupport.so
new file mode 100755
index 0000000..c8e4272
--- /dev/null
+++ b/renderscript/lib/x86/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/x86/libclcore.bc b/renderscript/lib/x86/libclcore.bc
new file mode 100644
index 0000000..bc5cf4f
--- /dev/null
+++ b/renderscript/lib/x86/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/x86/libcompiler_rt.a b/renderscript/lib/x86/libcompiler_rt.a
new file mode 100644
index 0000000..9ecef1d
--- /dev/null
+++ b/renderscript/lib/x86/libcompiler_rt.a
Binary files differ
diff --git a/renderscript/lib/x86/librsjni.so b/renderscript/lib/x86/librsjni.so
new file mode 100755
index 0000000..765056f
--- /dev/null
+++ b/renderscript/lib/x86/librsjni.so
Binary files differ
diff --git a/tools/Android.mk b/tools/Android.mk
index 2623f7b..a6a929e 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -126,6 +126,7 @@
 LOCAL_SRC_FILES := $(HOST_OS)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
 LOCAL_MODULE_CLASS := EXECUTABLES
 LOCAL_MODULE_TAGS := optional
+LOCAL_REQUIRED_MODULES := libLLVM libclang
 LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
 LOCAL_BUILT_MODULE_STEM := llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
 LOCAL_IS_HOST_MODULE := true
@@ -133,6 +134,30 @@
 include $(BUILD_PREBUILT)
 
 ##################################
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libLLVM
+LOCAL_SRC_FILES := $(HOST_OS)/$(LOCAL_MODULE)$(HOST_SHLIB_SUFFIX)
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
+LOCAL_IS_HOST_MODULE := true
+
+include $(BUILD_PREBUILT)
+
+##################################
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libclang
+LOCAL_SRC_FILES := $(HOST_OS)/$(LOCAL_MODULE)$(HOST_SHLIB_SUFFIX)
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
+LOCAL_IS_HOST_MODULE := true
+
+include $(BUILD_PREBUILT)
+
+##################################
 
 endif # TARGET_BUILD_APPS or TARGET_BUILD_PDK
 
diff --git a/tools/darwin/bcc_compat b/tools/darwin/bcc_compat
index 88387e1..eb6de75 100755
--- a/tools/darwin/bcc_compat
+++ b/tools/darwin/bcc_compat
Binary files differ
diff --git a/tools/darwin/libLLVM.dylib b/tools/darwin/libLLVM.dylib
new file mode 100755
index 0000000..54100d8
--- /dev/null
+++ b/tools/darwin/libLLVM.dylib
Binary files differ
diff --git a/tools/darwin/libbcc.dylib b/tools/darwin/libbcc.dylib
index 85f1b04..d056545 100755
--- a/tools/darwin/libbcc.dylib
+++ b/tools/darwin/libbcc.dylib
Binary files differ
diff --git a/tools/darwin/libbcinfo.dylib b/tools/darwin/libbcinfo.dylib
index d7baac9..c0846b0 100755
--- a/tools/darwin/libbcinfo.dylib
+++ b/tools/darwin/libbcinfo.dylib
Binary files differ
diff --git a/tools/darwin/libclang.dylib b/tools/darwin/libclang.dylib
new file mode 100755
index 0000000..e62898c
--- /dev/null
+++ b/tools/darwin/libclang.dylib
Binary files differ
diff --git a/tools/darwin/llvm-rs-cc b/tools/darwin/llvm-rs-cc
index ae58ab2..98cf723 100755
--- a/tools/darwin/llvm-rs-cc
+++ b/tools/darwin/llvm-rs-cc
Binary files differ
diff --git a/tools/linux/bcc_compat b/tools/linux/bcc_compat
index 57b48b4..6a1efd0 100755
--- a/tools/linux/bcc_compat
+++ b/tools/linux/bcc_compat
Binary files differ
diff --git a/tools/linux/libLLVM.so b/tools/linux/libLLVM.so
new file mode 100755
index 0000000..91195c1
--- /dev/null
+++ b/tools/linux/libLLVM.so
Binary files differ
diff --git a/tools/linux/libbcc.so b/tools/linux/libbcc.so
index ebbcb82..7ddf48e 100755
--- a/tools/linux/libbcc.so
+++ b/tools/linux/libbcc.so
Binary files differ
diff --git a/tools/linux/libbcinfo.so b/tools/linux/libbcinfo.so
index f6c05ea..8c222ff 100755
--- a/tools/linux/libbcinfo.so
+++ b/tools/linux/libbcinfo.so
Binary files differ
diff --git a/tools/linux/libclang.so b/tools/linux/libclang.so
new file mode 100755
index 0000000..49a0a14
--- /dev/null
+++ b/tools/linux/libclang.so
Binary files differ
diff --git a/tools/linux/llvm-rs-cc b/tools/linux/llvm-rs-cc
index 0ccd5fe..8448a33 100755
--- a/tools/linux/llvm-rs-cc
+++ b/tools/linux/llvm-rs-cc
Binary files differ