CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2021-07-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jul 10 22:39:56 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_linux.cc

Log Message:
remove an old #if 0'd section.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_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/asan/asan_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.15 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.16
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.15	Sun Apr 11 23:54:25 2021
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc	Sat Jul 10 22:39:56 2021
@@ -234,139 +234,6 @@ void AsanCheckIncompatibleRT() {
 }
 #endif // SANITIZER_ANDROID
 
-#if 0 // was in old netbsd / gcc 5 sanitizer stuff
-void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
-#ifdef __NetBSD__
-# define __UC_MACHINE_FP(ucontext, r) \
-(ucontext)->uc_mcontext.__gregs[(r)]
-/*
- * Unfortunately we don't have a portable frame pointer (yet)
- */
-# if defined(__alpha__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S6)
-# elif defined(__arm__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_FP)
-# elif defined(__x86_64__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_RBP)
-# elif defined(__i386__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_EBP)
-# elif defined(__m68k__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_A6)
-# elif defined(__mips__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S8)
-# elif defined(__powerpc__) || defined(__powerpc64__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_R1)
-# elif defined(__riscv__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S0)
-# elif defined(__sparc__)
-#  define _UC_MACHINE_FP(ucontext) sp[15]
-# elif defined(__sh3__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_R14)
-# elif defined(__vax__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_FP)
-# else
-#  define _UC_MACHINE_FP(ucontext) 0
-# endif
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = _UC_MACHINE_PC(ucontext);
-  *sp = _UC_MACHINE_SP(ucontext);
-  *bp = _UC_MACHINE_FP(ucontext);
-#elif ASAN_ANDROID
-  *pc = *sp = *bp = 0;
-#elif defined(__arm__)
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.arm_pc;
-  *bp = ucontext->uc_mcontext.arm_fp;
-  *sp = ucontext->uc_mcontext.arm_sp;
-#elif defined(__aarch64__)
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.pc;
-  *bp = ucontext->uc_mcontext.regs[29];
-  *sp = ucontext->uc_mcontext.sp;
-#elif defined(__hppa__)
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.sc_iaoq[0];
-  /* GCC uses %r3 whenever a frame pointer is needed.  */
-  *bp = ucontext->uc_mcontext.sc_gr[3];
-  *sp = ucontext->uc_mcontext.sc_gr[30];
-#elif defined(__x86_64__)
-# if SANITIZER_FREEBSD
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.mc_rip;
-  *bp = ucontext->uc_mcontext.mc_rbp;
-  *sp = ucontext->uc_mcontext.mc_rsp;
-# elif SANITIZER_NETBSD
-  *pc = ucontext->uc_mcontext.__gregs[_REG_RIP];
-  *bp = ucontext->uc_mcontext.__gregs[_REG_RBP];
-  *sp = ucontext->uc_mcontext.__gregs[_REG_RSP];
-# else
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.gregs[REG_RIP];
-  *bp = ucontext->uc_mcontext.gregs[REG_RBP];
-  *sp = ucontext->uc_mcontext.gregs[REG_RSP];
-# endif
-#elif defined(__i386__)
-# if SANITIZER_FREEBSD
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.mc_eip;
-  *bp = ucontext->uc_mcontext.mc_ebp;
-  *sp = ucontext->uc_mcontext.mc_esp;
-# elif SANITIZER_FREEBSD
-  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];
-  *bp = ucontext->uc_mcontext.gregs[REG_EBP];
-  *sp = ucontext->uc_mcontext.gregs[REG_ESP];
-# endif
-#elif defined(__powerpc__) || defined(__powerpc64__)
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.regs->nip;
-  *sp = ucontext->uc_mcontext.regs->gpr[PT_R1];
-  // The powerpc{,64}-linux ABIs do not specify r31 as the frame
-  // pointer, but GCC always uses r31 when we need a frame pointer.
-  *bp = ucontext->uc_mcontext.regs->gpr[PT_R31];
-#elif defined(__riscv__)
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.gregs[REG_PC];
-  *bp = ucontext->uc_mcontext.gregs[REG_S0];
-  *sp = 

CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2019-01-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 17 20:37:20 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_thread.cc

Log Message:
Use the proper stack aligment for the architecture. Fixes broken asan
tests on i386.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_thread.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/asan/asan_thread.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_thread.cc:1.1.1.3 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_thread.cc:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_thread.cc:1.1.1.3	Thu Feb  1 20:58:47 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_thread.cc	Thu Jan 17 15:37:20 2019
@@ -9,6 +9,10 @@
 //
 // Thread-related code.
 //===--===//
+
+#define __EXPOSE_STACK
+#include 
+
 #include "asan_allocator.h"
 #include "asan_interceptors.h"
 #include "asan_poisoning.h"
