pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Switch syscall(2)/__syscall(2) to libc calls



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Aug 28 20:28:59 2018 +0200
Changeset:	81ae8f2d12bc85f35d84c2e89adde4e071f11d52

Modified Files:
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-CMakeLists.txt
	compiler-rt-netbsd/patches/patch-cmake_Modules_HandleCompilerRT.cmake
	compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
	compiler-rt-netbsd/patches/patch-lib_asan_asan__posix.cc
	compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
	compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
	compiler-rt-netbsd/patches/patch-lib_interception_interception.h
	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__common__interceptors.inc
	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__linux__libcdep.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc
	compiler-rt-netbsd/patches/patch-lib_scudo_scudo__platform.h
	compiler-rt-netbsd/patches/patch-lib_tsan_CMakeLists.txt
	compiler-rt-netbsd/patches/patch-test_asan_TestCases_Posix_stack-use-after-return.cc
	compiler-rt-netbsd/patches/patch-test_asan_TestCases_heavy__uar__test.cc
	compiler-rt-netbsd/patches/patch-test_asan_TestCases_interception__failure__test.cc
	compiler-rt-netbsd/patches/patch-test_fuzzer_NullDerefTest.cpp
	compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg
	compiler-rt-netbsd/patches/patch-test_lsan_lit.common.cfg
	compiler-rt-netbsd/patches/patch-test_scudo_lit.cfg
Added Files:
	compiler-rt-netbsd/patches/patch-lib_safestack_safestack.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__openbsd.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__posix.h
	compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h
	compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc

Log Message:
compiler-rt-netbsd: Switch syscall(2)/__syscall(2) to libc calls

This commit contains some local draft code.

There is no obervable regression.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=81ae8f2d12bc85f35d84c2e89adde4e071f11d52

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

diffstat:
 compiler-rt-netbsd/distinfo                        |  60 ++-
 compiler-rt-netbsd/patches/patch-CMakeLists.txt    |   2 +-
 .../patch-cmake_Modules_HandleCompilerRT.cmake     |   2 +-
 .../patches/patch-cmake_config-ix.cmake            |   2 +-
 .../patches/patch-lib_asan_asan__posix.cc          |   2 +-
 .../patches/patch-lib_fuzzer_FuzzerLoop.cpp        |   4 +-
 .../patches/patch-lib_fuzzer_tests_CMakeLists.txt  |   4 +-
 .../patches/patch-lib_interception_interception.h  |   2 +-
 .../patches/patch-lib_msan_msan__interceptors.cc   |  10 +-
 .../patches/patch-lib_msan_msan__linux.cc          |   2 +-
 .../patches/patch-lib_safestack_safestack.cc       |   0
 ...zer__common_sanitizer__common__interceptors.inc |   6 +-
 ...b_sanitizer__common_sanitizer__internal__defs.h |   4 +-
 ...patch-lib_sanitizer__common_sanitizer__linux.cc | 589 ++++++++++++++++++++-
 ..._sanitizer__common_sanitizer__linux__libcdep.cc |  29 +-
 .../patch-lib_sanitizer__common_sanitizer__mac.cc  |  28 +
 ...tch-lib_sanitizer__common_sanitizer__openbsd.cc |  37 ++
 ...zer__common_sanitizer__platform__interceptors.h |   4 +-
 ...r__common_sanitizer__platform__limits__posix.cc |   2 +-
 ...er__common_sanitizer__platform__limits__posix.h |   2 +-
 .../patch-lib_sanitizer__common_sanitizer__posix.h |  14 +
 ...b_sanitizer__common_sanitizer__procmaps__bsd.cc |  38 +-
 ...er__common_sanitizer__unwind__linux__libcdep.cc |   2 +-
 .../patches/patch-lib_scudo_scudo__platform.h      |   2 +-
 .../patches/patch-lib_tsan_CMakeLists.txt          |   4 +-
 .../patches/patch-lib_xray_xray__flags.h           |  14 +
 .../patches/patch-lib_xray_xray__profiling.cc      |  19 +
 ..._asan_TestCases_Posix_stack-use-after-return.cc |   4 +-
 .../patch-test_asan_TestCases_heavy__uar__test.cc  |   2 +-
 ...t_asan_TestCases_interception__failure__test.cc |   2 +-
 .../patches/patch-test_fuzzer_NullDerefTest.cpp    |   2 +-
 .../patches/patch-test_fuzzer_lit.cfg              |   2 +-
 .../patches/patch-test_lsan_lit.common.cfg         |   2 +-
 .../patches/patch-test_scudo_lit.cfg               |   6 +-
 34 files changed, 814 insertions(+), 90 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index bd6fb5bc3d..ccc6c5341f 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -1,33 +1,39 @@
 $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 
-SHA1 (patch-CMakeLists.txt) = d266456097955589919b5163f6fe5f1cfd95eecd
-SHA1 (patch-cmake_Modules_HandleCompilerRT.cmake) = 2456af23f62cc919aba7358b8af25ef86cc64dc1
-SHA1 (patch-cmake_config-ix.cmake) = fc637abe72ed27d5baba1308087bb0372f8fbbe2
-SHA1 (patch-lib_asan_asan__posix.cc) = 0f596061c078eaab0b5b4b183550aa7820677f46
-SHA1 (patch-lib_fuzzer_FuzzerLoop.cpp) = 01456bfacb94c06e008eefc660781d3c7bb1c2e7
-SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = e2e0e397eaf148df329f2c25ca9185f57989d082
-SHA1 (patch-lib_interception_interception.h) = a7f97b191769c846be27e17430bbe39435976642
-SHA1 (patch-lib_msan_msan__interceptors.cc) = bfb0d6ba97382a26d54141c3e4cc0c0f584178a1
-SHA1 (patch-lib_msan_msan__linux.cc) = dc3431b7606f3e1c106ffd2568ab4a6c77321731
-SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = f9dce4a714af9644b862c3d705646c4e52923825
+SHA1 (patch-CMakeLists.txt) = bce32bd256b9e57e9cadc51cf6adcf269445bcb3
+SHA1 (patch-cmake_Modules_HandleCompilerRT.cmake) = fde0a4b440a257dec40c4f106c2352d5efecceef
+SHA1 (patch-cmake_config-ix.cmake) = 1456a6d244727885d51b68d333de7119523d1d6d
+SHA1 (patch-lib_asan_asan__posix.cc) = be7e47c252e30184639f7ed1c98c75a8667fd261
+SHA1 (patch-lib_fuzzer_FuzzerLoop.cpp) = 18ec3311ab74dc12321579a3b01adc900af2a3a9
+SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 8f3afca11a9f45a7e843db7c65eeee292292b8bf
+SHA1 (patch-lib_interception_interception.h) = df981a3929568807134d3aadbfcc1adb99fbe83d
+SHA1 (patch-lib_msan_msan__interceptors.cc) = 7af07c88b0ddf650f3df5dea4f6664ff9393d963
+SHA1 (patch-lib_msan_msan__linux.cc) = b5df0f4f5930d7c1681b1ad867c893d01d6e5cf7
+SHA1 (patch-lib_safestack_safestack.cc) = da39a3ee5e6b4b0d3255bfef95601890afd80709
+SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = 4c3291b1bbb6ad997db35dd168bf210c6fbd3733
 SHA1 (patch-lib_sanitizer__common_sanitizer__interceptors__ioctl__netbsd.inc) = 1c6e8c4a755af57d523d06b12f08a1946f1aef25
-SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = 9ffcb3ae5ccfcb99d842efe55f6d698cd2e02846
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = 83636321cef6a17281a27e2ed3dd1b71e5429a6a
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc) = ac04d9b155c7281dde98741b7f79714e98c2bbc3
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = cdf1461c641ca6f9e13f3d3319170e4aad76e367
+SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = e231d87d8e04d528f73275f5de7000c2b395a9c4
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = e4823f1e17f6119762f11b6d77f07ce8bbb7b88d
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc) = bfde1c5fa8c786a506fc9a8f0fb24531419573e7
+SHA1 (patch-lib_sanitizer__common_sanitizer__mac.cc) = 19549c7e4c4703aa0199c0ae6cb380751aa183a3
+SHA1 (patch-lib_sanitizer__common_sanitizer__openbsd.cc) = d2ee02d530c1a2293caf00579ef489809114e180
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 87684ad05a8e3a5ab2f1c9cf00cbecab4823eeb3
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = b52e02792201d54d1f9e9336a8cf74ff8c9eca68
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = e8a0d9389f3ddd41f911e00f8ff62e214441296d
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc) = 95fef4690641063603db1b1dcb00c610948142f1
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h) = b2c0149501713bc16b657344b8b9a3a0ce48b107
-SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc) = 8b629840ff7f56c670d322a9dbbdf7e33ce90cb5
-SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = 5225619de386fa8e017b6d391c9f1eba4bdda2af
-SHA1 (patch-lib_scudo_scudo__platform.h) = 119d7ad8f8ca9d3e846dbdd7f805ca771e30e410
-SHA1 (patch-lib_tsan_CMakeLists.txt) = 1407f3eaa0edf1ddd13ceac8a6341a9e1f0a906b
-SHA1 (patch-test_asan_TestCases_Posix_stack-use-after-return.cc) = 7eb1109c646b5eb4cce26140246949eb4c593a3b
-SHA1 (patch-test_asan_TestCases_heavy__uar__test.cc) = a0d7c228b02c4b5d4a198bce9ef8bc594c92544d
-SHA1 (patch-test_asan_TestCases_interception__failure__test.cc) = b4711fcc3315eaacc2a4ec1021e04b8200749e51
-SHA1 (patch-test_fuzzer_NullDerefTest.cpp) = 80b63f1c77fef2747af03c3c09a8b805ed2f27f9
-SHA1 (patch-test_fuzzer_lit.cfg) = 98e8e0589d68bb17b1794634256ac03ddb9af293
-SHA1 (patch-test_lsan_lit.common.cfg) = b09b4ab3a97dc881b701a3583b0b126b8206cfe2
-SHA1 (patch-test_scudo_lit.cfg) = 35e4f0524a8fd26e90e5d968b73d75f277da3779
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc) = 3fb785fdc01d68425b7ff9ccabd7d28057b47597
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h) = 9f535e84c3e1ab5704b11e388ac240439a9900d6
+SHA1 (patch-lib_sanitizer__common_sanitizer__posix.h) = 557bf6ba52b11bcf3b7ea8f9ca43bdca5e932e0b
+SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc) = c4ef1f0bd0f297c5b9e8f93b75cd9df082cb9394
+SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = 86d53010debaf2cc5c9793d83186db2db76b280f
+SHA1 (patch-lib_scudo_scudo__platform.h) = 68f33b18d913984c3a459597ef62f63d36184ca9
+SHA1 (patch-lib_tsan_CMakeLists.txt) = 11fda934da12d046350463076bed2c209ec682e9
+SHA1 (patch-lib_xray_xray__flags.h) = b5abd9ee12c7c96514564dd17225f864c9489c8e
+SHA1 (patch-lib_xray_xray__profiling.cc) = c8653c7bd11b535f9066a3d7f4f975a6a2e5bfa0
+SHA1 (patch-test_asan_TestCases_Posix_stack-use-after-return.cc) = 474bfca0e8891bb777a81ae926c89c3d56f7cdb9
+SHA1 (patch-test_asan_TestCases_heavy__uar__test.cc) = fce8bfec44d93bb606920dba9ddd7165f127d23a
+SHA1 (patch-test_asan_TestCases_interception__failure__test.cc) = 0a359141e3c30b672842904b32d1542170b03ab1
+SHA1 (patch-test_fuzzer_NullDerefTest.cpp) = 32b012ffd94a935cbdf9d8f53402f79743ccca74
+SHA1 (patch-test_fuzzer_lit.cfg) = 22ff655f201f1df7a8dcaf3e1b70e113647ef705
+SHA1 (patch-test_lsan_lit.common.cfg) = 4e0a0f71dfb7c19b62747abaa5f265e0f0dc1e05
+SHA1 (patch-test_scudo_lit.cfg) = 708c7bcf31b5fbf1c5b48da8882978c25908362c
 SHA1 (patch-utils_generate__netbsd__ioctls.awk) = 56c92131aa95b64765af3e9b60fd7d7cc55facbc
diff --git a/compiler-rt-netbsd/patches/patch-CMakeLists.txt b/compiler-rt-netbsd/patches/patch-CMakeLists.txt
index 563646bbc2..00915e381f 100644
--- a/compiler-rt-netbsd/patches/patch-CMakeLists.txt
+++ b/compiler-rt-netbsd/patches/patch-CMakeLists.txt
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- CMakeLists.txt.orig	2018-08-21 21:25:22.900816085 +0000
+--- CMakeLists.txt.orig	2018-08-21 21:25:22.000000000 +0000
 +++ CMakeLists.txt
 @@ -338,6 +338,10 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuch
    list(APPEND SANITIZER_COMMON_LINK_LIBS zircon)
diff --git a/compiler-rt-netbsd/patches/patch-cmake_Modules_HandleCompilerRT.cmake b/compiler-rt-netbsd/patches/patch-cmake_Modules_HandleCompilerRT.cmake
index c614a7fe1c..3c5f628c4e 100644
--- a/compiler-rt-netbsd/patches/patch-cmake_Modules_HandleCompilerRT.cmake
+++ b/compiler-rt-netbsd/patches/patch-cmake_Modules_HandleCompilerRT.cmake
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- cmake/Modules/HandleCompilerRT.cmake.orig	2018-06-01 09:36:57.000000000 +0000
+--- cmake/Modules/HandleCompilerRT.cmake.orig	2018-08-21 21:25:36.000000000 +0000
 +++ cmake/Modules/HandleCompilerRT.cmake
 @@ -1,5 +1,5 @@
  function(find_compiler_rt_library name variable)
diff --git a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
index da17ce30e0..393846d8d1 100644
--- a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
+++ b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- cmake/config-ix.cmake.orig	2018-08-21 21:25:36.351211184 +0000
+--- cmake/config-ix.cmake.orig	2018-08-21 21:25:36.000000000 +0000
 +++ cmake/config-ix.cmake
 @@ -557,7 +557,7 @@ else()
  endif()
