pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Sync patches with my local copy



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sat May 5 04:33:09 2018 +0200
Changeset:	7dc9a9e7a7786962cedbde91c74500592c3e9d04

Modified Files:
	compiler-rt-netbsd/distinfo
	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_FuzzerShmemPosix.cpp
	compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
	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__platform__interceptors.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__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-test_fuzzer_equivalence-signals.test
	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_msan_tests_msan__test.cc
	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_asan_lit.cfg
	compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg
	compiler-rt-netbsd/patches/patch-test_lit.common.cfg

Log Message:
compiler-rt-netbsd: Sync patches with my local copy

Corrections in tests in sanitizers and libfuzzer.

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

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

diffstat:
 compiler-rt-netbsd/distinfo                        |  43 +-
 .../patches/patch-cmake_config-ix.cmake            |   2 +-
 .../patches/patch-lib_asan_asan__posix.cc          |   2 +-
 .../patches/patch-lib_fuzzer_FuzzerShmemPosix.cpp  |  10 +-
 .../patches/patch-lib_fuzzer_tests_CMakeLists.txt  |   2 +-
 .../patches/patch-lib_msan_msan__interceptors.cc   |   2 +-
 .../patches/patch-lib_msan_msan__linux.cc          |   2 +-
 .../patches/patch-lib_msan_tests_msan__test.cc     | 468 +++++++++++++++++++++
 ...zer__common_sanitizer__common__interceptors.inc |   2 +-
 ...b_sanitizer__common_sanitizer__internal__defs.h |   2 +-
 ...patch-lib_sanitizer__common_sanitizer__linux.cc |   2 +-
 ...zer__common_sanitizer__platform__interceptors.h |   2 +-
 ...__common_sanitizer__platform__limits__netbsd.cc |   2 +-
 ...r__common_sanitizer__platform__limits__netbsd.h |   2 +-
 ...b_sanitizer__common_sanitizer__procmaps__bsd.cc |   2 +-
 ...er__common_sanitizer__unwind__linux__libcdep.cc |   2 +-
 .../patches/patch-lib_scudo_scudo__platform.h      |   2 +-
 ..._asan_TestCases_Posix_stack-use-after-return.cc |  16 +
 .../patch-test_asan_TestCases_heavy__uar__test.cc  |  15 +
 ...t_asan_TestCases_interception__failure__test.cc |  13 +
 compiler-rt-netbsd/patches/patch-test_asan_lit.cfg |  13 +
 .../patch-test_fuzzer_equivalence-signals.test     |   2 +-
 .../patches/patch-test_fuzzer_lit.cfg              |  13 +
 .../patches/patch-test_lit.common.cfg              |  13 +
 .../patches/patch-test_lsan_lit.common.cfg         |   2 +-
 .../patches/patch-test_scudo_lit.cfg               |   2 +-
 26 files changed, 597 insertions(+), 41 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 149a4813aa..ddad7650c0 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -1,20 +1,27 @@
 $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 
