Module Name:    src
Committed By:   mrg
Date:           Mon Sep  7 00:22:51 UTC 2020

Modified Files:
        src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
            sanitizer_linux.cc

Log Message:
fix for netbsd/mips.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 \
    src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc

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_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.35 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.36
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.35	Sun Sep  6 10:55:16 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc	Mon Sep  7 00:22:51 2020
@@ -33,6 +33,7 @@
 // format. Struct kernel_stat is defined as 'struct stat' in asm/stat.h. To
 // access stat from asm/stat.h, without conflicting with definition in
 // sys/stat.h, we use this trick.
+#if SANITIZER_LINUX
 #if defined(__mips64)
 #include <asm/unistd.h>
 #include <sys/types.h>
@@ -40,6 +41,7 @@
 #include <asm/stat.h>
 #undef stat
 #endif
+#endif
 
 #if SANITIZER_NETBSD
 #include <lwp.h>
@@ -1848,7 +1850,12 @@ SignalContext::WriteFlag SignalContext::
   uint32_t faulty_instruction;
   uint32_t op_code;
 
+#if SANITIZER_NETBSD
+  ucontext_t *nucontext = (ucontext_t *)ucontext;
+  exception_source = (uint32_t *)_UC_MACHINE_PC(nucontext);
+#else
   exception_source = (uint32_t *)ucontext->uc_mcontext.pc;
+#endif
   faulty_instruction = (uint32_t)(*exception_source);
 
   op_code = (faulty_instruction >> 26) & 0x3f;

Reply via email to