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 port to mips and alpha.



details:   https://anonhg.NetBSD.org/src/rev/71cc48d8b0cd
branches:  trunk
changeset: 829584:71cc48d8b0cd
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Feb 06 09:31:56 2018 +0000

description:
port to mips and alpha.

diffstat:

 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc         |  18 ++++++++-
 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc |   2 +
 external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h                      |   2 +-
 3 files changed, 18 insertions(+), 4 deletions(-)

diffs (90 lines):

diff -r c34454690a1d -r 71cc48d8b0cd external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Tue Feb 06 09:28:48 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Tue Feb 06 09:31:56 2018 +0000
@@ -27,7 +27,6 @@
 
 #if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
 #include <asm/param.h>
-#endif
 
 // For mips64, syscall(__NR_stat) fills the buffer in the 'struct kernel_stat'
 // format. Struct kernel_stat is defined as 'struct stat' in asm/stat.h. To
@@ -41,6 +40,8 @@
 #undef stat
 #endif
 
+#endif // !SANITIZER_FREEBSD && !SANITIZER_NETBSD
+
 #include <dlfcn.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -207,7 +208,7 @@
 }
 #endif
 
-#if defined(__mips64)
+#if defined(__mips64) && SANITIZER_LINUX
 static void kernel_stat_to_stat(struct kernel_stat *in, struct stat *out) {
   internal_memset(out, 0, sizeof(*out));
   out->st_dev = in->st_dev;
@@ -933,7 +934,7 @@
                        : "rsp", "memory", "r11", "rcx");
   return res;
 }
-#elif defined(__mips__)
+#elif defined(__mips__) && SANITIZER_LINUX
 uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
                     int *parent_tidptr, void *newtls, int *child_tidptr) {
   long long res;
@@ -1233,9 +1234,20 @@
 # endif
 #elif defined(__mips__)
   ucontext_t *ucontext = (ucontext_t*)context;
+# if SANITIZER_NETBSD
+  *pc = _UC_MACHINE_PC(ucontext);
+  *sp = _UC_MACHINE_SP(ucontext);
+  *bp = ucontext->uc_mcontext.__gregs[_REG_S8];
+# else
   *pc = ucontext->uc_mcontext.pc;
   *bp = ucontext->uc_mcontext.gregs[30];
   *sp = ucontext->uc_mcontext.gregs[29];
+# endif
+#elif defined(__alpha__) && SANITIZER_NETBSD
+  ucontext_t *ucontext = (ucontext_t*)context;
+  *pc = _UC_MACHINE_PC(ucontext);
+  *sp = _UC_MACHINE_SP(ucontext);
+  *bp = ucontext->uc_mcontext.__gregs[_REG_S6];
 #else
 # error "Unsupported arch"
 #endif
diff -r c34454690a1d -r 71cc48d8b0cd external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc   Tue Feb 06 09:28:48 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc   Tue Feb 06 09:31:56 2018 +0000
@@ -164,6 +164,7 @@
 # define DL_INTERNAL_FUNCTION
 #endif
 
+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_ANDROID && !SANITIZER_GO
 #if defined(__mips__) || defined(__powerpc64__)
 // TlsPreTcbSize includes size of struct pthread_descr and size of tcb
 // head structure. It lies before the static tls blocks.
@@ -181,6 +182,7 @@
   return kTlsPreTcbSize;
 }
 #endif
+#endif // !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_ANDROID && !SANITIZER_GO
 
 void InitTlsSize() {
 #if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_NETBSD && !SANITIZER_GO
diff -r c34454690a1d -r 71cc48d8b0cd external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h
--- a/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h        Tue Feb 06 09:28:48 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h        Tue Feb 06 09:31:56 2018 +0000
@@ -17,7 +17,7 @@
      defined(__APPLE__)) && \
     (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
      defined(__aarch64__) || defined(__mips__) || defined(__powerpc__) || \
-     defined(__powerpc64__) || defined(__sparc__))
+     defined(__powerpc64__) || defined(__sparc__) || defined(__alpha__))
 # define CAN_SANITIZE_UB 1
 #elif defined(_WIN32)
 # define CAN_SANITIZE_UB 1



Home | Main Index | Thread Index | Old Index