-SHA1 (patch-cmake_config-ix.cmake) = c67b7b096926a6c515ccd2b074527b75cf8c7b48
-SHA1 (patch-lib_asan_asan__posix.cc) = 7722d9789e463b06aa3b271584507c24fb76b59d
-SHA1 (patch-lib_fuzzer_FuzzerShmemPosix.cpp) = e8e5ebeb03e2fcf1773f5979e4966386d80c742a
-SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 2e8b9ce5dd468fef6c774c40da8cc29d7dadf744
-SHA1 (patch-lib_msan_msan__interceptors.cc) = 4c925295c34b7945d7d64bba421e8d2f62022248
-SHA1 (patch-lib_msan_msan__linux.cc) = d343f2286f248921859ae0b06c42919c8fbd69b8
-SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = 6cf85b551f35106b38b90191d9329ce57a95234f
-SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = ecfd60810adbac4e5700e5b61fe23987685465b3
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = ac6194df3380f084e42802aa3349aadeed1cb8f8
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 84b805965de62b9e8ef3a9457ec8fdf12359e031
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = dcfa389e4be13a67354eac93e1e9b7127c861d09
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = 1a7eb6c97cb69fc7ccfffe77703938138e941ab0
-SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc) = bbab1a3f78ab04b72b612a7bc028ed1fde3aaf92
-SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = 0e911b8328ff3e5f041675d62425c2dff5e60511
-SHA1 (patch-lib_scudo_scudo__platform.h) = c978a609763a1acc197058c9f127f049fa336aae
-SHA1 (patch-test_fuzzer_equivalence-signals.test) = 51540aac4a065e05c8c1e834717c53a83c0f2cd9
-SHA1 (patch-test_lsan_lit.common.cfg) = 7a768835f358adc0cbd81e22b024e3e6f3d53ce5
-SHA1 (patch-test_scudo_lit.cfg) = 99e5a8140bc42cc6ef44b3a31d9932115b4a0070
+SHA1 (patch-cmake_config-ix.cmake) = 91ffb8c1e65394c7c6e9956379373b28348e3f1f
+SHA1 (patch-lib_asan_asan__posix.cc) = 0f596061c078eaab0b5b4b183550aa7820677f46
+SHA1 (patch-lib_fuzzer_FuzzerShmemPosix.cpp) = e2540a9385d641c77a2b5da49a2ac66313db8a94
+SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 0e559ebb791942cba9c83f3098d7752f91e1f187
+SHA1 (patch-lib_msan_msan__interceptors.cc) = 79bfe137923597d79bb467d0f282d57221079a85
+SHA1 (patch-lib_msan_msan__linux.cc) = 6fd2ada4a84d1e1cc47ec8f4e1f0608861c73c1a
+SHA1 (patch-lib_msan_tests_msan__test.cc) = 8f0a40c51a200f5de107cac5bd47db87aeff7c57
+SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = a89e76e65e7aa735e4f796505917b4993ccc2662
+SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = 91f645a6652d895e97b0aefbb62d80e680cd2c39
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = e4c889d8c140b06cb62429b37d56eca88feaaf03
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 16926ba39d41178a49cfabd268ecece4d964170f
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = 0a5d94fff8dfe8cf62bcf2e269e33d52f8ac5137
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = a5036c0da703ad178daded1994008756dcc99cf1
+SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc) = 8b629840ff7f56c670d322a9dbbdf7e33ce90cb5
+SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = e520ec1e0fefb3cf9fb1d872ebf81952599a6c49
+SHA1 (patch-lib_scudo_scudo__platform.h) = 119d7ad8f8ca9d3e846dbdd7f805ca771e30e410
+SHA1 (patch-test_asan_TestCases_Posix_stack-use-after-return.cc) = dea34873ff32e999da657766016a2434430be2ad
+SHA1 (patch-test_asan_TestCases_heavy__uar__test.cc) = d271e63af0b399d3e64add96a1b1b1b5e1039d7e
+SHA1 (patch-test_asan_TestCases_interception__failure__test.cc) = b4711fcc3315eaacc2a4ec1021e04b8200749e51
+SHA1 (patch-test_asan_lit.cfg) = 16bf28a2625ba69b6d6a1ba96ed7bbf3e17b56a4
+SHA1 (patch-test_fuzzer_equivalence-signals.test) = 8d4f424d84bb1bd36ebb56dd1092c98208465a2e
+SHA1 (patch-test_fuzzer_lit.cfg) = b36c905a14ff1594dac503bc04e08f61d7e843b0
+SHA1 (patch-test_lit.common.cfg) = df0aa8345c30b5d7c53f14ca286e25e0f481d425
+SHA1 (patch-test_lsan_lit.common.cfg) = b09b4ab3a97dc881b701a3583b0b126b8206cfe2
+SHA1 (patch-test_scudo_lit.cfg) = 35e4f0524a8fd26e90e5d968b73d75f277da3779
diff --git a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
index bd89dc9c17..1337a02512 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-05-04 08:00:10.159967293 +0000
+--- cmake/config-ix.cmake.orig	2018-04-25 21:13:41.000000000 +0000
 +++ cmake/config-ix.cmake
 @@ -551,7 +551,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 df456d4496..91acb1083e 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-05-04 08:00:20.277669793 +0000
+--- lib/asan/asan_posix.cc.orig	2018-02-01 23:46:05.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_FuzzerShmemPosix.cpp b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerShmemPosix.cpp
index df57528c1a..851e2113c6 100644
--- a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerShmemPosix.cpp
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerShmemPosix.cpp
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/fuzzer/FuzzerShmemPosix.cpp.orig	2018-05-04 08:00:20.583688133 +0000
+--- lib/fuzzer/FuzzerShmemPosix.cpp.orig	2018-02-01 23:46:06.000000000 +0000
 +++ lib/fuzzer/FuzzerShmemPosix.cpp
 @@ -32,6 +32,8 @@ std::string SharedMemoryRegion::Path(con
  
@@ -11,18 +11,16 @@ $NetBSD$
    return Res + (char)('0' + Idx);
  }
  