@@ -221,7 +225,10 @@ bool AsanThread::GetStackFrameAccessByAd
 access->frame_descr = (const char *)((uptr*)bottom)[1];
 return true;
   }
-  uptr aligned_addr = addr & ~(SANITIZER_WORDSIZE/8 - 1);  // align addr.
+#ifndef STACK_ALIGNBYTES
+# define STACK_ALIGNBYTES (~(SANITIZER_WORDSIZE/8 - 1))
+#endif
+  uptr aligned_addr = addr & STACK_ALIGNBYTES; // align addr.
   u8 *shadow_ptr = (u8*)MemToShadow(aligned_addr);
   u8 *shadow_bottom = (u8*)MemToShadow(bottom);
 



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2018-02-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 14 02:11:22 UTC 2018

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_interceptors.cc

Log Message:
our __csa_atexit does not like NULL dso; use atexit(3) instead.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.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/asan/asan_interceptors.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.3 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.4
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.3	Thu Feb  1 22:41:11 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc	Tue Feb 13 21:11:22 2018
@@ -705,10 +705,17 @@ INTERCEPTOR(long long, atoll, const char
 }
 #endif  // ASAN_INTERCEPT_ATOLL_AND_STRTOLL
 
+#ifdef SANITIZER_NETBSD
+extern "C" void atexit(void (*)(void));
+static void Atexit(void) {
+  StopInitOrderChecking();
+}
+#else
 static void AtCxaAtexit(void *unused) {
   (void)unused;
   StopInitOrderChecking();
 }
+#endif
 
 #if ASAN_INTERCEPT___CXA_ATEXIT
 INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
@@ -718,7 +725,11 @@ INTERCEPTOR(int, __cxa_atexit, void (*fu
 #endif
   ENSURE_ASAN_INITED();
   int res = REAL(__cxa_atexit)(func, arg, dso_handle);
+#ifdef SANITIZER_NETBSD
+  ::atexit(Atexit);
+#else
   REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr);
+#endif
   return res;
 }
 #endif  // ASAN_INTERCEPT___CXA_ATEXIT



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2016-06-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun  9 14:30:57 UTC 2016

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_malloc_linux.cc

Log Message:
Disable glibc workaround for non linux. Rin Okuyama


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_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/asan/asan_malloc_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc:1.4 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc:1.5
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc:1.4	Tue Jun  7 02:14:18 2016
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc	Thu Jun  9 10:30:57 2016
@@ -56,9 +56,14 @@ INTERCEPTOR(void, cfree, void *ptr) {
 }
 
 INTERCEPTOR(void*, malloc, uptr size) {
+#if SANITIZER_LINUX
+  // This is a workaround for glibc, by which asan_malloc() fails into infinite
+  // recursion of AsanInitInternal(): http://reviews.llvm.org/rL254395
+  // It is irrelevant to us, rather causes abort due to shortage of buffer.
   if (UNLIKELY(!asan_inited))
 // Hack: dlsym calls malloc before REAL(malloc) is retrieved from dlsym.
 return AllocateFromLocalPool(size);
+#endif
   GET_STACK_TRACE_MALLOC;
   return asan_malloc(size, );
 }



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2016-06-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun  1 17:03:26 UTC 2016

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_interceptors.cc

Log Message:
deal with rename lossage


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.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/asan/asan_interceptors.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.1.1.2 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.1.1.2	Sun Jan 24 01:05:41 2016
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc	Wed Jun  1 13:03:26 2016
@@ -267,6 +267,11 @@ INTERCEPTOR(int, swapcontext, struct uco
 }
 #endif  // ASAN_INTERCEPT_SWAPCONTEXT
 
