Build host valgrind binaries (x86 and amd64)

  Also fixed the problem with memset within memset
  recursive call because of clang x86_64 codegen (see TODO).

Bug: 17936452
Change-Id: I43a0ed3645925efad94456285a3c8805d5833573
diff --git a/main/Android.build_all.mk b/main/Android.build_all.mk
index 1f17490..606e74c 100644
--- a/main/Android.build_all.mk
+++ b/main/Android.build_all.mk
@@ -12,8 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-vg_local_arch_cflags := $(target_arch_cflags)
-vg_local_2nd_arch_cflags := $(target_2nd_arch_cflags)
+vg_local_target_arch_cflags := $(target_arch_cflags)
+vg_local_target_2nd_arch_cflags := $(target_2nd_arch_cflags)
 vg_build_second_arch := false
 include $(LOCAL_PATH)/Android.build_one.mk
 
@@ -23,6 +23,14 @@
   include $(LOCAL_PATH)/Android.build_one.mk
 endif
 
+vg_build_second_arch := false
+vg_local_host_arch_cflags := $(host_arch_cflags)
+include $(LOCAL_PATH)/Android.build_host.mk
+
+vg_build_second_arch := true
+vg_local_host_arch_cflags := $(host_2nd_arch_cflags)
+include $(LOCAL_PATH)/Android.build_host.mk
+
 # clean vg_locals
 include $(LOCAL_PATH)/Android.clean.mk
 
diff --git a/main/Android.build_host.mk b/main/Android.build_host.mk
new file mode 100644
index 0000000..adf3fdc
--- /dev/null
+++ b/main/Android.build_host.mk
@@ -0,0 +1,71 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include $(CLEAR_VARS)
+
+ifeq ($(vg_build_second_arch),true)
+  LOCAL_MULTILIB := 32
+  vg_local_arch := x86
+else
+  LOCAL_MULTILIB := first
+  vg_local_arch := amd64
+endif
+
+# TODO: This workaround is to avoid calling memset from VG(memset)
+# wrapper because of invalid clang optimization; This seems to be
+# limited to amd64/x86 codegen(?);
+LOCAL_CLANG := false
+
+LOCAL_MODULE := $(vg_local_module)-$(vg_local_arch)-linux
+
+LOCAL_SRC_FILES := $(vg_local_src_files)
+
+LOCAL_C_INCLUDES := $(common_includes) $(vg_local_c_includes)
+
+LOCAL_CFLAGS := $(vg_local_cflags) $(vg_local_host_arch_cflags)
+
+LOCAL_ASFLAGS := $(common_cflags) $(vg_local_host_arch_cflags)
+
+LOCAL_LDFLAGS := $(vg_local_ldflags) -lpthread
+
+LOCAL_MODULE_CLASS := $(vg_local_module_class)
+
+LOCAL_STATIC_LIBRARIES := \
+    $(foreach l,$(vg_local_static_libraries),$l-$(vg_local_arch)-linux)
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+    $(foreach l,$(vg_local_whole_static_libraries),$l-$(vg_local_arch)-linux)
+
+ifeq ($(vg_local_target),EXECUTABLE)
+  LOCAL_FORCE_STATIC_EXECUTABLE := true
+  LOCAL_NO_FPIE := true
+endif
+
+ifneq ($(vg_local_target),STATIC_LIBRARY)
+  LOCAL_MODULE_PATH=$(HOST_OUT)/lib64/valgrind
+endif
+
+ifeq ($(vg_local_without_system_shared_libraries),true)
+  LOCAL_SYSTEM_SHARED_LIBRARIES :=
+  # for host 32 bit we need -static-libgcc
+  LOCAL_LDFLAGS += -lgcc
+endif
+
+ifeq ($(vg_local_no_crt),true)
+  LOCAL_NO_CRT := true
+endif
+
+LOCAL_CXX_STL := none
+LOCAL_ADDRESS_SANITIZER := false
+
+include $(BUILD_HOST_$(vg_local_target))
diff --git a/main/Android.build_one.mk b/main/Android.build_one.mk
index ea9fbec..61465a7 100644
--- a/main/Android.build_one.mk
+++ b/main/Android.build_one.mk
@@ -14,16 +14,22 @@
 
 include $(CLEAR_VARS)
 
