--- lib/tsan/rtl/tsan_rtl_amd64.S.orig 2015-12-01 01:11:02.000000000 +1100 +++ lib/tsan/rtl/tsan_rtl_amd64.S 2020-05-26 14:41:23.180108000 +1000 @@ -178,7 +178,7 @@ CFI_ADJUST_CFA_OFFSET(8) CFI_REL_OFFSET(%rdi, 0) // obtain %rsp -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__BSDSUniX__) lea 8(%rsp), %rdi mov %rdi, %rsi #elif defined(__APPLE__) @@ -219,7 +219,7 @@ CFI_ADJUST_CFA_OFFSET(8) CFI_REL_OFFSET(%rdi, 0) // obtain %rsp -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__BSDSUniX__) lea 8(%rsp), %rdi mov %rdi, %rsi #elif defined(__APPLE__) @@ -267,7 +267,7 @@ sub $8, %rsp CFI_ADJUST_CFA_OFFSET(8) // obtain %rsp -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__BSDSUniX__) lea 24(%rsp), %rdi mov %rdi, %rsi #elif defined(__APPLE__) @@ -323,7 +323,7 @@ sub $8, %rsp CFI_ADJUST_CFA_OFFSET(8) // obtain %rsp -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__BSDSUniX__) lea 24(%rsp), %rdi mov %rdi, %rsi #else @@ -353,7 +353,7 @@ ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)) #endif // !defined(__APPLE__) -#if defined(__FreeBSD__) || defined(__linux__) +#if defined(__FreeBSD__) || defined(__linux__) || defined(__BSDSUniX__) /* We do not need executable stack. */ .section .note.GNU-stack,"",@progbits #endif --- lib/tsan/rtl/tsan_platform_linux.cc.orig 2016-12-01 07:41:59.000000000 +1100 +++ lib/tsan/rtl/tsan_platform_linux.cc 2020-05-26 14:43:31.920147000 +1000 @@ -9,12 +9,12 @@ // // This file is a part of ThreadSanitizer (TSan), a race detector. // -// Linux- and FreeBSD-specific code. +// Linux- BSDSUniX- and FreeBSD-specific code. //===----------------------------------------------------------------------===// #include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_libc.h" @@ -63,7 +63,7 @@ # undef sa_sigaction #endif -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX extern "C" void *__libc_stack_end; void *__libc_stack_end = 0; #endif @@ -404,4 +404,4 @@ } // namespace __tsan -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX --- lib/tsan/rtl/tsan_interceptors.cc.orig 2017-01-11 11:54:26.000000000 +1100 +++ lib/tsan/rtl/tsan_interceptors.cc 2020-05-26 14:46:07.271880000 +1000 @@ -35,7 +35,7 @@ using namespace __tsan; // NOLINT -#if SANITIZER_FREEBSD || SANITIZER_MAC +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX #define __errno_location __error #define stdout __stdoutp #define stderr __stderrp @@ -46,7 +46,7 @@ #define mallopt(a, b) #endif -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #define PTHREAD_CREATE_DETACHED 1 #elif SANITIZER_MAC #define PTHREAD_CREATE_DETACHED 2 @@ -96,11 +96,11 @@ extern "C" int *__errno_location(); extern "C" int fileno_unlocked(void *stream); extern "C" int dirfd(void *dirp); -#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID +#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_BSDSUNIX extern "C" int mallopt(int param, int value); #endif extern __sanitizer_FILE *stdout, *stderr; -#if !SANITIZER_FREEBSD && !SANITIZER_MAC +#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_BSDSUNIX const int PTHREAD_MUTEX_RECURSIVE = 1; const int PTHREAD_MUTEX_RECURSIVE_NP = 1; #else @@ -110,7 +110,7 @@ const int EINVAL = 22; const int EBUSY = 16; const int EOWNERDEAD = 130; -#if !SANITIZER_FREEBSD && !SANITIZER_MAC +#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_BSDSUNIX const int EPOLL_CTL_ADD = 1; #endif const int SIGILL = 4; @@ -119,7 +119,7 @@ const int SIGSEGV = 11; const int SIGPIPE = 13; const int SIGTERM = 15; -#if defined(__mips__) || SANITIZER_FREEBSD || SANITIZER_MAC +#if defined(__mips__) || SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX const int SIGBUS = 10; const int SIGSYS = 12; #else @@ -163,7 +163,7 @@ sighandler_t sa_handler; sigactionhandler_t sa_sigaction; }; -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX int sa_flags; __sanitizer_sigset_t sa_mask; #elif SANITIZER_MAC @@ -182,7 +182,7 @@ const sighandler_t SIG_DFL = (sighandler_t)0; const sighandler_t SIG_IGN = (sighandler_t)1; const sighandler_t SIG_ERR = (sighandler_t)-1; -#if SANITIZER_FREEBSD || SANITIZER_MAC +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX const int SA_SIGINFO = 0x40; const int SIG_SETMASK = 3; #elif defined(__mips__) @@ -296,7 +296,7 @@ } #define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func) -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX # define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION(func) #else # define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION_VER(func, ver) @@ -473,7 +473,7 @@ static void LongJmp(ThreadState *thr, uptr *env) { #ifdef __powerpc__ uptr mangled_sp = env[0]; -#elif SANITIZER_FREEBSD || SANITIZER_MAC +#elif SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX uptr mangled_sp = env[2]; #elif defined(SANITIZER_LINUX) # ifdef __aarch64__ @@ -1352,7 +1352,7 @@ #endif TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) { -#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_ANDROID +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_ANDROID || SANITIZER_BSDSUNIX SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf); if (fd > 0) FdAccess(thr, pc, fd); @@ -1951,7 +1951,7 @@ sigactions[sig].sa_flags = *(volatile int*)&act->sa_flags; internal_memcpy(&sigactions[sig].sa_mask, &act->sa_mask, sizeof(sigactions[sig].sa_mask)); -#if !SANITIZER_FREEBSD && !SANITIZER_MAC +#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_BSDSUNIX sigactions[sig].sa_restorer = act->sa_restorer; #endif sigaction_t newact; @@ -2309,7 +2309,7 @@ } }; -#if !SANITIZER_FREEBSD && !SANITIZER_MAC +#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_BSDSUNIX static void syscall_access_range(uptr pc, uptr p, uptr s, bool write) { TSAN_SYSCALL(); MemoryAccessRange(thr, pc, p, s, write); --- lib/tsan/tests/rtl/tsan_test_util_posix.cc.orig 2016-12-27 13:05:24.000000000 +1100 +++ lib/tsan/tests/rtl/tsan_test_util_posix.cc 2020-05-26 15:05:46.433363000 +1000 @@ -9,7 +9,7 @@ // // This file is a part of ThreadSanitizer (TSan), a race detector. // -// Test utils, Linux, FreeBSD and Darwin implementation. +// Test utils, Linux, FreeBSD, BSDSUniX and Darwin implementation. //===----------------------------------------------------------------------===// #include "sanitizer_common/sanitizer_atomic.h" @@ -270,7 +270,7 @@ } } CHECK_NE(tsan_mop, 0); -#if defined(__FreeBSD__) || defined(__APPLE__) +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__BSDSUniX__) const int ErrCode = ESOCKTNOSUPPORT; #else const int ErrCode = ECHRNG;