[asan] Fix syscall hooks build on Android.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193670 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc
index baa1d5b..0032155 100644
--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -2063,6 +2063,13 @@
   }
 }
 
+PRE_SYSCALL(ipc)(long call, long first, long second, long third, void *ptr,
+                 long fifth) {}
+
+POST_SYSCALL(ipc)(long res, long call, long first, long second, long third,
+                  void *ptr, long fifth) {}
+
+#if !SANITIZER_ANDROID
 PRE_SYSCALL(shmctl)(long shmid, long cmd, void *buf) {}
 
 POST_SYSCALL(shmctl)(long res, long shmid, long cmd, void *buf) {
@@ -2071,13 +2078,6 @@
   }
 }
 
-PRE_SYSCALL(ipc)(long call, long first, long second, long third, void *ptr,
-                 long fifth) {}
-
-POST_SYSCALL(ipc)(long res, long call, long first, long second, long third,
-                  void *ptr, long fifth) {}
-
-#if !SANITIZER_ANDROID
 PRE_SYSCALL(mq_open)(const void *name, long oflag, long mode, void *attr) {
   if (name)
     PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
@@ -2219,6 +2219,7 @@
 POST_SYSCALL(ni_syscall)(long res) {}
 
 PRE_SYSCALL(ptrace)(long request, long pid, long addr, long data) {
+#if defined(__i386) || defined (__x86_64)
   if (data) {
     if (request == ptrace_setregs) {
       PRE_READ((void *)data, struct_user_regs_struct_sz);
@@ -2233,9 +2234,11 @@
       PRE_READ(iov->iov_base, iov->iov_len);
     }
   }
+#endif
 }
 
 POST_SYSCALL(ptrace)(long res, long request, long pid, long addr, long data) {
+#if defined(__i386) || defined (__x86_64)
   if (res >= 0 && data) {
     // Note that this is different from the interceptor in
     // sanitizer_common_interceptors.inc.
@@ -2256,6 +2259,7 @@
       POST_WRITE((void *)data, sizeof(void *));
     }
   }
+#endif
 }
 
 PRE_SYSCALL(add_key)(const void *_type, const void *_description,
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_linux.cc b/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
index a957cbe..9d4eb34 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
@@ -23,6 +23,12 @@
 #include <asm/stat.h>
 #include <linux/aio_abi.h>
 
+#if SANITIZER_ANDROID
+#include <asm/statfs.h>
+#else
+#include <sys/statfs.h>
+#endif
+
 #if !SANITIZER_ANDROID
 #include <linux/perf_event.h>
 #endif
@@ -32,6 +38,7 @@
   unsigned struct_kernel_stat_sz = sizeof(struct stat);
   unsigned struct_io_event_sz = sizeof(struct io_event);
   unsigned struct_iocb_sz = sizeof(struct iocb);
+  unsigned struct_statfs64_sz = sizeof(struct statfs64);
 
 #ifndef _LP64
   unsigned struct_kernel_stat64_sz = sizeof(struct stat64);
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
index 8276a96..133ddcf 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -143,9 +143,12 @@
   unsigned struct_sched_param_sz = sizeof(struct sched_param);
   unsigned struct_statfs_sz = sizeof(struct statfs);
 
+#if SANITIZER_MAC
+  unsigned struct_statfs64_sz = sizeof(struct statfs64);
+#endif
+
 #if !SANITIZER_ANDROID
   unsigned ucontext_t_sz = sizeof(ucontext_t);
-  unsigned struct_statfs64_sz = sizeof(struct statfs64);
 #endif // !SANITIZER_ANDROID
 
 #if SANITIZER_LINUX
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index 6f27ba4..864162d 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -39,10 +39,10 @@
   extern unsigned struct_sigevent_sz;
   extern unsigned struct_sched_param_sz;
   extern unsigned struct_statfs_sz;
+  extern unsigned struct_statfs64_sz;
 
 #if !SANITIZER_ANDROID
   extern unsigned ucontext_t_sz;
-  extern unsigned struct_statfs64_sz;
 #endif // !SANITIZER_ANDROID
 
 #if SANITIZER_LINUX