+LOCAL_ARM_MODE := arm
 ifeq ($(vg_build_second_arch),true)
 LOCAL_MULTILIB := 32
-LOCAL_ARM_MODE := arm
 vg_local_arch := $(TARGET_2ND_ARCH)
 else
 LOCAL_MULTILIB := first
-LOCAL_ARM_MODE := arm64
 vg_local_arch  := $(vg_arch)
 endif
 
+# TODO: This workaround is to avoid calling memset from VG(memset)
+# wrapper because of invalid clang optimization; This seems to be
+# limited to amd64/x86 codegen(?);
+ifeq ($(filter $TARGET_ARCH,x86 x86_64),)
+  LOCAL_CLANG := false
+endif
+
 LOCAL_MODULE := $(vg_local_module)-$(vg_local_arch)-linux
 
 LOCAL_SRC_FILES := $(vg_local_src_files)
@@ -31,12 +37,12 @@
 LOCAL_C_INCLUDES := $(common_includes) $(vg_local_c_includes)
 
 LOCAL_CFLAGS := $(vg_local_cflags)
-LOCAL_CFLAGS_$(TARGET_ARCH) := $(vg_local_arch_cflags)
-LOCAL_CFLAGS_$(TARGET_2ND_ARCH) := $(vg_local_2nd_arch_cflags)
+LOCAL_CFLAGS_$(TARGET_ARCH) := $(vg_local_target_arch_cflags)
+LOCAL_CFLAGS_$(TARGET_2ND_ARCH) := $(vg_local_target_2nd_arch_cflags)
 
 LOCAL_ASFLAGS := $(common_cflags)
-LOCAL_ASFLAGS_$(TARGET_ARCH) := $(vg_local_arch_cflags)
-LOCAL_ASFLAGS_$(TARGET_2ND_ARCH) := $(vg_local_2nd_arch_cflags)
+LOCAL_ASFLAGS_$(TARGET_ARCH) := $(vg_local_target_arch_cflags)
+LOCAL_ASFLAGS_$(TARGET_2ND_ARCH) := $(vg_local_target_2nd_arch_cflags)
 
 
 LOCAL_LDFLAGS := $(vg_local_ldflags)
@@ -50,10 +56,11 @@
 
 ifeq ($(vg_local_target),EXECUTABLE)
   LOCAL_FORCE_STATIC_EXECUTABLE := true
+  LOCAL_NO_FPIE := true
 endif
 
 ifneq ($(vg_local_target),STATIC_LIBRARY)
-  LOCAL_MODULE_PATH=$(PRODUCT_OUT)$(vg_module_path)
+  LOCAL_MODULE_PATH=$(PRODUCT_OUT)$(vg_target_module_path)
 endif
 
 ifeq ($(vg_local_without_system_shared_libraries),true)
diff --git a/main/Android.clean.mk b/main/Android.clean.mk
index a85907d..31ae7f4 100644
--- a/main/Android.clean.mk
+++ b/main/Android.clean.mk
@@ -23,5 +23,7 @@
 vg_local_without_system_shared_libraries :=
 vg_local_no_crt :=
 vg_local_cflags :=
-vg_local_arch_cflags :=
+vg_local_host_arch_cflags :=
+vg_local_target_arch_cflags :=
+vg_local_target_2nd_arch_cflags :=
 vg_local_c_includes :=
diff --git a/main/Android.mk b/main/Android.mk
index 53bf178..9966e03 100644
--- a/main/Android.mk
+++ b/main/Android.mk
@@ -31,33 +31,43 @@
 	-DVGO_linux=1 \
 	-DANDROID_SYMBOLS_DIR=\"/data/local/symbols\"
 
+ifeq ($(TARGET_IS_64_BIT),true)
+  vg_target_module_path := /system/lib64/valgrind
+else
+  vg_target_module_path := /system/lib/valgrind
+endif
+
 target_arch_cflags := \
 	-DVGA_$(vg_arch)=1 \
 	-DVGP_$(vg_arch)_linux=1 \
 	-DVGPV_$(vg_arch)_linux_android=1 \
