summaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2018-11-06 10:42:05 +0000
committerRainer Orth <ro@gcc.gnu.org>2018-11-06 10:42:05 +0000
commit0b5ccc800e06364b31cec61c45aede13e6c68a58 (patch)
tree4823738feeeda4151ec7d68b864b520d544e5efb /libsanitizer
parent2a98b4bfc3d952f0c5b71419a5eba51553dcc776 (diff)
Cherry-pick Solaris sanitizer fixes (PR sanitizer/80953)
PR sanitizer/80953 * sanitizer_common/sanitizer_internal_defs.h, sanitizer_common/sanitizer_platform_limits_solaris.h, sanitizer_common/sanitizer_procmaps_solaris.cc, sanitizer_common/sanitizer_solaris.cc: Cherry-pick compiler-rt revision 346153. * sanitizer_common/sanitizer_stacktrace.h, sanitizer_common/sanitizer_stacktrace_sparc.cc: Cherry-pick compiler-rt revision 346155. From-SVN: r265836
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog12
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_internal_defs.h1
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cc2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_solaris.cc45
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace.h2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cc5
7 files changed, 48 insertions, 22 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index b2dfda871a9..a9bbf889cbc 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,15 @@
+2018-11-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR sanitizer/80953
+ * sanitizer_common/sanitizer_internal_defs.h,
+ sanitizer_common/sanitizer_platform_limits_solaris.h,
+ sanitizer_common/sanitizer_procmaps_solaris.cc,
+ sanitizer_common/sanitizer_solaris.cc: Cherry-pick compiler-rt
+ revision 346153.
+ * sanitizer_common/sanitizer_stacktrace.h,
+ sanitizer_common/sanitizer_stacktrace_sparc.cc: Cherry-pick
+ compiler-rt revision 346155.
+
2018-11-05 Segher Boessenkool <segher@kernel.crashing.org>
* LOCAL_PATCHES: Add r258525.
diff --git a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
index 8bd1bcacac1..26bea8bed91 100644
--- a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
+++ b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
@@ -170,6 +170,7 @@ typedef int pid_t;
#if SANITIZER_FREEBSD || SANITIZER_NETBSD || \
SANITIZER_OPENBSD || SANITIZER_MAC || \
+ (SANITIZER_SOLARIS && (defined(_LP64) || _FILE_OFFSET_BITS == 64)) || \
(SANITIZER_LINUX && defined(__x86_64__))
typedef u64 OFF_T;
#else
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h
index 0bd3de88562..97788d61d62 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h
@@ -208,8 +208,7 @@ struct __sanitizer_cmsghdr {
int cmsg_type;
};
-#if SANITIZER_SOLARIS32 && 0
-// FIXME: need to deal with large file and non-large file cases
+#if SANITIZER_SOLARIS && (defined(_LP64) || _FILE_OFFSET_BITS == 64)
struct __sanitizer_dirent {
unsigned long long d_ino;
long long d_off;
diff --git a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cc b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cc
index bfe83170f4e..9e5e37e6b9d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cc
@@ -13,6 +13,8 @@
#include "sanitizer_common.h"
#include "sanitizer_procmaps.h"
+// Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
+#undef _FILE_OFFSET_BITS
#include <procfs.h>
#include <limits.h>
diff --git a/libsanitizer/sanitizer_common/sanitizer_solaris.cc b/libsanitizer/sanitizer_common/sanitizer_solaris.cc
index a5db22994e0..9d0c3d93d44 100644
--- a/libsanitizer/sanitizer_common/sanitizer_solaris.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_solaris.cc
@@ -48,10 +48,21 @@ namespace __sanitizer {
DECLARE__REAL(ret_type, func, __VA_ARGS__); \
ret_type internal_ ## func(__VA_ARGS__)
+#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
+#define _REAL64(func) _ ## func ## 64
+#else
+#define _REAL64(func) _REAL(func)
+#endif
+#define DECLARE__REAL64(ret_type, func, ...) \
+ extern "C" ret_type _REAL64(func)(__VA_ARGS__)
+#define DECLARE__REAL_AND_INTERNAL64(ret_type, func, ...) \
+ DECLARE__REAL64(ret_type, func, __VA_ARGS__); \
+ ret_type internal_ ## func(__VA_ARGS__)
+
// ---------------------- sanitizer_libc.h
-DECLARE__REAL_AND_INTERNAL(uptr, mmap, void *addr, uptr /*size_t*/ length,
- int prot, int flags, int fd, OFF_T offset) {
- return (uptr)_REAL(mmap)(addr, length, prot, flags, fd, offset);
+DECLARE__REAL_AND_INTERNAL64(uptr, mmap, void *addr, uptr /*size_t*/ length,
+ int prot, int flags, int fd, OFF_T offset) {
+ return (uptr)_REAL64(mmap)(addr, length, prot, flags, fd, offset);
}
DECLARE__REAL_AND_INTERNAL(uptr, munmap, void *addr, uptr length) {
@@ -66,14 +77,14 @@ DECLARE__REAL_AND_INTERNAL(uptr, close, fd_t fd) {
return _REAL(close)(fd);
}
-extern "C" int _REAL(open)(const char *, int, ...);
+extern "C" int _REAL64(open)(const char *, int, ...);
uptr internal_open(const char *filename, int flags) {
- return _REAL(open)(filename, flags);
+ return _REAL64(open)(filename, flags);
}
uptr internal_open(const char *filename, int flags, u32 mode) {
- return _REAL(open)(filename, flags, mode);
+ return _REAL64(open)(filename, flags, mode);
}
uptr OpenFile(const char *filename, bool write) {
@@ -94,16 +105,16 @@ DECLARE__REAL_AND_INTERNAL(uptr, ftruncate, fd_t fd, uptr size) {
return ftruncate(fd, size);
}
-DECLARE__REAL_AND_INTERNAL(uptr, stat, const char *path, void *buf) {
- return _REAL(stat)(path, (struct stat *)buf);
+DECLARE__REAL_AND_INTERNAL64(uptr, stat, const char *path, void *buf) {
+ return _REAL64(stat)(path, (struct stat *)buf);
}
-DECLARE__REAL_AND_INTERNAL(uptr, lstat, const char *path, void *buf) {
- return _REAL(lstat)(path, (struct stat *)buf);
+DECLARE__REAL_AND_INTERNAL64(uptr, lstat, const char *path, void *buf) {
+ return _REAL64(lstat)(path, (struct stat *)buf);
}
-DECLARE__REAL_AND_INTERNAL(uptr, fstat, fd_t fd, void *buf) {
- return _REAL(fstat)(fd, (struct stat *)buf);
+DECLARE__REAL_AND_INTERNAL64(uptr, fstat, fd_t fd, void *buf) {
+ return _REAL64(fstat)(fd, (struct stat *)buf);
}
uptr internal_filesize(fd_t fd) {
@@ -153,13 +164,13 @@ DECLARE__REAL_AND_INTERNAL(uptr, getpid, void) {
}
// FIXME: This might be wrong: _getdents doesn't take a struct linux_dirent *.
-DECLARE__REAL_AND_INTERNAL(uptr, getdents, fd_t fd, struct linux_dirent *dirp,
- unsigned int count) {
- return _REAL(getdents)(fd, dirp, count);
+DECLARE__REAL_AND_INTERNAL64(uptr, getdents, fd_t fd, struct linux_dirent *dirp,
+ unsigned int count) {
+ return _REAL64(getdents)(fd, dirp, count);
}
-DECLARE__REAL_AND_INTERNAL(uptr, lseek, fd_t fd, OFF_T offset, int whence) {
- return _REAL(lseek)(fd, offset, whence);
+DECLARE__REAL_AND_INTERNAL64(uptr, lseek, fd_t fd, OFF_T offset, int whence) {
+ return _REAL64(lseek)(fd, offset, whence);
}
// FIXME: This might be wrong: _sigfillset doesn't take a
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace.h b/libsanitizer/sanitizer_common/sanitizer_stacktrace.h
index fa457d5bfb4..7f3756c2cba 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stacktrace.h
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace.h
@@ -17,7 +17,7 @@ namespace __sanitizer {
static const u32 kStackTraceMax = 256;
-#if SANITIZER_LINUX && (defined(__sparc__) || defined(__mips__))
+#if defined(__sparc__) || (SANITIZER_LINUX && defined(__mips__))
# define SANITIZER_CAN_FAST_UNWIND 0
#elif SANITIZER_WINDOWS
# define SANITIZER_CAN_FAST_UNWIND 0
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cc b/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cc
index 623fba25ed5..7e7017bb1b1 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cc
@@ -13,7 +13,7 @@
// This file is ported to Sparc v8, but it should be easy to port to
// Sparc v9.
-#if defined(__sparcv8__)
+#if defined(__sparcv8__) || defined(__sparcv8) || defined(__sparc_v8__)
#include "sanitizer_common.h"
#include "sanitizer_stacktrace.h"
@@ -53,4 +53,5 @@ void BufferedStackTrace::FastUnwindStack(uptr pc, uptr bp, uptr stack_top,
} // namespace __sanitizer
-#endif // !defined(__sparcv8__)
+#endif // !defined(__sparcv8__) && !defined(__sparcv8) &&
+ // !defined(__sparc_v8__)