pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
compiler-rt-netbsd: Include tsan patches
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Sun Aug 20 02:18:06 2017 +0200
Changeset: 4367124e2cfbf2bd63527cd709a2a7b13c2932a5
Added Files:
compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__linux.cc
compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S
compiler-rt-netbsd/patches/patch-lib_tsan_tests_rtl_tsan__test__util__posix.cc
Log Message:
compiler-rt-netbsd: Include tsan patches
Sponsored by <The NetBSD Foundation>
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=4367124e2cfbf2bd63527cd709a2a7b13c2932a5
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
.../patch-lib_tsan_rtl_tsan__interceptors.cc | 133 +++++++++++++++++++++
.../patch-lib_tsan_rtl_tsan__platform__linux.cc | 28 +++++
.../patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S | 40 +++++++
...h-lib_tsan_tests_rtl_tsan__test__util__posix.cc | 22 ++++
4 files changed, 223 insertions(+)
diffs:
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
new file mode 100644
index 0000000000..bd10b9dae2
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
@@ -0,0 +1,133 @@
+$NetBSD$
+
+--- lib/tsan/rtl/tsan_interceptors.cc.orig 2017-08-03 21:24:38.000000000 +0000
++++ lib/tsan/rtl/tsan_interceptors.cc
+@@ -39,6 +39,12 @@ using namespace __tsan; // NOLINT
+ #define stderr __stderrp
+ #endif
+
++#if SANITIZER_NETBSD
++#define fileno_unlocked fileno
++#define stdout __sF[1]
++#define stderr __sF[2]
++#endif
++
+ #if SANITIZER_ANDROID
+ #define mallopt(a, b)
+ #endif
+@@ -85,18 +91,22 @@ extern "C" void *pthread_self();
+ extern "C" void _exit(int status);
+ extern "C" int fileno_unlocked(void *stream);
+ extern "C" int dirfd(void *dirp);
+-#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID
++#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_NETBSD
+ extern "C" int mallopt(int param, int value);
+ #endif
++#if SANITIZER_NETBSD
++extern __sanitizer_FILE **__sF;
++#else
+ extern __sanitizer_FILE *stdout, *stderr;
+-#if !SANITIZER_FREEBSD && !SANITIZER_MAC
++#endif
++#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_NETBSD
+ const int PTHREAD_MUTEX_RECURSIVE = 1;
+ const int PTHREAD_MUTEX_RECURSIVE_NP = 1;
+ #else
+ const int PTHREAD_MUTEX_RECURSIVE = 2;
+ const int PTHREAD_MUTEX_RECURSIVE_NP = 2;
+ #endif
+-#if !SANITIZER_FREEBSD && !SANITIZER_MAC
++#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_NETBSD
+ const int EPOLL_CTL_ADD = 1;
+ #endif
+ const int SIGILL = 4;
+@@ -105,7 +115,7 @@ const int SIGFPE = 8;
+ const int SIGSEGV = 11;
+ const int SIGPIPE = 13;
+ const int SIGTERM = 15;
+-#if defined(__mips__) || SANITIZER_FREEBSD || SANITIZER_MAC
++#if defined(__mips__) || SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD
+ const int SIGBUS = 10;
+ const int SIGSYS = 12;
+ #else
+@@ -113,7 +123,9 @@ const int SIGBUS = 7;
+ const int SIGSYS = 31;
+ #endif
+ void *const MAP_FAILED = (void*)-1;
+-#if !SANITIZER_MAC
++#if SANITIZER_NETBSD
++const int PTHREAD_BARRIER_SERIAL_THREAD = 1234567;
++#elif !SANITIZER_MAC
+ const int PTHREAD_BARRIER_SERIAL_THREAD = -1;
+ #endif
+ const int MAP_FIXED = 0x10;
+@@ -138,6 +150,15 @@ struct sigaction_t {
+ __sanitizer_sigset_t sa_mask;
+ void (*sa_restorer)();
+ };
++#elif SANITIZER_NETBSD
++struct sigaction_t {
++ union {
++ sighandler_t sa_handler;
++ sigactionhandler_t sa_sigaction;
++ };
++ __sanitizer_sigset_t sa_mask;
++ int sa_flags;
++};
+ #else
+ struct sigaction_t {
+ #ifdef __mips__
+@@ -166,7 +187,7 @@ struct sigaction_t {
+ const sighandler_t SIG_DFL = (sighandler_t)0;
+ const sighandler_t SIG_IGN = (sighandler_t)1;
+ const sighandler_t SIG_ERR = (sighandler_t)-1;
+-#if SANITIZER_FREEBSD || SANITIZER_MAC
++#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD
+ const int SA_SIGINFO = 0x40;
+ const int SIG_SETMASK = 3;
+ #elif defined(__mips__)
+@@ -282,7 +303,7 @@ void ScopedInterceptor::DisableIgnores()
+ }
+
+ #define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func)
+-#if SANITIZER_FREEBSD
++#if SANITIZER_FREEBSD || SANITIZER_NETBSD
+ # define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION(func)
+ #else
+ # define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION_VER(func, ver)
+@@ -459,7 +480,7 @@ static void SetJmp(ThreadState *thr, upt
+ static void LongJmp(ThreadState *thr, uptr *env) {
+ #ifdef __powerpc__
+ uptr mangled_sp = env[0];
+-#elif SANITIZER_FREEBSD
++#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
+ uptr mangled_sp = env[2];
+ #elif SANITIZER_MAC
+ # ifdef __aarch64__
+@@ -1345,7 +1366,7 @@ TSAN_INTERCEPTOR(int, __fxstat, int vers
+ #endif
+
+ TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) {
+-#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_ANDROID
++#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_ANDROID || SANITIZER_NETBSD
+ SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
+@@ -1926,7 +1947,7 @@ TSAN_INTERCEPTOR(int, sigaction, int sig
+ sigactions[sig].sa_flags = *(volatile int*)&act->sa_flags;
+ internal_memcpy(&sigactions[sig].sa_mask, &act->sa_mask,
+ sizeof(sigactions[sig].sa_mask));
+-#if !SANITIZER_FREEBSD && !SANITIZER_MAC
++#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_NETBSD
+ sigactions[sig].sa_restorer = act->sa_restorer;
+ #endif
+ sigaction_t newact;
+@@ -2288,7 +2309,7 @@ struct ScopedSyscall {
+ }
+ };
+
+-#if !SANITIZER_FREEBSD && !SANITIZER_MAC
++#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_NETBSD
+ static void syscall_access_range(uptr pc, uptr p, uptr s, bool write) {
+ TSAN_SYSCALL();
+ MemoryAccessRange(thr, pc, p, s, write);
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__linux.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__linux.cc
new file mode 100644
index 0000000000..f7cb9d9d1c
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__linux.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- lib/tsan/rtl/tsan_platform_linux.cc.orig 2017-07-16 22:40:10.000000000 +0000
++++ lib/tsan/rtl/tsan_platform_linux.cc
+@@ -14,7 +14,7 @@
+
+
+ #include "sanitizer_common/sanitizer_platform.h"
+-#if SANITIZER_LINUX || SANITIZER_FREEBSD
++#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD
+
+ #include "sanitizer_common/sanitizer_common.h"
+ #include "sanitizer_common/sanitizer_libc.h"
+@@ -62,7 +62,7 @@
+ # undef sa_sigaction
+ #endif
+
+-#if SANITIZER_FREEBSD
++#if SANITIZER_FREEBSD || SANITIZER_NETBSD
+ extern "C" void *__libc_stack_end;
+ void *__libc_stack_end = 0;
+ #endif
+@@ -401,4 +401,4 @@ void cur_thread_finalize() {
+
+ } // namespace __tsan
+
+-#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
++#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S
new file mode 100644
index 0000000000..a8c3ad059c
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- lib/tsan/rtl/tsan_rtl_amd64.S.orig 2017-07-16 22:40:10.000000000 +0000
++++ lib/tsan/rtl/tsan_rtl_amd64.S
+@@ -185,7 +185,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
+ #if defined(__FreeBSD__)
+ lea 8(%rsp), %rdi
+ mov %rdi, %rsi
+-#elif defined(__APPLE__)
++#elif defined(__APPLE__) || defined(__NetBSD__)
+ lea 16(%rsp), %rdi
+ mov %rdi, %rsi
+ #elif defined(__linux__)
+@@ -226,7 +226,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
+ #if defined(__FreeBSD__)
+ lea 8(%rsp), %rdi
+ mov %rdi, %rsi
+-#elif defined(__APPLE__)
++#elif defined(__APPLE__) || defined(__NetBSD__)
+ lea 16(%rsp), %rdi
+ mov %rdi, %rsi
+ #elif defined(__linux__)
+@@ -274,7 +274,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
+ #if defined(__FreeBSD__)
+ lea 24(%rsp), %rdi
+ mov %rdi, %rsi
+-#elif defined(__APPLE__)
++#elif defined(__APPLE__) || defined(__NetBSD__)
+ lea 32(%rsp), %rdi
+ mov %rdi, %rsi
+ #elif defined(__linux__)
+@@ -327,7 +327,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
+ sub $8, %rsp
+ CFI_ADJUST_CFA_OFFSET(8)
+ // obtain %rsp
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ lea 24(%rsp), %rdi
+ mov %rdi, %rsi
+ #else
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_tests_rtl_tsan__test__util__posix.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_tests_rtl_tsan__test__util__posix.cc
new file mode 100644
index 0000000000..cbba080f74
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_tests_rtl_tsan__test__util__posix.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- lib/tsan/tests/rtl/tsan_test_util_posix.cc.orig 2017-07-04 05:53:21.000000000 +0000
++++ lib/tsan/tests/rtl/tsan_test_util_posix.cc
+@@ -9,7 +9,7 @@
+ //
+ // This file is a part of ThreadSanitizer (TSan), a race detector.
+ //
+-// Test utils, Linux, FreeBSD and Darwin implementation.
++// Test utils, Linux, FreeBSD, NetBSD and Darwin implementation.
+ //===----------------------------------------------------------------------===//
+
+ #include "sanitizer_common/sanitizer_atomic.h"
+@@ -270,7 +270,7 @@ void ScopedThread::Impl::HandleEvent(Eve
+ }
+ }
+ CHECK_NE(tsan_mop, 0);
+-#if defined(__FreeBSD__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__)
+ const int ErrCode = ESOCKTNOSUPPORT;
+ #else
+ const int ErrCode = ECHRNG;
Home |
Main Index |
Thread Index |
Old Index