+	-DVG_LIBDIR=\"$(vg_target_module_path)\" \
 	-DVG_PLATFORM=\"$(vg_arch)-linux\"
 
-ifeq ($(TARGET_IS_64_BIT),true)
-  vg_module_path := /system/lib64/valgrind
-else
-  vg_module_path := /system/lib/valgrind
-endif
-
-vg_libdir := \"$(vg_module_path)\"
-
-target_arch_cflags+=-DVG_LIBDIR=$(vg_libdir)
-
 ifdef TARGET_2ND_ARCH
 target_2nd_arch_cflags := \
 	-DVGA_$(TARGET_2ND_ARCH)=1 \
 	-DVGP_$(TARGET_2ND_ARCH)_linux=1 \
 	-DVGPV_$(TARGET_2ND_ARCH)_linux_android=1 \
-    -DVG_LIBDIR=$(vg_libdir) \
+	-DVG_LIBDIR=\"$(vg_target_module_path)\" \
 	-DVG_PLATFORM=\"$(TARGET_2ND_ARCH)-linux\"
 vg_second_arch := $(TARGET_2ND_ARCH)
 
 endif
 
+# The supported host platform are linux amd64 and linux x86
+host_arch_cflags := \
+  -DVGA_amd64=1 \
+  -DVGP_amd64_linux=1 \
+  -DVG_PLATFORM=\"amd64-linux\" \
+  -DVG_LIBDIR=\"$(realpath $(HOST_OUT_SHARED_LIBRARIES))/valgrind\"
+
+host_2nd_arch_cflags := \
+  -DVGA_x86=1 \
+  -DVGP_x86_linux=1 \
+  -DVG_PLATFORM=\"x86-linux\" \
+  -DVG_LIBDIR=\"$(realpath $(HOST_OUT_SHARED_LIBRARIES))/valgrind\"
+
 common_includes := \
 	external/valgrind/main \
 	external/valgrind/main/include \
@@ -67,8 +77,7 @@
 vex_ldflags := -nodefaultlibs
 
 ifeq (,$(filter $(TARGET_ARCH),arm arm64))
-tool_ldflags := -static -Wl,--build-id=none,-Ttext=0x38000000 -nodefaultlibs -nostartfiles -u _start -e_start
-
+tool_ldflags := -static -Wl,--build-id=none,-Ttext=0x38000000 -nodefaultlibs -nostartfiles -Wl,-e,_start
 # ioctl/syscall wrappers are device dependent
 ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),manta)
 ANDROID_HARDWARE := ANDROID_HARDWARE_nexus_10
@@ -79,7 +88,7 @@
 endif
 
 else
-tool_ldflags := -static -Wl,-Ttext=0x38000000 -nodefaultlibs -nostartfiles -u _start -e_start
+tool_ldflags := -static -Wl,-Ttext=0x38000000 -nodefaultlibs -nostartfiles -Wl,-e,_start
 endif
 
 common_cflags += -D$(ANDROID_HARDWARE)
@@ -368,11 +377,6 @@
 
 include $(LOCAL_PATH)/Android.build_all.mk
 
-#LOCAL_STRIP_MODULE := false
-#vg_local_no_crt := true
-#LOCAL_PRELINK_MODULE := false
-
-
 # Build cachegrind-$(TARGET_ARCH)-linux
 vg_local_module := cachegrind
 vg_local_module_class := SHARED_LIBRARIES
@@ -502,9 +506,7 @@
 vg_local_module := vgpreload_drd
 vg_local_module_class := SHARED_LIBRARIES
 vg_local_target := SHARED_LIBRARY
-#LOCAL_STRIP_MODULE := false
 vg_local_no_crt := true
-#LOCAL_PRELINK_MODULE := false
 
 vg_local_src_files := \
 	drd/drd_pthread_intercepts.c \
@@ -522,7 +524,6 @@
 vg_local_module := massif
 vg_local_module_class := SHARED_LIBRARIES
 vg_local_target := EXECUTABLE
-#LOCAL_FORCE_STATIC_EXECUTABLE := true
 vg_local_no_crt := true
 vg_local_without_system_shared_libraries := true
 
