[compiler-rt] r193775 - [libsanitizer] Define SANITIZER_IOS when building for iOS or iOS simulator.

Alexander Potapenko glider at google.com
Thu Oct 31 10:38:18 PDT 2013


Author: glider
Date: Thu Oct 31 12:38:18 2013
New Revision: 193775

URL: http://llvm.org/viewvc/llvm-project?rev=193775&view=rev
Log:
[libsanitizer] Define SANITIZER_IOS when building for iOS or iOS simulator.
Do not use struct stat64 and struct statfs64 when building for iOS, where __DARWIN_ONLY_64_BIT_INO_T is set to 1.



Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h?rev=193775&r1=193774&r2=193775&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h Thu Oct 31 12:38:18 2013
@@ -25,8 +25,15 @@
 
 #if defined(__APPLE__)
 # define SANITIZER_MAC     1
+# include <TargetConditionals.h>
+# if TARGET_OS_IPHONE
+#  define SANITIZER_IOS    1
+# else
+#  define SANITIZER_IOS    0
+# endif
 #else
 # define SANITIZER_MAC     0
+# define SANITIZER_IOS     0
 #endif
 
 #if defined(_WIN32)

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=193775&r1=193774&r2=193775&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Thu Oct 31 12:38:18 2013
@@ -41,6 +41,12 @@
 # define SI_MAC 0
 #endif
 
+#if SANITIZER_IOS
+# define SI_IOS 1
+#else
+# define SI_IOS 0
+#endif
+
 # define SANITIZER_INTERCEPT_STRCMP 1
 # define SANITIZER_INTERCEPT_STRCASECMP SI_NOT_WINDOWS
 
@@ -129,7 +135,8 @@
 # define SANITIZER_INTERCEPT_GETMNTENT SI_LINUX
 # define SANITIZER_INTERCEPT_GETMNTENT_R SI_LINUX_NOT_ANDROID
 # define SANITIZER_INTERCEPT_STATFS SI_NOT_WINDOWS
-# define SANITIZER_INTERCEPT_STATFS64 SI_MAC || SI_LINUX_NOT_ANDROID
+# define SANITIZER_INTERCEPT_STATFS64 \
+    (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID
 # define SANITIZER_INTERCEPT_STATVFS SI_LINUX_NOT_ANDROID
 # define SANITIZER_INTERCEPT_STATVFS64 SI_LINUX_NOT_ANDROID
 # define SANITIZER_INTERCEPT_INITGROUPS SI_NOT_WINDOWS

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc?rev=193775&r1=193774&r2=193775&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc Thu Oct 31 12:38:18 2013
@@ -122,7 +122,9 @@
 namespace __sanitizer {
   unsigned struct_utsname_sz = sizeof(struct utsname);
   unsigned struct_stat_sz = sizeof(struct stat);
+#if !SANITIZER_IOS
   unsigned struct_stat64_sz = sizeof(struct stat64);
+#endif // !SANITIZER_IOS
   unsigned struct_rusage_sz = sizeof(struct rusage);
   unsigned struct_tm_sz = sizeof(struct tm);
   unsigned struct_passwd_sz = sizeof(struct passwd);
@@ -143,9 +145,9 @@ namespace __sanitizer {
   unsigned struct_sched_param_sz = sizeof(struct sched_param);
   unsigned struct_statfs_sz = sizeof(struct statfs);
 
-#if SANITIZER_MAC
+#if SANITIZER_MAC && !SANITIZER_IOS
   unsigned struct_statfs64_sz = sizeof(struct statfs64);
-#endif
+#endif // SANITIZER_MAC && !SANITIZER_IOS
 
 #if !SANITIZER_ANDROID
   unsigned ucontext_t_sz = sizeof(ucontext_t);

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=193775&r1=193774&r2=193775&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h Thu Oct 31 12:38:18 2013
@@ -21,7 +21,9 @@
 namespace __sanitizer {
   extern unsigned struct_utsname_sz;
   extern unsigned struct_stat_sz;
+#if !SANITIZER_IOS
   extern unsigned struct_stat64_sz;
+#endif
   extern unsigned struct_rusage_sz;
   extern unsigned struct_passwd_sz;
   extern unsigned struct_group_sz;





More information about the llvm-commits mailing list