pkgsrc-WIP-changes archive

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

compiler-rt-git: First round to rebase to HEAD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sat Aug 5 16:31:55 2017 +0200
Changeset:	aefd7dd189f6ca990a622619d1548ae348f6d02b

Modified Files:
	compiler-rt-git/Makefile
	compiler-rt-git/distinfo
	compiler-rt-git/patches/patch-cmake_config-ix.cmake
	compiler-rt-git/patches/patch-lib_asan_asan__errors.cc
	compiler-rt-git/patches/patch-lib_asan_asan__malloc__linux.cc
	compiler-rt-git/patches/patch-lib_interception_interception__linux.cc
	compiler-rt-git/patches/patch-lib_interception_interception__linux.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
Removed Files:
	compiler-rt-git/patches/patch-lib_interception_interception.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_CMakeLists.txt
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__libignore.cc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__netbsd.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__posix.cc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps.h
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__common.cc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__netbsd.cc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__syscall__generic.inc
	compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc

Log Message:
compiler-rt-git: First round to rebase to HEAD

Rebase patches to HEAD.

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=aefd7dd189f6ca990a622619d1548ae348f6d02b

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

diffstat:
 compiler-rt-git/Makefile                           |   3 +-
 compiler-rt-git/distinfo                           |  33 +--
 .../patches/patch-cmake_config-ix.cmake            |  21 +-
 .../patches/patch-lib_asan_asan__errors.cc         |   6 +-
 .../patches/patch-lib_asan_asan__malloc__linux.cc  |  12 +-
 .../patches/patch-lib_interception_interception.h  |  33 ---
 .../patch-lib_interception_interception__linux.cc  |   2 +-
 .../patch-lib_interception_interception__linux.h   |   2 +-
 .../patch-lib_sanitizer__common_CMakeLists.txt     |  12 -
 ...b_sanitizer__common_sanitizer__internal__defs.h |   8 +-
 ...h-lib_sanitizer__common_sanitizer__libignore.cc |  19 --
 ...patch-lib_sanitizer__common_sanitizer__linux.cc |  70 +++---
 .../patch-lib_sanitizer__common_sanitizer__linux.h |   4 +-
 ..._sanitizer__common_sanitizer__linux__libcdep.cc |  70 ------
 ...patch-lib_sanitizer__common_sanitizer__netbsd.h |  25 --
 ...tch-lib_sanitizer__common_sanitizer__platform.h |  38 ----
 ...zer__common_sanitizer__platform__interceptors.h | 251 ---------------------
 ...r__common_sanitizer__platform__limits__posix.cc |  36 +--
 ...er__common_sanitizer__platform__limits__posix.h | 221 +++++-------------
 ...patch-lib_sanitizer__common_sanitizer__posix.cc |  15 --
 ...tch-lib_sanitizer__common_sanitizer__procmaps.h |  31 ---
 ...anitizer__common_sanitizer__procmaps__common.cc |  19 --
 ...anitizer__common_sanitizer__procmaps__netbsd.cc |  83 -------
 ...nitizer__common_sanitizer__syscall__generic.inc |  44 ----
 ...er__common_sanitizer__unwind__linux__libcdep.cc |  43 ----
 25 files changed, 152 insertions(+), 949 deletions(-)

diffs:
diff --git a/compiler-rt-git/Makefile b/compiler-rt-git/Makefile
index d83ff99c3d..3345f556cd 100644
--- a/compiler-rt-git/Makefile
+++ b/compiler-rt-git/Makefile
@@ -1,11 +1,10 @@
 # $NetBSD: Makefile.common,v 1.7 2015/07/20 05:49:53 adam Exp $
 
-PKGNAME=	compiler-rt-5.0.0
+PKGNAME=	compiler-rt-6.0.0
 CATEGORIES=	lang devel
 
 GIT_REPOSITORIES=	compiler-rt
 GIT_REPO.compiler-rt=	https://github.com/llvm-mirror/compiler-rt.git
-GIT_REVISION.compiler-rt=	6ee59ff2a0b91f2224d38adb3fdb2dd5aefc107b
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://compiler-rt.llvm.org/
diff --git a/compiler-rt-git/distinfo b/compiler-rt-git/distinfo
index 3e3bc2cad0..789b8c3354 100644
--- a/compiler-rt-git/distinfo
+++ b/compiler-rt-git/distinfo
@@ -12,32 +12,19 @@ Size (libcxx-3.6.2.src.tar.xz) = 944020 bytes
 SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
-SHA1 (patch-cmake_config-ix.cmake) = 0558457785a6069a28eb6c3525bc9f545bbc59cb
-SHA1 (patch-lib_asan_asan__errors.cc) = ce47b52abdfcb1696d98ec7440e5166fc5444574
+SHA1 (patch-cmake_config-ix.cmake) = 497da73e6ce4abe19f048a94b4d80b92c0ce7e82
+SHA1 (patch-lib_asan_asan__errors.cc) = c029fa05715dfc5bcbda0fd6e28c966a96c2c278
 SHA1 (patch-lib_asan_asan__interceptors.cc) = 9786a54c62e081c7194efa26139f8539ad1e8c41
 SHA1 (patch-lib_asan_asan__interceptors.h) = 520419376759f2991c6f74f4c2a5ef62851d7838
 SHA1 (patch-lib_asan_asan__linux.cc) = 31dd5c3978d64ccc28c8af037a967c2360d71cff
-SHA1 (patch-lib_asan_asan__malloc__linux.cc) = 8125ba85983cab81779a2ebe0849ba3e65040eb4
+SHA1 (patch-lib_asan_asan__malloc__linux.cc) = 8d690c207d11e19ca96f231d41a6c192c8528933
 SHA1 (patch-lib_asan_asan__mapping.h) = 73f5f33e946868b4780864e633916376b11b16f1
 SHA1 (patch-lib_asan_asan__stack.h) = 58aa9e67cf2a92863fd3bd545074dff136bed7c5
 SHA1 (patch-lib_asan_scripts_asan__symbolize.py) = 95024c8d49fdcbdbf5ccc9013e54ad9b3f469e14
-SHA1 (patch-lib_interception_interception.h) = e6826deb85420ac5c7d9594d5d4364767d22389f
-SHA1 (patch-lib_interception_interception__linux.cc) = 9748f01fb3621c51197a435422e658b9f694dc01
-SHA1 (patch-lib_interception_interception__linux.h) = 8ab24466d85d19d0c5dd35c5867a7cc958009143
-SHA1 (patch-lib_sanitizer__common_CMakeLists.txt) = a563a3b1c04ae343dc7c6646a846f48b96c9e8de
-SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = 3e2f5c06d54209d981835d11e272f7cff9086ffb
-SHA1 (patch-lib_sanitizer__common_sanitizer__libignore.cc) = 57eb2b213bd0eb664524aa0e047d5e73d4956ad2
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = dc5bd14b37758e9197d3a8022f5d4a24bf26642a
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux.h) = bdec0460d99a5f05b6e54d075032ead845a1c984
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc) = b9bf8727fe9bf471e749c2176829f7b9a74c2be9
-SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd.h) = a4b6a100cbff1d35c4bf40b49b555062cc1bfbaa
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform.h) = ffb31dccce9824c81f3686de47c4b1e79bda3e1e
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = b985ae53dafddfc5b4112eae65cab49176fc1989
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc) = 216496ec38f40a1c1d6905e006039860c4c1d48d
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h) = 3f2b057d66ee112fd2cb3a198630ed51b255b57a
-SHA1 (patch-lib_sanitizer__common_sanitizer__posix.cc) = a561675ba1a7ef3b71d5c0af6521fb6a0f91f205
-SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps.h) = 2bc9a7c32f0a7d18fe4d0d465b9b42547abbd989
-SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__common.cc) = 5a407e496f92dfd2dd78a3b2582d7c695e2547fb
-SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__netbsd.cc) = 83f8088cb990ebc5a85e319f1d4990d04196d67a
-SHA1 (patch-lib_sanitizer__common_sanitizer__syscall__generic.inc) = b9ab90fafcb14d589e02a2062fe7e978d6b7edbb
-SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = cf7e016fff0f57e7bcae93696ec05e5cff7b7093
+SHA1 (patch-lib_interception_interception__linux.cc) = 41e29e48d879a7c1a8e8c5c466439310783d5e9f
+SHA1 (patch-lib_interception_interception__linux.h) = ebbdd314aeff8be22107a78872a71b9606748b36
+SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = f84e3442e72b6d07ad7c8e8fcf44718c547e2a93
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = 5d09c96941940fb7bb21b83161a5723140ac31e6
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux.h) = b3177dc169208b1b3e0c951fe3fd9c07e82fff49
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc) = 36a89517584891a1a50536a681a5d42e99ef904d
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h) = 7ae546fe4c5fada950a8e06c73f7ac0e5ba81924
diff --git a/compiler-rt-git/patches/patch-cmake_config-ix.cmake b/compiler-rt-git/patches/patch-cmake_config-ix.cmake
index ce66005418..b7e26bbd75 100644
--- a/compiler-rt-git/patches/patch-cmake_config-ix.cmake
+++ b/compiler-rt-git/patches/patch-cmake_config-ix.cmake
@@ -1,22 +1,23 @@
 $NetBSD$
 
---- cmake/config-ix.cmake.orig	2017-07-03 15:33:06.000000000 +0000
+--- cmake/config-ix.cmake.orig	2017-08-03 21:24:37.000000000 +0000
 +++ cmake/config-ix.cmake