@@ -540,11 +541,8 @@
 vg_local_module := vgpreload_massif
 vg_local_module_class := SHARED_LIBRARIES
 vg_local_target := SHARED_LIBRARY
-#LOCAL_STRIP_MODULE := false
 vg_local_no_crt := true
 
-#LOCAL_PRELINK_MODULE := false
-
 vg_local_src_files :=
 
 vg_local_ldflags := $(preload_ldflags)
@@ -558,7 +556,6 @@
 vg_local_module_class := SHARED_LIBRARIES
 vg_local_target := EXECUTABLE
 
-#LOCAL_FORCE_STATIC_EXECUTABLE := true
 vg_local_no_crt := true
 vg_local_without_system_shared_libraries := true
 
@@ -586,8 +583,20 @@
 
 include $(BUILD_EXECUTABLE)
 
+# Build valgrind for host
+include $(CLEAR_VARS)
+LOCAL_MODULE := valgrind
+LOCAL_SRC_FILES := \
+	coregrind/launcher-linux.c \
+	coregrind/m_debuglog.c
+
+LOCAL_C_INCLUDES := $(common_includes)
+LOCAL_CFLAGS := $(common_cflags) $(host_arch_cflags)
+
+include $(BUILD_HOST_EXECUTABLE)
+
 #vg_build_tests := true
-# Build tests (one of them)...
+# Build tests (some of them)...
 # TODO: tests need separate build framework it terms of 2ND_ARCH
 ifeq ($(vg_build_tests),true)
 ifeq ($(TARGET_ARCH),arm)
@@ -609,12 +618,20 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE := default.supp
 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_MODULE_PATH := $(PRODUCT_OUT)$(vg_module_path)
+LOCAL_MODULE_PATH := $(PRODUCT_OUT)$(vg_target_module_path)
 LOCAL_STRIP_MODULE := false
 LOCAL_SRC_FILES := bionic.supp
 
 include $(BUILD_PREBUILT)
 
-#include bionic/libc/Android.mk
+include $(CLEAR_VARS)
+LOCAL_IS_HOST_MODULE := true
+LOCAL_MODULE := default.supp
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_PATH := $(HOST_OUT_SHARED_LIBRARIES)/valgrind
+LOCAL_STRIP_MODULE := false
+LOCAL_SRC_FILES := bionic.supp
+
+include $(BUILD_PREBUILT)
 
 endif
diff --git a/main/config.h b/main/config.h
index 3bc4524..070244f 100644
--- a/main/config.h
+++ b/main/config.h
@@ -1,8 +1,11 @@
 /* config.h.  Generated from config.h.in by configure.  */
-/* config.h.in.  Generated from configure.in by autoheader.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
 
 /* Define to 1 if you're using Bionic */
-#define BIONIC_LIBC 1
+/* #undef BIONIC_LIBC */
+
+/* DARWIN_VERS value for Mac OS X 10.10 */
+/* #undef DARWIN_10_10 */
 
 /* DARWIN_VERS value for Mac OS X 10.5 */
 /* #undef DARWIN_10_5 */
@@ -16,6 +19,9 @@
 /* DARWIN_VERS value for Mac OS X 10.8 */
 /* #undef DARWIN_10_8 */
 
+/* DARWIN_VERS value for Mac OS X 10.9 */
+/* #undef DARWIN_10_9 */
+
 /* Define to 1 if you're using Darwin */
 /* #undef DARWIN_LIBC */
 
@@ -31,59 +37,16 @@
 /* path to GDB */
 #define GDB_PATH "/usr/bin/gdb"
 
-/* Define to 1 if you're using glibc 2.10.x */
-/* #undef GLIBC_2_10 */
+/* Define to 1 if index() and strlen() have been optimized heavily (x86 glibc
+   >= 2.12) */
+#ifndef __ANDROID__
+#define GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT 1
+#endif
 