+#if SANITIZER_NETBSD
+#define longjmp __longjmp14
+#define siglongjmp __siglongjmp14
+#endif
+
 INTERCEPTOR(void, longjmp, void *env, int val) {
   __asan_handle_no_return();
   REAL(longjmp)(env, val);



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2016-05-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun  1 04:07:51 UTC 2016

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_mapping.h

Log Message:
use the default offsets since gcc hardcodes them (TARGET_ASAN_SHADOW_OFFSET ->
ix86_asan_shadow_offset)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_mapping.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/asan/asan_mapping.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_mapping.h:1.2 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_mapping.h:1.3
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_mapping.h:1.2	Tue May 31 16:47:25 2016
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_mapping.h	Wed Jun  1 00:07:51 2016
@@ -97,7 +97,7 @@ static const u64 kFreeBSD_ShadowOffset64
 # if SANITIZER_WORDSIZE == 32
 #  if defined(__mips__)
 #define SHADOW_OFFSET kMIPS32_ShadowOffset32
-#  elif SANITIZER_FREEBSD || SANITIZER_NETBSD
+#  elif SANITIZER_FREEBSD
 #define SHADOW_OFFSET kFreeBSD_ShadowOffset32
 #  else
 #if SANITIZER_IOS
@@ -111,7 +111,7 @@ static const u64 kFreeBSD_ShadowOffset64
 #define SHADOW_OFFSET kAArch64_ShadowOffset64
 #  elif defined(__powerpc64__)
 #define SHADOW_OFFSET kPPC64_ShadowOffset64
-#  elif SANITIZER_FREEBSD || SANITIZER_NETBSD
+#  elif SANITIZER_FREEBSD
 #define SHADOW_OFFSET kFreeBSD_ShadowOffset64
 #  elif SANITIZER_MAC
 #   define SHADOW_OFFSET kDefaultShadowOffset64



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2016-05-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun  1 00:53:35 UTC 2016

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_linux.cc

Log Message:
Ignore the first dlpi entry which is ourselves on NetBSD instead of having
a NULL name as on linux.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_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/asan/asan_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.8 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.9
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.8	Tue May 31 16:47:25 2016
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc	Tue May 31 20:53:35 2016
@@ -95,6 +95,15 @@ static int FindFirstDSOCallback(struct d
   if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
 return 0;
 
+#if SANITIZER_NETBSD
+  // Ignore first entry (the main program)
+  char **p = (char **)data;
+  if (*p == NULL) {
+*p = (char *)-1;
+return 0;
+  }
+#endif
+
   *(const char **)data = info->dlpi_name;
   return 1;
 }



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2015-03-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 31 17:58:30 UTC 2015

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_linux.cc

Log Message:
Add RISCV bits


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_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/asan/asan_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.5 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.6
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.5	Thu Oct 23 19:03:38 2014
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc	Tue Mar 31 17:58:30 2015
@@ -69,6 +69,8 @@ void GetPcSpBp(void *context, uptr *pc, 
 #  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S8)
 # elif defined(__powerpc__) || defined(__powerpc64__)
 #  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_R1)
+# elif defined(__riscv__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S0)
 # elif defined(__sparc__)
 #  define _UC_MACHINE_FP(ucontext) sp[15]
 # elif defined(__sh3__)
@@ -106,6 +108,11 @@ void GetPcSpBp(void *context, uptr *pc, 
   // The powerpc{,64}-linux ABIs do not specify r31 as the frame
   // pointer, but GCC always uses r31 when we need a frame pointer.
   *bp = ucontext-uc_mcontext.regs-gpr[PT_R31];
+# elif defined(__riscv__)
+  ucontext_t *ucontext = (ucontext_t*)context;
+  *pc = ucontext-uc_mcontext.gregs[REG_PC];
+  *bp = ucontext-uc_mcontext.gregs[REG_S0];
+  *sp = ucontext-uc_mcontext.gregs[REG_SP];
 # elif defined(__sparc__)
   ucontext_t *ucontext = (ucontext_t*)context;
   uptr *stk_ptr;



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2014-10-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 23 19:03:38 UTC 2014

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_linux.cc

Log Message:
make alpha compile


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_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/asan/asan_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.4 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.5
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.4	Wed Oct 22 20:25:54 2014
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc	Thu Oct 23 15:03:38 2014
@@ -56,7 +56,7 @@ void GetPcSpBp(void *context, uptr *pc, 
  * Unfortunately we don't have a portable frame pointer (yet)
  */
 # if defined(__alpha__)
-#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_X15)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S6)
 # elif defined(__arm__)
 #  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_FP)
 # elif defined(__x86_64__)



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2014-10-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 22 16:53:16 UTC 2014

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_linux.cc

Log Message:
Do the mcontext stuff differently so that we don't fail compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_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/asan/asan_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.2 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.3
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.2	Wed Oct 15 14:44:49 2014
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc	Wed Oct 22 12:53:16 2014
@@ -48,15 +48,42 @@ void *AsanDoesNotSupportStaticLinkage() 
   return _DYNAMIC;  // defined in link.h
 }
 
+void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
 #ifdef __NetBSD__
-#define gregs __gregs
-#define REG_RIP _REG_RIP
-#define REG_RBP _REG_RBP
-#define REG_RSP _REG_RSP
+# if defined(__arm__)
+#  define REG_PC _REG_PC
+#  define REG_BP _REG_FP
+#  define REG_SP _REG_SP
+# elif defined(__x86_64__)
+#  define REG_PC _REG_RIP
+#  define REG_BP _REG_RBP
+#  define REG_SP _REG_RSP
+# elif defined(__i386__)
+#  define REG_PC _REG_EIP
+#  define REG_BP _REG_EBP
+#  define REG_SP _REG_ESP
+# elif defined(__powerpc__) || defined(__powerpc64__)
+#  define REG_PC _REG_PC
+#  define REG_BP _REG_R1
+#  define REG_SP _REG_R31
+# elif defined(__sparc__)
+  ucontext_t *ucontext = (ucontext_t*)context;
+  *pc = _UC_MACHINE_PC(ucontext);
+  *sp = _UC_MACHINE_SP(ucontext);
+  *bp = sp[15]; // XXX: christos
+# else
+  // Lot's are missing, please add more.
 #endif
 
-void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
-#if ASAN_ANDROID
+# ifdef REG_PC
+  ucontext_t *ucontext = (ucontext_t*)context;
+  *pc = ucontext-uc_mcontext.__gregs[REG_PC];
+  *bp = ucontext-uc_mcontext.__gregs[REG_BP];
+  *sp = ucontext-uc_mcontext.__gregs[REG_SP];
+# else
+  *pc = *bp = *sp = 0;
+# endif
+#elif ASAN_ANDROID
   *pc = *sp = *bp = 0;
 #elif defined(__arm__)
   ucontext_t *ucontext = (ucontext_t*)context;



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2014-10-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 23 00:25:54 UTC 2014

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_linux.cc

Log Message:
simplify and add more architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_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/asan/asan_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.3 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.4
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc:1.3	Wed Oct 22 12:53:16 2014
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc	Wed Oct 22 20:25:54 2014
@@ -50,39 +50,38 @@ void *AsanDoesNotSupportStaticLinkage() 
 
 void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
 #ifdef __NetBSD__
-# if defined(__arm__)
-#  define REG_PC _REG_PC
-#  define REG_BP _REG_FP
-#  define REG_SP _REG_SP
+# define __UC_MACHINE_FP(ucontext, r) \
+(ucontext)-uc_mcontext.__gregs[(r)]
+/*
+ * Unfortunately we don't have a portable frame pointer (yet)
+ */
+# if defined(__alpha__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_X15)
+# elif defined(__arm__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_FP)
 # elif defined(__x86_64__)
-#  define REG_PC _REG_RIP
-#  define REG_BP _REG_RBP
-#  define REG_SP _REG_RSP
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_RBP)
 # elif defined(__i386__)
-#  define REG_PC _REG_EIP
-#  define REG_BP _REG_EBP
-#  define REG_SP _REG_ESP
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_EBP)
+# elif defined(__m68k__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_A6)
+# elif defined(__mips__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S8)
 # elif defined(__powerpc__) || defined(__powerpc64__)
-#  define REG_PC _REG_PC
-#  define REG_BP _REG_R1
-#  define REG_SP _REG_R31
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_R1)
 # elif defined(__sparc__)
