Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/libsanitizer fixes to build the sanit...



details:   https://anonhg.NetBSD.org/src/rev/88a219e5bde6
branches:  trunk
changeset: 829486:88a219e5bde6
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Feb 04 01:14:42 2018 +0000

description:
fixes to build the sanitizer files.  not tested, but builds.

diffstat:

 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h         |   4 +-
 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc                |   5 ++
 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc        |   1 -
 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h |  20 +++++-----
 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc                |   2 +-
 external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h                             |   3 +-
 6 files changed, 20 insertions(+), 15 deletions(-)

diffs (109 lines):

diff -r 8101dc773f72 -r 88a219e5bde6 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h    Sun Feb 04 01:13:45 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h    Sun Feb 04 01:14:42 2018 +0000
@@ -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 @@
 // _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
diff -r 8101dc773f72 -r 88a219e5bde6 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Sun Feb 04 01:13:45 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Sun Feb 04 01:14:42 2018 +0000
@@ -1173,6 +1173,11 @@
   *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];
diff -r 8101dc773f72 -r 88a219e5bde6 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc   Sun Feb 04 01:13:45 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc   Sun Feb 04 01:14:42 2018 +0000
@@ -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"
diff -r 8101dc773f72 -r 88a219e5bde6 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h    Sun Feb 04 01:13:45 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h    Sun Feb 04 01:14:42 2018 +0000
@@ -616,16 +616,7 @@
      unsigned int __bits[4];
   };
 #endif
-#if SANITIZER_NETBSD
-  struct __sanitizer_sigaction {
-    union {
-      void (*sigaction)(int sig, void *siginfo, void *uctx);
-      void (*handler)(int sig);
-    };
-    __sanitizer_sigset_t sa_mask;
-    int sa_flags;
-  };
-#else
+
   // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
 #if SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 64)
   struct __sanitizer_sigaction {
@@ -647,6 +638,15 @@
     uptr sa_flags;
     void (*sa_restorer)();
   };
+#elif SANITIZER_NETBSD
+  struct __sanitizer_sigaction {
+    union {
+      void (*sigaction)(int sig, void *siginfo, void *uctx);
+      void (*handler)(int sig);
+    };
+    __sanitizer_sigset_t sa_mask;
+    int sa_flags;
+  };
 #else // !SANITIZER_ANDROID
   struct __sanitizer_sigaction {
 #if defined(__mips__) && !SANITIZER_FREEBSD
diff -r 8101dc773f72 -r 88a219e5bde6 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc   Sun Feb 04 01:13:45 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc   Sun Feb 04 01:14:42 2018 +0000
@@ -170,7 +170,7 @@
 }
 
 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;
diff -r 8101dc773f72 -r 88a219e5bde6 external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h
--- a/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h        Sun Feb 04 01:13:45 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h        Sun Feb 04 01:14:42 2018 +0000
@@ -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



Home | Main Index | Thread Index | Old Index