diff --git a/compiler-rt-netbsd/patches/patch-lib_asan_asan__posix.cc b/compiler-rt-netbsd/patches/patch-lib_asan_asan__posix.cc
index 91acb1083e..aea86c1ee4 100644
--- a/compiler-rt-netbsd/patches/patch-lib_asan_asan__posix.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_asan_asan__posix.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/asan/asan_posix.cc.orig	2018-02-01 23:46:05.000000000 +0000
+--- lib/asan/asan_posix.cc.orig	2018-08-21 21:25:41.000000000 +0000
 +++ lib/asan/asan_posix.cc
 @@ -40,31 +40,35 @@ void AsanOnDeadlySignal(int signo, void 
  
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
index 9af3f240cd..61a85cd43c 100644
--- a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerLoop.cpp
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- lib/fuzzer/FuzzerLoop.cpp.orig	2018-06-07 08:27:17.000000000 +0000
+--- lib/fuzzer/FuzzerLoop.cpp.orig	2018-08-21 21:25:41.000000000 +0000
 +++ lib/fuzzer/FuzzerLoop.cpp
-@@ -272,7 +272,7 @@ NO_SANITIZE_MEMORY
+@@ -276,7 +276,7 @@ NO_SANITIZE_MEMORY
  void Fuzzer::AlarmCallback() {
    assert(Options.UnitTimeoutSec > 0);
    // In Windows Alarm callback is executed by a different thread.
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 ffca788606..7df9c787cb 100644
--- a/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- lib/fuzzer/tests/CMakeLists.txt.orig	2018-06-01 09:39:33.000000000 +0000
+--- lib/fuzzer/tests/CMakeLists.txt.orig	2018-08-21 21:25:41.000000000 +0000
 +++ lib/fuzzer/tests/CMakeLists.txt
-@@ -10,6 +10,9 @@ add_custom_target(FuzzerUnitTests)
+@@ -13,6 +13,9 @@ add_custom_target(FuzzerUnitTests)
  set_target_properties(FuzzerUnitTests PROPERTIES FOLDER "Compiler-RT Tests")
  
  set(LIBFUZZER_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_LINK_FLAGS})
diff --git a/compiler-rt-netbsd/patches/patch-lib_interception_interception.h b/compiler-rt-netbsd/patches/patch-lib_interception_interception.h
index aad5e06952..b184027e15 100644
--- a/compiler-rt-netbsd/patches/patch-lib_interception_interception.h
+++ b/compiler-rt-netbsd/patches/patch-lib_interception_interception.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/interception/interception.h.orig	2018-06-01 09:36:54.000000000 +0000
+--- lib/interception/interception.h.orig	2018-08-21 21:25:37.000000000 +0000
 +++ lib/interception/interception.h
 @@ -29,6 +29,7 @@ typedef __sanitizer::uptr    SIZE_T;
  typedef __sanitizer::sptr    SSIZE_T;
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
index 6edb015ea4..f4a017b60c 100644
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/msan/msan_interceptors.cc.orig	2018-06-14 12:14:39.000000000 +0000
+--- lib/msan/msan_interceptors.cc.orig	2018-08-21 21:25:44.000000000 +0000
 +++ lib/msan/msan_interceptors.cc
 @@ -34,11 +34,13 @@
  #include "sanitizer_common/sanitizer_libc.h"
@@ -16,7 +16,7 @@ $NetBSD$
  #endif
  
  #include <stdarg.h>
-@@ -1066,6 +1068,18 @@ INTERCEPTOR(int, pthread_join, void *th,
+@@ -1069,6 +1071,18 @@ INTERCEPTOR(int, pthread_join, void *th,
  
  extern char *tzname[2];
  
@@ -35,7 +35,7 @@ $NetBSD$
  INTERCEPTOR(void, tzset, int fake) {
    ENSURE_MSAN_INITED();
    REAL(tzset)(fake);
-@@ -1075,29 +1089,85 @@ INTERCEPTOR(void, tzset, int fake) {
+@@ -1078,29 +1092,85 @@ INTERCEPTOR(void, tzset, int fake) {
      __msan_unpoison(tzname[1], REAL(strlen)(tzname[1]) + 1);
    return;
  }
@@ -124,7 +124,7 @@ $NetBSD$
  }
  
  static void BeforeFork() {
-@@ -1517,6 +1587,9 @@ namespace __msan {
+@@ -1520,6 +1590,9 @@ namespace __msan {
  void InitializeInterceptors() {
    static int inited = 0;
    CHECK_EQ(inited, 0);
@@ -134,7 +134,7 @@ $NetBSD$
    InitializeCommonInterceptors();
    InitializeSignalInterceptors();
  
-@@ -1626,6 +1699,7 @@ void InitializeInterceptors() {
+@@ -1629,6 +1702,7 @@ void InitializeInterceptors() {
  
    INTERCEPT_FUNCTION(pthread_join);
    INTERCEPT_FUNCTION(tzset);
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc
index 3fddc91ff3..8c7e059cf7 100644
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_msan__linux.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/msan/msan_linux.cc.orig	2018-06-14 12:14:39.000000000 +0000
+--- lib/msan/msan_linux.cc.orig	2018-08-21 21:25:44.000000000 +0000
 +++ lib/msan/msan_linux.cc
 @@ -31,6 +31,7 @@
  #include <sys/time.h>
diff --git a/compiler-rt-netbsd/patches/patch-lib_safestack_safestack.cc b/compiler-rt-netbsd/patches/patch-lib_safestack_safestack.cc
new file mode 100644
index 0000000000..e69de29bb2
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 b4c578448a..1509e79a21 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,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig	2018-06-14 12:14:39.000000000 +0000
+--- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig	2018-08-21 21:25:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_common_interceptors.inc
 @@ -77,6 +77,11 @@
  #define ctime __ctime50
@@ -87,7 +87,7 @@ $NetBSD$
    void *ctx;
    COMMON_INTERCEPTOR_ENTER(ctx, statvfs, path, buf);
    if (path) COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1);
-@@ -7234,6 +7252,1606 @@ INTERCEPTOR(struct __sanitizer_netent *,
+@@ -7235,6 +7253,1606 @@ INTERCEPTOR(struct __sanitizer_netent *,
  #define INIT_NETENT
  #endif
  
@@ -1694,7 +1694,7 @@ $NetBSD$
  static void InitializeCommonInterceptors() {
    static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1];
    interceptor_metadata_map = new((void *)&metadata_mem) MetadataHashMap();
-@@ -7483,6 +9101,30 @@ static void InitializeCommonInterceptors
+@@ -7484,6 +9102,30 @@ static void InitializeCommonInterceptors
    INIT_TTYENT;
    INIT_PROTOENT;
    INIT_NETENT;
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
index dda748de91..1fb84c264d 100644
--- 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
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_internal_defs.h.orig	2018-06-01 09:39:33.000000000 +0000
+--- lib/sanitizer_common/sanitizer_internal_defs.h.orig	2018-08-21 21:25:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_internal_defs.h
-@@ -186,7 +186,9 @@ typedef u64 tid_t;
+@@ -196,7 +196,9 @@ typedef u64 tid_t;
  // This header should NOT include any other headers to avoid portability issues.
  
  // Common defs.
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
index b336d7d19e..a279d01999 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
@@ -1,12 +1,587 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_linux.cc.orig	2018-06-07 08:27:17.000000000 +0000
+--- lib/sanitizer_common/sanitizer_linux.cc.orig	2018-08-21 21:25:39.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_linux.cc
-@@ -93,6 +93,7 @@ extern "C" {
+@@ -155,7 +155,20 @@ extern void internal_sigreturn();
+ # else
+ #   define SANITIZER_USE_GETENTROPY 0
+ # endif
+-#endif // SANITIZER_USE_GETENTROPY
++#endif // SANITIZER_USE_GETENTROP
++
++#if SANITIZER_NETBSD
++//#include "interception/interception.h"
++#if 0
++DECLARE_REAL(void *, __mmap, void *addr, size_t length, int prot, \
++int flags, int fd, int pad, off_t offset);
++#endif
++#if 0
++extern "C" void *__mmap(void *, size_t, int, int, int, int, off_t);
++DEFINE_REAL(void *, __mmap, void *addr, size_t length, int prot, \
++int flags, int fd, int pad, off_t offset)
++#endif
++#endif
  
+ namespace __sanitizer {
+ 
+@@ -169,12 +182,37 @@ namespace __sanitizer {
+ #include "sanitizer_syscall_generic.inc"
+ #endif
+ 
++#if SANITIZER_NETBSD
++static void *GetRealLibcAddress(const char *symbol) {
++  void *real = dlsym(RTLD_NEXT, symbol);
++  if (!real)
++    real = dlsym(RTLD_DEFAULT, symbol);
++  if (!real) {
++    Printf("GetRealLibcAddress failed for symbol=%s", symbol);
++    Die();
++  }
++  return real;
++}
++#endif
++
+ // --------------- sanitizer_libc.h
+ #if !SANITIZER_SOLARIS
+ #if !SANITIZER_S390 && !SANITIZER_OPENBSD
+ uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd,
+                    OFF_T offset) {
+-#if SANITIZER_NETBSD
++#if SANITIZER_NETBSDxx
++  GetRealFunctionAddress();
++  return (uptr)REAL(__mmap)(addr, length, prot, flags, fd, 0, offset);
++#elif SANITIZER_NETBSD
++  static uptr (*real___mmap)(void *a, uptr b, int c, int d, int e, int f,
++                             OFF_T g) = NULL;
++  if (!real___mmap) {
++    real___mmap = (uptr(*)(void *a, uptr b, int c, int d, int e, int f,
++                   OFF_T g))GetRealLibcAddress("__mmap");
++  }
++  CHECK(real___mmap);
++  return (*real___mmap)(addr, length, prot, flags, fd, 0, offset);
++#elif SANITIZER_NETBSDxxx
+   return internal_syscall64(SYSCALL(mmap), addr, length, prot, flags, fd,
+                               (long)0, offset);
+ #elif SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS
+@@ -191,20 +229,52 @@ uptr internal_mmap(void *addr, uptr leng
+ 
+ #if !SANITIZER_OPENBSD
+ uptr internal_munmap(void *addr, uptr length) {
++#if SANITIZER_NETBSD
++  static int (*real_munmap)(void *a, uptr b) = NULL;
++  if (!real_munmap) {
++    real_munmap = (int(*)(void *a, uptr b))GetRealLibcAddress("munmap");
++  }
++  CHECK(real_munmap);
++  return (*real_munmap)(addr, length);
++#else
+   return internal_syscall_ptr(SYSCALL(munmap), (uptr)addr, length);
++#endif
+ }
+ 
+ int internal_mprotect(void *addr, uptr length, int prot) {
++#if SANITIZER_NETBSD
++  static int (*real_mprotect)(void *a, uptr b, int c) = NULL;
++  if (!real_mprotect) {
++    real_mprotect = (int(*)(void *a, uptr b, int c))
++                    GetRealLibcAddress("mprotect");
++  }
++  return (*real_mprotect)(addr, length, prot);
++#else
+   return internal_syscall_ptr(SYSCALL(mprotect), (uptr)addr, length, prot);
++#endif
+ }
+ #endif
+ 
+ uptr internal_close(fd_t fd) {
++#if SANITIZER_NETBSD
++  static int (*real_close)(int a) = NULL;
++  if (!real_close) {
++    real_close = (int(*)(int a))GetRealLibcAddress("close");
++  }
++  return (*real_close)(fd);
++#else
+   return internal_syscall(SYSCALL(close), fd);
++#endif
+ }
+ 
+ uptr internal_open(const char *filename, int flags) {
+-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
++#if SANITIZER_NETBSD
++  static int (*real_open)(const char *a, int b) = NULL;
++  if (!real_open) {
++    real_open = (int(*)(const char *a, int b))GetRealLibcAddress("open");
++  }
++  return (*real_open)(filename, flags);
++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+   return internal_syscall(SYSCALL(openat), AT_FDCWD, (uptr)filename, flags);
+ #else
+   return internal_syscall_ptr(SYSCALL(open), (uptr)filename, flags);
+@@ -212,7 +282,13 @@ 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
++  static int (*real_open)(const char *a, int b, u32 c) = NULL;
++  if (!real_open) {
++    real_open = (int(*)(const char *a, int b, u32 c))GetRealLibcAddress("open");
++  }
++  return (*real_open)(filename, flags, mode);
++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+   return internal_syscall(SYSCALL(openat), AT_FDCWD, (uptr)filename, flags,
+                           mode);
+ #else
+@@ -222,21 +298,45 @@ uptr internal_open(const char *filename,
+ 
+ uptr internal_read(fd_t fd, void *buf, uptr count) {
+   sptr res;
++#if SANITIZER_NETBSD
++  static int (*real_read)(int a, void *b, uptr c) = NULL;
++  if (!real_read) {
++    real_read = (int(*)(int a, void *b, uptr c))GetRealLibcAddress("read");
++  }
++  CHECK(real_read);
++  HANDLE_EINTR(res, (sptr)(*real_read)(fd, buf, count));
++#else
+   HANDLE_EINTR(res, (sptr)internal_syscall_ptr(SYSCALL(read), fd, (uptr)buf,
+                count));
++#endif
+   return res;
+ }
+ 
+ uptr internal_write(fd_t fd, const void *buf, uptr count) {
+   sptr res;
++#if SANITIZER_NETBSD
++  static int (*real_write)(int a, const void *b, uptr c) = NULL;
++  if (!real_write) {
++    real_write = (int(*)(int a, const void *b, uptr c))
++                 GetRealLibcAddress("write");
++  }
++  HANDLE_EINTR(res, (sptr)(*real_write)(fd, buf, count));
++#else
+   HANDLE_EINTR(res, (sptr)internal_syscall_ptr(SYSCALL(write), fd, (uptr)buf,
+                count));
++#endif
+   return res;
+ }
+ 
+ uptr internal_ftruncate(fd_t fd, uptr size) {
+   sptr res;
  #if SANITIZER_NETBSD
- #include <limits.h>  // For NAME_MAX
-+#define sysctl _sysctl
- #include <sys/sysctl.h>
- #include <sys/exec.h>
- extern struct ps_strings *__ps_strings;
++  static int (*real_ftruncate)(int a, s64 b) = NULL;
++  if (!real_ftruncate) {
++    real_ftruncate = (int(*)(int a, s64 b))GetRealLibcAddress("ftruncate");
++  }
++  HANDLE_EINTR(res, (uptr)(*real_ftruncate)(fd, size));
++#elif SANITIZER_NETBSDxx
+   HANDLE_EINTR(res, internal_syscall64(SYSCALL(ftruncate), fd, 0, (s64)size));
+ #else
+   HANDLE_EINTR(res, (sptr)internal_syscall(SYSCALL(ftruncate), fd,
+@@ -313,7 +413,14 @@ static void kernel_stat_to_stat(struct k
+ #endif
+ 
+ uptr internal_stat(const char *path, void *buf) {
+-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
++#if SANITIZER_NETBSD
++  static int (*real_stat)(const char *a, void *b) = NULL;
++  if (!real_stat) {
++    real_stat = (int(*)(const char *a, void *b))GetRealLibcAddress("__stat50");
++  }
++  CHECK(real_stat);
++  return (*real_stat)(path, buf);
++#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxx || SANITIZER_OPENBSD
+   return internal_syscall_ptr(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf,
+                               0);
+ #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+@@ -339,6 +446,14 @@ uptr internal_stat(const char *path, voi
+ 
+ uptr internal_lstat(const char *path, void *buf) {
+ #if SANITIZER_NETBSD
++  static int (*real_lstat)(const char *a, void *b) = NULL;
++  if (!real_lstat) {
++    real_lstat = (int(*)(const char *a, void *b))
++                 GetRealLibcAddress("__lstat50");
++  }
++  CHECK(real_lstat);
++  return (*real_lstat)(path, buf);
++#elif SANITIZER_NETBSDxxx
+   return internal_syscall_ptr(SYSCALL(lstat), path, buf);
+ #elif SANITIZER_FREEBSD || SANITIZER_OPENBSD
+   return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf,
+@@ -365,7 +480,14 @@ uptr internal_lstat(const char *path, vo
+ }
+ 
+ uptr internal_fstat(fd_t fd, void *buf) {
+-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD ||              \
++#if SANITIZER_NETBSD
++  static int (*real_fstat)(int a, void *b) = NULL;
++  if (!real_fstat) {
++    real_fstat = (int(*)(int a, void *b))GetRealLibcAddress("__fstat50");
++  }
++  CHECK(real_fstat);
++  return (*real_fstat)(fd, buf);
++#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxx || SANITIZER_OPENBSD ||          \
+     SANITIZER_LINUX_USES_64BIT_SYSCALLS
+ #if SANITIZER_MIPS64 && !SANITIZER_NETBSD && !SANITIZER_OPENBSD
+   // For mips64, fstat syscall fills buffer in the format of kernel_stat
+@@ -392,7 +514,14 @@ uptr internal_filesize(fd_t fd) {
+ }
+ 
+ uptr internal_dup2(int oldfd, int newfd) {
+-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
++#if SANITIZER_NETBSD
++  static int (*real_dup2)(int a, int b) = NULL;
++  if (!real_dup2) {
++    real_dup2 = (int(*)(int a, int b))GetRealLibcAddress("dup2");
++  }
++  CHECK(real_dup2);
++  return (*real_dup2)(oldfd, newfd);
++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+   return internal_syscall(SYSCALL(dup3), oldfd, newfd, 0);
+ #else
+   return internal_syscall(SYSCALL(dup2), oldfd, newfd);
+@@ -400,7 +529,15 @@ uptr internal_dup2(int oldfd, int newfd)
+ }
+ 
+ uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
+-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
++#if SANITIZER_NETBSD
++  static ssize_t (*real_readlink)(const char *a, char *b, size_t c) = NULL;
++  if (!real_readlink) {
++    real_readlink = (ssize_t(*)(const char *a, char *b, size_t c))
++                    GetRealLibcAddress("readlink");
++  }
++  CHECK(real_readlink);
++  return (*real_readlink)(path, buf, bufsize);
++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+   return internal_syscall(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, (uptr)buf,
+                           bufsize);
+ #elif SANITIZER_OPENBSD
+@@ -412,7 +549,14 @@ uptr internal_readlink(const char *path,
+ }
+ 
+ uptr internal_unlink(const char *path) {
+-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD
++#if SANITIZER_NETBSD
++  static int (*real_unlink)(const char *a) = NULL;
++  if (!real_unlink) {
++    real_unlink = (int(*)(const char *a))GetRealLibcAddress("unlink");
++  }
++  CHECK(real_unlink);
++  return (*real_unlink)(path);
++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD
+   return internal_syscall(SYSCALL(unlinkat), AT_FDCWD, (uptr)path, 0);
+ #else
+   return internal_syscall_ptr(SYSCALL(unlink), (uptr)path);
+@@ -420,7 +564,15 @@ uptr internal_unlink(const char *path) {
+ }
+ 
+ uptr internal_rename(const char *oldpath, const char *newpath) {
+-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD
++#if SANITIZER_NETBSD
++  static int (*real_rename)(const char *a, const char *b) = NULL;
++  if (!real_rename) {
++    real_rename = (int(*)(const char *a, const char *b))
++                  GetRealLibcAddress("rename");
++  }
++  CHECK(real_rename);
++  return (*real_rename)(oldpath, newpath);
++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD
+   return internal_syscall(SYSCALL(renameat), AT_FDCWD, (uptr)oldpath, AT_FDCWD,
+                           (uptr)newpath);
+ #else
+@@ -429,11 +581,27 @@ uptr internal_rename(const char *oldpath
+ }
+ 
+ uptr internal_sched_yield() {
++#if !SANITIZER_NETBSD
++  static int (*real_sched_yield)() = NULL;
++  if (!real_sched_yield) {
++    real_sched_yield = (int(*)())GetRealLibcAddress("sched_yield");
++  }
++  CHECK(real_sched_yield);
++  return (*real_sched_yield)();
++#else
+   return internal_syscall(SYSCALL(sched_yield));
++#endif
+ }
+ 
+ void internal__exit(int exitcode) {
+-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
++#if SANITIZER_NETBSD
++  static void (*real__exit)(int a) = NULL;
++  if (!real__exit) {
++    real__exit = (void(*)(int a))GetRealLibcAddress("_exit");
++  }
++  CHECK(real__exit);
++  (*real__exit)(exitcode);
++#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxxx || SANITIZER_OPENBSD
+   internal_syscall(SYSCALL(exit), exitcode);
+ #else
+   internal_syscall(SYSCALL(exit_group), exitcode);
+@@ -442,18 +610,38 @@ void internal__exit(int exitcode) {
+ }
+ 
+ unsigned int internal_sleep(unsigned int seconds) {
++#if SANITIZER_NETBSD
++  static unsigned int (*real_sleep)(unsigned int a) = NULL;
++  if (!real_sleep) {
++    real_sleep = (unsigned int(*)(unsigned int a))GetRealLibcAddress("sleep");
++  }
++  CHECK(real_sleep);
++  return (*real_sleep)(seconds);
++#else
+   struct timespec ts;
+   ts.tv_sec = 1;
+   ts.tv_nsec = 0;
+   int res = internal_syscall_ptr(SYSCALL(nanosleep), &ts, &ts);
+   if (res) return ts.tv_sec;
+   return 0;
++#endif
+ }
+ 
+ uptr internal_execve(const char *filename, char *const argv[],
+                      char *const envp[]) {
++#if SANITIZER_NETBSD
++  static int (*real_execve)(const char *a, char *const b[], char *const c[])
++  = NULL;
++  if (!real_execve) {
++    real_execve = (int(*)(const char *a, char *const b[], char *const c[]))
++                  GetRealLibcAddress("execve");
++  }
++  CHECK(real_execve);
++  return (*real_execve)(filename, argv, envp);
++#else
+   return internal_syscall_ptr(SYSCALL(execve), (uptr)filename, (uptr)argv,
+                               (uptr)envp);
++#endif
+ }
+ #endif // !SANITIZER_SOLARIS
+ 
+@@ -511,12 +699,32 @@ u64 NanoTime() {
+   kernel_timeval tv;
+ #endif
+   internal_memset(&tv, 0, sizeof(tv));
++#if SANITIZER_NETBSD
++  static int (*real_gettimeofday)(void *a, void *b) = NULL;
++  if (!real_gettimeofday) {
++    real_gettimeofday = (int(*)(void *a, void *b))
++                        GetRealLibcAddress("__gettimeofday50");
++  }
++  CHECK(real_gettimeofday);
++  (*real_gettimeofday)(&tv, 0);
++#else
+   internal_syscall_ptr(SYSCALL(gettimeofday), &tv, 0);
++#endif
+   return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000;
+ }
+ 
+ uptr internal_clock_gettime(__sanitizer_clockid_t clk_id, void *tp) {
++#if SANITIZER_NETBSD
++  static int (*real_clock_gettime)(__sanitizer_clockid_t a, void *b) = NULL;
++  if (!real_clock_gettime) {
++    real_clock_gettime = (int(*)(__sanitizer_clockid_t a, void *b))
++                         GetRealLibcAddress("__clock_gettime50");
++  }
++  CHECK(real_clock_gettime);
++  return (*real_clock_gettime)(clk_id, tp);
++#else
+   return internal_syscall_ptr(SYSCALL(clock_gettime), clk_id, tp);
++#endif
+ }
+ #endif // !SANITIZER_SOLARIS
+ 
+@@ -524,7 +732,7 @@ uptr internal_clock_gettime(__sanitizer_
+ // 'environ' array (on some others) and does not use libc. This function
+ // should be called first inside __asan_init.
+ const char *GetEnv(const char *name) {
+-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD ||              \
++#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD ||            \
+     SANITIZER_SOLARIS
+   if (::environ != 0) {
+     uptr NameLen = internal_strlen(name);
+@@ -645,10 +853,10 @@ void ReExec() {
+     CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME,
+   };
+   char path[400];
+-  size_t len;
++  uptr len;
+ 
+   len = sizeof(path);
+-  if (sysctl(name, ARRAY_SIZE(name), path, &len, NULL, 0) != -1)
++  if (internal_sysctl(name, ARRAY_SIZE(name), path, &len, NULL, 0) != -1)
+     pathname = path;
+ #elif SANITIZER_SOLARIS
+   pathname = getexecname();
+@@ -763,20 +971,55 @@ uptr internal_ptrace(int request, int pi
+ }
+ 
+ uptr internal_waitpid(int pid, int *status, int options) {
++#if SANITIZER_NETBSD
++  static int (*real_waitpid)(int a, int *b, int c) = NULL;
++  if (!real_waitpid) {
++    real_waitpid = (int(*)(int a, int *b, int c))GetRealLibcAddress("waitpid");
++  }
++  CHECK(real_waitpid);
++  return (*real_waitpid)(pid, status, options);
++#else
+   return internal_syscall_ptr(SYSCALL(wait4), pid, (uptr)status, options,
+                           0 /* rusage */);
++#endif
+ }
+ 
+ uptr internal_getpid() {
++#if SANITIZER_NETBSD
++  static int (*real_getpid)() = NULL;
++  if (!real_getpid) {
++    real_getpid = (int(*)())GetRealLibcAddress("getpid");
++  }
++  CHECK(real_getpid);
++  return (*real_getpid)();
++#else
+   return internal_syscall(SYSCALL(getpid));
++#endif
+ }
+ 
+ uptr internal_getppid() {
++#if SANITIZER_NETBSD
++  static int (*real_getppid)() = NULL;
++  if (!real_getppid) {
++    real_getppid = (int(*)())GetRealLibcAddress("getppid");
++  }
++  CHECK(real_getppid);
++  return (*real_getppid)();
++#else
+   return internal_syscall(SYSCALL(getppid));
++#endif
+ }
+ 
+ uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) {
+-#if SANITIZER_FREEBSD
++#if SANITIZER_NETBSD
++  static int (*real_getdents)(int a, void *b, size_t c) = NULL;
++  if (!real_getdents) {
++    real_getdents = (int(*)(int a, void *b, size_t c))
++                    GetRealLibcAddress("__getdents30");
++  }
++  CHECK(real_getdents);
++  return (*real_getdents)(fd, dirp, count);
++#elif SANITIZER_FREEBSD
+   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);
+@@ -787,6 +1030,14 @@ uptr internal_getdents(fd_t fd, struct l
+ 
+ uptr internal_lseek(fd_t fd, OFF_T offset, int whence) {
+ #if SANITIZER_NETBSD
++  static OFF_T (*real___lseek)(int a, int b, OFF_T c, int d) = NULL;
++  if (!real___lseek) {
++    real___lseek = (OFF_T(*)(int a, int b, OFF_T c, int d))
++                   GetRealLibcAddress("__lseek");
++  }
++  CHECK(real___lseek);
++  return (*real___lseek)(fd, 0, offset, whence);
++#elif SANITIZER_NETBSDxxx
+   return internal_syscall64(SYSCALL(lseek), fd, 0, offset, whence);
+ #else
+   return internal_syscall(SYSCALL(lseek), fd, offset, whence);
+@@ -800,17 +1051,52 @@ uptr internal_prctl(int option, uptr arg
+ #endif
+ 
+ uptr internal_sigaltstack(const void *ss, void *oss) {
++#if SANITIZER_NETBSD
++  static int (*real_sigaltstack)(const void *a, void *b) = NULL;
++  if (!real_sigaltstack) {
++    real_sigaltstack = (int(*)(const void *a, void *b))
++                   GetRealLibcAddress("__sigaltstack14");
++  }
++  CHECK(real_sigaltstack);
++  return (*real_sigaltstack)(ss, oss);
++#else
+   return internal_syscall_ptr(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
++#endif
+ }
+ 
+ int internal_fork() {
+-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
++#if SANITIZER_NETBSD
++  static int (*real_fork)() = NULL;
++  if (!real_fork) {
++    real_fork = (int(*)())GetRealLibcAddress("fork");
++  }
++  CHECK(real_fork);
++  return (*real_fork)();
++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+   return internal_syscall(SYSCALL(clone), SIGCHLD, 0);
+ #else
+   return internal_syscall(SYSCALL(fork));
+ #endif
+ }
+ 
++#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
++int internal_sysctl(const int *name, unsigned int namelen, void *oldp,
++                    uptr *oldlenp, const void *newp, uptr newlen) {
++#if SANITIZER_NETBSD
++  static int (*real_sysctl)(const int *a, unsigned int b, void *c, uptr *d,
++                            const void *e, uptr f) = NULL;
++  if (!real_sysctl) {
++    real_sysctl = (int(*)(const int *a, unsigned int b, void *c, uptr *d,
++                          const void *e, uptr f))GetRealLibcAddress("sysctl");
++  }
++  CHECK(real_sysctl);
++  return (*real_sysctl)(name, namelen, oldp, oldlenp, newp, newlen);
++#else
++  return sysctl(name, namelen, oldp, oldlenp, newp, newlen);
++#endif
++}
++#endif
++
+ #if SANITIZER_LINUX
+ #define SA_RESTORER 0x04000000
+ // Doesn't set sa_restorer if the caller did not set it, so use with caution
+@@ -880,7 +1166,15 @@ int internal_sigaction_syscall(int signu
+ 
+ uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
+                           __sanitizer_sigset_t *oldset) {
+-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
++#if SANITIZER_NETBSD
++  static int (*real_sigprocmask)(int a, void *b, void *c) = NULL;
++  if (!real_sigprocmask) {
++    real_sigprocmask = (int(*)(int a, void *b, void *c))
++                   GetRealLibcAddress("__sigprocmask14");
++  }
++  CHECK(real_sigprocmask);
++  return (*real_sigprocmask)(how, set, oldset);
++#elif SANITIZER_FREEBSD || SANITIZER_NETBSDxx || SANITIZER_OPENBSD
+   return internal_syscall_ptr(SYSCALL(sigprocmask), how, set, oldset);
+ #else
+   __sanitizer_kernel_sigset_t *k_set = (__sanitizer_kernel_sigset_t *)set;
+@@ -1110,8 +1404,9 @@ uptr ReadBinaryName(/*out*/char *buf, up
+   const int Mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME};
+ #endif
+   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);
++  uptr Size = buf_len;
++  bool IsErr = (internal_sysctl(Mib, ARRAY_SIZE(Mib), buf, &Size, NULL, 0)
++                != 0);
+   int readlink_error = IsErr ? errno : 0;
+   uptr module_name_len = Size;
+ #else
+@@ -1976,13 +2271,13 @@ void CheckASLR() {
+ #if SANITIZER_NETBSD
+   int mib[3];
+   int paxflags;
+-  size_t len = sizeof(paxflags);
++  uptr len = sizeof(paxflags);
+ 
+   mib[0] = CTL_PROC;
+   mib[1] = internal_getpid();
+   mib[2] = PROC_PID_PAXFLAGS;
+ 
+-  if (UNLIKELY(sysctl(mib, 3, &paxflags, &len, NULL, 0) == -1)) {
++  if (UNLIKELY(internal_sysctl(mib, 3, &paxflags, &len, NULL, 0) == -1)) {
+     Printf("sysctl failed\n");
+     Die();
+   }
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
index ae02c83148..87f50ce159 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc
@@ -1,12 +1,25 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_linux_libcdep.cc.orig	2018-06-14 12:14:40.000000000 +0000
+--- lib/sanitizer_common/sanitizer_linux_libcdep.cc.orig	2018-08-21 21:25:38.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_linux_libcdep.cc
-@@ -47,6 +47,7 @@
- #endif
+@@ -25,6 +25,7 @@
+ #include "sanitizer_freebsd.h"
+ #include "sanitizer_linux.h"
+ #include "sanitizer_placement_new.h"
++#include "sanitizer_posix.h"
+ #include "sanitizer_procmaps.h"
  
- #if SANITIZER_NETBSD
-+#define sysctl _sysctl
- #include <sys/sysctl.h>
- #include <sys/tls.h>
- #endif
+ #include <dlfcn.h>  // for dlsym()
+@@ -652,10 +653,10 @@ u32 GetNumberOfCPUs() {
+ #if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
+   u32 ncpu;
+   int req[2];
+-  size_t len = sizeof(ncpu);
++  uptr len = sizeof(ncpu);
+   req[0] = CTL_HW;
+   req[1] = HW_NCPU;
+-  CHECK_EQ(sysctl(req, 2, &ncpu, &len, NULL, 0), 0);
++  CHECK_EQ(internal_sysctl(req, 2, &ncpu, &len, NULL, 0), 0);
+   return ncpu;
+ #elif SANITIZER_ANDROID && !defined(CPU_COUNT) && !defined(__aarch64__)
+   // Fall back to /sys/devices/system/cpu on Android when cpu_set_t doesn't
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc
new file mode 100644
index 0000000000..f558b44196
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_mac.cc.orig	2018-08-21 21:25:40.000000000 +0000
++++ lib/sanitizer_common/sanitizer_mac.cc
+@@ -213,6 +213,11 @@ int internal_fork() {
+   return fork();
+ }
+ 
++int internal_sysctl(const int *name, unsigned int namelen, void *oldp,
++                    uptr *oldlenp, const void *newp, uptr newlen) {
++  return sysctl(name, namelen, oldp, oldlenp, newp, newlen);
++}
++
+ int internal_forkpty(int *amaster) {
+   int master, slave;
+   if (openpty(&master, &slave, nullptr, nullptr, nullptr) == -1) return -1;
+@@ -499,9 +504,9 @@ MacosVersion GetMacosVersionInternal() {
+   uptr len = 0, maxlen = sizeof(version) / sizeof(version[0]);
+   for (uptr i = 0; i < maxlen; i++) version[i] = '\0';
+   // Get the version length.
+-  CHECK_NE(sysctl(mib, 2, 0, &len, 0, 0), -1);
++  CHECK_NE(internal_sysctl(mib, 2, 0, &len, 0, 0), -1);
+   CHECK_LT(len, maxlen);
+-  CHECK_NE(sysctl(mib, 2, version, &len, 0, 0), -1);
++  CHECK_NE(internal_sysctl(mib, 2, version, &len, 0, 0), -1);
+   switch (version[0]) {
+     case '9': return MACOS_VERSION_LEOPARD;
+     case '1': {
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__openbsd.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__openbsd.cc
new file mode 100644
index 0000000000..f0db9d2e18
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__openbsd.cc
@@ -0,0 +1,37 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_openbsd.cc.orig	2018-08-21 21:25:38.000000000 +0000
++++ lib/sanitizer_common/sanitizer_openbsd.cc
+@@ -56,7 +56,7 @@ uptr ReadBinaryName(/*out*/char *buf, up
+   struct kinfo_proc kp;
+   size_t kl;
+   const int Mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()};
+-  if (sysctl(Mib, ARRAY_SIZE(Mib), &kp, &kl, NULL, 0) != -1)
++  if (internal_sysctl(Mib, ARRAY_SIZE(Mib), &kp, &kl, NULL, 0) != -1)
+     return internal_snprintf(buf,
+                              (KI_MAXCOMLEN < buf_len ? KI_MAXCOMLEN : buf_len),
+                              "%s", kp.p_comm);
+@@ -68,19 +68,19 @@ static void GetArgsAndEnv(char ***argv, 
+   size_t nenv;
+   int argvmib[4] = {CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV};
+   int envmib[4] = {CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ENV};
+-  if (sysctl(argvmib, 4, NULL, &nargv, NULL, 0) == -1) {
++  if (internal_sysctl(argvmib, 4, NULL, &nargv, NULL, 0) == -1) {
+     Printf("sysctl KERN_PROC_NARGV failed\n");
+     Die();
+   }
+-  if (sysctl(envmib, 4, NULL, &nenv, NULL, 0) == -1) {
++  if (internal_sysctl(envmib, 4, NULL, &nenv, NULL, 0) == -1) {
+     Printf("sysctl KERN_PROC_NENV failed\n");
+     Die();
+   }
+-  if (sysctl(argvmib, 4, &argv, &nargv, NULL, 0) == -1) {
++  if (internal_sysctl(argvmib, 4, &argv, &nargv, NULL, 0) == -1) {
+     Printf("sysctl KERN_PROC_ARGV failed\n");
+     Die();
+   }
+-  if (sysctl(envmib, 4, &envp, &nenv, NULL, 0) == -1) {
++  if (internal_sysctl(envmib, 4, &envp, &nenv, NULL, 0) == -1) {
+     Printf("sysctl KERN_PROC_ENV failed\n");
+     Die();
+   }
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
index 70bf9e3387..baca0bc1ed 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig	2018-06-14 12:14:40.000000000 +0000
+--- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig	2018-08-21 21:25:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_interceptors.h
-@@ -510,4 +510,29 @@
+@@ -511,4 +511,29 @@
  #define SANITIZER_INTERCEPT_PROTOENT SI_NETBSD
  #define SANITIZER_INTERCEPT_NETENT SI_NETBSD
  
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
index 0b41f04fc0..792c5f91da 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig	2018-06-01 09:39:33.000000000 +0000
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig	2018-08-21 21:25:39.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
 @@ -945,6 +945,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
  
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
index 015d080cf2..f1d3e332ff 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig	2018-04-25 21:13:40.000000000 +0000
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig	2018-08-21 21:25:39.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_limits_posix.h
 @@ -1504,6 +1504,7 @@ struct __sanitizer_cookie_io_functions_t
  
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__posix.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__posix.h
new file mode 100644
index 0000000000..2fc4343b25
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__posix.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_posix.h.orig	2018-08-21 21:25:39.000000000 +0000
++++ lib/sanitizer_common/sanitizer_posix.h
+@@ -60,6 +60,9 @@ uptr internal_waitpid(int pid, int *stat
+ int internal_fork();
+ int internal_forkpty(int *amaster);
+ 
++int internal_sysctl(const int *name, unsigned int namelen, void *oldp,
++                    uptr *oldlenp, const void *newp, uptr newlen);
++
+ // These functions call appropriate pthread_ functions directly, bypassing
+ // the interceptor. They are weak and may not be present in some tools.
+ SANITIZER_WEAK_ATTRIBUTE
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc
index 3caee22a2f..794f03641a 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc
@@ -1,15 +1,33 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_procmaps_bsd.cc.orig	2018-04-25 21:13:40.000000000 +0000
+--- lib/sanitizer_common/sanitizer_procmaps_bsd.cc.orig	2018-08-21 21:25:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_procmaps_bsd.cc
-@@ -19,6 +19,10 @@
+@@ -67,8 +67,8 @@ void ReadProcMaps(ProcSelfMapsBuff *proc
  #endif
- #include "sanitizer_procmaps.h"
+   };
  
-+#if SANITIZER_NETBSD
-+#define sysctl _sysctl // Use an internal symbol to bypass the interceptor
-+#endif
-+
- // clang-format off
- #include <sys/types.h>
- #include <sys/sysctl.h>
+-  size_t Size = 0;
+-  int Err = sysctl(Mib, ARRAY_SIZE(Mib), NULL, &Size, NULL, 0);
++  uptr Size = 0;
++  int Err = internal_sysctl(Mib, ARRAY_SIZE(Mib), NULL, &Size, NULL, 0);
+   CHECK_EQ(Err, 0);
+   CHECK_GT(Size, 0);
+ 
+@@ -76,7 +76,7 @@ void ReadProcMaps(ProcSelfMapsBuff *proc
+   size_t MmapedSize = Size * 4 / 3;
+   void *VmMap = MmapOrDie(MmapedSize, "ReadProcMaps()");
+   Size = MmapedSize;
+-  Err = sysctl(Mib, ARRAY_SIZE(Mib), VmMap, &Size, NULL, 0);
++  Err = internal_sysctl(Mib, ARRAY_SIZE(Mib), VmMap, &Size, NULL, 0);
+   CHECK_EQ(Err, 0);
+   proc_maps->data = (char *)VmMap;
+ #else
+@@ -88,7 +88,7 @@ void ReadProcMaps(ProcSelfMapsBuff *proc
+   if (Size > 0x10000)
+     Size = 0x10000;
+   Size = (Size / sizeof(struct kinfo_vmentry)) * sizeof(struct kinfo_vmentry);
+-  Err = sysctl(Mib, ARRAY_SIZE(Mib), Mem, &Size, NULL, 0);
++  Err = internal_sysctl(Mib, ARRAY_SIZE(Mib), Mem, &Size, NULL, 0);
+   CHECK_EQ(Err, 0);
+   MmapedSize = Size;
+   proc_maps->data = Mem;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc
index 33e9872f59..8d9d103baa 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc.orig	2018-05-10 23:16:36.000000000 +0000
+--- lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc.orig	2018-08-21 21:25:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc
 @@ -97,7 +97,7 @@ uptr Unwind_GetIP(struct _Unwind_Context
    // Clear the Thumb bit.
diff --git a/compiler-rt-netbsd/patches/patch-lib_scudo_scudo__platform.h b/compiler-rt-netbsd/patches/patch-lib_scudo_scudo__platform.h
index b10883f4be..4cabee2f3d 100644
--- a/compiler-rt-netbsd/patches/patch-lib_scudo_scudo__platform.h
+++ b/compiler-rt-netbsd/patches/patch-lib_scudo_scudo__platform.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/scudo/scudo_platform.h.orig	2018-02-01 23:46:04.000000000 +0000
+--- lib/scudo/scudo_platform.h.orig	2018-08-21 21:25:38.000000000 +0000
 +++ lib/scudo/scudo_platform.h
 @@ -17,7 +17,7 @@
  
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_CMakeLists.txt b/compiler-rt-netbsd/patches/patch-lib_tsan_CMakeLists.txt
index ccd0e16cb7..201d11f061 100644
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_CMakeLists.txt
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_CMakeLists.txt
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- lib/tsan/CMakeLists.txt.orig	2018-04-25 21:13:39.000000000 +0000
+--- lib/tsan/CMakeLists.txt.orig	2018-08-21 21:25:37.000000000 +0000
 +++ lib/tsan/CMakeLists.txt
-@@ -206,7 +206,7 @@ endif()
+@@ -215,7 +215,7 @@ endif()
  # in the base system due to incompatibilities between FreeBSD's and Clang's
  # versions. As a workaround do not use --sysroot=. on FreeBSD until this is
  # addressed.
diff --git a/compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h b/compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h
new file mode 100644
index 0000000000..6b2abf40af
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_xray_xray__flags.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- lib/xray/xray_flags.h.orig	2018-08-21 21:25:41.000000000 +0000
++++ lib/xray/xray_flags.h
+@@ -31,7 +31,8 @@ struct Flags {
+ extern Flags xray_flags_dont_use_directly;
+ extern void registerXRayFlags(FlagParser *P, Flags *F);
+ const char *useCompilerDefinedFlags();
+-inline Flags *flags() { return &xray_flags_dont_use_directly; }
++inline Flags *flags() {
++ return &xray_flags_dont_use_directly; }
+ 
+ void initializeFlags();
+ 
diff --git a/compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc b/compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc
new file mode 100644
index 0000000000..8264464611
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_xray_xray__profiling.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- lib/xray/xray_profiling.cc.orig	2018-08-21 21:25:41.000000000 +0000
++++ lib/xray/xray_profiling.cc
+@@ -345,8 +345,12 @@ bool profilingDynamicInitializer() XRAY_
+     return false;
+   }
+ 
+-  if (!internal_strcmp(flags()->xray_mode, "xray-profiling"))
+-    __xray_log_select_mode("xray_profiling");
++  Printf("flags()=%p\n", flags());
++  Printf("flags()->xray_mode=%s\n", flags()->xray_mode);
++  Printf("flags()->xray_logfile_base=%s\n", flags()->xray_logfile_base);
++
++//  if (!internal_strcmp(flags()->xray_mode, "xray-profiling"))
++//    __xray_log_select_mode("xray_profiling");
+   return true;
+ }
+ 
diff --git a/compiler-rt-netbsd/patches/patch-test_asan_TestCases_Posix_stack-use-after-return.cc b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_Posix_stack-use-after-return.cc
index beb79ca070..be1e1500a8 100644
--- a/compiler-rt-netbsd/patches/patch-test_asan_TestCases_Posix_stack-use-after-return.cc
+++ b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_Posix_stack-use-after-return.cc
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- test/asan/TestCases/Posix/stack-use-after-return.cc.orig	2018-06-01 09:39:33.000000000 +0000
+--- test/asan/TestCases/Posix/stack-use-after-return.cc.orig	2018-08-21 21:25:30.000000000 +0000
 +++ test/asan/TestCases/Posix/stack-use-after-return.cc
-@@ -76,9 +76,11 @@ int main(int argc, char **argv) {
+@@ -78,9 +78,11 @@ int main(int argc, char **argv) {
    pthread_attr_init(&attr);
    if (kStackSize > 0) {
      size_t desired_stack_size = kStackSize;
diff --git a/compiler-rt-netbsd/patches/patch-test_asan_TestCases_heavy__uar__test.cc b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_heavy__uar__test.cc
index 64cb4a4c52..0f3b28f52f 100644
--- a/compiler-rt-netbsd/patches/patch-test_asan_TestCases_heavy__uar__test.cc
+++ b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_heavy__uar__test.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/asan/TestCases/heavy_uar_test.cc.orig	2018-06-01 09:39:33.000000000 +0000
+--- test/asan/TestCases/heavy_uar_test.cc.orig	2018-08-21 21:25:29.000000000 +0000
 +++ test/asan/TestCases/heavy_uar_test.cc
 @@ -53,8 +53,8 @@ int main(int argc, char **argv) {
      RecursiveFunctionWithStackFrame<1024>(depth);
diff --git a/compiler-rt-netbsd/patches/patch-test_asan_TestCases_interception__failure__test.cc b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_interception__failure__test.cc
index 584a24eac4..36abb20d49 100644
--- a/compiler-rt-netbsd/patches/patch-test_asan_TestCases_interception__failure__test.cc
+++ b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_interception__failure__test.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/asan/TestCases/interception_failure_test.cc.orig	2018-02-01 23:45:56.000000000 +0000
+--- test/asan/TestCases/interception_failure_test.cc.orig	2018-08-21 21:25:31.000000000 +0000
 +++ test/asan/TestCases/interception_failure_test.cc
 @@ -5,7 +5,7 @@
  // RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
diff --git a/compiler-rt-netbsd/patches/patch-test_fuzzer_NullDerefTest.cpp b/compiler-rt-netbsd/patches/patch-test_fuzzer_NullDerefTest.cpp
index 5e634639aa..36e473b5a7 100644
--- a/compiler-rt-netbsd/patches/patch-test_fuzzer_NullDerefTest.cpp
+++ b/compiler-rt-netbsd/patches/patch-test_fuzzer_NullDerefTest.cpp
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/fuzzer/NullDerefTest.cpp.orig	2018-06-07 08:27:17.000000000 +0000
+--- test/fuzzer/NullDerefTest.cpp.orig	2018-08-21 21:25:32.000000000 +0000
 +++ test/fuzzer/NullDerefTest.cpp
 @@ -23,4 +23,3 @@ extern "C" int LLVMFuzzerTestOneInput(co
    }
diff --git a/compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg b/compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg
index 3769dc114c..a1d5e22632 100644
--- a/compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg
+++ b/compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/fuzzer/lit.cfg.orig	2018-06-14 12:14:40.000000000 +0000
+--- test/fuzzer/lit.cfg.orig	2018-08-21 21:25:32.000000000 +0000
 +++ test/fuzzer/lit.cfg
 @@ -25,7 +25,7 @@ else:
  config.test_format = lit.formats.ShTest(execute_external)
diff --git a/compiler-rt-netbsd/patches/patch-test_lsan_lit.common.cfg b/compiler-rt-netbsd/patches/patch-test_lsan_lit.common.cfg
index 3c065eeec9..618eea8826 100644
--- a/compiler-rt-netbsd/patches/patch-test_lsan_lit.common.cfg
+++ b/compiler-rt-netbsd/patches/patch-test_lsan_lit.common.cfg
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/lsan/lit.common.cfg.orig	2018-02-01 23:45:50.000000000 +0000
+--- test/lsan/lit.common.cfg.orig	2018-08-21 21:25:23.000000000 +0000
 +++ test/lsan/lit.common.cfg
 @@ -67,10 +67,10 @@ config.substitutions.append( ("%clangxx 
  config.substitutions.append( ("%clang_lsan ", build_invocation(clang_lsan_cflags)) )
diff --git a/compiler-rt-netbsd/patches/patch-test_scudo_lit.cfg b/compiler-rt-netbsd/patches/patch-test_scudo_lit.cfg
index 9c67ac91e7..1a3edd78b6 100644
--- a/compiler-rt-netbsd/patches/patch-test_scudo_lit.cfg
+++ b/compiler-rt-netbsd/patches/patch-test_scudo_lit.cfg
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- test/scudo/lit.cfg.orig	2018-02-01 23:45:54.000000000 +0000
+--- test/scudo/lit.cfg.orig	2018-08-21 21:25:27.000000000 +0000
 +++ test/scudo/lit.cfg
-@@ -21,9 +21,11 @@ c_flags = ([config.target_cflags] +
+@@ -22,9 +22,11 @@ c_flags = ([config.target_cflags] +
             "-pie",
             "-O0",
             "-UNDEBUG",
@@ -15,7 +15,7 @@ $NetBSD$
  # Android doesn't want -lrt.
  if not config.android:
    c_flags += ["-lrt"]
-@@ -54,5 +56,5 @@ config.substitutions.append(('%env_scudo
+@@ -56,5 +58,5 @@ config.substitutions.append(('%env_scudo
                               'env SCUDO_OPTIONS=' + default_scudo_opts))
  
  # Hardened Allocator tests are currently supported on Linux only.


Home | Main Index | Thread Index | Old Index