113 lines
3.5 KiB
Diff
113 lines
3.5 KiB
Diff
Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
|
|
===================================================================
|
|
--- projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h (revision 195441)
|
|
+++ projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h (revision 195442)
|
|
@@ -61,6 +61,14 @@
|
|
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,10 +134,15 @@
|
|
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;
|
|
};
|
|
@@ -136,7 +149,9 @@
|
|
|
|
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 @@
|
|
#ifndef _LP64
|
|
uptr __unused3;
|
|
#endif
|
|
+ #ifdef __powerpc__
|
|
+ uptr shm_segsz;
|
|
+ #endif
|
|
int shm_cpid;
|
|
int shm_lpid;
|
|
uptr shm_nattch;
|
|
@@ -271,8 +289,15 @@
|
|
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))];
|
|
Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
|
|
===================================================================
|
|
--- projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cc (revision 195441)
|
|
+++ projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cc (revision 195442)
|
|
@@ -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 @@
|
|
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__)
|