-@@ -52,8 +54,9 @@ bool SharedMemoryRegion::Create(const ch
+@@ -52,7 +54,7 @@ bool SharedMemoryRegion::Create(const ch
    for (int i = 0; i < 2; i++) {
      sem_unlink(SemName(Name, i).c_str());
      Semaphore[i] = sem_open(SemName(Name, i).c_str(), O_CREAT, 0644, 0);
 -    if (Semaphore[i] == (void *)-1)
-+    if (Semaphore[i] == SEM_FAILED) {
++    if (Semaphore[i] == SEM_FAILED)
        return false;
-+    }
    }
    IAmServer = true;
-   return true;
-@@ -70,7 +73,7 @@ bool SharedMemoryRegion::Open(const char
+@@ -70,7 +72,7 @@ bool SharedMemoryRegion::Open(const char
      return false;
    for (int i = 0; i < 2; i++) {
      Semaphore[i] = sem_open(SemName(Name, i).c_str(), 0);
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 d7ea6a9cab..f38a025815 100644
--- a/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/fuzzer/tests/CMakeLists.txt.orig	2018-05-04 08:00:20.295801193 +0000
+--- lib/fuzzer/tests/CMakeLists.txt.orig	2018-04-25 21:13:39.000000000 +0000
 +++ lib/fuzzer/tests/CMakeLists.txt
 @@ -10,6 +10,9 @@ add_custom_target(FuzzerUnitTests)
  set_target_properties(FuzzerUnitTests PROPERTIES FOLDER "Compiler-RT Tests")
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
index bd344f9a59..763519d939 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-05-04 08:00:27.417464903 +0000
+--- lib/msan/msan_interceptors.cc.orig	2018-04-25 21:13:39.000000000 +0000
 +++ lib/msan/msan_interceptors.cc
 @@ -33,11 +33,13 @@
  #include "sanitizer_common/sanitizer_libc.h"
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 82d516a7f7..9d80fab403 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-05-04 08:00:26.914805073 +0000
+--- lib/msan/msan_linux.cc.orig	2018-02-01 23:45:59.000000000 +0000
 +++ lib/msan/msan_linux.cc
 @@ -30,6 +30,7 @@
  #include <sys/time.h>
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_tests_msan__test.cc b/compiler-rt-netbsd/patches/patch-lib_msan_tests_msan__test.cc
new file mode 100644
index 0000000000..697be584eb
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_tests_msan__test.cc
@@ -0,0 +1,468 @@
+$NetBSD$
+
+--- lib/msan/tests/msan_test.cc.orig	2018-02-01 23:46:00.000000000 +0000
++++ lib/msan/tests/msan_test.cc
+@@ -65,16 +65,17 @@ int shmdt(const void *);
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
+ 
+-#if !defined(__FreeBSD__)
+-# include <malloc.h>
+-# include <sys/sysinfo.h>
+-# include <sys/vfs.h>
+-# include <mntent.h>
+-# include <netinet/ether.h>
+-# if defined(__linux__)
+-#  include <sys/uio.h>
+-# endif
+-#else
++#if defined(__NetBSD__)
++# include <signal.h>
++# include <netinet/in.h>
++# include <sys/uio.h>
++# include <sys/mount.h>
++# include <sys/sysctl.h>
++# include <net/if.h>
++# include <net/if_ether.h>
++# include <sched.h>
++# define cpu_set_t cpuset_t
++#elif defined(__FreeBSD__)
+ # include <signal.h>
+ # include <netinet/in.h>
+ # include <pthread_np.h>
+@@ -90,6 +91,15 @@ extern "C" {
+ // ordinary function, we can declare it here to complete the tests.
+ void *mempcpy(void *dest, const void *src, size_t n);
+ }
++#else
++# include <malloc.h>
++# include <sys/sysinfo.h>
++# include <sys/vfs.h>
++# include <mntent.h>
++# include <netinet/ether.h>
++# if defined(__linux__)
++#  include <sys/uio.h>
++# endif
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__)
+@@ -103,8 +113,8 @@ void *mempcpy(void *dest, const void *sr
+ # include <immintrin.h>
+ #endif
+ 
+-// On FreeBSD procfs is not enabled by default.
+-#if defined(__FreeBSD__)
++// On FreeBSD and NetBSD procfs is not enabled by default.
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ # define FILE_TO_READ "/bin/cat"
+ # define DIR_TO_READ "/bin"
+ # define SUBFILE_TO_READ "cat"
+@@ -745,6 +755,7 @@ TEST(MemorySanitizer, fstatat) {
+   close(dirfd);
+ }
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, statfs) {
+   struct statfs st;
+   int res = statfs("/", &st);
+@@ -753,6 +764,7 @@ TEST(MemorySanitizer, statfs) {
+   EXPECT_NOT_POISONED(st.f_bfree);
+   EXPECT_NOT_POISONED(st.f_namelen);
+ }
++#endif
+ 
+ TEST(MemorySanitizer, statvfs) {
+   struct statvfs st;
+@@ -829,8 +841,8 @@ TEST(MemorySanitizer, poll) {
+   close(pipefd[1]);
+ }
+ 
+-// There is no ppoll() on FreeBSD.
+-#if !defined (__FreeBSD__)
++// There is no ppoll() on FreeBSD and NetBSD.
++#if !defined (__FreeBSD__) && !defined (__NetBSD__)
+ TEST(MemorySanitizer, ppoll) {
+   int* pipefd = new int[2];
+   int res = pipe(pipefd);
+@@ -1168,6 +1180,7 @@ TEST(MemorySanitizer, gethostbyaddr) {
+   EXPECT_HOSTENT_NOT_POISONED(he);
+ }
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, gethostent_r) {
+   char buf[2000];
+   struct hostent he;
+@@ -1180,7 +1193,9 @@ TEST(MemorySanitizer, gethostent_r) {
+   EXPECT_HOSTENT_NOT_POISONED(result);
+   EXPECT_NOT_POISONED(err);
+ }
++#endif
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, gethostbyname_r) {
+   char buf[2000];
+   struct hostent he;
+@@ -1193,7 +1208,9 @@ TEST(MemorySanitizer, gethostbyname_r) {
+   EXPECT_HOSTENT_NOT_POISONED(result);
+   EXPECT_NOT_POISONED(err);
+ }
++#endif
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, gethostbyname_r_bad_host_name) {
+   char buf[2000];
+   struct hostent he;
+@@ -1203,7 +1220,9 @@ TEST(MemorySanitizer, gethostbyname_r_ba
+   ASSERT_EQ((struct hostent *)0, result);
+   EXPECT_NOT_POISONED(err);
+ }
++#endif
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, gethostbyname_r_erange) {
+   char buf[5];
+   struct hostent he;
+@@ -1213,7 +1232,9 @@ TEST(MemorySanitizer, gethostbyname_r_er
+   ASSERT_EQ(ERANGE, errno);
+   EXPECT_NOT_POISONED(err);
+ }
++#endif
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, gethostbyname2_r) {
+   char buf[2000];
+   struct hostent he;
+@@ -1227,7 +1248,9 @@ TEST(MemorySanitizer, gethostbyname2_r) 
+   EXPECT_HOSTENT_NOT_POISONED(result);
+   EXPECT_NOT_POISONED(err);
+ }
++#endif
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, gethostbyaddr_r) {
+   char buf[2000];
+   struct hostent he;
+@@ -1243,6 +1266,7 @@ TEST(MemorySanitizer, gethostbyaddr_r) {
+   EXPECT_HOSTENT_NOT_POISONED(result);
+   EXPECT_NOT_POISONED(err);
+ }
++#endif
+ 
+ TEST(MemorySanitizer, getsockopt) {
+   int sock = socket(AF_UNIX, SOCK_STREAM, 0);
+@@ -1269,8 +1293,8 @@ TEST(MemorySanitizer, getcwd_gnu) {
+   free(res);
+ }
+ 
+-// There's no get_current_dir_name() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no get_current_dir_name() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, get_current_dir_name) {
+   char* res = get_current_dir_name();
+   ASSERT_TRUE(res != NULL);
+@@ -1289,7 +1313,7 @@ TEST(MemorySanitizer, shmctl) {
+   EXPECT_NOT_POISONED(ds);
+ 
+   // FreeBSD does not support shmctl(IPC_INFO) and shmctl(SHM_INFO).
+-#if !defined(__FreeBSD__)
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+   struct shminfo si;
+   res = shmctl(id, IPC_INFO, (struct shmid_ds *)&si);
+   ASSERT_GT(res, -1);
+@@ -1337,8 +1361,8 @@ TEST(MemorySanitizer, shmat) {
+   ASSERT_GT(res, -1);
+ }
+ 
+-// There's no random_r() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no random_r() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, random_r) {
+   int32_t x;
+   char z[64];
+@@ -1419,7 +1443,7 @@ TEST(MemorySanitizer, realpath_null) {
+ }
+ 
+ // There's no canonicalize_file_name() on FreeBSD.
+-#if !defined(__FreeBSD__)
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, canonicalize_file_name) {
+   const char* relpath = ".";
+   char* res = canonicalize_file_name(relpath);
+@@ -1877,8 +1901,8 @@ TEST(MemorySanitizer, modfl) {
+   EXPECT_NOT_POISONED(y);
+ }
+ 
+-// There's no sincos() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no sincos() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, sincos) {
+   double s, c;
+   sincos(0.2, &s, &c);
+@@ -1887,8 +1911,8 @@ TEST(MemorySanitizer, sincos) {
+ }
+ #endif
+ 
+-// There's no sincosf() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no sincosf() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, sincosf) {
+   float s, c;
+   sincosf(0.2, &s, &c);
+@@ -1897,8 +1921,8 @@ TEST(MemorySanitizer, sincosf) {
+ }
+ #endif
+ 
+-// There's no sincosl() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no sincosl() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, sincosl) {
+   long double s, c;
+   sincosl(0.2, &s, &c);
+@@ -1960,8 +1984,8 @@ TEST(MemorySanitizer, lgammaf_r) {
+   EXPECT_NOT_POISONED(sgn);
+ }
+ 
+-// There's no lgammal_r() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no lgammal_r() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, lgammal_r) {
+   int sgn;
+   long double res = lgammal_r(1.1, &sgn);
+@@ -1970,8 +1994,8 @@ TEST(MemorySanitizer, lgammal_r) {
+ }
+ #endif
+ 
+-// There's no drand48_r() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no drand48_r() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, drand48_r) {
+   struct drand48_data buf;
+   srand48_r(0, &buf);
+@@ -1981,8 +2005,8 @@ TEST(MemorySanitizer, drand48_r) {
+ }
+ #endif
+ 
+-// There's no lrand48_r() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no lrand48_r() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, lrand48_r) {
+   struct drand48_data buf;
+   srand48_r(0, &buf);
+@@ -2267,7 +2291,7 @@ TEST(MemorySanitizer, localtime_r) {
+   EXPECT_NE(0U, strlen(time.tm_zone));
+ }
+ 
+-#if !defined(__FreeBSD__)
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ /* Creates a temporary file with contents similar to /etc/fstab to be used
+    with getmntent{_r}.  */
+ class TempFstabFile {
+@@ -2305,8 +2329,8 @@ class TempFstabFile {
+ };
+ #endif
+ 
+-// There's no getmntent() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no getmntent() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, getmntent) {
+   TempFstabFile fstabtmp;
+   ASSERT_TRUE(fstabtmp.Create());
+@@ -2324,8 +2348,8 @@ TEST(MemorySanitizer, getmntent) {
+ }
+ #endif
+ 
+-// There's no getmntent_r() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no getmntent_r() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, getmntent_r) {
+   TempFstabFile fstabtmp;
+   ASSERT_TRUE(fstabtmp.Create());
+@@ -2345,6 +2369,7 @@ TEST(MemorySanitizer, getmntent_r) {
+ }
+ #endif
+ 
++#if !defined(__NetBSD__)
+ TEST(MemorySanitizer, ether) {
+   const char *asc = "11:22:33:44:55:66";
+   struct ether_addr *paddr = ether_aton(asc);
+@@ -2363,6 +2388,7 @@ TEST(MemorySanitizer, ether) {
+   ASSERT_EQ(s, buf);
+   ASSERT_NE(0U, strlen(buf));
+ }
++#endif
+ 
+ TEST(MemorySanitizer, mmap) {
+   const int size = 4096;
+@@ -2383,8 +2409,8 @@ TEST(MemorySanitizer, mmap) {
+   }
+ }
+ 
+-// There's no fcvt() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no fcvt() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ // FIXME: enable and add ecvt.
+ // FIXME: check why msandr does nt handle fcvt.
+ TEST(MemorySanitizer, fcvt) {
+@@ -2402,8 +2428,8 @@ TEST(MemorySanitizer, fcvt) {
+ }
+ #endif
+ 
+-// There's no fcvt_long() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no fcvt_long() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, fcvt_long) {
+   int a, b;
+   break_optimization(&a);
+@@ -2478,11 +2504,15 @@ void SigactionHandler(int signo, siginfo
+   ASSERT_TRUE(si != NULL);
+   EXPECT_NOT_POISONED(si->si_errno);
+   EXPECT_NOT_POISONED(si->si_pid);
+-#if __linux__
+-# if defined(__x86_64__)
++#ifdef _UC_MACHINE_PC
++  EXPECT_NOT_POISONED(_UC_MACHINE_PC((ucontext_t*)uc));
++#else
++# if __linux__
++#  if defined(__x86_64__)
+   EXPECT_NOT_POISONED(((ucontext_t*)uc)->uc_mcontext.gregs[REG_RIP]);
+-# elif defined(__i386__)
++#  elif defined(__i386__)
+   EXPECT_NOT_POISONED(((ucontext_t*)uc)->uc_mcontext.gregs[REG_EIP]);
++#  endif
+ # endif
+ #endif
+   ++cnt;
+@@ -3012,7 +3042,9 @@ TEST(MemorySanitizer, LongStruct) {
+   EXPECT_POISONED(s2.a8);
+ }
+ 
+-#ifdef __GLIBC__
++#if defined(__NetBSD__)
++#define MSAN_TEST_PRLIMIT 0
++#elif defined(__GLIBC__)
+ #define MSAN_TEST_PRLIMIT __GLIBC_PREREQ(2, 13)
+ #else
+ #define MSAN_TEST_PRLIMIT 1
+@@ -3063,9 +3095,13 @@ TEST(MemorySanitizer, getrusage) {
+   EXPECT_NOT_POISONED(usage.ru_nivcsw);
+ }
+ 
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ static void GetProgramPath(char *buf, size_t sz) {
++#if defined(__FreeBSD__)
+   int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
++#elif defined(__NetBSD__)
++  int mib[4] = { CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME};
++#endif
+   int res = sysctl(mib, 4, buf, &sz, NULL, 0);
+   ASSERT_EQ(0, res);
+ }
+@@ -3187,8 +3223,8 @@ TEST(MemorySanitizer, dlopenFailed) {
+ 
+ #endif // MSAN_TEST_DISABLE_DLOPEN
+ 
+-// There's no sched_getaffinity() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no sched_getaffinity() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, sched_getaffinity) {
+   cpu_set_t mask;
+   int res = sched_getaffinity(getpid(), sizeof(mask), &mask);
+@@ -3336,12 +3372,14 @@ TEST(MemorySanitizer, pthread_attr_get) 
+     EXPECT_NOT_POISONED(v);
+     EXPECT_NOT_POISONED(w);
+   }
++#if !defined(__NetBSD__)
+   {
+     cpu_set_t v;
+     res = pthread_attr_getaffinity_np(&attr, sizeof(v), &v);
+     ASSERT_EQ(0, res);
+     EXPECT_NOT_POISONED(v);
+   }
++#endif
+   res = pthread_attr_destroy(&attr);
+   ASSERT_EQ(0, res);
+ }
+@@ -3433,8 +3471,8 @@ TEST(MemorySanitizer, posix_memalign) {
+   free(p);
+ }
+ 
+-// There's no memalign() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no memalign() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, memalign) {
+   void *p = memalign(4096, 13);
+   EXPECT_EQ(0U, (uintptr_t)p % 4096);
+@@ -3449,8 +3487,8 @@ TEST(MemorySanitizer, valloc) {
+   free(a);
+ }
+ 
+-// There's no pvalloc() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no pvalloc() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, pvalloc) {
+   uintptr_t PageSize = GetPageSize();
+   void *p = pvalloc(PageSize + 100);
+@@ -3507,8 +3545,8 @@ TEST(MemorySanitizer, gethostname) {
+   EXPECT_NOT_POISONED(strlen(buf));
+ }
+ 
+-// There's no sysinfo() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no sysinfo() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, sysinfo) {
+   struct sysinfo info;
+   int res = sysinfo(&info);
+@@ -3605,8 +3643,8 @@ TEST(MemorySanitizer, getpwent_r) {
+   EXPECT_NOT_POISONED(pwdres);
+ }
+ 
+-// There's no fgetpwent() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no fgetpwent() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, fgetpwent) {
+   FILE *fp = fopen("/etc/passwd", "r");
+   struct passwd *p = fgetpwent(fp);
+@@ -3629,8 +3667,8 @@ TEST(MemorySanitizer, getgrent) {
+   EXPECT_NOT_POISONED(p->gr_gid);
+ }
+ 
+-// There's no fgetgrent() on FreeBSD.
+-#if !defined(__FreeBSD__)
++// There's no fgetgrent() on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ TEST(MemorySanitizer, fgetgrent) {
+   FILE *fp = fopen("/etc/group", "r");
+   struct group *grp = fgetgrent(fp);
+@@ -4392,12 +4430,14 @@ void MemCpyTest() {
+   EXPECT_POISONED_O(y[N/2], ox);
+   EXPECT_POISONED_O(y[N-1], ox);
+   EXPECT_NOT_POISONED(x);
++#if !defined(__NetBSD__)
+   void *res = mempcpy(q, x, N * sizeof(T));
+   ASSERT_EQ(q + N, res);
+   EXPECT_POISONED_O(q[0], ox);
+   EXPECT_POISONED_O(q[N/2], ox);
+   EXPECT_POISONED_O(q[N-1], ox);
+   EXPECT_NOT_POISONED(x);
++#endif
+   memmove(z, x, N * sizeof(T));
+   EXPECT_POISONED_O(z[0], ox);
+   EXPECT_POISONED_O(z[N/2], ox);
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 5ef38cc731..d714aaff8c 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-05-04 08:00:15.541116903 +0000
+--- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig	2018-04-25 21:13:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_common_interceptors.inc
 @@ -77,6 +77,11 @@
  #define ctime __ctime50
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 c8d6b7341a..fe925bb13e 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,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_internal_defs.h.orig	2018-05-04 08:00:18.006055373 +0000
+--- lib/sanitizer_common/sanitizer_internal_defs.h.orig	2018-04-25 21:13:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_internal_defs.h
 @@ -186,7 +186,9 @@ typedef u64 tid_t;
  // This header should NOT include any other headers to avoid portability issues.
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 01304f2471..26177a79d1 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,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_linux.cc.orig	2018-05-04 08:00:15.553459333 +0000
+--- lib/sanitizer_common/sanitizer_linux.cc.orig	2018-04-25 21:13:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_linux.cc
 @@ -93,6 +93,7 @@ extern "C" {
  
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 b6a683caf8..754b30fd4d 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,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig	2018-05-04 08:00:15.557522313 +0000
+--- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig	2018-04-25 21:13:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_interceptors.h
 @@ -495,4 +495,10 @@
  #define SANITIZER_INTERCEPT_PROTOENT SI_NETBSD
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
index 48cd56435e..8d60bc2cf7 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc.orig	2018-05-04 08:00:15.526146093 +0000
+--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc.orig	2018-04-25 21:13:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
 @@ -15,9 +15,15 @@
  #include "sanitizer_platform.h"
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
index 69ea8448dc..2b3fe36bd0 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h.orig	2018-05-04 08:00:15.477300193 +0000
+--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h.orig	2018-04-25 21:13:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
 @@ -60,6 +60,15 @@ extern unsigned struct_timespec_sz;
  extern unsigned struct_sembuf_sz;
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 65b4a37353..3caee22a2f 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,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_procmaps_bsd.cc.orig	2018-05-04 08:00:15.481287563 +0000
+--- lib/sanitizer_common/sanitizer_procmaps_bsd.cc.orig	2018-04-25 21:13:40.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_procmaps_bsd.cc
 @@ -19,6 +19,10 @@
  #endif
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 9f4c25309c..85b2dc39d1 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-04 08:00:15.561205773 +0000
+--- lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc.orig	2018-02-01 23:46:05.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 ad1a07e6e5..b10883f4be 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-05-04 08:00:13.523354513 +0000
+--- lib/scudo/scudo_platform.h.orig	2018-02-01 23:46:04.000000000 +0000
 +++ lib/scudo/scudo_platform.h
 @@ -17,7 +17,7 @@
  
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
new file mode 100644
index 0000000000..2580d79580
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_Posix_stack-use-after-return.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- test/asan/TestCases/Posix/stack-use-after-return.cc.orig	2018-02-01 23:45:58.000000000 +0000
++++ test/asan/TestCases/Posix/stack-use-after-return.cc
+@@ -76,9 +76,11 @@ int main(int argc, char **argv) {
+   pthread_attr_init(&attr);
+   if (kStackSize > 0) {
+     size_t desired_stack_size = kStackSize;
++#ifdef PTHREAD_STACK_MIN
+     if (desired_stack_size < PTHREAD_STACK_MIN) {
+       desired_stack_size = PTHREAD_STACK_MIN;
+     }
++#endif
+ 
+     int ret = pthread_attr_setstacksize(&attr, desired_stack_size);
+     if (ret != 0) {
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
new file mode 100644
index 0000000000..87e7da21b5
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_heavy__uar__test.cc
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- test/asan/TestCases/heavy_uar_test.cc.orig	2018-02-01 23:45:57.000000000 +0000
++++ test/asan/TestCases/heavy_uar_test.cc
+@@ -53,8 +53,8 @@ int main(int argc, char **argv) {
+     RecursiveFunctionWithStackFrame<1024>(depth);
+     RecursiveFunctionWithStackFrame<2000>(depth);
+     // The stack size is tight for the main thread in multithread
+-    // environment on FreeBSD.
+-#if !defined(__FreeBSD__)
++    // environment on FreeBSD and NetBSD.
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+     RecursiveFunctionWithStackFrame<5000>(depth);
+     RecursiveFunctionWithStackFrame<10000>(depth);
+ #endif
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
new file mode 100644
index 0000000000..584a24eac4
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_asan_TestCases_interception__failure__test.cc
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- test/asan/TestCases/interception_failure_test.cc.orig	2018-02-01 23:45:56.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
+ // RUN: %clangxx_asan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
+ // RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
+-// XFAIL: freebsd
++// XFAIL: freebsd, netbsd
+ 
+ // On Windows, defining strtoll in a static build results in linker errors, but
+ // it works with the dynamic runtime.
diff --git a/compiler-rt-netbsd/patches/patch-test_asan_lit.cfg b/compiler-rt-netbsd/patches/patch-test_asan_lit.cfg
new file mode 100644
index 0000000000..735982dd47
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_asan_lit.cfg
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- test/asan/lit.cfg.orig	2018-02-15 16:00:57.000000000 +0000
++++ test/asan/lit.cfg
+@@ -49,7 +49,7 @@ config.substitutions.append(('%env_asan_
+ config.test_source_root = os.path.dirname(__file__)
+ 
+ # There is no libdl on FreeBSD.
+-if config.host_os != 'FreeBSD':
++if config.host_os != 'FreeBSD' and config.host_os != 'NetBSD':
+   libdl_flag = "-ldl"
+ else:
+   libdl_flag = ""
diff --git a/compiler-rt-netbsd/patches/patch-test_fuzzer_equivalence-signals.test b/compiler-rt-netbsd/patches/patch-test_fuzzer_equivalence-signals.test
index 6c34f6cdaa..448c8be74d 100644
--- a/compiler-rt-netbsd/patches/patch-test_fuzzer_equivalence-signals.test
+++ b/compiler-rt-netbsd/patches/patch-test_fuzzer_equivalence-signals.test
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/fuzzer/equivalence-signals.test.orig	2018-05-04 07:59:26.951280343 +0000
+--- test/fuzzer/equivalence-signals.test.orig	2018-04-25 21:13:41.000000000 +0000
 +++ test/fuzzer/equivalence-signals.test
 @@ -7,7 +7,7 @@ UNSUPPORTED: freebsd
  UNSUPPORTED: darwin
diff --git a/compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg b/compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg
new file mode 100644
index 0000000000..1bac92a929
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_fuzzer_lit.cfg
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- test/fuzzer/lit.cfg.orig	2018-04-25 21:13:41.000000000 +0000
++++ test/fuzzer/lit.cfg
+@@ -25,7 +25,7 @@ else:
+ config.test_format = lit.formats.ShTest(execute_external)
+ 
+ # LeakSanitizer is not supported on OSX right now.
+-if sys.platform.startswith('darwin') or sys.platform.startswith('freebsd'):
++if sys.platform.startswith('darwin') or sys.platform.startswith('freebsd') or sys.platform.startswith('netbsd'):
+   lit_config.note('lsan feature unavailable')
+ else:
+   lit_config.note('lsan feature available')
diff --git a/compiler-rt-netbsd/patches/patch-test_lit.common.cfg b/compiler-rt-netbsd/patches/patch-test_lit.common.cfg
new file mode 100644
index 0000000000..e906f87dc8
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_lit.common.cfg
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- test/lit.common.cfg.orig	2018-02-27 02:50:00.000000000 +0000
++++ test/lit.common.cfg
+@@ -312,7 +312,7 @@ if config.host_os == 'Darwin' and config
+ if config.host_os == 'Darwin':
+   config.substitutions.append( ("%ld_flags_rpath_exe", '-Wl,-rpath,@executable_path/ %dynamiclib') )
+   config.substitutions.append( ("%ld_flags_rpath_so", '-install_name @rpath/`basename %dynamiclib`') )
+-elif config.host_os == 'FreeBSD':
++elif config.host_os == 'FreeBSD' or config.host_os == 'NetBSD':
+   config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec") )
+   config.substitutions.append( ("%ld_flags_rpath_so", '') )
+ elif config.host_os == 'Linux':
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 30f4421e0f..3c065eeec9 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-05-04 07:59:35.651438853 +0000
+--- test/lsan/lit.common.cfg.orig	2018-02-01 23:45:50.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 94d8eeea64..9c67ac91e7 100644
--- a/compiler-rt-netbsd/patches/patch-test_scudo_lit.cfg
+++ b/compiler-rt-netbsd/patches/patch-test_scudo_lit.cfg
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/scudo/lit.cfg.orig	2018-05-04 07:59:57.577602353 +0000
+--- test/scudo/lit.cfg.orig	2018-02-01 23:45:54.000000000 +0000
 +++ test/scudo/lit.cfg
 @@ -21,9 +21,11 @@ c_flags = ([config.target_cflags] +
             "-pie",



Home | Main Index | Thread Index | Old Index