-/* Define to 1 if you're using glibc 2.11.x */
-/* #dundef GLIBC_2_11 1 */
-
-/* Define to 1 if you're using glibc 2.12.x */
-/* #undef GLIBC_2_12 */
-
-/* Define to 1 if you're using glibc 2.13.x */
-/* #undef GLIBC_2_13 */
-
-/* Define to 1 if you're using glibc 2.14.x */
-/* #undef GLIBC_2_14 */
-
-/* Define to 1 if you're using glibc 2.15.x */
-/* #undef GLIBC_2_15 */
-
-/* Define to 1 if you're using glibc 2.16.x */
-/* #undef GLIBC_2_16 */
-
-/* Define to 1 if you're using glibc 2.17.x */
-/* #undef GLIBC_2_17 */
-
-/* Define to 1 if you're using glibc 2.18.x */
-/* #undef GLIBC_2_18 */
-
-/* Define to 1 if you're using glibc 2.19.x */
-/* #undef GLIBC_2_19 */
-
-/* Define to 1 if you're using glibc 2.2.x */
-/* #undef GLIBC_2_2 */
-
-/* Define to 1 if you're using glibc 2.3.x */
-/* #undef GLIBC_2_3 */
-
-/* Define to 1 if you're using glibc 2.4.x */
-/* #undef GLIBC_2_4 */
-
-/* Define to 1 if you're using glibc 2.5.x */
-/* #undef GLIBC_2_5 */
-
-/* Define to 1 if you're using glibc 2.6.x */
-/* #undef GLIBC_2_6 */
-
-/* Define to 1 if you're using glibc 2.7.x */
-/* #undef GLIBC_2_7 */
-
-/* Define to 1 if you're using glibc 2.8.x */
-/* #undef GLIBC_2_8 */
-
-/* Define to 1 if you're using glibc 2.9.x */
-/* #undef GLIBC_2_9 */
+/* Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10) */
+#ifndef __ANDROID__
+#define GLIBC_MANDATORY_STRLEN_REDIRECT 1
+#endif
 
 /* Define to 1 if gcc/as can do Altivec. */
 /* #undef HAS_ALTIVEC */
@@ -99,11 +62,20 @@
 
 /* Define to 1 if gcc supports __sync_bool_compare_and_swap() and
    __sync_add_and_fetch() for the primary target */
-/* #undef HAVE_BUILTIN_ATOMIC */
+#define HAVE_BUILTIN_ATOMIC 1
 
 /* Define to 1 if g++ supports __sync_bool_compare_and_swap() and
    __sync_add_and_fetch() */
-/* #undef HAVE_BUILTIN_ATOMIC_CXX */
+#define HAVE_BUILTIN_ATOMIC_CXX 1
+
+/* Define to 1 if compiler provides __builtin_clz(). */
+#define HAVE_BUILTIN_CLZ 1
+
+/* Define to 1 if compiler provides __builtin_ctz(). */
+#define HAVE_BUILTIN_CTZ 1
+
+/* Define to 1 if compiler provides __builtin_popcount(). */
+#define HAVE_BUILTIN_POPCOUT 1
 
 /* Define to 1 if you have the `clock_gettime' function. */
 #define HAVE_CLOCK_GETTIME 1
@@ -111,6 +83,11 @@
 /* Define to 1 if you have the `CLOCK_MONOTONIC' constant. */
 #define HAVE_CLOCK_MONOTONIC 1
 
+/* Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID. */
+#ifndef __ANDROID__
+#define HAVE_DLINFO_RTLD_DI_TLS_MODID 1
+#endif
+
 /* Define to 1 if you have the <endian.h> header file. */
 #define HAVE_ENDIAN_H 1
 
@@ -169,13 +146,19 @@
 #define HAVE_PPOLL 1
 
 /* Define to 1 if you have the `process_vm_readv' function. */
-/* #undef HAVE_PROCESS_VM_READV */
+#ifndef __ANDROID__
+#define HAVE_PROCESS_VM_READV 1
+#endif
 
 /* Define to 1 if you have the `process_vm_writev' function. */
-/* #undef HAVE_PROCESS_VM_WRITEV */
+#ifndef __ANDROID__
+#define HAVE_PROCESS_VM_WRITEV 1
+#endif
 
 /* Define to 1 if you have the `pthread_barrier_init' function. */
