diff options
author | Kostya Serebryany <kcc@google.com> | 2014-01-14 07:38:53 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-01-14 07:38:53 +0000 |
commit | 2aba9e1dfe7ec92f51c5d846c2658b295d9a63e9 (patch) | |
tree | b8aabb73488339dff360b3417f33386f96b05c13 /lib | |
parent | 91e60e70a22b35bc1d93319c602fbe18954ed984 (diff) |
[asan] Include <sys/stat.h> if __x86_64__ is defined
struct stat defined in <asm/stat.h> is incorrect for x32. <asm/stat.h>
is included to get struct __old_kernel_stat. But struct __old_kernel_stat
isn't used for x86-64 nor x32. This patch includes <sys/stat.h> instead
of <asm/stat.h> and comments out size check of struct __old_kernel_stat
for x86-64.
Patch by H.J. Lu
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sanitizer_common/sanitizer_platform_limits_linux.cc | 6 | ||||
-rw-r--r-- | lib/sanitizer_common/sanitizer_platform_limits_posix.h | 16 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_linux.cc b/lib/sanitizer_common/sanitizer_platform_limits_linux.cc index 034b32002..54c080925 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_linux.cc +++ b/lib/sanitizer_common/sanitizer_platform_limits_linux.cc @@ -29,6 +29,9 @@ // are not defined anywhere in userspace headers. Fake them. This seems to work // fine with newer headers, too. #include <asm/posix_types.h> +#if defined(__x86_64__) +#include <sys/stat.h> +#else #define ino_t __kernel_ino_t #define mode_t __kernel_mode_t #define nlink_t __kernel_nlink_t @@ -43,6 +46,7 @@ #undef uid_t #undef gid_t #undef off_t +#endif #include <linux/aio_abi.h> @@ -60,7 +64,7 @@ namespace __sanitizer { unsigned struct_statfs64_sz = sizeof(struct statfs64); } // namespace __sanitizer -#if !defined(__powerpc64__) +#if !defined(__powerpc64__) && !defined(__x86_64__) COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat)); #endif diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h index 97866b814..5293ed08b 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -169,6 +169,11 @@ namespace __sanitizer { #elif !defined(__powerpc64__) uptr __unused0; #endif + #if defined(__x86_64__) && !defined(_LP64) + u64 shm_atime; + u64 shm_dtime; + u64 shm_ctime; + #else uptr shm_atime; #ifndef _LP64 uptr __unused1; @@ -181,14 +186,21 @@ namespace __sanitizer { #ifndef _LP64 uptr __unused3; #endif + #endif #ifdef __powerpc__ uptr shm_segsz; #endif int shm_cpid; int shm_lpid; + #if defined(__x86_64__) && !defined(_LP64) + u64 shm_nattch; + u64 __unused4; + u64 __unused5; + #else uptr shm_nattch; uptr __unused4; uptr __unused5; + #endif }; #endif // SANITIZER_LINUX && !SANITIZER_ANDROID @@ -296,7 +308,11 @@ namespace __sanitizer { }; #endif +#if defined(__x86_64__) && !defined(_LP64) + typedef long long __sanitizer_clock_t; +#else typedef long __sanitizer_clock_t; +#endif #if SANITIZER_LINUX #if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__) |