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/sanitizer_common/sanitizer_platform_limits_linux.cc | |
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/sanitizer_common/sanitizer_platform_limits_linux.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_platform_limits_linux.cc | 6 |
1 files changed, 5 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 |