-/* #undef HAVE_PTHREAD_BARRIER_INIT */
+#ifndef __ANDROID__
+#define HAVE_PTHREAD_BARRIER_INIT 1
+#endif
 
 /* Define to 1 if you have the `pthread_condattr_setclock' function. */
 #define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
@@ -184,7 +167,9 @@
 /* #undef HAVE_PTHREAD_CREATE_GLIBC_2_0 */
 
 /* Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant. */
-/* #undef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
+#ifndef __ANDROID__
+#define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 1
+#endif
 
 /* Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant. */
 #define HAVE_PTHREAD_MUTEX_ERRORCHECK_NP 1
@@ -196,7 +181,9 @@
 #define HAVE_PTHREAD_MUTEX_TIMEDLOCK 1
 
 /* Define to 1 if pthread_mutex_t has a member __data.__kind. */
-/* #undef HAVE_PTHREAD_MUTEX_T__DATA__KIND */
+#ifndef __ANDROID__
+#define HAVE_PTHREAD_MUTEX_T__DATA__KIND 1
+#endif
 
 /* Define to 1 if pthread_mutex_t has a member called __m_kind. */
 /* #undef HAVE_PTHREAD_MUTEX_T__M_KIND */
@@ -218,7 +205,9 @@
 #define HAVE_PTHREAD_SETNAME_NP 1
 
 /* Define to 1 if you have the `pthread_spin_lock' function. */
-/* #undef HAVE_PTHREAD_SPIN_LOCK */
+#ifndef __ANDROID__
+#define HAVE_PTHREAD_SPIN_LOCK 1
+#endif
 
 /* Define to 1 if you have the `pthread_yield' function. */
 #define HAVE_PTHREAD_YIELD 1
@@ -233,7 +222,9 @@
 #define HAVE_SEMTIMEDOP 1
 
 /* Define to 1 if libstd++ supports annotating shared pointers */
-/* #undef HAVE_SHARED_POINTER_ANNOTATION */
+#ifndef __ANDROID__
+#define HAVE_SHARED_POINTER_ANNOTATION 1
+#endif
 
 /* Define to 1 if you have the `signalfd' function. */
 #define HAVE_SIGNALFD 1
@@ -272,7 +263,7 @@
 #define HAVE_SYSCALL 1
 
 /* Define to 1 if you have the <sys/endian.h> header file. */
-#define HAVE_SYS_ENDIAN_H 1
+/* #undef HAVE_SYS_ENDIAN_H 1 */
 
 /* Define to 1 if you have the <sys/epoll.h> header file. */
 #define HAVE_SYS_EPOLL_H 1
@@ -307,6 +298,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #define HAVE_SYS_TYPES_H 1
 
+/* Define to 1 if <sys/user.h> defines struct user_regs_struct */
+#define HAVE_SYS_USER_REGS 1
+
 /* can use __thread to define thread-local variables */
 #define HAVE_TLS 1
 
@@ -328,9 +322,6 @@
 /* configured default page size 4k */
 #define MIPS_PAGE_SHIFT 12
 
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-/* #undef NO_MINUS_C_MINUS_O */
-
 /* Name of package */
 #define PACKAGE "valgrind"
 
@@ -341,7 +332,7 @@
 #define PACKAGE_NAME "Valgrind"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "Valgrind 3.10.0.SVN"
+#define PACKAGE_STRING "Valgrind 3.11.0.SVN.aosp"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "valgrind"
@@ -350,10 +341,7 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "3.10.0.SVN"
-
-/* configured memory alignment 2*PAGE_SIZE */
-#define SHM_ALIGNMENT 2*(1UL << MIPS_PAGE_SHIFT)
+#define PACKAGE_VERSION "3.11.0.SVN.aosp"
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
@@ -362,10 +350,14 @@
 #define TIME_WITH_SYS_TIME 1
 
 /* Version number of package */
-#define VERSION "3.10.0.SVN"
+#define VERSION "3.11.0.SVN.aosp"
 
 /* Temporary files directory */
+#ifdef __ANDROID__
 #define VG_TMPDIR "/data/local/tmp"
+#else
+#define VG_TMPDIR "/tmp"
+#endif
 
 /* Define to `int' if <sys/types.h> doesn't define. */
 /* #undef gid_t */