+#  define _UC_MACHINE_FP(ucontext) sp[15]
+# elif defined(__sh3__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_R14)
+# elif defined(__vax__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_FP)
+# else
+#  define _UC_MACHINE_FP(ucontext) 0
+# endif
   ucontext_t *ucontext = (ucontext_t*)context;
   *pc = _UC_MACHINE_PC(ucontext);
   *sp = _UC_MACHINE_SP(ucontext);
-  *bp = sp[15]; // XXX: christos
-# else
-  // Lot's are missing, please add more.
-#endif
-
-# ifdef REG_PC
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext-uc_mcontext.__gregs[REG_PC];
-  *bp = ucontext-uc_mcontext.__gregs[REG_BP];
-  *sp = ucontext-uc_mcontext.__gregs[REG_SP];
-# else
-  *pc = *bp = *sp = 0;
-# endif
+  *bp = _UC_MACHINE_FP(ucontext);
 #elif ASAN_ANDROID
   *pc = *sp = *bp = 0;
 #elif defined(__arm__)



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/asan

2014-10-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 22 00:14:52 UTC 2014

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_rtl.cc

Log Message:
remove default debugging code.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_rtl.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/asan/asan_rtl.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_rtl.cc:1.2 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_rtl.cc:1.3
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_rtl.cc:1.2	Fri Oct 17 17:44:47 2014
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_rtl.cc	Tue Oct 21 20:14:52 2014
@@ -133,10 +133,8 @@ void InitializeFlags(Flags *f, const cha
   f-quarantine_size = (ASAN_LOW_MEMORY) ? 1UL  26 : 1UL  28;
   f-symbolize = false;
   f-verbosity = 0;
-f-verbosity = 100;
   f-redzone = ASAN_ALLOCATOR_VERSION == 2 ? 16 : (ASAN_LOW_MEMORY) ? 64 : 128;
   f-debug = false;
-f-debug = true;
   f-report_globals = 1;
   f-check_initialization_order = true;
   f-malloc_context_size = kDeafultMallocContextSize;
@@ -154,7 +152,6 @@ f-debug = true;
   f-unmap_shadow_on_exit = false;
   f-abort_on_error = false;
   f-print_stats = false;
-f-print_stats = true;
   f-print_legend = true;
   f-atexit = false;
   f-disable_core = (SANITIZER_WORDSIZE == 64);