[llvm-branch-commits] [compiler-rt-branch] r195464 - Merging r195442:

Evgeniy Stepanov eugeni.stepanov at gmail.com
Fri Nov 22 06:01:24 PST 2013


Author: eugenis
Date: Fri Nov 22 08:01:23 2013
New Revision: 195464

URL: http://llvm.org/viewvc/llvm-project?rev=195464&view=rev
Log:
Merging r195442:
------------------------------------------------------------------------
r195442 | eugenis | 2013-11-22 15:01:43 +0400 (Fri, 22 Nov 2013) | 2 lines

[sanitizer] Fix kernel headers compatibility on powerpc64.

------------------------------------------------------------------------

Modified:
    compiler-rt/branches/release_34/   (props changed)
    compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
    compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h

Propchange: compiler-rt/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 22 08:01:23 2013
@@ -1 +1 @@
-/compiler-rt/trunk:195427,195433-195434,195436
+/compiler-rt/trunk:195427,195433-195434,195436,195442

Modified: compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_linux.cc?rev=195464&r1=195463&r2=195464&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_linux.cc (original)
+++ compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_linux.cc Fri Nov 22 08:01:23 2013
@@ -25,8 +25,25 @@
 // For offsetof -> __builtin_offsetof definition.
 #include <stddef.h>
 
+// With old kernels (and even new kernels on powerpc) asm/stat.h uses types that
+// are not defined anywhere in userspace headers. Fake them. This seems to work
+// fine with newer headers, too.
+#include <asm/posix_types.h>
+#define ino_t __kernel_ino_t
+#define mode_t __kernel_mode_t
+#define nlink_t __kernel_nlink_t
+#define uid_t __kernel_uid_t
+#define gid_t __kernel_gid_t
+#define off_t __kernel_off_t
 // This header seems to contain the definitions of _kernel_ stat* structs.
 #include <asm/stat.h>
+#undef ino_t
+#undef mode_t
+#undef nlink_t
+#undef uid_t
+#undef gid_t
+#undef off_t
+
 #include <linux/aio_abi.h>
 
 #if SANITIZER_ANDROID
@@ -43,7 +60,10 @@ namespace __sanitizer {
   unsigned struct_statfs64_sz = sizeof(struct statfs64);
 }  // namespace __sanitizer
 
+#if !defined(__powerpc64__)
 COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
+#endif
+
 COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat));
 
 #if defined(__i386__)

Modified: compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=195464&r1=195463&r2=195464&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)
+++ compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h Fri Nov 22 08:01:23 2013
@@ -61,6 +61,14 @@ namespace __sanitizer {
   const unsigned struct___old_kernel_stat_sz = 32;
   const unsigned struct_kernel_stat_sz = 64;
   const unsigned struct_kernel_stat64_sz = 104;
+#elif defined(__powerpc__) && !defined(__powerpc64__)
+  const unsigned struct___old_kernel_stat_sz = 32;
+  const unsigned struct_kernel_stat_sz = 72;
+  const unsigned struct_kernel_stat64_sz = 104;
+#elif defined(__powerpc64__)
+  const unsigned struct___old_kernel_stat_sz = 0;
+  const unsigned struct_kernel_stat_sz = 144;
+  const unsigned struct_kernel_stat64_sz = 104;
 #endif
   const unsigned struct_io_event_sz = 32;
   struct __sanitizer_perf_event_attr {
@@ -126,17 +134,24 @@ namespace __sanitizer {
     int gid;
     int cuid;
     int cgid;
+#ifdef __powerpc64__
+    unsigned mode;
+    unsigned __seq;
+#else
     unsigned short mode;
     unsigned short __pad1;
     unsigned short __seq;
     unsigned short __pad2;
+#endif
     uptr __unused1;
     uptr __unused2;
   };
 
   struct __sanitizer_shmid_ds {
     __sanitizer_ipc_perm shm_perm;
+  #ifndef __powerpc__
     uptr shm_segsz;
+  #endif
     uptr shm_atime;
   #ifndef _LP64
     uptr __unused1;
@@ -149,6 +164,9 @@ namespace __sanitizer {
   #ifndef _LP64
     uptr __unused3;
   #endif
+  #ifdef __powerpc__
+    uptr shm_segsz;
+  #endif
     int shm_cpid;
     int shm_lpid;
     uptr shm_nattch;
@@ -271,8 +289,15 @@ namespace __sanitizer {
   typedef unsigned short __sanitizer___kernel_gid_t;
   typedef long __sanitizer___kernel_off_t;
 #endif
+
+#if defined(__powerpc64__)
+  typedef unsigned int __sanitizer___kernel_old_uid_t;
+  typedef unsigned int __sanitizer___kernel_old_gid_t;
+#else
   typedef unsigned short __sanitizer___kernel_old_uid_t;
   typedef unsigned short __sanitizer___kernel_old_gid_t;
+#endif
+
   typedef long long __sanitizer___kernel_loff_t;
   typedef struct {
     unsigned long fds_bits[1024 / (8 * sizeof(long))];





More information about the llvm-branch-commits mailing list