From b8a141f3783d796eabf45fabff82f3e08244e338 Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Thu, 31 Oct 2013 17:38:18 +0000 Subject: [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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193775 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/sanitizer_platform.h | 7 +++++++ lib/sanitizer_common/sanitizer_platform_interceptors.h | 9 ++++++++- lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 6 ++++-- lib/sanitizer_common/sanitizer_platform_limits_posix.h | 2 ++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h index acb99718..fce721e3 100644 --- a/lib/sanitizer_common/sanitizer_platform.h +++ b/lib/sanitizer_common/sanitizer_platform.h @@ -25,8 +25,15 @@ #if defined(__APPLE__) # define SANITIZER_MAC 1 +# include +# 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) diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h index f9a9870c..1d6fe010 100644 --- a/lib/sanitizer_common/sanitizer_platform_interceptors.h +++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h @@ -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 diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc index 133ddcf2..22384771 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -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); diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h index 864162d2..0fa1b9d2 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -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; -- cgit v1.2.3