-@@ -441,7 +441,7 @@ set(COMPILER_RT_SANITIZERS_TO_BUILD ${AL
+@@ -470,7 +470,7 @@ set(COMPILER_RT_SANITIZERS_TO_BUILD ${AL
  list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")
  
  if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
--    (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR
-+    (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD" OR
+-    (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|Fuchsia" OR
++    (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia" OR
      (OS_NAME MATCHES "Windows" AND (NOT MINGW AND NOT CYGWIN))))
    set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
  else()
-@@ -460,7 +460,7 @@ else()
-   set(COMPILER_RT_HAS_ASAN FALSE)
+@@ -483,7 +483,8 @@ else()
+   set(COMPILER_RT_HAS_INTERCEPTION FALSE)
  endif()
  
--if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
-+if (OS_NAME MATCHES "Linux|FreeBSD|NetBSD|Windows")
-   set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
+-if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH)
++if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH AND
++    (NOT OS_NAME MATCHES "NetBSD"))
+   set(COMPILER_RT_HAS_ASAN TRUE)
  else()
-   set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
+   set(COMPILER_RT_HAS_ASAN FALSE)
diff --git a/compiler-rt-git/patches/patch-lib_asan_asan__errors.cc b/compiler-rt-git/patches/patch-lib_asan_asan__errors.cc
index b150d1b715..ad9a3bab85 100644
--- a/compiler-rt-git/patches/patch-lib_asan_asan__errors.cc
+++ b/compiler-rt-git/patches/patch-lib_asan_asan__errors.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/asan/asan_errors.cc.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/asan/asan_errors.cc.orig	2017-08-05 14:29:08.000000000 +0000
 +++ lib/asan/asan_errors.cc
 @@ -59,7 +59,7 @@ static void MaybeDumpRegisters(void *con
  }
@@ -9,5 +9,5 @@ $NetBSD$
 -#if SANITIZER_FREEBSD || SANITIZER_LINUX
 +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
    MemoryMappingLayout proc_maps(/*cache_enabled*/ true);
-   uptr start, end, protection;
-   while (proc_maps.Next(&start, &end, nullptr, nullptr, 0, &protection)) {
+   MemoryMappedSegment segment;
+   while (proc_maps.Next(&segment)) {
diff --git a/compiler-rt-git/patches/patch-lib_asan_asan__malloc__linux.cc b/compiler-rt-git/patches/patch-lib_asan_asan__malloc__linux.cc
index 0b4f7460bd..556110e6eb 100644
--- a/compiler-rt-git/patches/patch-lib_asan_asan__malloc__linux.cc
+++ b/compiler-rt-git/patches/patch-lib_asan_asan__malloc__linux.cc
@@ -1,19 +1,19 @@
 $NetBSD$
 
---- lib/asan/asan_malloc_linux.cc.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/asan/asan_malloc_linux.cc.orig	2017-08-05 14:29:08.000000000 +0000
 +++ lib/asan/asan_malloc_linux.cc
 @@ -15,7 +15,7 @@
  //===----------------------------------------------------------------------===//
  
  #include "sanitizer_common/sanitizer_platform.h"
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
+-#if SANITIZER_FREEBSD || SANITIZER_FUCHSIA || SANITIZER_LINUX
++#if SANITIZER_FREEBSD || SANITIZER_FUCHSIA || SANITIZER_LINUX || SANITIZER_NETBSD
  
  #include "sanitizer_common/sanitizer_tls_get_addr.h"
  #include "asan_allocator.h"
-@@ -226,4 +226,4 @@ void ReplaceSystemMalloc() {
+@@ -234,4 +234,4 @@ void ReplaceSystemMalloc() {
  }  // namespace __asan
  #endif  // SANITIZER_ANDROID
  
--#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX
-+#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
+-#endif  // SANITIZER_FREEBSD || SANITIZER_FUCHSIA || SANITIZER_LINUX
++#endif  // SANITIZER_FREEBSD || SANITIZER_FUCHSIA || SANITIZER_LINUX || SANITIZER_NETBSD
diff --git a/compiler-rt-git/patches/patch-lib_interception_interception.h b/compiler-rt-git/patches/patch-lib_interception_interception.h
deleted file mode 100644
index 7faa04119b..0000000000
--- a/compiler-rt-git/patches/patch-lib_interception_interception.h
+++ /dev/null
@@ -1,33 +0,0 @@
-$NetBSD$
-
---- lib/interception/interception.h.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/interception/interception.h
-@@ -15,8 +15,8 @@
- #ifndef INTERCEPTION_H
- #define INTERCEPTION_H
- 
--#if !defined(__linux__) && !defined(__FreeBSD__) && \
--  !defined(__APPLE__) && !defined(_WIN32)
-+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
-+    !defined(__APPLE__) && !defined(_WIN32)
- # error "Interception doesn't work on this operating system."
- #endif
- 
-@@ -129,7 +129,7 @@ const interpose_substitution substitutio
-     extern "C" ret_type func(__VA_ARGS__);
- # define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \
-     extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__);
--#elif defined(__FreeBSD__)
-+#elif defined(__FreeBSD__) || defined(__NetBSD__)
- # define WRAP(x) __interceptor_ ## x
- # define WRAPPER_NAME(x) "__interceptor_" #x
- # define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
-@@ -241,7 +241,7 @@ typedef unsigned long uptr;  // NOLINT
- 
- #define INCLUDED_FROM_INTERCEPTION_LIB
- 
--#if defined(__linux__) || defined(__FreeBSD__)
-+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
- # include "interception_linux.h"
- # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
- # define INTERCEPT_FUNCTION_VER(func, symver) \
diff --git a/compiler-rt-git/patches/patch-lib_interception_interception__linux.cc b/compiler-rt-git/patches/patch-lib_interception_interception__linux.cc
index 06d8d980c3..1038330d7c 100644
--- a/compiler-rt-git/patches/patch-lib_interception_interception__linux.cc
+++ b/compiler-rt-git/patches/patch-lib_interception_interception__linux.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/interception/interception_linux.cc.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/interception/interception_linux.cc.orig	2017-07-04 05:53:20.000000000 +0000
 +++ lib/interception/interception_linux.cc
 @@ -12,14 +12,26 @@
  // Linux-specific interception methods.
diff --git a/compiler-rt-git/patches/patch-lib_interception_interception__linux.h b/compiler-rt-git/patches/patch-lib_interception_interception__linux.h
index 0535469d53..12e8b384ec 100644
--- a/compiler-rt-git/patches/patch-lib_interception_interception__linux.h
+++ b/compiler-rt-git/patches/patch-lib_interception_interception__linux.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/interception/interception_linux.h.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/interception/interception_linux.h.orig	2017-07-04 05:53:20.000000000 +0000
 +++ lib/interception/interception_linux.h
 @@ -12,7 +12,7 @@
  // Linux-specific interception methods.
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_CMakeLists.txt b/compiler-rt-git/patches/patch-lib_sanitizer__common_CMakeLists.txt
deleted file mode 100644
index 27f2c14464..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/CMakeLists.txt.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/CMakeLists.txt
-@@ -22,6 +22,7 @@ set(SANITIZER_SOURCES_NOTERMINATION
-   sanitizer_procmaps_freebsd.cc
-   sanitizer_procmaps_linux.cc
-   sanitizer_procmaps_mac.cc
-+  sanitizer_procmaps_netbsd.cc
-   sanitizer_stackdepot.cc
-   sanitizer_stacktrace.cc
-   sanitizer_stacktrace_printer.cc
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h
index 35fdb035cb..0cd984030f 100644
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h
+++ b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__internal__defs.h
@@ -1,13 +1,15 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_internal_defs.h.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/sanitizer_common/sanitizer_internal_defs.h.orig	2017-07-04 05:53:22.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_internal_defs.h
-@@ -133,8 +133,8 @@ typedef int pid_t;
+@@ -132,9 +132,9 @@ typedef int pid_t;
+ // WARNING: OFF_T may be different from OS type off_t, depending on the value of
  // _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls
  // like pread and mmap, as opposed to pread64 and mmap64.
- // FreeBSD, Mac and Linux/x86-64 are special.
+-// FreeBSD, Mac and Linux/x86-64 are special.
 -#if SANITIZER_FREEBSD || SANITIZER_MAC || \
 -  (SANITIZER_LINUX && defined(__x86_64__))
++// FreeBSD, NetBSD, Mac and Linux/x86-64 are special.
 +#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC || \
 +    (SANITIZER_LINUX && defined(__x86_64__))
  typedef u64 OFF_T;
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__libignore.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__libignore.cc
deleted file mode 100644
index 464bd0d300..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__libignore.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_libignore.cc.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_libignore.cc
-@@ -9,7 +9,7 @@
- 
- #include "sanitizer_platform.h"
- 
--#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || SANITIZER_NETBSD
- 
- #include "sanitizer_libignore.h"
- #include "sanitizer_flags.h"
-@@ -125,4 +125,4 @@ void LibIgnore::OnLibraryUnloaded() {
- 
- } // namespace __sanitizer
- 
--#endif // #if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#endif  // #if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
index 51d205ea50..dda3f6a33d 100644
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
+++ b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_linux.cc.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/sanitizer_common/sanitizer_linux.cc.orig	2017-07-16 22:40:10.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_linux.cc
 @@ -14,7 +14,7 @@
  
@@ -16,7 +16,7 @@ $NetBSD$
  #include "sanitizer_symbolizer.h"
  
 -#if !SANITIZER_FREEBSD
-+#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
++#if SANITIZER_LINUX
  #include <asm/param.h>
  #endif
  
@@ -27,7 +27,7 @@ $NetBSD$
  // 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
  // access stat from asm/stat.h, without conflicting with definition in
-@@ -71,6 +75,12 @@ extern "C" {
+@@ -79,6 +83,12 @@ extern "C" {
  extern char **environ;  // provided by crt1
  #endif  // SANITIZER_FREEBSD
  
@@ -40,7 +40,7 @@ $NetBSD$
  #if !SANITIZER_ANDROID
  #include <sys/signal.h>
  #endif
-@@ -131,7 +141,10 @@ namespace __sanitizer {
+@@ -139,7 +149,10 @@ namespace __sanitizer {
  #if !SANITIZER_S390
  uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd,
                     OFF_T offset) {
@@ -52,11 +52,11 @@ $NetBSD$
    return internal_syscall(SYSCALL(mmap), (uptr)addr, length, prot, flags, fd,
                            offset);
  #else
-@@ -174,26 +187,39 @@ uptr internal_open(const char *filename,
+@@ -182,26 +195,38 @@ uptr internal_open(const char *filename,
  
  uptr internal_read(fd_t fd, void *buf, uptr count) {
    sptr res;
-+#ifdef SANITIZER_NETBSD
++#if SANITIZER_NETBSD
 +  HANDLE_EINTR(res, internal_syscall_ptr(SYSCALL(read), fd, buf, count));
 +#else
    HANDLE_EINTR(res, (sptr)internal_syscall(SYSCALL(read), fd, (uptr)buf,
@@ -67,7 +67,7 @@ $NetBSD$
  
  uptr internal_write(fd_t fd, const void *buf, uptr count) {
    sptr res;
-+#ifdef SANITIZER_NETBSD
++#if SANITIZER_NETBSD
 +  HANDLE_EINTR(res, internal_syscall_ptr(SYSCALL(write), fd, buf, count));
 +#else
    HANDLE_EINTR(res, (sptr)internal_syscall(SYSCALL(write), fd, (uptr)buf,
@@ -78,7 +78,7 @@ $NetBSD$
  
  uptr internal_ftruncate(fd_t fd, uptr size) {
    sptr res;
-+#ifdef SANITIZER_NETBSD
++#if SANITIZER_NETBSD
 +  HANDLE_EINTR(res, internal_syscall(SYSCALL(ftruncate), fd, 0, (s64)size));
 +#else
    HANDLE_EINTR(res, (sptr)internal_syscall(SYSCALL(ftruncate), fd,
@@ -88,12 +88,11 @@ $NetBSD$
  }
  
 -#if !SANITIZER_LINUX_USES_64BIT_SYSCALLS && !SANITIZER_FREEBSD
-+#if !SANITIZER_LINUX_USES_64BIT_SYSCALLS && !SANITIZER_FREEBSD && \
-+    !SANITIZER_NETBSD
++#if !SANITIZER_LINUX_USES_64BIT_SYSCALLS && SANITIZER_LINUX
  static void stat64_to_stat(struct stat64 *in, struct stat *out) {
    internal_memset(out, 0, sizeof(*out));
    out->st_dev = in->st_dev;
-@@ -234,7 +260,7 @@ static void kernel_stat_to_stat(struct k
+@@ -240,7 +265,7 @@ static void kernel_stat_to_stat(struct k
  #endif
  
  uptr internal_stat(const char *path, void *buf) {
@@ -102,7 +101,7 @@ $NetBSD$
    return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path,
                            (uptr)buf, 0);
  #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-@@ -259,7 +285,9 @@ uptr internal_stat(const char *path, voi
+@@ -265,7 +290,9 @@ uptr internal_stat(const char *path, voi
  }
  
  uptr internal_lstat(const char *path, void *buf) {
@@ -113,7 +112,7 @@ $NetBSD$
    return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path,
                            (uptr)buf, AT_SYMLINK_NOFOLLOW);
  #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-@@ -284,7 +312,7 @@ uptr internal_lstat(const char *path, vo
+@@ -290,7 +317,7 @@ uptr internal_lstat(const char *path, vo
  }
  
  uptr internal_fstat(fd_t fd, void *buf) {
@@ -122,7 +121,7 @@ $NetBSD$
  # if SANITIZER_MIPS64
    // For mips64, fstat syscall fills buffer in the format of kernel_stat
    struct kernel_stat kbuf;
-@@ -318,7 +346,9 @@ uptr internal_dup2(int oldfd, int newfd)
+@@ -324,7 +351,9 @@ uptr internal_dup2(int oldfd, int newfd)
  }
  
  uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
@@ -133,7 +132,7 @@ $NetBSD$
    return internal_syscall(SYSCALL(readlinkat), AT_FDCWD,
                            (uptr)path, (uptr)buf, bufsize);
  #else
-@@ -348,7 +378,7 @@ uptr internal_sched_yield() {
+@@ -354,7 +383,7 @@ uptr internal_sched_yield() {
  }
  
  void internal__exit(int exitcode) {
@@ -142,7 +141,7 @@ $NetBSD$
    internal_syscall(SYSCALL(exit), exitcode);
  #else
    internal_syscall(SYSCALL(exit_group), exitcode);
-@@ -387,19 +417,25 @@ bool FileExists(const char *filename) {
+@@ -393,19 +422,25 @@ bool FileExists(const char *filename) {
  tid_t GetTid() {
  #if SANITIZER_FREEBSD
    return (uptr)pthread_self();
@@ -162,14 +161,14 @@ $NetBSD$
  #endif
    internal_memset(&tv, 0, sizeof(tv));
 +#if SANITIZER_NETBSD
-+  internal_syscall(SYSCALL(gettimeofday), &tv, NULL);
++  internal_syscall_ptr(SYSCALL(gettimeofday), &tv, NULL);
 +#else
    internal_syscall(SYSCALL(gettimeofday), (uptr)&tv, 0);
 +#endif
    return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000;
  }
  
-@@ -407,7 +443,7 @@ u64 NanoTime() {
+@@ -413,7 +448,7 @@ u64 NanoTime() {
  // 'environ' array (on FreeBSD) and does not use libc. This function should be
  // called first inside __asan_init.
  const char *GetEnv(const char *name) {
@@ -178,7 +177,7 @@ $NetBSD$
    if (::environ != 0) {
      uptr NameLen = internal_strlen(name);
      for (char **Env = ::environ; *Env != 0; Env++) {
-@@ -541,6 +577,8 @@ void BlockingMutex::Lock() {
+@@ -547,6 +582,8 @@ void BlockingMutex::Lock() {
    while (atomic_exchange(m, MtxSleeping, memory_order_acquire) != MtxUnlocked) {
  #if SANITIZER_FREEBSD
      _umtx_op(m, UMTX_OP_WAIT_UINT, MtxSleeping, 0, 0);
@@ -187,7 +186,7 @@ $NetBSD$
  #else
      internal_syscall(SYSCALL(futex), (uptr)m, FUTEX_WAIT, MtxSleeping, 0, 0, 0);
  #endif
-@@ -554,6 +592,8 @@ void BlockingMutex::Unlock() {
+@@ -560,6 +597,8 @@ void BlockingMutex::Unlock() {
    if (v == MtxSleeping) {
  #if SANITIZER_FREEBSD
      _umtx_op(m, UMTX_OP_WAKE, 1, 0, 0);
@@ -196,7 +195,7 @@ $NetBSD$
  #else
      internal_syscall(SYSCALL(futex), (uptr)m, FUTEX_WAKE, 1, 0, 0, 0);
  #endif
-@@ -569,6 +609,17 @@ void BlockingMutex::CheckLocked() {
+@@ -575,6 +614,17 @@ void BlockingMutex::CheckLocked() {
  // The actual size of this structure is specified by d_reclen.
  // Note that getdents64 uses a different structure format. We only provide the
  // 32-bit syscall here.
@@ -214,7 +213,7 @@ $NetBSD$
  struct linux_dirent {
  #if SANITIZER_X32 || defined(__aarch64__)
    u64 d_ino;
-@@ -583,16 +634,34 @@ struct linux_dirent {
+@@ -589,16 +639,34 @@ struct linux_dirent {
  #endif
    char               d_name[256];
  };
@@ -249,7 +248,7 @@ $NetBSD$
  }
  
  uptr internal_getpid() {
-@@ -604,7 +673,9 @@ uptr internal_getppid() {
+@@ -610,7 +678,9 @@ uptr internal_getppid() {
  }
  
  uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) {
@@ -260,7 +259,7 @@ $NetBSD$
    return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL);
  #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
    return internal_syscall(SYSCALL(getdents64), fd, (uptr)dirp, count);
-@@ -614,7 +685,11 @@ uptr internal_getdents(fd_t fd, struct l
+@@ -620,7 +690,11 @@ uptr internal_getdents(fd_t fd, struct l
  }
  
  uptr internal_lseek(fd_t fd, OFF_T offset, int whence) {
@@ -272,7 +271,7 @@ $NetBSD$
  }
  
  #if SANITIZER_LINUX
-@@ -706,7 +781,7 @@ int internal_sigaction_syscall(int signu
+@@ -711,7 +785,7 @@ int internal_sigaction_syscall(int signu
  
  uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
      __sanitizer_sigset_t *oldset) {
@@ -281,7 +280,18 @@ $NetBSD$
    return internal_syscall(SYSCALL(sigprocmask), how, set, oldset);
  #else
    __sanitizer_kernel_sigset_t *k_set = (__sanitizer_kernel_sigset_t *)set;
-@@ -829,8 +904,12 @@ uptr GetPageSize() {
+@@ -856,7 +930,9 @@ static uptr GetKernelAreaSize() {
+ #endif  // SANITIZER_WORDSIZE == 32
+ 
+ uptr GetMaxVirtualAddress() {
+-#if SANITIZER_WORDSIZE == 64
++#if SANITIZER_NETBSD && defined(__x86_64__)
++  return 0x7f7ffffff000ULL;  // (0x00007f8000000000 - PAGE_SIZE)
++#elif SANITIZER_WORDSIZE == 64
+ # if defined(__powerpc64__) || defined(__aarch64__)
+   // On PowerPC64 we have two different address space layouts: 44- and 46-bit.
+   // We somehow need to figure out which one we are using now and choose
+@@ -900,8 +976,12 @@ uptr GetPageSize() {
  }
  
  uptr ReadBinaryName(/*out*/char *buf, uptr buf_len) {
@@ -295,7 +305,7 @@ $NetBSD$
    const char *default_module_name = "kern.proc.pathname";
    size_t Size = buf_len;
    bool IsErr = (sysctl(Mib, ARRAY_SIZE(Mib), buf, &Size, NULL, 0) != 0);
-@@ -1474,6 +1553,8 @@ SignalContext::WriteFlag SignalContext::
+@@ -1545,6 +1625,8 @@ SignalContext::WriteFlag SignalContext::
    static const uptr PF_WRITE = 1U << 1;
  #if SANITIZER_FREEBSD
    uptr err = ucontext->uc_mcontext.mc_err;
@@ -304,7 +314,7 @@ $NetBSD$
  #else
    uptr err = ucontext->uc_mcontext.gregs[REG_ERR];
  #endif
-@@ -1520,6 +1601,11 @@ void GetPcSpBp(void *context, uptr *pc, 
+@@ -1591,6 +1673,11 @@ void GetPcSpBp(void *context, uptr *pc, 
    *pc = ucontext->uc_mcontext.mc_rip;
    *bp = ucontext->uc_mcontext.mc_rbp;
    *sp = ucontext->uc_mcontext.mc_rsp;
@@ -316,7 +326,7 @@ $NetBSD$
  # else
    ucontext_t *ucontext = (ucontext_t*)context;
    *pc = ucontext->uc_mcontext.gregs[REG_RIP];
-@@ -1532,6 +1618,11 @@ void GetPcSpBp(void *context, uptr *pc, 
+@@ -1603,6 +1690,11 @@ void GetPcSpBp(void *context, uptr *pc, 
    *pc = ucontext->uc_mcontext.mc_eip;
    *bp = ucontext->uc_mcontext.mc_ebp;
    *sp = ucontext->uc_mcontext.mc_esp;
@@ -328,7 +338,7 @@ $NetBSD$
  # else
    ucontext_t *ucontext = (ucontext_t*)context;
    *pc = ucontext->uc_mcontext.gregs[REG_EIP];
-@@ -1632,4 +1723,4 @@ bool GetRandom(void *buffer, uptr length
+@@ -1704,4 +1796,4 @@ bool GetRandom(void *buffer, uptr length
  
  } // namespace __sanitizer
  
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.h b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.h
index 2f3913ce2e..f59e5c1790 100644
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.h
+++ b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_linux.h.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/sanitizer_common/sanitizer_linux.h.orig	2017-07-16 22:40:10.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_linux.h
 @@ -14,7 +14,7 @@
  #define SANITIZER_LINUX_H
@@ -11,7 +11,7 @@ $NetBSD$
  #include "sanitizer_common.h"
  #include "sanitizer_internal_defs.h"
  #include "sanitizer_posix.h"
-@@ -130,5 +130,5 @@ ALWAYS_INLINE uptr *get_android_tls_ptr(
+@@ -128,5 +128,5 @@ ALWAYS_INLINE uptr *get_android_tls_ptr(
  
  }  // namespace __sanitizer
  
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
deleted file mode 100644
index 09c4cbe10e..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_linux_libcdep.cc.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_linux_libcdep.cc
-@@ -14,7 +14,7 @@
- 
- #include "sanitizer_platform.h"
- 
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
- 
- #include "sanitizer_allocator_internal.h"
- #include "sanitizer_atomic.h"
-@@ -22,6 +22,7 @@
- #include "sanitizer_flags.h"
- #include "sanitizer_freebsd.h"
- #include "sanitizer_linux.h"
-+#include "sanitizer_netbsd.h"
- #include "sanitizer_placement_new.h"
- #include "sanitizer_procmaps.h"
- #include "sanitizer_stacktrace.h"
-@@ -151,7 +152,8 @@ bool SanitizerGetThreadName(char *name, 
- #endif
- }
- 
--#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO
-+#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && \
-+    !SANITIZER_NETBSD
- static uptr g_tls_size;
- 
- #ifdef __i386__
-@@ -179,7 +181,8 @@ void InitTlsSize() {
- }
- #else
- void InitTlsSize() { }
--#endif  // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO
-+#endif  // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO &&
-+        // !SANITIZER_NETBSD
- 
- #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \
-     || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__) \
-@@ -336,6 +339,10 @@ uptr ThreadSelf() {
- }
- #endif  // SANITIZER_FREEBSD
- 
-+#if SANITIZER_NETBSD
-+uptr ThreadSelf() { return (uptr)pthread_self(); }
-+#endif  // SANITIZER_NETBSD
-+
- #if !SANITIZER_GO
- static void GetTls(uptr *addr, uptr *size) {
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
-@@ -365,7 +372,7 @@ static void GetTls(uptr *addr, uptr *siz
-     *addr = (uptr) dtv[2];
-     *size = (*addr == 0) ? 0 : ((uptr) segbase[0] - (uptr) dtv[2]);
-   }
--#elif SANITIZER_ANDROID
-+#elif SANITIZER_ANDROID || SANITIZER_NETBSD
-   *addr = 0;
-   *size = 0;
- #else
-@@ -376,7 +383,7 @@ static void GetTls(uptr *addr, uptr *siz
- 
- #if !SANITIZER_GO
- uptr GetTlsSize() {
--#if SANITIZER_FREEBSD || SANITIZER_ANDROID
-+#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NETBSD
-   uptr addr, size;
-   GetTls(&addr, &size);
-   return size;
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__netbsd.h b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__netbsd.h
deleted file mode 100644
index 383e3ac780..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__netbsd.h
+++ /dev/null
@@ -1,25 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_netbsd.h.orig	2017-07-03 18:33:56.808690628 +0000
-+++ lib/sanitizer_common/sanitizer_netbsd.h
-@@ -0,0 +1,20 @@
-+//===-- sanitizer_freebsd.h -------------------------------------*- C++ -*-===//
-+//
-+//                     The LLVM Compiler Infrastructure
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+//
-+// This file is a part of Sanitizer runtime. It contains NetBSD-specific
-+// definitions.
-+//
-+//===----------------------------------------------------------------------===//
-+
-+#ifndef SANITIZER_NETBSD_H
-+#define SANITIZER_NETBSD_H
-+
-+#include "sanitizer_internal_defs.h"
-+
-+#endif  // SANITIZER_NETBSD_H
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform.h b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform.h
deleted file mode 100644
index 41e30222d2..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform.h
+++ /dev/null
@@ -1,38 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_platform.h.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_platform.h
-@@ -13,8 +13,8 @@
- #ifndef SANITIZER_PLATFORM_H
- #define SANITIZER_PLATFORM_H
- 
--#if !defined(__linux__) && !defined(__FreeBSD__) && \
--  !defined(__APPLE__) && !defined(_WIN32)
-+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
-+    !defined(__APPLE__) && !defined(_WIN32)
- # error "This operating system is not supported"
- #endif
- 
-@@ -30,6 +30,12 @@
- # define SANITIZER_FREEBSD 0
- #endif
- 
-+#if defined(__NetBSD__)
-+#define SANITIZER_NETBSD 1
-+#else
-+#define SANITIZER_NETBSD 0
-+#endif
-+
- #if defined(__APPLE__)
- # define SANITIZER_MAC     1
- # include <TargetConditionals.h>
-@@ -79,7 +85,8 @@
- # define SANITIZER_ANDROID 0
- #endif
- 
--#define SANITIZER_POSIX (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC)
-+#define SANITIZER_POSIX \
-+  (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_MAC)
- 
- #if __LP64__ || defined(_WIN64)
- #  define SANITIZER_WORDSIZE 64
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
deleted file mode 100644
index 453404f73d..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
+++ /dev/null
@@ -1,251 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
-@@ -49,6 +49,12 @@
- # define SI_FREEBSD 0
- #endif
- 
-+#if SANITIZER_NETBSD
-+#define SI_NETBSD 1
-+#else
-+#define SI_NETBSD 0
-+#endif
-+
- #if SANITIZER_LINUX
- # define SI_LINUX 1
- #else
-@@ -111,7 +117,7 @@
- #define SANITIZER_INTERCEPT_MEMMEM \
-   SI_NOT_WINDOWS && !SI_MAC_DEPLOYMENT_BELOW_10_7
- #define SANITIZER_INTERCEPT_MEMCHR 1
--#define SANITIZER_INTERCEPT_MEMRCHR SI_FREEBSD || SI_LINUX
-+#define SANITIZER_INTERCEPT_MEMRCHR SI_FREEBSD || SI_LINUX || SI_NETBSD
- 
- #define SANITIZER_INTERCEPT_READ   SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_PREAD  SI_NOT_WINDOWS
-@@ -127,7 +133,8 @@
- #define SANITIZER_INTERCEPT_READV SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_WRITEV SI_NOT_WINDOWS
- 
--#define SANITIZER_INTERCEPT_PREADV SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+#define SANITIZER_INTERCEPT_PREADV \
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PREADV64 SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PWRITEV64 SI_LINUX_NOT_ANDROID
-@@ -142,7 +149,7 @@
- 
- #ifndef SANITIZER_INTERCEPT_PRINTF
- # define SANITIZER_INTERCEPT_PRINTF SI_NOT_WINDOWS
--# define SANITIZER_INTERCEPT_PRINTF_L SI_FREEBSD
-+#define SANITIZER_INTERCEPT_PRINTF_L SI_FREEBSD || SI_NETBSD
- # define SANITIZER_INTERCEPT_ISOC99_PRINTF SI_LINUX_NOT_ANDROID
- #endif
- 
-@@ -151,13 +158,14 @@
- 
- #define SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_GETPWENT \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_FGETPWENT SI_LINUX_NOT_ANDROID
--#define SANITIZER_INTERCEPT_GETPWENT_R SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+#define SANITIZER_INTERCEPT_GETPWENT_R \
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SETPWENT SI_MAC || SI_LINUX_NOT_ANDROID
--#define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_FREEBSD || SI_LINUX
-+#define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_FREEBSD || SI_NETBSD || SI_LINUX
- #define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID
-@@ -200,41 +208,43 @@
- #define SANITIZER_INTERCEPT_MBSNRTOWCS SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_WCSTOMBS SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_WCSNRTOMBS \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_WCRTOMB \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_REALPATH SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_CONFSTR \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SCHED_GETPARAM SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_STRERROR SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_STRERROR_R SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_XPG_STRERROR_R SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SCANDIR \
--  SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SCANDIR64 SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_GETGROUPS SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_POLL SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_PPOLL SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_WORDEXP \
--  SI_FREEBSD || (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SIGWAIT SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_SIGWAITINFO SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SIGTIMEDWAIT SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SIGSETOPS \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SIGPENDING SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_SIGPROCMASK SI_NOT_WINDOWS
--#define SANITIZER_INTERCEPT_BACKTRACE SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+#define SANITIZER_INTERCEPT_BACKTRACE \
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_GETMNTENT SI_LINUX
- #define SANITIZER_INTERCEPT_GETMNTENT_R SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_STATFS SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_STATFS64 \
-   (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID
--#define SANITIZER_INTERCEPT_STATVFS SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+#define SANITIZER_INTERCEPT_STATVFS \
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_STATVFS64 SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_INITGROUPS SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_ETHER_NTOA_ATON SI_NOT_WINDOWS
-@@ -242,18 +252,19 @@
-   SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_ETHER_R SI_FREEBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_SHMCTL \
--  ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64)
-+  SI_NETBSD ||                     \
-+      ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64)
- #define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPSHARED SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETTYPE SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPROTOCOL \
--  SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPRIOCEILING \
--  SI_MAC || SI_LINUX_NOT_ANDROID
-+  SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST_NP SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETPSHARED SI_NOT_WINDOWS
-@@ -272,29 +283,31 @@
- #define SANITIZER_INTERCEPT_LGAMMAL_R SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_DRAND48_R SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_RAND_R \
--  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
--#define SANITIZER_INTERCEPT_ICONV SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-+#define SANITIZER_INTERCEPT_ICONV \
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_TIMES SI_NOT_WINDOWS
- 
- // FIXME: getline seems to be available on OSX 10.7
--#define SANITIZER_INTERCEPT_GETLINE SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+#define SANITIZER_INTERCEPT_GETLINE \
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- 
--#define SANITIZER_INTERCEPT__EXIT SI_LINUX || SI_FREEBSD || SI_MAC
-+#define SANITIZER_INTERCEPT__EXIT SI_LINUX || SI_FREEBSD || SI_NETBSD || SI_MAC
- 
- #define SANITIZER_INTERCEPT_PHTREAD_MUTEX SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \
--  SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- 
- #define SANITIZER_INTERCEPT_TLS_GET_ADDR \
--  SI_FREEBSD || SI_LINUX_NOT_ANDROID
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
- 
- #define SANITIZER_INTERCEPT_LISTXATTR SI_LINUX
- #define SANITIZER_INTERCEPT_GETXATTR SI_LINUX
- #define SANITIZER_INTERCEPT_GETRESID SI_LINUX
- #define SANITIZER_INTERCEPT_GETIFADDRS \
--  SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC
- #define SANITIZER_INTERCEPT_IF_INDEXTONAME \
--  SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC
- #define SANITIZER_INTERCEPT_CAPGET SI_LINUX_NOT_ANDROID
- #if SI_LINUX && defined(__arm__)
- #define SANITIZER_INTERCEPT_AEABI_MEM 1
-@@ -302,32 +315,33 @@
- #define SANITIZER_INTERCEPT_AEABI_MEM 0
- #endif
- #define SANITIZER_INTERCEPT___BZERO SI_MAC
--#define SANITIZER_INTERCEPT_FTIME !SI_FREEBSD && SI_NOT_WINDOWS
-+#define SANITIZER_INTERCEPT_FTIME !SI_FREEBSD && !SI_NETBSD && SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_XDR SI_LINUX_NOT_ANDROID
--#define SANITIZER_INTERCEPT_TSEARCH SI_LINUX_NOT_ANDROID || SI_MAC
-+#define SANITIZER_INTERCEPT_TSEARCH SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD
- #define SANITIZER_INTERCEPT_LIBIO_INTERNALS SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_FOPEN SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_FOPEN64 SI_LINUX_NOT_ANDROID
--#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM SI_LINUX_NOT_ANDROID
-+#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM SI_LINUX_NOT_ANDROID || SI_NETBSD
- #define SANITIZER_INTERCEPT_OBSTACK SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT_FFLUSH SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_FCLOSE SI_NOT_WINDOWS
- 
- #ifndef SANITIZER_INTERCEPT_DLOPEN_DLCLOSE
- #define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE \
--    SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC
-+  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC
- #endif
- 
--#define SANITIZER_INTERCEPT_GETPASS SI_LINUX_NOT_ANDROID || SI_MAC
-+#define SANITIZER_INTERCEPT_GETPASS SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD
- #define SANITIZER_INTERCEPT_TIMERFD SI_LINUX_NOT_ANDROID
- 
- #define SANITIZER_INTERCEPT_MLOCKX SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_FOPENCOOKIE SI_LINUX_NOT_ANDROID
--#define SANITIZER_INTERCEPT_SEM SI_LINUX || SI_FREEBSD
-+#define SANITIZER_INTERCEPT_SEM SI_LINUX || SI_FREEBSD || SI_NETBSD
- #define SANITIZER_INTERCEPT_PTHREAD_SETCANCEL SI_NOT_WINDOWS
--#define SANITIZER_INTERCEPT_MINCORE SI_LINUX
-+#define SANITIZER_INTERCEPT_MINCORE SI_LINUX || SI_NETBSD
- #define SANITIZER_INTERCEPT_PROCESS_VM_READV SI_LINUX
--#define SANITIZER_INTERCEPT_CTERMID SI_LINUX || SI_MAC || SI_FREEBSD
-+#define SANITIZER_INTERCEPT_CTERMID \
-+  SI_LINUX || SI_MAC || SI_FREEBSD || SI_NETBSD
- #define SANITIZER_INTERCEPT_CTERMID_R SI_MAC || SI_FREEBSD
- 
- #define SANITIZER_INTERCEPTOR_HOOKS SI_LINUX || SI_MAC || SI_WINDOWS
-@@ -335,7 +349,8 @@
- #define SANITIZER_INTERCEPT_SEND_SENDTO SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX
- 
--#define SANITIZER_INTERCEPT_STAT (SI_FREEBSD || SI_MAC || SI_ANDROID)
-+#define SANITIZER_INTERCEPT_STAT \
-+  (SI_FREEBSD || SI_MAC || SI_ANDROID || SI_NETBSD)
- #define SANITIZER_INTERCEPT___XSTAT !SANITIZER_INTERCEPT_STAT && SI_NOT_WINDOWS
- #define SANITIZER_INTERCEPT___XSTAT64 SI_LINUX_NOT_ANDROID
- #define SANITIZER_INTERCEPT___LXSTAT SANITIZER_INTERCEPT___XSTAT
-@@ -345,12 +360,13 @@
- #define SANITIZER_INTERCEPT_UTMPX SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD
- 
- #define SANITIZER_INTERCEPT_GETLOADAVG \
--  SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD
-+  SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD || SI_NETBSD
- 
--#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO (!SI_FREEBSD && !SI_MAC)
--#define SANITIZER_INTERCEPT_MEMALIGN (!SI_FREEBSD && !SI_MAC)
--#define SANITIZER_INTERCEPT_PVALLOC (!SI_FREEBSD && !SI_MAC)
--#define SANITIZER_INTERCEPT_CFREE (!SI_FREEBSD && !SI_MAC)
-+#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
-+  (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
-+#define SANITIZER_INTERCEPT_MEMALIGN (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
-+#define SANITIZER_INTERCEPT_PVALLOC (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
-+#define SANITIZER_INTERCEPT_CFREE (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
- #define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC)
- #define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC)
- #define SANITIZER_INTERCEPT_MCHECK_MPROBE SI_LINUX_NOT_ANDROID
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
index 025227704f..b6fd1aad26 100644
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
+++ b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig	2017-07-16 22:40:10.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
 @@ -14,7 +14,7 @@
  
@@ -11,7 +11,7 @@ $NetBSD$
  // Tests in this file assume that off_t-dependent data structures match the
  // libc ABI. For example, struct dirent here is what readdir() function (as
  // exported from libc) returns, and not the user-facing "dirent", which
-@@ -79,7 +79,7 @@
+@@ -78,7 +78,7 @@
  #include <net/if_arp.h>
  #endif
  
@@ -20,7 +20,7 @@ $NetBSD$
  # include <sys/mount.h>
  # include <sys/sockio.h>
  # include <sys/socket.h>
-@@ -94,16 +94,18 @@
+@@ -93,16 +93,18 @@
  # include <sys/statvfs.h>
  # include <sys/soundcard.h>
  # include <sys/mtio.h>
@@ -43,7 +43,7 @@ $NetBSD$
  #define _KERNEL  // to declare 'shminfo' structure
  # include <sys/shm.h>
  #undef _KERNEL
-@@ -111,11 +113,19 @@
+@@ -110,11 +112,19 @@
  #undef INLINE  // to avoid clashes with sanitizers' definitions
  #endif
  
@@ -65,7 +65,7 @@ $NetBSD$
  # include <utime.h>
  # include <sys/ptrace.h>
  # if defined(__mips64) || defined(__aarch64__) || defined(__arm__)
-@@ -200,9 +210,9 @@ typedef struct user_fpregs elf_fpregset_
+@@ -199,9 +209,9 @@ typedef struct user_fpregs elf_fpregset_
  namespace __sanitizer {
    unsigned struct_utsname_sz = sizeof(struct utsname);
    unsigned struct_stat_sz = sizeof(struct stat);
@@ -77,7 +77,7 @@ $NetBSD$
    unsigned struct_rusage_sz = sizeof(struct rusage);
    unsigned struct_tm_sz = sizeof(struct tm);
    unsigned struct_passwd_sz = sizeof(struct passwd);
-@@ -245,12 +255,12 @@ namespace __sanitizer {
+@@ -244,12 +254,12 @@ namespace __sanitizer {
    unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname);
  #endif // SANITIZER_LINUX
  
@@ -92,7 +92,7 @@ $NetBSD$
  
  #if SANITIZER_LINUX && !SANITIZER_ANDROID
    unsigned struct_ustat_sz = sizeof(struct ustat);
-@@ -258,12 +268,14 @@ namespace __sanitizer {
+@@ -257,12 +267,14 @@ namespace __sanitizer {
    unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
  #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
  
@@ -109,7 +109,7 @@ $NetBSD$
  
    uptr sig_ign = (uptr)SIG_IGN;
    uptr sig_dfl = (uptr)SIG_DFL;
-@@ -273,10 +285,17 @@ namespace __sanitizer {
+@@ -272,10 +284,17 @@ namespace __sanitizer {
    int e_tabsz = (int)E_TABSZ;
  #endif
  
@@ -129,7 +129,7 @@ $NetBSD$
    int shmctl_ipc_stat = (int)IPC_STAT;
    int shmctl_ipc_info = (int)IPC_INFO;
    int shmctl_shm_info = (int)SHM_INFO;
-@@ -310,9 +329,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
+@@ -309,9 +328,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
  unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
  #endif
  
@@ -143,7 +143,7 @@ $NetBSD$
  #endif
  
  #if SANITIZER_LINUX && !SANITIZER_ANDROID && \
-@@ -452,7 +472,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
+@@ -451,7 +471,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
    unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec);
    unsigned struct_synth_info_sz = sizeof(struct synth_info);
    unsigned struct_vt_mode_sz = sizeof(struct vt_mode);
@@ -152,7 +152,7 @@ $NetBSD$
  
  #if SANITIZER_LINUX && !SANITIZER_ANDROID
    unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
-@@ -479,7 +499,8 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
+@@ -478,7 +498,8 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
    unsigned struct_unimapinit_sz = sizeof(struct unimapinit);
  #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
  
@@ -162,7 +162,7 @@ $NetBSD$
    unsigned struct_audio_buf_info_sz = sizeof(struct audio_buf_info);
    unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats);
  #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
-@@ -535,7 +556,8 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
+@@ -534,7 +555,8 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
    unsigned IOCTL_TIOCSPGRP = TIOCSPGRP;
    unsigned IOCTL_TIOCSTI = TIOCSTI;
    unsigned IOCTL_TIOCSWINSZ = TIOCSWINSZ;
@@ -172,7 +172,7 @@ $NetBSD$
    unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT;
    unsigned IOCTL_SIOCGETVIFCNT = SIOCGETVIFCNT;
  #endif
-@@ -975,7 +997,7 @@ COMPILER_CHECK(IOC_NR(0x12345678) == _IO
+@@ -966,7 +988,7 @@ COMPILER_CHECK(IOC_NR(0x12345678) == _IO
  COMPILER_CHECK(IOC_TYPE(0x12345678) == _IOC_TYPE(0x12345678));
  #endif // SANITIZER_LINUX
  
@@ -181,7 +181,7 @@ $NetBSD$
  // There are more undocumented fields in dl_phdr_info that we are not interested
  // in.
  COMPILER_CHECK(sizeof(__sanitizer_dl_phdr_info) <= sizeof(dl_phdr_info));
-@@ -983,9 +1005,10 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi
+@@ -974,9 +996,10 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi
  CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_name);
  CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr);
  CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
@@ -194,7 +194,7 @@ $NetBSD$
  CHECK_TYPE_SIZE(glob_t);
  CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
  CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
-@@ -1037,7 +1060,7 @@ COMPILER_CHECK(sizeof(__sanitizer_dirent
+@@ -1028,7 +1051,7 @@ COMPILER_CHECK(sizeof(__sanitizer_dirent
  CHECK_SIZE_AND_OFFSET(dirent, d_ino);
  #if SANITIZER_MAC
  CHECK_SIZE_AND_OFFSET(dirent, d_seekoff);
@@ -203,7 +203,7 @@ $NetBSD$
  // There is no 'd_off' field on FreeBSD.
  #else
  CHECK_SIZE_AND_OFFSET(dirent, d_off);
-@@ -1134,11 +1157,15 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno
+@@ -1125,11 +1148,15 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno
  
  CHECK_TYPE_SIZE(ether_addr);
  
@@ -220,7 +220,7 @@ $NetBSD$
  # else
  CHECK_SIZE_AND_OFFSET(ipc_perm, __key);
  CHECK_SIZE_AND_OFFSET(ipc_perm, __seq);
-@@ -1175,20 +1202,20 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_next)
+@@ -1166,20 +1193,20 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_next)
  CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_name);
  CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_addr);
  CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_netmask);
@@ -244,7 +244,7 @@ $NetBSD$
  #else
  CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
  #endif // SANITIZER_LINUX
-@@ -1289,4 +1316,5 @@ CHECK_TYPE_SIZE(sem_t);
+@@ -1280,4 +1307,5 @@ CHECK_TYPE_SIZE(sem_t);
  COMPILER_CHECK(ARM_VFPREGS_SIZE == ARM_VFPREGS_SIZE_ASAN);
  #endif
  
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
index 7e939d6a26..71730992a9 100644
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
+++ b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig	2017-07-03 15:33:06.000000000 +0000
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig	2017-07-16 22:40:10.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_limits_posix.h
 @@ -18,18 +18,31 @@
  #include "sanitizer_internal_defs.h"
@@ -63,13 +63,7 @@ $NetBSD$
    extern unsigned struct_sockaddr_sz;
    extern unsigned ucontext_t_sz;
  #endif // !SANITIZER_ANDROID
-@@ -121,18 +138,21 @@ namespace __sanitizer {
- #endif  // SANITIZER_LINUX
- 
- #if SANITIZER_LINUX || SANITIZER_FREEBSD
--
- #if defined(__powerpc64__) || defined(__s390__)
-   const unsigned struct___old_kernel_stat_sz = 0;
+@@ -127,12 +144,16 @@ namespace __sanitizer {
  #elif !defined(__sparc__)
    const unsigned struct___old_kernel_stat_sz = 32;
  #endif
@@ -86,36 +80,25 @@ $NetBSD$
      u64   aio_data;
      u32   aio_key_or_aio_reserved1; // Simply crazy.
      u32   aio_reserved1_or_aio_key; // Luckily, we don't need these.
-@@ -144,21 +164,54 @@ namespace __sanitizer {
+@@ -144,19 +165,40 @@ namespace __sanitizer {
      s64   aio_offset;
      u64   aio_reserved2;
      u64   aio_reserved3;
 +#elif SANITIZER_NETBSD
-+#if defined(__x86_64__)
 +    u64 aio_offset;
-+    u64 aio_buf;
-+    u64 aio_nbytes;
++    uptr aio_buf;
++    long aio_nbytes;
 +    u32 aio_fildes;
 +    u32 aio_lio_opcode;
-+    u64 aio_reqprio;
++    long aio_reqprio;
++#if _LP64
 +    u8 aio_sigevent[32];
-+    u32 _state;
-+    u32 _errno;
-+    u64 _retval;
-+#elif defined(__i386__)
-+    u64 aio_offset;
-+    u32 aio_buf;
-+    u32 aio_nbytes;
-+    u32 aio_fildes;
-+    u32 aio_lio_opcode;
-+    u32 aio_reqprio;
++#else
 +    u8 aio_sigevent[20];
++#endif
 +    u32 _state;
 +    u32 _errno;
-+    u32 _retval;
-+#else
-+#error port this to your platform
-+#endif
++    long _retval;
 +#endif
    };
 +#endif
@@ -137,32 +120,13 @@ $NetBSD$
 +#endif
  
    struct __sanitizer___sysctl_args {
-+#if SANITIZER_LINUX || SANITIZER_FREEBSD
      int *name;
-     int nlen;
-     void *oldval;
-@@ -166,10 +219,32 @@ namespace __sanitizer {
+@@ -165,11 +207,16 @@ namespace __sanitizer {
+     uptr *oldlenp;
      void *newval;
      uptr newlen;
++#if SANITIZER_LINUX || SANITIZER_FREEBSD
      unsigned long ___unused[4];
-+#else
-+#if defined(__x86_64__)
-+    u64 name;
-+    u32 namelen;
-+    u64 oldp;
-+    u64 oldlenp;
-+    u64 newp;
-+    u64 newlen;
-+#elif defined(__i386__)
-+    u32 name;
-+    u32 namelen;
-+    u32 oldp;
-+    u32 oldlenp;
-+    u32 newp;
-+    u32 newlen;
-+#else
-+#error port this
-+#endif
 +#endif
    };
  
@@ -174,18 +138,12 @@ $NetBSD$
    struct __sanitizer_sem_t {
  #if SANITIZER_ANDROID && defined(_LP64)
      int data[4];
-@@ -179,9 +254,17 @@ namespace __sanitizer {
+@@ -179,9 +226,11 @@ namespace __sanitizer {
      uptr data[4];
  #elif SANITIZER_FREEBSD
      u32 data[4];
 +#elif SANITIZER_NETBSD
-+#if defined(__x86_64__)
-+    u8 data[40];
-+#elif defined(__i386__)
-+    u8 data[20];
-+#else
-+#error port this to your platform
-+#endif
++    uptr data[5];
  #endif
    };
 -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
@@ -193,7 +151,7 @@ $NetBSD$
  
  #if SANITIZER_ANDROID
    struct __sanitizer_mallinfo {
-@@ -324,14 +407,39 @@ namespace __sanitizer {
+@@ -324,14 +373,39 @@ namespace __sanitizer {
      unsigned long shm_dtime;
      unsigned long shm_ctime;
    };
@@ -235,7 +193,7 @@ $NetBSD$
  
    struct __sanitizer_iovec {
      void *iov_base;
-@@ -351,6 +459,9 @@ namespace __sanitizer {
+@@ -351,6 +425,9 @@ namespace __sanitizer {
  # endif
      void *ifa_dstaddr; // (struct sockaddr *)
      void *ifa_data;
@@ -245,7 +203,7 @@ $NetBSD$
    };
  #endif  // !SANITIZER_ANDROID
  
-@@ -376,13 +487,24 @@ namespace __sanitizer {
+@@ -376,13 +453,19 @@ namespace __sanitizer {
    const int __sanitizer_XDR_FREE = 2;
  #endif
  
@@ -258,21 +216,16 @@ $NetBSD$
    struct __sanitizer_passwd {
      char *pw_name;
      char *pw_passwd;
-+#if SANITIZER_NETBSD
      int pw_uid;
      int pw_gid;
 -#if SANITIZER_MAC || SANITIZER_FREEBSD
 -    long pw_change;
-+#else
-+    u32 pw_uid;
-+    u32 pw_gid;
-+#endif
 +#if SANITIZER_MAC || SANITIZER_FREEBSD || SANITIZER_NETBSD
 +    __sanitizer_time_t pw_change;
      char *pw_class;
  #endif
  #if !(SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32))
-@@ -390,8 +512,8 @@ namespace __sanitizer {
+@@ -390,8 +473,8 @@ namespace __sanitizer {
  #endif
      char *pw_dir;
      char *pw_shell;
@@ -283,7 +236,7 @@ $NetBSD$
  #endif
  #if SANITIZER_FREEBSD
      int pw_fields;
-@@ -405,12 +527,6 @@ namespace __sanitizer {
+@@ -405,12 +488,6 @@ namespace __sanitizer {
      char **gr_mem;
    };
  
@@ -296,7 +249,7 @@ $NetBSD$
    struct __sanitizer_timeb {
      __sanitizer_time_t time;
      unsigned short millitm;
-@@ -447,7 +563,7 @@ namespace __sanitizer {
+@@ -447,7 +524,7 @@ namespace __sanitizer {
    };
  #endif
  
@@ -305,7 +258,7 @@ $NetBSD$
    struct __sanitizer_msghdr {
      void *msg_name;
      unsigned msg_namelen;
-@@ -497,6 +613,16 @@ namespace __sanitizer {
+@@ -497,6 +574,12 @@ namespace __sanitizer {
      unsigned short d_reclen;
      // more fields that we don't care about
    };
@@ -313,16 +266,12 @@ $NetBSD$
 +  struct __sanitizer_dirent {
 +    u64 d_fileno;
 +    u16 d_reclen;
-+#if 0  // not needed here?
-+    u16 d_namlen;
-+    u8  d_type;
-+    u8  d_name[512];
-+#endif
++    // more fields that we don't care about
 +  };
  #elif SANITIZER_ANDROID || defined(__x86_64__)
    struct __sanitizer_dirent {
      unsigned long long d_ino;
-@@ -523,7 +649,7 @@ namespace __sanitizer {
+@@ -523,7 +606,7 @@ namespace __sanitizer {
  #endif
  
  // 'clock_t' is 32 bits wide on x64 FreeBSD
@@ -331,7 +280,7 @@ $NetBSD$
    typedef int __sanitizer_clock_t;
  #elif defined(__x86_64__) && !defined(_LP64)
    typedef long long __sanitizer_clock_t;
-@@ -531,7 +657,7 @@ namespace __sanitizer {
+@@ -531,7 +614,7 @@ namespace __sanitizer {
    typedef long __sanitizer_clock_t;
  #endif
  
@@ -340,7 +289,7 @@ $NetBSD$
    typedef int __sanitizer_clockid_t;
  #endif
  
-@@ -562,8 +688,22 @@ namespace __sanitizer {
+@@ -562,8 +645,22 @@ namespace __sanitizer {
    typedef struct {
      unsigned long fds_bits[1024 / (8 * sizeof(long))];
    } __sanitizer___kernel_fd_set;
@@ -363,7 +312,7 @@ $NetBSD$
    // This thing depends on the platform. We are only interested in the upper
    // limit. Verified with a compiler assert in .cc.
    const int pthread_attr_t_max_sz = 128;
-@@ -571,6 +711,7 @@ namespace __sanitizer {
+@@ -571,6 +668,7 @@ namespace __sanitizer {
      char size[pthread_attr_t_max_sz]; // NOLINT
      void *align;
    };
@@ -371,18 +320,16 @@ $NetBSD$
  
  #if SANITIZER_ANDROID
  # if SANITIZER_MIPS
-@@ -590,6 +731,10 @@ namespace __sanitizer {
+@@ -585,7 +683,7 @@ namespace __sanitizer {
+     // The size is determined by looking at sizeof of real sigset_t on linux.
+     uptr val[128 / sizeof(uptr)];
+   };
+-#elif SANITIZER_FREEBSD
++#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
+   struct __sanitizer_sigset_t {
       // uint32_t * 4
       unsigned int __bits[4];
-   };
-+#elif SANITIZER_NETBSD
-+  struct __sanitizer_sigset_t {
-+    u32 __bits[4];
-+  };
- #endif
- 
-   // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
-@@ -622,6 +767,15 @@ namespace __sanitizer {
+@@ -622,6 +720,15 @@ namespace __sanitizer {
      uptr sa_flags;
      void (*sa_restorer)();
    };
@@ -398,15 +345,7 @@ $NetBSD$
  #else // !SANITIZER_ANDROID
    struct __sanitizer_sigaction {
  #if defined(__mips__) && !SANITIZER_FREEBSD
-@@ -640,6 +794,7 @@ namespace __sanitizer {
- #else
-     __sanitizer_sigset_t sa_mask;
- #endif
-+
- #ifndef __mips__
- #if defined(__sparc__)
- #if __GLIBC_PREREQ (2, 20)
-@@ -670,7 +825,7 @@ namespace __sanitizer {
+@@ -670,7 +777,7 @@ namespace __sanitizer {
    };
  #endif // !SANITIZER_ANDROID
  
@@ -415,7 +354,7 @@ $NetBSD$
    typedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t;
  #elif defined(__mips__)
    struct __sanitizer_kernel_sigset_t {
-@@ -717,7 +872,7 @@ namespace __sanitizer {
+@@ -717,7 +824,7 @@ namespace __sanitizer {
    extern int af_inet6;
    uptr __sanitizer_in_addr_sz(int af);
  
@@ -424,7 +363,7 @@ $NetBSD$
    struct __sanitizer_dl_phdr_info {
      uptr dlpi_addr;
      const char *dlpi_name;
-@@ -733,7 +888,7 @@ namespace __sanitizer {
+@@ -733,7 +840,7 @@ namespace __sanitizer {
      int ai_family;
      int ai_socktype;
      int ai_protocol;
@@ -433,7 +372,7 @@ $NetBSD$
      unsigned ai_addrlen;
      char *ai_canonname;
      void *ai_addr;
-@@ -759,7 +914,7 @@ namespace __sanitizer {
+@@ -759,7 +866,7 @@ namespace __sanitizer {
      short revents;
    };
  
@@ -442,7 +381,7 @@ $NetBSD$
    typedef unsigned __sanitizer_nfds_t;
  #else
    typedef unsigned long __sanitizer_nfds_t;
-@@ -779,7 +934,7 @@ namespace __sanitizer {
+@@ -779,7 +886,7 @@ namespace __sanitizer {
      int (*gl_lstat)(const char *, void *);
      int (*gl_stat)(const char *, void *);
    };
@@ -451,7 +390,7 @@ $NetBSD$
    struct __sanitizer_glob_t {
      uptr gl_pathc;
      uptr gl_matchc;
-@@ -793,9 +948,9 @@ namespace __sanitizer {
+@@ -793,9 +900,9 @@ namespace __sanitizer {
      int (*gl_lstat)(const char*, void* /* struct stat* */);
      int (*gl_stat)(const char*, void* /* struct stat* */);
    };
@@ -463,7 +402,7 @@ $NetBSD$
    extern int glob_nomatch;
    extern int glob_altdirfunc;
  # endif
-@@ -807,7 +962,7 @@ namespace __sanitizer {
+@@ -807,7 +914,7 @@ namespace __sanitizer {
      uptr we_wordc;
      char **we_wordv;
      uptr we_offs;
@@ -472,45 +411,7 @@ $NetBSD$
      char *we_strings;
      uptr we_nbytes;
  #endif
-@@ -832,6 +987,37 @@ namespace __sanitizer {
-     int _fileno;
-   };
- # define SANITIZER_HAS_STRUCT_FILE 1
-+#elif SANITIZER_NETBSD
-+  struct __sanitizer_FILE {
-+    unsigned char *_p;
-+    int _r;
-+    int _w;
-+    unsigned short _flags;
-+    short _file;
-+    struct {
-+      unsigned char *_base;
-+      int _size;
-+    } _bf;
-+    int _lbfsize;
-+    void *_cookie;
-+    int (*_close)(void *ptr);
-+    u64 (*_read)(void *, void *, uptr);
-+    u64 (*_seek)(void *, u64, int);
-+    uptr (*_write)(void *, const void *, uptr);
-+    struct {
-+      unsigned char *_base;
-+      int _size;
-+    } _ext;
-+    unsigned char *_up;
-+    int _ur;
-+    unsigned char _ubuf[3];
-+    unsigned char _nbuf[1];
-+    int (*_flush)(void *ptr);
-+    char _lb_unused[sizeof(uptr)];
-+    int _blksize;
-+    u64 _offset;
-+  };
-+#define SANITIZER_HAS_STRUCT_FILE 0  // not ported
- #else
-   typedef void __sanitizer_FILE;
- # define SANITIZER_HAS_STRUCT_FILE 0
-@@ -864,7 +1050,8 @@ namespace __sanitizer {
+@@ -864,7 +971,8 @@ namespace __sanitizer {
    extern int ptrace_geteventmsg;
  #endif
  
@@ -520,19 +421,9 @@ $NetBSD$
    extern unsigned struct_shminfo_sz;
    extern unsigned struct_shm_info_sz;
    extern int shmctl_ipc_stat;
-@@ -923,6 +1110,7 @@ struct __sanitizer_cookie_io_functions_t
- };
- #endif
- 
-+#if 1  // !SANITIZER_NETBSD
- #define IOC_NRBITS 8
- #define IOC_TYPEBITS 8
- #if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || \
-@@ -966,39 +1154,43 @@ struct __sanitizer_cookie_io_functions_t
- #else
+@@ -967,38 +1075,41 @@ struct __sanitizer_cookie_io_functions_t
  #define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
  #endif
-+#endif
  
 -  extern unsigned struct_ifreq_sz;
 -  extern unsigned struct_termios_sz;
@@ -602,7 +493,7 @@ $NetBSD$
  #endif  // SANITIZER_LINUX
  
  #if SANITIZER_LINUX || SANITIZER_FREEBSD
-@@ -1006,6 +1198,9 @@ struct __sanitizer_cookie_io_functions_t
+@@ -1006,6 +1117,9 @@ struct __sanitizer_cookie_io_functions_t
    extern unsigned struct_copr_debug_buf_sz;
    extern unsigned struct_copr_msg_sz;
    extern unsigned struct_midi_info_sz;
@@ -612,7 +503,7 @@ $NetBSD$
    extern unsigned struct_mtget_sz;
    extern unsigned struct_mtop_sz;
    extern unsigned struct_rtentry_sz;
-@@ -1013,7 +1208,7 @@ struct __sanitizer_cookie_io_functions_t
+@@ -1013,7 +1127,7 @@ struct __sanitizer_cookie_io_functions_t
    extern unsigned struct_seq_event_rec_sz;
    extern unsigned struct_synth_info_sz;
    extern unsigned struct_vt_mode_sz;
@@ -621,7 +512,7 @@ $NetBSD$
  
  #if SANITIZER_LINUX && !SANITIZER_ANDROID
    extern unsigned struct_ax25_parms_struct_sz;
-@@ -1035,10 +1230,12 @@ struct __sanitizer_cookie_io_functions_t
+@@ -1035,10 +1149,12 @@ struct __sanitizer_cookie_io_functions_t
    extern unsigned struct_unimapinit_sz;
  #endif  // SANITIZER_LINUX && !SANITIZER_ANDROID
  
@@ -636,7 +527,7 @@ $NetBSD$
  
  #if !SANITIZER_ANDROID && !SANITIZER_MAC
    extern unsigned struct_sioc_sg_req_sz;
-@@ -1095,7 +1292,8 @@ struct __sanitizer_cookie_io_functions_t
+@@ -1095,7 +1211,8 @@ struct __sanitizer_cookie_io_functions_t
    extern unsigned IOCTL_TIOCSPGRP;
    extern unsigned IOCTL_TIOCSTI;
    extern unsigned IOCTL_TIOCSWINSZ;
@@ -646,7 +537,7 @@ $NetBSD$
    extern unsigned IOCTL_SIOCGETSGCNT;
    extern unsigned IOCTL_SIOCGETVIFCNT;
  #endif
-@@ -1258,10 +1456,10 @@ struct __sanitizer_cookie_io_functions_t
+@@ -1258,7 +1375,7 @@ struct __sanitizer_cookie_io_functions_t
    extern unsigned IOCTL_VT_RESIZEX;
    extern unsigned IOCTL_VT_SENDSIG;
  #endif  // SANITIZER_LINUX
@@ -654,12 +545,8 @@ $NetBSD$
 +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD
    extern unsigned IOCTL_MTIOCGET;
    extern unsigned IOCTL_MTIOCTOP;
--  extern unsigned IOCTL_SIOCADDRT;
-+  extern unsigned IOCTL_SIOCADDRT;  //
-   extern unsigned IOCTL_SIOCDELRT;
-   extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE;
-   extern unsigned IOCTL_SNDCTL_DSP_GETFMTS;
-@@ -1359,7 +1557,7 @@ struct __sanitizer_cookie_io_functions_t
+   extern unsigned IOCTL_SIOCADDRT;
+@@ -1359,7 +1476,7 @@ struct __sanitizer_cookie_io_functions_t
    extern unsigned IOCTL_VT_RELDISP;
    extern unsigned IOCTL_VT_SETMODE;
    extern unsigned IOCTL_VT_WAITACTIVE;
@@ -668,7 +555,7 @@ $NetBSD$
  
  #if SANITIZER_LINUX && !SANITIZER_ANDROID
    extern unsigned IOCTL_CYGETDEFTHRESH;
-@@ -1448,21 +1646,28 @@ struct __sanitizer_cookie_io_functions_t
+@@ -1448,21 +1565,28 @@ struct __sanitizer_cookie_io_functions_t
    extern unsigned IOCTL_TIOCSSERIAL;
  #endif  // SANITIZER_LINUX && !SANITIZER_ANDROID
  
@@ -696,5 +583,5 @@ $NetBSD$
  #endif
 +#endif
  
-   extern const int errno_EINVAL;
-   extern const int errno_EOWNERDEAD;
+   extern const int si_SEGV_MAPERR;
+   extern const int si_SEGV_ACCERR;
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__posix.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__posix.cc
deleted file mode 100644
index 81b0723bb6..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__posix.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_posix.cc.orig	2017-07-03 15:33:07.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_posix.cc
-@@ -90,7 +90,9 @@ static uptr GetKernelAreaSize() {
- 
- uptr GetMaxVirtualAddress() {
- #if SANITIZER_WORDSIZE == 64
--# if defined(__aarch64__) && SANITIZER_IOS && !SANITIZER_IOSSIM
-+# if SANITIZER_NETBSD && defined(__x86_64__)
-+  return 0x7f7ffffff000ULL;  // (0x00007f8000000000 - PAGE_SIZE)
-+# elif defined(__aarch64__) && SANITIZER_IOS && !SANITIZER_IOSSIM
-   // Ideally, we would derive the upper bound from MACH_VM_MAX_ADDRESS. The
-   // upper bound can change depending on the device.
-   return 0x200000000 - 1;
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps.h b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps.h
deleted file mode 100644
index 7df23a6c7d..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps.h
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_procmaps.h.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_procmaps.h
-@@ -20,7 +20,7 @@
- 
- namespace __sanitizer {
- 
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
- struct ProcSelfMapsBuff {
-   char *data;
-   uptr mmaped_size;
-@@ -29,7 +29,7 @@ struct ProcSelfMapsBuff {
- 
- // Reads process memory map in an OS-specific way.
- void ReadProcMaps(ProcSelfMapsBuff *proc_maps);
--#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX
-+#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
- 
- class MemoryMappingLayout {
-  public:
-@@ -58,7 +58,7 @@ class MemoryMappingLayout {
- 
-   // FIXME: Hide implementation details for different platforms in
-   // platform-specific files.
--# if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
-   ProcSelfMapsBuff proc_self_maps_;
-   const char *current_;
- 
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__common.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__common.cc
deleted file mode 100644
index 2d1aa6d5df..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__common.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_procmaps_common.cc.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_procmaps_common.cc
-@@ -12,7 +12,7 @@
- 
- #include "sanitizer_platform.h"
- 
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
- 
- #include "sanitizer_common.h"
- #include "sanitizer_placement_new.h"
-@@ -173,4 +173,4 @@ void GetMemoryProfile(fill_profile_f cb,
- 
- } // namespace __sanitizer
- 
--#endif // SANITIZER_FREEBSD || SANITIZER_LINUX
-+#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__netbsd.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__netbsd.cc
deleted file mode 100644
index 97130d4617..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__procmaps__netbsd.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_procmaps_netbsd.cc.orig	2017-07-03 18:33:56.810198571 +0000
-+++ lib/sanitizer_common/sanitizer_procmaps_netbsd.cc
-@@ -0,0 +1,78 @@
-+//===-- sanitizer_procmaps_freebsd.cc -------------------------------------===//
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+//
-+// Information about the process mappings (NetBSD-specific parts).
-+//===----------------------------------------------------------------------===//
-+
-+#include "sanitizer_platform.h"
-+#if SANITIZER_NETBSD
-+#include "sanitizer_common.h"
-+#include "sanitizer_procmaps.h"
-+
-+#include <sys/sysctl.h>
-+#include <unistd.h>
-+
-+namespace __sanitizer {
-+
-+void ReadProcMaps(ProcSelfMapsBuff *proc_maps) {
-+  struct kinfo_vmentry *kiv;
-+  const int Mib[] = {CTL_VM, VM_PROC, VM_PROC_MAP, getpid(), sizeof(*kiv)};
-+  size_t Size = 0;
-+  int Err = sysctl(Mib, __arraycount(Mib), NULL, &Size, NULL, 0);
-+  CHECK_EQ(Err, 0);
-+  CHECK_GT(Size, 0);
-+
-+  size_t MmapedSize = Size * 4 / 3;
-+  void *VmMap = MmapOrDie(MmapedSize, "ReadProcMaps()");
-+  Size = MmapedSize;
-+  Err = sysctl(Mib, __arraycount(Mib), VmMap, &Size, NULL, 0);
-+  CHECK_EQ(Err, 0);
-+
-+  proc_maps->data = (char *)VmMap;
-+  proc_maps->mmaped_size = MmapedSize;
-+  proc_maps->len = Size;
-+}
-+
-+bool MemoryMappingLayout::Next(uptr *start, uptr *end, uptr *offset,
-+                               char filename[], uptr filename_size,
-+                               uptr *protection, ModuleArch *arch, u8 *uuid) {
-+  CHECK(!arch && "not implemented");
-+  CHECK(!uuid && "not implemented");
-+  char *last = proc_self_maps_.data + proc_self_maps_.len;
-+  if (current_ >= last) return false;
-+  uptr dummy;
-+  if (!start) start = &dummy;
-+  if (!end) end = &dummy;
-+  if (!offset) offset = &dummy;
-+  if (!protection) protection = &dummy;
-+  struct kinfo_vmentry *VmEntry = (struct kinfo_vmentry *)current_;
-+
-+  *start = (uptr)VmEntry->kve_start;
-+  *end = (uptr)VmEntry->kve_end;
-+  *offset = (uptr)VmEntry->kve_offset;
-+
-+  *protection = 0;
-+  if ((VmEntry->kve_protection & KVME_PROT_READ) != 0)
-+    *protection |= kProtectionRead;
-+  if ((VmEntry->kve_protection & KVME_PROT_WRITE) != 0)
-+    *protection |= kProtectionWrite;
-+  if ((VmEntry->kve_protection & KVME_PROT_EXEC) != 0)
-+    *protection |= kProtectionExecute;
-+
-+  if (filename != NULL && filename_size > 0) {
-+    internal_snprintf(filename, Min(filename_size, (uptr)PATH_MAX), "%s",
-+                      VmEntry->kve_path);
-+  }
-+
-+  current_ += sizeof(*VmEntry);
-+
-+  return true;
-+}
-+
-+}  // namespace __sanitizer
-+
-+#endif  // SANITIZER_NETBSD
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__syscall__generic.inc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__syscall__generic.inc
deleted file mode 100644
index 5a3029f57f..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__syscall__generic.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_syscall_generic.inc.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_syscall_generic.inc
-@@ -11,13 +11,37 @@
- //
- //===----------------------------------------------------------------------===//
- 
--#if SANITIZER_FREEBSD || SANITIZER_MAC
-+#ifdef SANITIZER_NETBSD
-+# define SYS_stat SYS___stat50
-+# define SYS_lstat SYS___lstat50
-+# define SYS_fstat SYS___fstat50
-+# define SYS_gettimeofday SYS___gettimeofday50
-+# define SYS_wait4 SYS___wait450
-+# define SYS_getdents SYS___getdents30
-+# define SYS_sigaltstack SYS___sigaltstack14
-+# define SYS_sigprocmask SYS___sigprocmask14
-+# define SYS_nanosleep SYS___nanosleep50
-+#endif
-+#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD
- # define SYSCALL(name) SYS_ ## name
- #else
- # define SYSCALL(name) __NR_ ## name
- #endif
- 
--#if (SANITIZER_FREEBSD || SANITIZER_MAC) && defined(__x86_64__)
-+#if SANITIZER_NETBSD
-+// We use 3 kinds of internal_syscall's for different types of retval in order
-+// to address problems related to the byte order.
-+//   - internal_syscall     for 32-bit length (int, pid_t)
-+//   - internal_syscall64   for 64-bit length (off_t)
-+//   - internal_syscall_ptr for pointer and (s)size_t
-+# define  internal_syscall      syscall
-+# define  internal_syscall64    __syscall
-+# if SANITIZER_WORDSIZE == 64
-+#  define internal_syscall_ptr  __syscall
-+# else
-+#  define internal_syscall_ptr  syscall
-+# endif
-+#elif defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC)
- # define internal_syscall __syscall
- # else
- # define internal_syscall syscall
diff --git a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc b/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc
deleted file mode 100644
index ab5771ab33..0000000000
--- a/compiler-rt-git/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc.orig	2017-07-03 15:33:06.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc
-@@ -8,11 +8,11 @@
- //===----------------------------------------------------------------------===//
- //
- // This file contains the unwind.h-based (aka "slow") stack unwinding routines
--// available to the tools on Linux, Android, and FreeBSD.
-+// available to the tools on Linux, Android, NetBSD and FreeBSD.
- //===----------------------------------------------------------------------===//
- 
- #include "sanitizer_platform.h"
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
- #include "sanitizer_common.h"
- #include "sanitizer_stacktrace.h"
- 
-@@ -78,7 +78,8 @@ void SanitizerInitializeUnwinder() {
- }
- #endif
- 
--#ifdef __arm__
-+#if defined(__arm__) && !SANITIZER_NETBSD
-+// NetBSD uses dwarf EH
- #define UNWIND_STOP _URC_END_OF_STACK
- #define UNWIND_CONTINUE _URC_NO_REASON
- #else
-@@ -95,7 +96,7 @@ uptr Unwind_GetIP(struct _Unwind_Context
-   // Clear the Thumb bit.
-   return val & ~(uptr)1;
- #else
--  return _Unwind_GetIP(ctx);
-+  return (uptr)_Unwind_GetIP(ctx);
- #endif
- }
- 
-@@ -165,4 +166,4 @@ void BufferedStackTrace::SlowUnwindStack
- 
- }  // namespace __sanitizer
- 
--#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX
-+#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD


Home | Main Index | Thread Index | Old Index