Module Name: src
Committed By: mrg
Date: Sun Feb 4 01:14:42 UTC 2018
Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_internal_defs.h sanitizer_linux.cc
sanitizer_linux_libcdep.cc sanitizer_platform_limits_posix.h
sanitizer_posix.cc
src/external/gpl3/gcc/dist/libsanitizer/ubsan: ubsan_platform.h
Log Message:
fixes to build the sanitizer files. not tested, but builds.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
cvs rdiff -u -r1.10 -r1.11 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
\
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc
cvs rdiff -u -r1.11 -r1.12 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:1.7 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:1.8
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:1.7 Fri Feb 2 03:41:11 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h Sun Feb 4 01:14:42 2018
@@ -30,7 +30,7 @@
# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
#endif
-#if (SANITIZER_LINUX || SANITIZER_WINDOWS) && !defined(SANITIZER_GO)
+#if (SANITIZER_LINUX || SANITIZER_WINDOWS || SANITIZER_NETBSD) && !defined(SANITIZER_GO)
# define SANITIZER_SUPPORTS_WEAK_HOOKS 1
#else
# define SANITIZER_SUPPORTS_WEAK_HOOKS 0
@@ -92,7 +92,7 @@ typedef int error_t;
// _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls
// like pread and mmap, as opposed to pread64 and mmap64.
// FreeBSD, NetBSD, Mac and Linux/x86-64 are special.
-#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD \
+#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD || \
(SANITIZER_LINUX && defined(__x86_64__))
typedef u64 OFF_T;
#else
Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.10 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.11
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.10 Fri Feb 2 03:41:11 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc Sun Feb 4 01:14:42 2018
@@ -1173,6 +1173,11 @@ void GetPcSpBp(void *context, uptr *pc,
*pc = ucontext->uc_mcontext.mc_eip;
*bp = ucontext->uc_mcontext.mc_ebp;
*sp = ucontext->uc_mcontext.mc_esp;
+# elif SANITIZER_NETBSD
+ ucontext_t *ucontext = (ucontext_t*)context;
+ *pc = ucontext->uc_mcontext.__gregs[_REG_EIP];
+ *bp = ucontext->uc_mcontext.__gregs[_REG_EBP];
+ *sp = ucontext->uc_mcontext.__gregs[_REG_ESP];
# else
ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.gregs[REG_EIP];
Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.4 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.5
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.4 Fri Feb 2 03:41:11 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc Sun Feb 4 01:14:42 2018
@@ -12,7 +12,6 @@
#include "sanitizer_platform.h"
-#if SANITIZER_FREEBSD || SANITIZER_LINUX
#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
#include "sanitizer_allocator_internal.h"
Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc:1.4 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc:1.5
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc:1.4 Fri Feb 2 03:41:11 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc Sun Feb 4 01:14:42 2018
@@ -170,7 +170,7 @@ bool MprotectNoAccess(uptr addr, uptr si
}
fd_t OpenFile(const char *filename, FileAccessMode mode, error_t *errno_p) {
- int flags;
+ int flags = 0;
switch (mode) {
case RdOnly: flags = O_RDONLY; break;
case WrOnly: flags = O_WRONLY | O_CREAT; break;
Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1.11 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1.12
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1.11 Fri Feb 2 03:41:11 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h Sun Feb 4 01:14:42 2018
@@ -616,36 +616,36 @@ namespace __sanitizer {
unsigned int __bits[4];
};
#endif
-#if SANITIZER_NETBSD
+
+ // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
+#if SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 64)
struct __sanitizer_sigaction {
+ unsigned sa_flags;
union {
void (*sigaction)(int sig, void *siginfo, void *uctx);
void (*handler)(int sig);
};
__sanitizer_sigset_t sa_mask;
- int sa_flags;
+ void (*sa_restorer)();
};
-#else
- // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
-#if SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 64)
+#elif SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32)
struct __sanitizer_sigaction {
- unsigned sa_flags;
union {
void (*sigaction)(int sig, void *siginfo, void *uctx);
void (*handler)(int sig);
};
__sanitizer_sigset_t sa_mask;
+ uptr sa_flags;
void (*sa_restorer)();
};
-#elif SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32)
+#elif SANITIZER_NETBSD
struct __sanitizer_sigaction {
union {
void (*sigaction)(int sig, void *siginfo, void *uctx);
void (*handler)(int sig);
};
__sanitizer_sigset_t sa_mask;
- uptr sa_flags;
- void (*sa_restorer)();
+ int sa_flags;
};
#else // !SANITIZER_ANDROID
struct __sanitizer_sigaction {
Index: src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h:1.1.1.1 src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h:1.1.1.1 Fri Feb 2 01:58:47 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h Sun Feb 4 01:14:42 2018
@@ -13,7 +13,8 @@
#ifndef CAN_SANITIZE_UB
// Other platforms should be easy to add, and probably work as-is.
-#if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \
+#if (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
+ defined(__APPLE__)) && \
(defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__))
# define CAN_SANITIZE_UB 1