pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Upgrade to SVN r. 316598



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Wed Oct 25 21:14:53 2017 +0200
Changeset:	7829b2a7b7954af2fb234a1e3163c106b8d669ad

Modified Files:
	compiler-rt-netbsd/Makefile
	compiler-rt-netbsd/PLIST
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
	compiler-rt-netbsd/patches/patch-lib_msan_msan.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S
Removed Files:
	compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
	compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_go_buildgo.sh
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__linux.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__posix.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_tests_rtl_tsan__test__util__posix.cc
	compiler-rt-netbsd/patches/patch-test_msan_lit.cfg
	compiler-rt-netbsd/patches/patch-test_tsan_lit.cfg
	compiler-rt-netbsd/patches/patch-test_tsan_map32bit.cc
	compiler-rt-netbsd/patches/patch-test_tsan_strerror__r.cc
	compiler-rt-netbsd/patches/patch-test_tsan_tls__race.cc
	compiler-rt-netbsd/patches/patch-test_tsan_tls__race2.cc

Log Message:
compiler-rt-netbsd: Upgrade to SVN r. 316598

Merged upstream:

"Add NetBSD improvements in sanitizers"
https://reviews.llvm.org/D39124

After this upgrade, we keep locally only kludges to make tsan fail less often.
The remaining patches are under investigation.

Add msan files in PLIST.

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=7829b2a7b7954af2fb234a1e3163c106b8d669ad

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 compiler-rt-netbsd/Makefile                        |   2 +-
 compiler-rt-netbsd/PLIST                           |   5 +
 compiler-rt-netbsd/distinfo                        |  29 +--
 .../patches/patch-lib_fuzzer_tests_CMakeLists.txt  |   2 +-
 compiler-rt-netbsd/patches/patch-lib_msan_msan.h   |   2 +-
 .../patches/patch-lib_msan_msan__interceptors.cc   | 175 ---------------
 .../patches/patch-lib_msan_msan__linux.cc          |  24 --
 ...zer__common_sanitizer__common__interceptors.inc |  57 +----
 ...b_sanitizer__common_sanitizer__internal__defs.h |  13 --
 ...patch-lib_sanitizer__common_sanitizer__linux.cc | 250 ---------------------
 ...__common_sanitizer__platform__limits__netbsd.cc |  13 --
 ...r__common_sanitizer__platform__limits__netbsd.h |  13 --
 ...anitizer__common_sanitizer__thread__registry.cc |  13 --
 .../patches/patch-lib_tsan_go_buildgo.sh           |  26 ---
 .../patch-lib_tsan_rtl_tsan__interceptors.cc       |  95 +++-----
 .../patch-lib_tsan_rtl_tsan__platform__linux.cc    |  24 --
 .../patch-lib_tsan_rtl_tsan__platform__posix.cc    |  15 --
 .../patches/patch-lib_tsan_rtl_tsan__rtl.cc        |   3 +-
 .../patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S  |  44 ++--
 ...h-lib_tsan_tests_rtl_tsan__test__util__posix.cc |  22 --
 compiler-rt-netbsd/patches/patch-test_msan_lit.cfg |  13 --
 compiler-rt-netbsd/patches/patch-test_tsan_lit.cfg |  13 --
 .../patches/patch-test_tsan_map32bit.cc            |  20 --
 .../patches/patch-test_tsan_strerror__r.cc         |  14 --
 .../patches/patch-test_tsan_tls__race.cc           |   9 -
 .../patches/patch-test_tsan_tls__race2.cc          |   9 -
 26 files changed, 73 insertions(+), 832 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/Makefile b/compiler-rt-netbsd/Makefile
index 55663bc830..b1acca4db2 100644
--- a/compiler-rt-netbsd/Makefile
+++ b/compiler-rt-netbsd/Makefile
@@ -5,7 +5,7 @@ CATEGORIES=	lang devel
 
 SVN_REPOSITORIES=	compiler-rt
 SVN_REPO.compiler-rt=	http://llvm.org/svn/llvm-project/compiler-rt/trunk
-SVN_REVISION.compiler-rt=	315927
+SVN_REVISION.compiler-rt=	316598
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://compiler-rt.llvm.org/
diff --git a/compiler-rt-netbsd/PLIST b/compiler-rt-netbsd/PLIST
index 039222a6e8..beab8d2b13 100644
--- a/compiler-rt-netbsd/PLIST
+++ b/compiler-rt-netbsd/PLIST
@@ -1,6 +1,7 @@
 @comment $NetBSD$
 lib/clang/${PKGVERSION}/asan_blacklist.txt
 lib/clang/${PKGVERSION}/cfi_blacklist.txt
+lib/clang/${PKGVERSION}/msan_blacklist.txt
 lib/clang/${PKGVERSION}/include/sanitizer/allocator_interface.h
 lib/clang/${PKGVERSION}/include/sanitizer/asan_interface.h
 lib/clang/${PKGVERSION}/include/sanitizer/common_interface_defs.h
@@ -32,6 +33,10 @@ lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.fuzzer-x86_64.a
 lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.fuzzer_no_main-x86_64.a
 lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.lsan-i386.a
 lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.lsan-x86_64.a
+lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.msan-x86_64.a
+lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.msan-x86_64.a.syms
+lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.msan_cxx-x86_64.a
+lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.msan_cxx-x86_64.a.syms
 lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.profile-i386.a
 lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.profile-x86_64.a
 lib/clang/${PKGVERSION}/lib/${COMPILER_RT_OS_DIR}/libclang_rt.safestack-i386.a
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 8159bcc928..23999c2261 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -1,26 +1,9 @@
 $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 
 SHA1 (patch-cmake_config-ix.cmake) = a1814db3e044ce3954655fea1e157a96bfa8df2f
-SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = eaffd9f8f2621ad465b5c734a764bdff0243af3d
-SHA1 (patch-lib_msan_msan.h) = 5fefdf22e43c9c9a3cee8f9038bf21d8ba786da0
-SHA1 (patch-lib_msan_msan__interceptors.cc) = 57f1bc2f486aa346cf6ef12d5c4ca145f165df90
-SHA1 (patch-lib_msan_msan__linux.cc) = e38786bff9cde3de0a84614f757888f249fea905
-SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = f46dd7dcbe63fb39ed50696bf4bbb4eea1ef8f19
-SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = f5825b7081758e07e36dbd47a887f31a20912a83
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = 25cba9ff9d61910bb74d500e515da083af4e6cb7
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = 46f00f0eee984ac395f4418eae0fa75efd4895b2
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = ce1a3cbb60b81ae67a3242eb96f8d277a1fad059
-SHA1 (patch-lib_sanitizer__common_sanitizer__thread__registry.cc) = ab0bccc862443c04ec0e7287bbf8e2632546bb90
-SHA1 (patch-lib_tsan_go_buildgo.sh) = fe64b3389bbf6ae2ddf187df3e0600b2f817f51d
-SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = 3bea97313e5ddf4942f0a63fabeaf61789328698
-SHA1 (patch-lib_tsan_rtl_tsan__platform__linux.cc) = 23744bd656f0dcee425821491bcaa723f26130a3
-SHA1 (patch-lib_tsan_rtl_tsan__platform__posix.cc) = ddf48d91100e681f09b7303a37936ac8cd7f775a
-SHA1 (patch-lib_tsan_rtl_tsan__rtl.cc) = 8d5938bb27f9d238ceeb09ac1e6e8090b196fdcc
-SHA1 (patch-lib_tsan_rtl_tsan__rtl__amd64.S) = 95591667c23372ceb72334b2ceae800d32574ac6
-SHA1 (patch-lib_tsan_tests_rtl_tsan__test__util__posix.cc) = 302c72dab4fe5a0c94d7de0d728033e616811e5e
-SHA1 (patch-test_msan_lit.cfg) = 29a3a41c4a0c0df72ddde6a4e0c66d73ca1022e0
-SHA1 (patch-test_tsan_lit.cfg) = 001a4025f0542998da209df933359cf929d7631e
-SHA1 (patch-test_tsan_map32bit.cc) = 08886c59b31fb1bc3574ce8c12d2a8194c0b64a1
-SHA1 (patch-test_tsan_strerror__r.cc) = 6f157012b8a3ca80f11380b76c433bddea16c86b
-SHA1 (patch-test_tsan_tls__race.cc) = 7447ee161c27deb7196151f56ea739904bec8c1c
-SHA1 (patch-test_tsan_tls__race2.cc) = da9b3298b8e882db111b01ac10a5ae6dbeaa88dc
+SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 38ca750154dfc9843a56748078235824b772a147
+SHA1 (patch-lib_msan_msan.h) = ce3f544490aebc1db73be9e3388f0a9d31d5b369
+SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = ec1d31397b5036aedecd6e110a1f898558f0273e
+SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = efb9469d5c49a556c605545bfbbbd53ff7a2169d
+SHA1 (patch-lib_tsan_rtl_tsan__rtl.cc) = bc3d6aa81515ac4a4fc5b504e93b3ac8de355371
+SHA1 (patch-lib_tsan_rtl_tsan__rtl__amd64.S) = 6df0f2af44ebfec76d3b237c984eff63ee93b30f
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
index 1bc158c2c8..d2fd1cf3d9 100644
--- a/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/fuzzer/tests/CMakeLists.txt.orig	2017-08-21 23:23:37.000000000 +0000
+--- lib/fuzzer/tests/CMakeLists.txt.orig	2017-10-17 18:35:48.000000000 +0000
 +++ lib/fuzzer/tests/CMakeLists.txt
 @@ -10,6 +10,9 @@ add_custom_target(FuzzerUnitTests)
  set_target_properties(FuzzerUnitTests PROPERTIES FOLDER "Compiler-RT Tests")
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan.h b/compiler-rt-netbsd/patches/patch-lib_msan_msan.h
index f00903e1a8..58a27518a0 100644
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan.h
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_msan.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/msan/msan.h.orig	2017-10-20 10:50:29.258053447 +0000
+--- lib/msan/msan.h.orig	2017-10-17 18:35:51.000000000 +0000
 +++ lib/msan/msan.h
 @@ -199,7 +199,7 @@ const MappingDesc kMemoryLayout[] = {
  #define MEM_TO_SHADOW(mem) (LINEARIZE_MEM((mem)) + 0x100000000000ULL)
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
deleted file mode 100644
index 9a357f1bd1..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
+++ /dev/null
@@ -1,175 +0,0 @@
-$NetBSD$
-
---- lib/msan/msan_interceptors.cc.orig	2017-10-20 10:50:46.737765048 +0000
-+++ lib/msan/msan_interceptors.cc
-@@ -118,7 +118,7 @@ static void *AllocateFromLocalPool(uptr 
- #define CHECK_UNPOISONED_STRING(x, n)                           \
-     CHECK_UNPOISONED_STRING_OF_LEN((x), internal_strlen(x), (n))
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(SIZE_T, fread_unlocked, void *ptr, SIZE_T size, SIZE_T nmemb,
-             void *file) {
-   ENSURE_MSAN_INITED();
-@@ -168,7 +168,7 @@ INTERCEPTOR(int, posix_memalign, void **
-   return res;
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(void *, memalign, SIZE_T alignment, SIZE_T size) {
-   GET_MALLOC_STACK_TRACE;
-   return msan_memalign(alignment, size, &stack);
-@@ -196,7 +196,7 @@ INTERCEPTOR(void *, valloc, SIZE_T size)
-   return msan_valloc(size, &stack);
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(void *, pvalloc, SIZE_T size) {
-   GET_MALLOC_STACK_TRACE;
-   return msan_pvalloc(size, &stack);
-@@ -212,7 +212,7 @@ INTERCEPTOR(void, free, void *ptr) {
-   MsanDeallocate(&stack, ptr);
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(void, cfree, void *ptr) {
-   GET_MALLOC_STACK_TRACE;
-   if (!ptr || UNLIKELY(IsInDlsymAllocPool(ptr))) return;
-@@ -227,7 +227,7 @@ INTERCEPTOR(uptr, malloc_usable_size, vo
-   return __sanitizer_get_allocated_size(ptr);
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- // This function actually returns a struct by value, but we can't unpoison a
- // temporary! The following is equivalent on all supported platforms but
- // aarch64 (which uses a different register for sret value).  We have a test
-@@ -246,7 +246,7 @@ INTERCEPTOR(void, mallinfo, __sanitizer_
- #define MSAN_MAYBE_INTERCEPT_MALLINFO
- #endif
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, mallopt, int cmd, int value) {
-   return -1;
- }
-@@ -255,7 +255,7 @@ INTERCEPTOR(int, mallopt, int cmd, int v
- #define MSAN_MAYBE_INTERCEPT_MALLOPT
- #endif
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(void, malloc_stats, void) {
-   // FIXME: implement, but don't call REAL(malloc_stats)!
- }
-@@ -308,7 +308,7 @@ INTERCEPTOR(char *, strdup, char *src) {
-   return res;
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(char *, __strdup, char *src) {
-   ENSURE_MSAN_INITED();
-   GET_STORE_STACK_TRACE;
-@@ -473,7 +473,7 @@ INTERCEPTOR(SIZE_T, strftime_l, char *s,
-   INTERCEPTOR_STRFTIME_BODY(char, SIZE_T, strftime_l, s, max, format, tm, loc);
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(SIZE_T, __strftime_l, char *s, SIZE_T max, const char *format,
-             __sanitizer_tm *tm, void *loc) {
-   INTERCEPTOR_STRFTIME_BODY(char, SIZE_T, __strftime_l, s, max, format, tm,
-@@ -495,7 +495,7 @@ INTERCEPTOR(SIZE_T, wcsftime_l, wchar_t 
-                             loc);
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(SIZE_T, __wcsftime_l, wchar_t *s, SIZE_T max, const wchar_t *format,
-             __sanitizer_tm *tm, void *loc) {
-   INTERCEPTOR_STRFTIME_BODY(wchar_t, SIZE_T, __wcsftime_l, s, max, format, tm,
-@@ -614,7 +614,7 @@ INTERCEPTOR(int, putenv, char *string) {
-   return res;
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, __fxstat, int magic, int fd, void *buf) {
-   ENSURE_MSAN_INITED();
-   int res = REAL(__fxstat)(magic, fd, buf);
-@@ -627,7 +627,7 @@ INTERCEPTOR(int, __fxstat, int magic, in
- #define MSAN_MAYBE_INTERCEPT___FXSTAT
- #endif
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, __fxstat64, int magic, int fd, void *buf) {
-   ENSURE_MSAN_INITED();
-   int res = REAL(__fxstat64)(magic, fd, buf);
-@@ -640,7 +640,7 @@ INTERCEPTOR(int, __fxstat64, int magic, 
- #define MSAN_MAYBE_INTERCEPT___FXSTAT64
- #endif
- 
--#if SANITIZER_FREEBSD
-+#if SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, fstatat, int fd, char *pathname, void *buf, int flags) {
-   ENSURE_MSAN_INITED();
-   int res = REAL(fstatat)(fd, pathname, buf, flags);
-@@ -659,7 +659,7 @@ INTERCEPTOR(int, __fxstatat, int magic, 
- # define MSAN_INTERCEPT_FSTATAT INTERCEPT_FUNCTION(__fxstatat)
- #endif
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, __fxstatat64, int magic, int fd, char *pathname, void *buf,
-             int flags) {
-   ENSURE_MSAN_INITED();
-@@ -706,7 +706,7 @@ INTERCEPTOR(char *, fgets, char *s, int 
-   return res;
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(char *, fgets_unlocked, char *s, int size, void *stream) {
-   ENSURE_MSAN_INITED();
-   char *res = REAL(fgets_unlocked)(s, size, stream);
-@@ -729,7 +729,7 @@ INTERCEPTOR(int, getrlimit, int resource
-   return res;
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, getrlimit64, int resource, void *rlim) {
-   if (msan_init_is_running) return REAL(getrlimit64)(resource, rlim);
-   ENSURE_MSAN_INITED();
-@@ -805,7 +805,7 @@ INTERCEPTOR(int, gethostname, char *name
-   return res;
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, epoll_wait, int epfd, void *events, int maxevents,
-     int timeout) {
-   ENSURE_MSAN_INITED();
-@@ -820,7 +820,7 @@ INTERCEPTOR(int, epoll_wait, int epfd, v
- #define MSAN_MAYBE_INTERCEPT_EPOLL_WAIT
- #endif
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(int, epoll_pwait, int epfd, void *events, int maxevents,
-     int timeout, void *sigmask) {
-   ENSURE_MSAN_INITED();
-@@ -909,7 +909,7 @@ INTERCEPTOR(void *, mmap, void *addr, SI
-   return res;
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- INTERCEPTOR(void *, mmap64, void *addr, SIZE_T length, int prot, int flags,
-             int fd, OFF64_T offset) {
-   ENSURE_MSAN_INITED();
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc
deleted file mode 100644
index c0c27831be..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD$
-
---- lib/msan/msan_linux.cc.orig	2017-10-20 10:51:37.065317095 +0000
-+++ lib/msan/msan_linux.cc
-@@ -9,11 +9,11 @@
- //
- // This file is a part of MemorySanitizer.
- //
--// Linux- and FreeBSD-specific code.
-+// Linux-, NetBSD- and FreeBSD-specific code.
- //===----------------------------------------------------------------------===//
- 
- #include "sanitizer_common/sanitizer_platform.h"
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
- 
- #include "msan.h"
- #include "msan_thread.h"
-@@ -213,4 +213,4 @@ void MsanTSDDtor(void *tsd) {
- 
- } // namespace __msan
- 
--#endif // SANITIZER_FREEBSD || SANITIZER_LINUX
-+#endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
index c1e75ed1c5..fd14017a36 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
@@ -1,66 +1,13 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig	2017-10-17 18:35:46.000000000 +0000
+--- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig	2017-10-25 19:03:28.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_common_interceptors.inc
 @@ -3795,7 +3795,7 @@ INTERCEPTOR(void, _exit, int status) {
  #define INIT__EXIT
  #endif
  
 -#if SANITIZER_INTERCEPT_PHTREAD_MUTEX
-+#if SANITIZER_INTERCEPT_PHTREAD_MUTEX && !SANITIZER_NETBSD
++#if SANITIZER_INTERCEPT_PHTREAD_MUTEX && 0
  INTERCEPTOR(int, pthread_mutex_lock, void *m) {
    void *ctx;
    COMMON_INTERCEPTOR_ENTER(ctx, pthread_mutex_lock, m);
-@@ -3828,6 +3828,13 @@ INTERCEPTOR(int, pthread_mutex_unlock, v
- #define INIT_PTHREAD_MUTEX_UNLOCK
- #endif
- 
-+__attribute__((constructor))
-+static void
-+yikes(void) {
-+//  INIT_PTHREAD_MUTEX_LOCK;
-+//  INIT_PTHREAD_MUTEX_UNLOCK;
-+}
-+
- #if SANITIZER_INTERCEPT_GETMNTENT || SANITIZER_INTERCEPT_GETMNTENT_R
- static void write_mntent(void *ctx, __sanitizer_mntent *mnt) {
-   COMMON_INTERCEPTOR_WRITE_RANGE(ctx, mnt, sizeof(*mnt));
-@@ -4405,7 +4412,7 @@ INTERCEPTOR(char *, tempnam, char *dir, 
- #define INIT_TEMPNAM
- #endif
- 
--#if SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP
-+#if SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP && !SANITIZER_NETBSD
- INTERCEPTOR(int, pthread_setname_np, uptr thread, const char *name) {
-   void *ctx;
-   COMMON_INTERCEPTOR_ENTER(ctx, pthread_setname_np, thread, name);
-@@ -4414,6 +4421,18 @@ INTERCEPTOR(int, pthread_setname_np, upt
-   return REAL(pthread_setname_np)(thread, name);
- }
- #define INIT_PTHREAD_SETNAME_NP COMMON_INTERCEPT_FUNCTION(pthread_setname_np);
-+#elif SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP && SANITIZER_NETBSD
-+INTERCEPTOR(int, pthread_setname_np, uptr thread, const char *name, void *arg) {
-+  void *ctx;
-+  char newname[32]; // PTHREAD_MAX_NAMELEN_NP=32
-+  int namelen;
-+  COMMON_INTERCEPTOR_ENTER(ctx, pthread_setname_np, thread, name, arg);
-+  namelen = internal_snprintf(newname, sizeof(newname), name, arg);
-+  COMMON_INTERCEPTOR_READ_STRING(ctx, newname, namelen);
-+  COMMON_INTERCEPTOR_SET_PTHREAD_NAME(ctx, thread, newname);
-+  return REAL(pthread_setname_np)(thread, name, arg);
-+}
-+#define INIT_PTHREAD_SETNAME_NP COMMON_INTERCEPT_FUNCTION(pthread_setname_np);
- #else
- #define INIT_PTHREAD_SETNAME_NP
- #endif
-@@ -6373,8 +6392,10 @@ static void InitializeCommonInterceptors
-   INIT_SIGPROCMASK;
-   INIT_BACKTRACE;
-   INIT__EXIT;
-+#if !SANITIZER_NETBSD
-   INIT_PTHREAD_MUTEX_LOCK;
-   INIT_PTHREAD_MUTEX_UNLOCK;
-+#endif
-   INIT_GETMNTENT;
-   INIT_GETMNTENT_R;
-   INIT_STATFS;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h
deleted file mode 100644
index c6bca26724..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_internal_defs.h.orig	2017-10-02 13:17:03.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_internal_defs.h
-@@ -36,7 +36,7 @@
- #endif
- 
- // TLS is handled differently on different platforms
--#if SANITIZER_LINUX
-+#if SANITIZER_LINUX || SANITIZER_NETBSD
- # define SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE \
-     __attribute__((tls_model("initial-exec"))) thread_local
- #else
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
deleted file mode 100644
index 16cd7b0915..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
+++ /dev/null
@@ -1,250 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_linux.cc.orig	2017-10-02 13:17:02.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_linux.cc
-@@ -87,6 +87,8 @@ extern char **environ;  // provided by c
- #include <limits.h>  // For NAME_MAX
- #include <sys/sysctl.h>
- extern char **environ;  // provided by crt1
-+#include <sys/exec.h>
-+extern struct ps_strings *__ps_strings;
- #endif                  // SANITIZER_NETBSD
- 
- #if !SANITIZER_ANDROID
-@@ -186,7 +188,9 @@ uptr internal_close(fd_t fd) {
- }
- 
- uptr internal_open(const char *filename, int flags) {
--#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-+#if SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(open), (uptr)filename, flags);
-+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-   return internal_syscall(SYSCALL(openat), AT_FDCWD, (uptr)filename, flags);
- #else
-   return internal_syscall(SYSCALL(open), (uptr)filename, flags);
-@@ -194,7 +198,9 @@ uptr internal_open(const char *filename,
- }
- 
- uptr internal_open(const char *filename, int flags, u32 mode) {
--#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-+#if SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(open), (uptr)filename, flags, mode);
-+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-   return internal_syscall(SYSCALL(openat), AT_FDCWD, (uptr)filename, flags,
-                           mode);
- #else
-@@ -227,7 +233,7 @@ uptr internal_write(fd_t fd, const void 
- uptr internal_ftruncate(fd_t fd, uptr size) {
-   sptr res;
- #if SANITIZER_NETBSD
--  HANDLE_EINTR(res, internal_syscall(SYSCALL(ftruncate), fd, 0, (s64)size));
-+  HANDLE_EINTR(res, internal_syscall64(SYSCALL(ftruncate), fd, 0, (s64)size));
- #else
-   HANDLE_EINTR(res, (sptr)internal_syscall(SYSCALL(ftruncate), fd,
-                (OFF_T)size));
-@@ -303,9 +309,12 @@ static void kernel_stat_to_stat(struct k
- #endif
- 
- uptr internal_stat(const char *path, void *buf) {
--#if SANITIZER_FREEBSD || SANITIZER_NETBSD
-+#if SANITIZER_FREEBSD
-   return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path,
-                           (uptr)buf, 0);
-+#elif SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(fstatat), AT_FDCWD, (uptr)path,
-+                          (uptr)buf, 0);
- #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-   return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path,
-                           (uptr)buf, 0);
-@@ -329,7 +338,7 @@ uptr internal_stat(const char *path, voi
- 
- uptr internal_lstat(const char *path, void *buf) {
- #if SANITIZER_NETBSD
--  return internal_syscall(SYSCALL(lstat), path, buf);
-+  return internal_syscall_ptr(SYSCALL(lstat), path, buf);
- #elif SANITIZER_FREEBSD
-   return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path,
-                           (uptr)buf, AT_SYMLINK_NOFOLLOW);
-@@ -355,7 +364,9 @@ uptr internal_lstat(const char *path, vo
- }
- 
- uptr internal_fstat(fd_t fd, void *buf) {
--#if SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS || SANITIZER_NETBSD
-+#if SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(fstat), fd, (uptr)buf);
-+#elif SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS
- # if SANITIZER_MIPS64
-   // For mips64, fstat syscall fills buffer in the format of kernel_stat
-   struct kernel_stat kbuf;
-@@ -400,7 +411,9 @@ uptr internal_readlink(const char *path,
- }
- 
- uptr internal_unlink(const char *path) {
--#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-+#if SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(unlink), (uptr)path);
-+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-   return internal_syscall(SYSCALL(unlinkat), AT_FDCWD, (uptr)path, 0);
- #else
-   return internal_syscall(SYSCALL(unlink), (uptr)path);
-@@ -408,7 +421,9 @@ uptr internal_unlink(const char *path) {
- }
- 
- uptr internal_rename(const char *oldpath, const char *newpath) {
--#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-+#if SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(rename), (uptr)oldpath, (uptr)newpath);
-+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-   return internal_syscall(SYSCALL(renameat), AT_FDCWD, (uptr)oldpath, AT_FDCWD,
-                           (uptr)newpath);
- #else
-@@ -433,15 +448,24 @@ unsigned int internal_sleep(unsigned int
-   struct timespec ts;
-   ts.tv_sec = 1;
-   ts.tv_nsec = 0;
-+#if SANITIZER_NETBSD
-+  int res = internal_syscall_ptr(SYSCALL(nanosleep), &ts, &ts);
-+#else
-   int res = internal_syscall(SYSCALL(nanosleep), &ts, &ts);
-+#endif
-   if (res) return ts.tv_sec;
-   return 0;
- }
- 
- uptr internal_execve(const char *filename, char *const argv[],
-                      char *const envp[]) {
-+#if SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(execve), (uptr)filename, (uptr)argv,
-+                          (uptr)envp);
-+#else
-   return internal_syscall(SYSCALL(execve), (uptr)filename, (uptr)argv,
-                           (uptr)envp);
-+#endif
- }
- 
- // ----------------- sanitizer_common.h
-@@ -524,13 +548,13 @@ const char *GetEnv(const char *name) {
- #endif
- }
- 
--#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- extern "C" {
-   SANITIZER_WEAK_ATTRIBUTE extern void *__libc_stack_end;
- }
- #endif
- 
--#if !SANITIZER_GO && !SANITIZER_FREEBSD
-+#if !SANITIZER_GO && !SANITIZER_FREEBSD && !SANITIZER_NETBSD
- static void ReadNullSepFileToArray(const char *path, char ***arr,
-                                    int arr_size) {
-   char *buff;
-@@ -556,7 +580,22 @@ static void ReadNullSepFileToArray(const
- #endif
- 
- static void GetArgsAndEnv(char ***argv, char ***envp) {
--#if !SANITIZER_FREEBSD
-+#if SANITIZER_FREEBSD
-+  // On FreeBSD, retrieving the argument and environment arrays is done via the
-+  // kern.ps_strings sysctl, which returns a pointer to a structure containing
-+  // this information. See also <sys/exec.h>.
-+  ps_strings *pss;
-+  size_t sz = sizeof(pss);
-+  if (sysctlbyname("kern.ps_strings", &pss, &sz, NULL, 0) == -1) {
-+    Printf("sysctl kern.ps_strings failed\n");
-+    Die();
-+  }
-+  *argv = pss->ps_argvstr;
-+  *envp = pss->ps_envstr;
-+#elif SANITIZER_NETBSD
-+  *argv = __ps_strings->ps_argvstr;
-+  *argv = __ps_strings->ps_envstr;
-+#else
- #if !SANITIZER_GO
-   if (&__libc_stack_end) {
- #endif
-@@ -571,18 +610,6 @@ static void GetArgsAndEnv(char ***argv, 
-     ReadNullSepFileToArray("/proc/self/environ", envp, kMaxEnvp);
-   }
- #endif
--#else
--  // On FreeBSD, retrieving the argument and environment arrays is done via the
--  // kern.ps_strings sysctl, which returns a pointer to a structure containing
--  // this information. See also <sys/exec.h>.
--  ps_strings *pss;
--  size_t sz = sizeof(pss);
--  if (sysctlbyname("kern.ps_strings", &pss, &sz, NULL, 0) == -1) {
--    Printf("sysctl kern.ps_strings failed\n");
--    Die();
--  }
--  *argv = pss->ps_argvstr;
--  *envp = pss->ps_envstr;
- #endif
- }
- 
-@@ -594,8 +621,22 @@ char **GetArgv() {
- 
- void ReExec() {
-   char **argv, **envp;
-+  const char *pathname = "/proc/self/exe";
-+
-+#if SANITIZER_NETBSD
-+  static const int name[] = {
-+    CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME,
-+  };
-+  char path[400];
-+  size_t len;
-+
-+  len = sizeof(path);
-+  if (sysctl(name, ARRAY_SIZE(name), path, &len, NULL, 0) != -1)
-+    pathname = path;
-+#endif
-+
-   GetArgsAndEnv(&argv, &envp);
--  uptr rv = internal_execve("/proc/self/exe", argv, envp);
-+  uptr rv = internal_execve(pathname, argv, envp);
-   int rverrno;
-   CHECK_EQ(internal_iserror(rv, &rverrno), true);
-   Printf("execve failed, errno %d\n", rverrno);
-@@ -699,7 +740,7 @@ uptr internal_ptrace(int request, int pi
- 
- uptr internal_waitpid(int pid, int *status, int options) {
- #if SANITIZER_NETBSD
--  return internal_syscall(SYSCALL(wait4), pid, status, options,
-+  return internal_syscall_ptr(SYSCALL(wait4), pid, status, options,
-                           NULL /* rusage */);
- #else
-   return internal_syscall(SYSCALL(wait4), pid, (uptr)status, options,
-@@ -717,7 +758,7 @@ uptr internal_getppid() {
- 
- uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) {
- #if SANITIZER_NETBSD
--  return internal_syscall(SYSCALL(getdents), fd, dirp, (uptr)count);
-+  return internal_syscall64(SYSCALL(getdents), fd, dirp, (uptr)count);
- #elif SANITIZER_FREEBSD
-   return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL);
- #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-@@ -742,7 +783,11 @@ uptr internal_prctl(int option, uptr arg
- #endif
- 
- uptr internal_sigaltstack(const void *ss, void *oss) {
-+#if SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
-+#else
-   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
-+#endif
- }
- 
- int internal_fork() {
-@@ -823,8 +868,10 @@ int internal_sigaction_syscall(int signu
- 
- uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
-     __sanitizer_sigset_t *oldset) {
--#if SANITIZER_FREEBSD || SANITIZER_NETBSD
-+#if SANITIZER_FREEBSD
-   return internal_syscall(SYSCALL(sigprocmask), how, set, oldset);
-+#elif SANITIZER_NETBSD
-+  return internal_syscall_ptr(SYSCALL(sigprocmask), how, set, oldset);
- #else
-   __sanitizer_kernel_sigset_t *k_set = (__sanitizer_kernel_sigset_t *)set;
-   __sanitizer_kernel_sigset_t *k_oldset = (__sanitizer_kernel_sigset_t *)oldset;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
deleted file mode 100644
index 2b2f51498c..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc.orig	2017-10-20 11:15:55.418787987 +0000
-+++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
-@@ -128,6 +128,8 @@ uptr __sanitizer_in_addr_sz(int af) {
-     return 0;
- }
- 
-+unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-+
- int glob_nomatch = GLOB_NOMATCH;
- int glob_altdirfunc = GLOB_ALTDIRFUNC;
- 
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
deleted file mode 100644
index e9c8fd582c..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h.orig	2017-10-17 18:35:46.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
-@@ -313,7 +313,7 @@ struct __sanitizer_wordexp_t {
-   uptr we_nbytes;
- };
- 
--typedef void __sanitizer_FILE;
-+typedef char __sanitizer_FILE;
- #define SANITIZER_HAS_STRUCT_FILE 0
- 
- extern int shmctl_ipc_stat;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
deleted file mode 100644
index 76ede97a1e..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_thread_registry.cc.orig	2017-10-17 18:35:46.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_thread_registry.cc
-@@ -47,7 +47,7 @@ void ThreadContextBase::SetDead() {
- void ThreadContextBase::SetJoined(void *arg) {
-   // FIXME(dvyukov): print message and continue (it's user error).
-   CHECK_EQ(false, detached);
--  CHECK_EQ(ThreadStatusFinished, status);
-+//  CHECK_EQ(ThreadStatusFinished, status);
-   status = ThreadStatusDead;
-   user_id = 0;
-   OnJoined(arg);
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_go_buildgo.sh b/compiler-rt-netbsd/patches/patch-lib_tsan_go_buildgo.sh
deleted file mode 100644
index b98aa5a3ce..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_go_buildgo.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-$NetBSD$
-
---- lib/tsan/go/buildgo.sh.orig	2017-07-24 13:39:38.000000000 +0000
-+++ lib/tsan/go/buildgo.sh
-@@ -68,6 +68,21 @@ elif [ "`uname -a | grep FreeBSD`" != ""
- 		../../sanitizer_common/sanitizer_linux_libcdep.cc
- 		../../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
- 	"
-+elif [ "`uname -a | grep NetBSD`" != "" ]; then
-+	SUFFIX="netbsd_amd64"
-+	OSCFLAGS="-fno-strict-aliasing -fPIC -Werror"
-+	OSLDFLAGS="-lpthread -fPIC -fpie"
-+	SRCS="
-+		$SRCS
-+		../rtl/tsan_platform_linux.cc
-+		../../sanitizer_common/sanitizer_posix.cc
-+		../../sanitizer_common/sanitizer_posix_libcdep.cc
-+		../../sanitizer_common/sanitizer_procmaps_common.cc
-+		../../sanitizer_common/sanitizer_procmaps_freebsd.cc
-+		../../sanitizer_common/sanitizer_linux.cc
-+		../../sanitizer_common/sanitizer_linux_libcdep.cc
-+		../../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
-+	"
- elif [ "`uname -a | grep Darwin`" != "" ]; then
- 	SUFFIX="darwin_amd64"
- 	OSCFLAGS="-fPIC -Wno-unused-const-variable -Wno-unknown-warning-option -isysroot $(xcodebuild -version -sdk macosx Path) -mmacosx-version-min=10.7"
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
index 21aebb1a2f..6870f6d066 100644
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
@@ -1,47 +1,21 @@
 $NetBSD$
 
---- lib/tsan/rtl/tsan_interceptors.cc.orig	2017-10-17 18:35:44.000000000 +0000
+--- lib/tsan/rtl/tsan_interceptors.cc.orig	2017-10-25 19:03:27.000000000 +0000
 +++ lib/tsan/rtl/tsan_interceptors.cc
-@@ -43,8 +43,16 @@ using namespace __tsan;  // NOLINT
- #if SANITIZER_NETBSD
- #define dirfd(dirp) (*(int *)(dirp))
- #define fileno_unlocked fileno
--#define stdout __sF[1]
--#define stderr __sF[2]
-+
-+#if _LP64
-+#define __sF_size 152
-+#else
-+#define __sF_size 88
-+#endif
-+
-+#define stdout ((char*)&__sF + (__sF_size * 1))
-+#define stderr ((char*)&__sF + (__sF_size * 2))
-+
- #endif
- 
- #if SANITIZER_ANDROID
-@@ -99,7 +107,7 @@ extern "C" int dirfd(void *dirp);
- extern "C" int mallopt(int param, int value);
- #endif
- #if SANITIZER_NETBSD
--extern __sanitizer_FILE **__sF;
-+extern __sanitizer_FILE __sF[];
- #else
- extern __sanitizer_FILE *stdout, *stderr;
- #endif
-@@ -388,8 +396,8 @@ static void at_exit_wrapper(void *arg) {
+@@ -395,9 +395,9 @@ static void at_exit_wrapper(void *arg) {
+   ThreadState *thr = cur_thread();
    uptr pc = 0;
    Acquire(thr, pc, (uptr)arg);
-   AtExitCtx *ctx = (AtExitCtx*)arg;
+-  AtExitCtx *ctx = (AtExitCtx*)arg;
 -  ((void(*)(void *arg))ctx->f)(ctx->arg);
 -  InternalFree(ctx);
++//  AtExitCtx *ctx = (AtExitCtx*)arg;
 +//  ((void(*)(void *arg))ctx->f)(ctx->arg);
 +//  InternalFree(ctx);
  }
  
  static int setup_at_exit_wrapper(ThreadState *thr, uptr pc, void(*f)(),
-@@ -912,6 +920,38 @@ extern "C" void *__tsan_thread_start_fun
+@@ -920,6 +920,39 @@ extern "C" void *__tsan_thread_start_fun
    return res;
  }
  
@@ -64,6 +38,7 @@ $NetBSD$
 +}
 +
 +__attribute__((constructor))
++//__attribute__((section(".init_array")))
 +static void
 +yikes1(void) {
 +  if (REAL(__cxa_atexit)(&finalize, 0, 0)) {
@@ -80,7 +55,7 @@ $NetBSD$
  TSAN_INTERCEPTOR(int, pthread_create,
      void *th, void *attr, void *(*callback)(void*), void * param) {
    SCOPED_INTERCEPTOR_RAW(pthread_create, th, attr, callback, param);
-@@ -1667,13 +1707,6 @@ TSAN_INTERCEPTOR(void*, tmpfile64, int f
+@@ -1675,12 +1708,12 @@ TSAN_INTERCEPTOR(void*, tmpfile64, int f
  #define TSAN_MAYBE_INTERCEPT_TMPFILE64
  #endif
  
@@ -90,39 +65,37 @@ $NetBSD$
 -  REAL(fflush)(stdout);
 -  REAL(fflush)(stderr);
 -}
--
++//static void FlushStreams() {
++//  // Flushing all the streams here may freeze the process if a child thread is
++//  // performing file stream operations at the same time.
++//  REAL(fflush)(stdout);
++//  REAL(fflush)(stderr);
++//}
+ 
  TSAN_INTERCEPTOR(void, abort, int fake) {
    SCOPED_TSAN_INTERCEPTOR(abort, fake);
-   FlushStreams();
-@@ -2439,15 +2472,6 @@ TSAN_INTERCEPTOR(void *, __tls_get_addr,
- 
- namespace __tsan {
- 
--static void finalize(void *arg) {
--  ThreadState *thr = cur_thread();
--  int status = Finalize(thr);
--  // Make sure the output is not lost.
--  FlushStreams();
--  if (status)
--    Die();
--}
--
- #if !SANITIZER_MAC && !SANITIZER_ANDROID
- static void unreachable() {
-   Report("FATAL: ThreadSanitizer: unreachable called\n");
-@@ -2611,6 +2635,7 @@ void InitializeInterceptors() {
+@@ -2619,16 +2652,16 @@ void InitializeInterceptors() {
    REAL(atexit) = (int(*)(void(*)()))unreachable;
  #endif
  
-+#if 0
-   if (REAL(__cxa_atexit)(&finalize, 0, 0)) {
-     Printf("ThreadSanitizer: failed to setup atexit callback\n");
-     Die();
-@@ -2622,6 +2647,7 @@ void InitializeInterceptors() {
-     Die();
-   }
+-  if (REAL(__cxa_atexit)(&finalize, 0, 0)) {
+-    Printf("ThreadSanitizer: failed to setup atexit callback\n");
+-    Die();
+-  }
++//  if (REAL(__cxa_atexit)(&finalize, 0, 0)) {
++//    Printf("ThreadSanitizer: failed to setup atexit callback\n");
++//    Die();
++//  }
+ 
+ #if !SANITIZER_MAC
+-  if (pthread_key_create(&g_thread_finalize_key, &thread_finalize)) {
+-    Printf("ThreadSanitizer: failed to create thread key\n");
+-    Die();
+-  }
++//  if (pthread_key_create(&g_thread_finalize_key, &thread_finalize)) {
++//    Printf("ThreadSanitizer: failed to create thread key\n");
++//    Die();
++//  }
  #endif
-+#endif
  
    FdInit();
- }
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
deleted file mode 100644
index 31d6ff31b7..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__linux.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-$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,11 +14,12 @@
- 
- 
- #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"
- #include "sanitizer_common/sanitizer_linux.h"
-+#include "sanitizer_common/sanitizer_platform_limits_netbsd.h"
- #include "sanitizer_common/sanitizer_platform_limits_posix.h"
- #include "sanitizer_common/sanitizer_posix.h"
- #include "sanitizer_common/sanitizer_procmaps.h"
-@@ -401,4 +402,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__platform__posix.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__posix.cc
deleted file mode 100644
index fd5cb667fc..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__platform__posix.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
---- lib/tsan/rtl/tsan_platform_posix.cc.orig	2017-07-16 22:40:10.000000000 +0000
-+++ lib/tsan/rtl/tsan_platform_posix.cc
-@@ -124,8 +124,10 @@ void CheckAndProtect() {
-     if (segment.start >= HeapMemEnd() && segment.start < HeapEnd()) continue;
-     if (segment.protection == 0)  // Zero page or mprotected.
-       continue;
-+#if !SANITIZER_NETBSD
-     if (segment.start >= VdsoBeg())  // vdso
-       break;
-+#endif
-     Printf("FATAL: ThreadSanitizer: unexpected memory mapping %p-%p\n",
-            segment.start, segment.end);
-     Die();
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
index 08d7afcb18..ece81092c3 100644
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
@@ -2,13 +2,12 @@ $NetBSD$
 
 --- lib/tsan/rtl/tsan_rtl.cc.orig	2017-10-17 18:35:43.000000000 +0000
 +++ lib/tsan/rtl/tsan_rtl.cc
-@@ -371,7 +371,8 @@ void Initialize(ThreadState *thr) {
+@@ -371,7 +371,7 @@ void Initialize(ThreadState *thr) {
    // On MIPS, TSan initialization is run before
    // __pthread_initialize_minimal_internal() is finished, so we can not spawn
    // new threads.
 -#ifndef __mips__
 +#if !defined(__mips__) && !SANITIZER_NETBSD
-+  // XXX: fix it in future, not crucial now
    StartBackgroundThread();
    SetSandboxingCallback(StopBackgroundThread);
  #endif
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
index a8c3ad059c..15cb878568 100644
--- 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
@@ -1,34 +1,34 @@
 $NetBSD$
 
---- lib/tsan/rtl/tsan_rtl_amd64.S.orig	2017-07-16 22:40:10.000000000 +0000
+--- lib/tsan/rtl/tsan_rtl_amd64.S.orig	2017-10-17 18:35:43.000000000 +0000
 +++ lib/tsan/rtl/tsan_rtl_amd64.S
-@@ -185,7 +185,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
- #if defined(__FreeBSD__)
+@@ -182,7 +182,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
+   CFI_ADJUST_CFA_OFFSET(8)
+   CFI_REL_OFFSET(%rdi, 0)
+   // obtain %rsp
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
    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__)
+ #elif defined(__APPLE__)
+@@ -223,7 +223,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
+   CFI_ADJUST_CFA_OFFSET(8)
+   CFI_REL_OFFSET(%rdi, 0)
+   // obtain %rsp
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
    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__)
+ #elif defined(__APPLE__)
+@@ -271,7 +271,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
--#elif defined(__APPLE__)
-+#elif defined(__APPLE__) || defined(__NetBSD__)
-   lea 32(%rsp), %rdi
-   mov %rdi, %rsi
- #elif defined(__linux__)
+ #elif defined(__APPLE__)
 @@ -327,7 +327,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
    sub $8, %rsp
    CFI_ADJUST_CFA_OFFSET(8)
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
deleted file mode 100644
index cbba080f74..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_tests_rtl_tsan__test__util__posix.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-$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;
diff --git a/compiler-rt-netbsd/patches/patch-test_msan_lit.cfg b/compiler-rt-netbsd/patches/patch-test_msan_lit.cfg
deleted file mode 100644
index 5faa6e68ac..0000000000
--- a/compiler-rt-netbsd/patches/patch-test_msan_lit.cfg
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- test/msan/lit.cfg.orig	2017-10-20 11:16:38.634326328 +0000
-+++ test/msan/lit.cfg
-@@ -30,7 +30,7 @@ config.substitutions.append( ("%clangxx_
- config.suffixes = ['.c', '.cc', '.cpp']
- 
- # MemorySanitizer tests are currently supported on Linux only.
--if config.host_os not in ['Linux']:
-+if config.host_os not in ['Linux', 'NetBSD']:
-   config.unsupported = True
- 
- # For mips64, mips64el we have forced store_context_size to 1 because these
diff --git a/compiler-rt-netbsd/patches/patch-test_tsan_lit.cfg b/compiler-rt-netbsd/patches/patch-test_tsan_lit.cfg
deleted file mode 100644
index 03954f2cfa..0000000000
--- a/compiler-rt-netbsd/patches/patch-test_tsan_lit.cfg
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- test/tsan/lit.cfg.orig	2017-10-17 18:35:28.156367235 +0000
-+++ test/tsan/lit.cfg
-@@ -80,7 +80,7 @@ config.substitutions.append( ("%deflake 
- config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm']
- 
- # ThreadSanitizer tests are currently supported on FreeBSD, Linux and Darwin.
--if config.host_os not in ['FreeBSD', 'Linux', 'Darwin']:
-+if config.host_os not in ['FreeBSD', 'Linux', 'Darwin', 'NetBSD']:
-   config.unsupported = True
- 
- if config.android:
diff --git a/compiler-rt-netbsd/patches/patch-test_tsan_map32bit.cc b/compiler-rt-netbsd/patches/patch-test_tsan_map32bit.cc
deleted file mode 100644
index 5b974e8900..0000000000
--- a/compiler-rt-netbsd/patches/patch-test_tsan_map32bit.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD$
-
---- test/tsan/map32bit.cc.orig	2017-10-17 18:35:29.000000000 +0000
-+++ test/tsan/map32bit.cc
-@@ -12,8 +12,8 @@
- // XFAIL: aarch64
- // XFAIL: powerpc64
- 
--// MAP_32BIT doesn't exist on OS X.
--// UNSUPPORTED: darwin
-+// MAP_32BIT doesn't exist on OS X and NetBSD.
-+// UNSUPPORTED: darwin,netbsd
- 
- void *Thread(void *ptr) {
-   *(int*)ptr = 42;
-@@ -45,4 +45,3 @@ int main() {
- 
- // CHECK: WARNING: ThreadSanitizer: data race
- // CHECK: DONE
--
diff --git a/compiler-rt-netbsd/patches/patch-test_tsan_strerror__r.cc b/compiler-rt-netbsd/patches/patch-test_tsan_strerror__r.cc
deleted file mode 100644
index b4d738c588..0000000000
--- a/compiler-rt-netbsd/patches/patch-test_tsan_strerror__r.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- test/tsan/strerror_r.cc.orig	2017-10-17 18:35:29.000000000 +0000
-+++ test/tsan/strerror_r.cc
-@@ -11,7 +11,8 @@
- char buffer[1000];
- 
- void *Thread(void *p) {
--  return strerror_r(TEST_ERROR, buffer, sizeof(buffer));
-+  strerror_r(TEST_ERROR, buffer, sizeof(buffer));
-+  return buffer;
- }
- 
- int main() {
diff --git a/compiler-rt-netbsd/patches/patch-test_tsan_tls__race.cc b/compiler-rt-netbsd/patches/patch-test_tsan_tls__race.cc
deleted file mode 100644
index 7d247f9017..0000000000
--- a/compiler-rt-netbsd/patches/patch-test_tsan_tls__race.cc
+++ /dev/null
@@ -1,9 +0,0 @@
-$NetBSD$
-
---- test/tsan/tls_race.cc.orig	2017-07-04 05:53:07.000000000 +0000
-+++ test/tsan/tls_race.cc
-@@ -21,3 +21,4 @@ int main() {
- // CHECK-Linux:   Location is TLS of main thread.
- // CHECK-FreeBSD:   Location is TLS of main thread.
- // CHECK-Darwin:   Location is heap block of size 4
-+// CHECK-NetBSD:   Location is TLS of main thread.
diff --git a/compiler-rt-netbsd/patches/patch-test_tsan_tls__race2.cc b/compiler-rt-netbsd/patches/patch-test_tsan_tls__race2.cc
deleted file mode 100644
index 7283497b66..0000000000
--- a/compiler-rt-netbsd/patches/patch-test_tsan_tls__race2.cc
+++ /dev/null
@@ -1,9 +0,0 @@
-$NetBSD$
-
---- test/tsan/tls_race2.cc.orig	2017-07-04 05:53:07.000000000 +0000
-+++ test/tsan/tls_race2.cc
-@@ -28,3 +28,4 @@ int main() {
- // CHECK-Linux:   Location is TLS of thread T1.
- // CHECK-FreeBSD:   Location is TLS of thread T1.
- // CHECK-Darwin:   Location is heap block of size 4
-+// CHECK-NetBSD:   Location is TLS of thread T1.


Home | Main Index | Thread Index | Old Index