--- lib/sanitizer_common/sanitizer_bsdsunix.h.orig 2020-05-20 08:40:26.647004000 +1000 +++ lib/sanitizer_common/sanitizer_bsdsunix.h 2020-05-20 08:42:24.634182000 +1000 @@ -0,0 +1,24 @@ +//===-- sanitizer_bsdsunix.h -------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file is a part of Sanitizer runtime. It contains BSDSUniX-specific +// definitions. +// +//===----------------------------------------------------------------------===// + +#ifndef SANITIZER_BSDSUNIX_H +#define SANITIZER_BSDSUNIX_H + +#include "sanitizer_internal_defs.h" + +#if SANITIZER_BSDSUNIX && (SANITIZER_WORDSIZE == 32) +# include +#endif // SANITIZER_BSDSUNIX && (SANITIZER_WORDSIZE == 32) + +#endif // SANITIZER_BSDSUNIX_H --- lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc.orig 2016-06-28 22:53:20.000000000 +1000 +++ lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc 2020-05-21 23:19:38.083891000 +1000 @@ -8,11 +8,11 @@ //===----------------------------------------------------------------------===// // // This file contains the unwind.h-based (aka "slow") stack unwinding routines -// available to the tools on Linux, Android, and FreeBSD. +// available to the tools on Linux, Android, BSDSUniX and FreeBSD. //===----------------------------------------------------------------------===// #include "sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_LINUX +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX #include "sanitizer_common.h" #include "sanitizer_stacktrace.h" @@ -20,7 +20,7 @@ #include // for dlopen() #endif -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #define _GNU_SOURCE // to declare _Unwind_Backtrace() from #endif #include @@ -165,4 +165,4 @@ } // namespace __sanitizer -#endif // SANITIZER_FREEBSD || SANITIZER_LINUX +#endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX --- lib/sanitizer_common/sanitizer_syscall_generic.inc.orig 2015-02-23 09:01:09.000000000 +1100 +++ lib/sanitizer_common/sanitizer_syscall_generic.inc 2020-05-21 23:20:21.327659000 +1000 @@ -11,13 +11,13 @@ // //===----------------------------------------------------------------------===// -#if SANITIZER_FREEBSD || SANITIZER_MAC +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX # define SYSCALL(name) SYS_ ## name #else # define SYSCALL(name) __NR_ ## name #endif -#if (SANITIZER_FREEBSD || SANITIZER_MAC) && defined(__x86_64__) +#if (SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX) && defined(__x86_64__) # define internal_syscall __syscall # else # define internal_syscall syscall --- lib/sanitizer_common/sanitizer_procmaps_common.cc.orig 2016-02-23 05:52:51.000000000 +1100 +++ lib/sanitizer_common/sanitizer_procmaps_common.cc 2020-05-21 23:20:48.986906000 +1000 @@ -12,7 +12,7 @@ #include "sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_LINUX +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX #include "sanitizer_common.h" #include "sanitizer_placement_new.h" @@ -172,4 +172,4 @@ } // namespace __sanitizer -#endif // SANITIZER_FREEBSD || SANITIZER_LINUX +#endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX --- lib/sanitizer_common/sanitizer_procmaps.h.orig 2017-01-07 06:34:54.000000000 +1100 +++ lib/sanitizer_common/sanitizer_procmaps.h 2020-05-21 23:21:38.845495000 +1000 @@ -20,7 +20,7 @@ namespace __sanitizer { -#if SANITIZER_FREEBSD || SANITIZER_LINUX +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX struct ProcSelfMapsBuff { char *data; uptr mmaped_size; @@ -29,7 +29,7 @@ // Reads process memory map in an OS-specific way. void ReadProcMaps(ProcSelfMapsBuff *proc_maps); -#endif // SANITIZER_FREEBSD || SANITIZER_LINUX +#endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX class MemoryMappingLayout { public: @@ -58,7 +58,7 @@ // FIXME: Hide implementation details for different platforms in // platform-specific files. -# if SANITIZER_FREEBSD || SANITIZER_LINUX +# if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX ProcSelfMapsBuff proc_self_maps_; const char *current_; --- lib/sanitizer_common/sanitizer_posix_libcdep.cc.orig 2016-12-01 07:41:59.000000000 +1100 +++ lib/sanitizer_common/sanitizer_posix_libcdep.cc 2020-05-21 23:22:18.174947000 +1000 @@ -37,7 +37,7 @@ #include #include -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX // The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before // that, it was never implemented. So just define it to zero. #undef MAP_NORESERVE --- lib/sanitizer_common/sanitizer_posix.cc.orig 2016-10-06 07:33:59.000000000 +1100 +++ lib/sanitizer_common/sanitizer_posix.cc 2020-05-21 23:22:41.634041000 +1000 @@ -34,7 +34,7 @@ #include #endif -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX // The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before // that, it was never implemented. So just define it to zero. #undef MAP_NORESERVE --- lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2017-02-15 06:40:03.000000000 +1100 +++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2020-05-21 23:26:17.749940000 +1000 @@ -14,7 +14,7 @@ #include "sanitizer_platform.h" -#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX // Tests in this file assume that off_t-dependent data structures match the // libc ABI. For example, struct dirent here is what readdir() function (as // exported from libc) returns, and not the user-facing "dirent", which @@ -46,7 +46,7 @@ #include #include #include -#if !SANITIZER_MAC && !SANITIZER_FREEBSD +#if !SANITIZER_MAC && !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX #include #endif @@ -79,7 +79,7 @@ #include #endif -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX # include # include # include @@ -111,11 +111,11 @@ #undef INLINE // to avoid clashes with sanitizers' definitions #endif -#if SANITIZER_FREEBSD || SANITIZER_IOS +#if SANITIZER_FREEBSD || SANITIZER_IOS || SANITIZER_BSDSUNIX #undef IOC_DIRMASK #endif -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX # include # include # if defined(__mips64) || defined(__aarch64__) || defined(__arm__) @@ -200,9 +200,9 @@ namespace __sanitizer { unsigned struct_utsname_sz = sizeof(struct utsname); unsigned struct_stat_sz = sizeof(struct stat); -#if !SANITIZER_IOS && !SANITIZER_FREEBSD +#if !SANITIZER_IOS && !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX unsigned struct_stat64_sz = sizeof(struct stat64); -#endif // !SANITIZER_IOS && !SANITIZER_FREEBSD +#endif // !SANITIZER_IOS && !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX unsigned struct_rusage_sz = sizeof(struct rusage); unsigned struct_tm_sz = sizeof(struct tm); unsigned struct_passwd_sz = sizeof(struct passwd); @@ -245,12 +245,12 @@ unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname); #endif // SANITIZER_LINUX -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX unsigned struct_rlimit_sz = sizeof(struct rlimit); unsigned struct_timespec_sz = sizeof(struct timespec); unsigned struct_utimbuf_sz = sizeof(struct utimbuf); unsigned struct_itimerspec_sz = sizeof(struct itimerspec); -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned struct_ustat_sz = sizeof(struct ustat); @@ -258,12 +258,12 @@ unsigned struct_statvfs64_sz = sizeof(struct statvfs64); #endif // SANITIZER_LINUX && !SANITIZER_ANDROID -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID unsigned struct_timex_sz = sizeof(struct timex); unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds); unsigned struct_mq_attr_sz = sizeof(struct mq_attr); unsigned struct_statvfs_sz = sizeof(struct statvfs); -#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID uptr sig_ign = (uptr)SIG_IGN; uptr sig_dfl = (uptr)SIG_DFL; @@ -274,7 +274,7 @@ #endif -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID unsigned struct_shminfo_sz = sizeof(struct shminfo); unsigned struct_shm_info_sz = sizeof(struct shm_info); int shmctl_ipc_stat = (int)IPC_STAT; @@ -283,7 +283,7 @@ int shmctl_shm_stat = (int)SHM_STAT; #endif -#if !SANITIZER_MAC && !SANITIZER_FREEBSD +#if !SANITIZER_MAC && !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX unsigned struct_utmp_sz = sizeof(struct utmp); #endif #if !SANITIZER_ANDROID @@ -306,11 +306,11 @@ #if SANITIZER_LINUX unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr)); -#elif SANITIZER_FREEBSD +#elif SANITIZER_FREEBSD || SANITIZER_BSDSUNIX unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); #endif -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID int glob_nomatch = GLOB_NOMATCH; int glob_altdirfunc = GLOB_ALTDIRFUNC; #endif @@ -435,7 +435,7 @@ unsigned struct_vt_stat_sz = sizeof(struct vt_stat); #endif // SANITIZER_LINUX -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if SOUND_VERSION >= 0x040000 unsigned struct_copr_buffer_sz = 0; unsigned struct_copr_debug_buf_sz = 0; @@ -452,7 +452,7 @@ unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec); unsigned struct_synth_info_sz = sizeof(struct synth_info); unsigned struct_vt_mode_sz = sizeof(struct vt_mode); -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); @@ -479,10 +479,10 @@ unsigned struct_unimapinit_sz = sizeof(struct unimapinit); #endif // SANITIZER_LINUX && !SANITIZER_ANDROID -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID unsigned struct_audio_buf_info_sz = sizeof(struct audio_buf_info); unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats); -#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID #if !SANITIZER_ANDROID && !SANITIZER_MAC unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req); @@ -535,7 +535,7 @@ unsigned IOCTL_TIOCSPGRP = TIOCSPGRP; unsigned IOCTL_TIOCSTI = TIOCSTI; unsigned IOCTL_TIOCSWINSZ = TIOCSWINSZ; -#if ((SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID) +#if ((SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID) unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT; unsigned IOCTL_SIOCGETVIFCNT = SIOCGETVIFCNT; #endif @@ -727,7 +727,7 @@ unsigned IOCTL_VT_SENDSIG = VT_SENDSIG; #endif // SANITIZER_LINUX -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX unsigned IOCTL_MTIOCGET = MTIOCGET; unsigned IOCTL_MTIOCTOP = MTIOCTOP; unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE = SNDCTL_DSP_GETBLKSIZE; @@ -820,7 +820,7 @@ unsigned IOCTL_VT_RELDISP = VT_RELDISP; unsigned IOCTL_VT_SETMODE = VT_SETMODE; unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; @@ -913,7 +913,7 @@ unsigned IOCTL_TIOCSSERIAL = TIOCSSERIAL; #endif // SANITIZER_LINUX && !SANITIZER_ANDROID -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID unsigned IOCTL_GIO_SCRNMAP = GIO_SCRNMAP; unsigned IOCTL_KDDISABIO = KDDISABIO; unsigned IOCTL_KDENABIO = KDENABIO; @@ -929,7 +929,7 @@ unsigned IOCTL_PIO_SCRNMAP = PIO_SCRNMAP; unsigned IOCTL_SNDCTL_DSP_GETISPACE = SNDCTL_DSP_GETISPACE; unsigned IOCTL_SNDCTL_DSP_GETOSPACE = SNDCTL_DSP_GETOSPACE; -#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID const int errno_EINVAL = EINVAL; // EOWNERDEAD is not present in some older platforms. @@ -975,7 +975,7 @@ COMPILER_CHECK(IOC_TYPE(0x12345678) == _IOC_TYPE(0x12345678)); #endif // SANITIZER_LINUX -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX // There are more undocumented fields in dl_phdr_info that we are not interested // in. COMPILER_CHECK(sizeof(__sanitizer_dl_phdr_info) <= sizeof(dl_phdr_info)); @@ -983,9 +983,9 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_name); CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr); CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum); -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID CHECK_TYPE_SIZE(glob_t); CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc); CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv); @@ -1037,7 +1037,7 @@ CHECK_SIZE_AND_OFFSET(dirent, d_ino); #if SANITIZER_MAC CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); -#elif SANITIZER_FREEBSD +#elif SANITIZER_FREEBSD || SANITIZER_BSDSUNIX // There is no 'd_off' field on FreeBSD. #else CHECK_SIZE_AND_OFFSET(dirent, d_off); @@ -1134,9 +1134,9 @@ CHECK_TYPE_SIZE(ether_addr); -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID CHECK_TYPE_SIZE(ipc_perm); -# if SANITIZER_FREEBSD +# if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX CHECK_SIZE_AND_OFFSET(ipc_perm, key); CHECK_SIZE_AND_OFFSET(ipc_perm, seq); # else @@ -1175,20 +1175,20 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_name); CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_addr); CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_netmask); -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX // Compare against the union, because we can't reach into the union in a // compliant way. #ifdef ifa_dstaddr #undef ifa_dstaddr #endif -# if SANITIZER_FREEBSD +# if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr); # else COMPILER_CHECK(sizeof(((__sanitizer_ifaddrs *)nullptr)->ifa_dstaddr) == sizeof(((ifaddrs *)nullptr)->ifa_ifu)); COMPILER_CHECK(offsetof(__sanitizer_ifaddrs, ifa_dstaddr) == offsetof(ifaddrs, ifa_ifu)); -# endif // SANITIZER_FREEBSD +# endif // SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #else CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr); #endif // SANITIZER_LINUX @@ -1281,7 +1281,7 @@ CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, close); #endif -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX CHECK_TYPE_SIZE(sem_t); #endif @@ -1289,4 +1289,4 @@ COMPILER_CHECK(ARM_VFPREGS_SIZE == ARM_VFPREGS_SIZE_ASAN); #endif -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX || SANITIZER_MAC --- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig 2017-02-03 05:28:41.000000000 +1100 +++ lib/sanitizer_common/sanitizer_platform_interceptors.h 2020-05-21 23:31:09.731379000 +1000 @@ -35,6 +35,12 @@ # define SI_ANDROID 0 #endif +#if SANITIZER_BSDSUNIX +# define SI_BSDSUNIX 1 +#else +# define SI_BSDSUNIX 0 +#endif + #if SANITIZER_FREEBSD # define SI_FREEBSD 1 #else @@ -86,7 +92,7 @@ // FIXME: enable memmem on Windows. #define SANITIZER_INTERCEPT_MEMMEM SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_MEMCHR 1 -#define SANITIZER_INTERCEPT_MEMRCHR SI_FREEBSD || SI_LINUX +#define SANITIZER_INTERCEPT_MEMRCHR SI_FREEBSD || SI_LINUX || SI_BSDSUNIX #define SANITIZER_INTERCEPT_READ SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_PREAD SI_NOT_WINDOWS @@ -99,7 +105,7 @@ #define SANITIZER_INTERCEPT_READV SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_WRITEV SI_NOT_WINDOWS -#define SANITIZER_INTERCEPT_PREADV SI_FREEBSD || SI_LINUX_NOT_ANDROID +#define SANITIZER_INTERCEPT_PREADV SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PREADV64 SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PWRITEV64 SI_LINUX_NOT_ANDROID @@ -114,7 +120,7 @@ #ifndef SANITIZER_INTERCEPT_PRINTF # define SANITIZER_INTERCEPT_PRINTF SI_NOT_WINDOWS -# define SANITIZER_INTERCEPT_PRINTF_L SI_FREEBSD +# define SANITIZER_INTERCEPT_PRINTF_L SI_FREEBSD || SI_BSDSUNIX # define SANITIZER_INTERCEPT_ISOC99_PRINTF SI_LINUX_NOT_ANDROID #endif @@ -123,13 +129,13 @@ #define SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_GETPWENT \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_FGETPWENT SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_GETPWENT_R SI_FREEBSD || SI_LINUX_NOT_ANDROID +#define SANITIZER_INTERCEPT_GETPWENT_R SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_SETPWENT SI_MAC || SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_FREEBSD || SI_LINUX +#define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_FREEBSD || SI_LINUX || SI_BSDSUNIX #define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID @@ -140,10 +146,10 @@ #define SANITIZER_INTERCEPT_GETNAMEINFO SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_GETSOCKNAME SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_GETHOSTBYNAME SI_NOT_WINDOWS -#define SANITIZER_INTERCEPT_GETHOSTBYNAME_R SI_FREEBSD || SI_LINUX -#define SANITIZER_INTERCEPT_GETHOSTBYNAME2_R SI_FREEBSD || SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R SI_FREEBSD || SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_GETHOSTENT_R SI_FREEBSD || SI_LINUX_NOT_ANDROID +#define SANITIZER_INTERCEPT_GETHOSTBYNAME_R SI_FREEBSD || SI_LINUX || SI_BSDSUNIX +#define SANITIZER_INTERCEPT_GETHOSTBYNAME2_R SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX +#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX +#define SANITIZER_INTERCEPT_GETHOSTENT_R SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_GETSOCKOPT SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_ACCEPT SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_ACCEPT4 SI_LINUX_NOT_ANDROID @@ -172,53 +178,53 @@ #define SANITIZER_INTERCEPT_MBSNRTOWCS SI_MAC || SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_WCSTOMBS SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_WCSNRTOMBS \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_WCRTOMB \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_REALPATH SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_CONFSTR \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_SCHED_GETPARAM SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_STRERROR SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_STRERROR_R SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_XPG_STRERROR_R SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_SCANDIR \ - SI_FREEBSD || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_SCANDIR64 SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_GETGROUPS SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_POLL SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_PPOLL SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_WORDEXP \ - SI_FREEBSD || (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID + SI_FREEBSD || (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_SIGWAIT SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_SIGWAITINFO SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_SIGTIMEDWAIT SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_SIGSETOPS \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_SIGPENDING SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_SIGPROCMASK SI_NOT_WINDOWS -#define SANITIZER_INTERCEPT_BACKTRACE SI_FREEBSD || SI_LINUX_NOT_ANDROID +#define SANITIZER_INTERCEPT_BACKTRACE SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_GETMNTENT SI_LINUX #define SANITIZER_INTERCEPT_GETMNTENT_R SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_STATFS SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID +#define SANITIZER_INTERCEPT_STATFS SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_STATFS64 \ (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_STATVFS SI_FREEBSD || SI_LINUX_NOT_ANDROID +#define SANITIZER_INTERCEPT_STATVFS SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_STATVFS64 SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_INITGROUPS SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_ETHER_NTOA_ATON SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_ETHER_HOST \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_ETHER_R SI_FREEBSD || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX +#define SANITIZER_INTERCEPT_ETHER_R SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_SHMCTL \ - ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64) + ((SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX) && SANITIZER_WORDSIZE == 64) #define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPSHARED SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETTYPE SI_NOT_WINDOWS @@ -240,33 +246,33 @@ #define SANITIZER_INTERCEPT_SINCOS SI_LINUX #define SANITIZER_INTERCEPT_REMQUO SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_LGAMMA SI_NOT_WINDOWS -#define SANITIZER_INTERCEPT_LGAMMA_R SI_FREEBSD || SI_LINUX +#define SANITIZER_INTERCEPT_LGAMMA_R SI_FREEBSD || SI_LINUX || SI_BSDSUNIX #define SANITIZER_INTERCEPT_LGAMMAL_R SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_DRAND48_R SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_RAND_R \ - SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_ICONV SI_FREEBSD || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX +#define SANITIZER_INTERCEPT_ICONV SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_TIMES SI_NOT_WINDOWS // FIXME: getline seems to be available on OSX 10.7 -#define SANITIZER_INTERCEPT_GETLINE SI_FREEBSD || SI_LINUX_NOT_ANDROID +#define SANITIZER_INTERCEPT_GETLINE SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX -#define SANITIZER_INTERCEPT__EXIT SI_LINUX || SI_FREEBSD || SI_MAC +#define SANITIZER_INTERCEPT__EXIT SI_LINUX || SI_FREEBSD || SI_MAC || SI_BSDSUNIX #define SANITIZER_INTERCEPT_PHTREAD_MUTEX SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \ - SI_FREEBSD || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_TLS_GET_ADDR \ - SI_FREEBSD || SI_LINUX_NOT_ANDROID + SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_BSDSUNIX #define SANITIZER_INTERCEPT_LISTXATTR SI_LINUX #define SANITIZER_INTERCEPT_GETXATTR SI_LINUX #define SANITIZER_INTERCEPT_GETRESID SI_LINUX #define SANITIZER_INTERCEPT_GETIFADDRS \ - SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC + SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC || SI_BSDSUNIX #define SANITIZER_INTERCEPT_IF_INDEXTONAME \ - SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC + SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC || SI_BSDSUNIX #define SANITIZER_INTERCEPT_CAPGET SI_LINUX_NOT_ANDROID #if SI_LINUX && defined(__arm__) #define SANITIZER_INTERCEPT_AEABI_MEM 1 @@ -274,7 +280,7 @@ #define SANITIZER_INTERCEPT_AEABI_MEM 0 #endif #define SANITIZER_INTERCEPT___BZERO SI_MAC -#define SANITIZER_INTERCEPT_FTIME !SI_FREEBSD && SI_NOT_WINDOWS +#define SANITIZER_INTERCEPT_FTIME !SI_FREEBSD && !SI_BSDSUNIX && SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_XDR SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_TSEARCH SI_LINUX_NOT_ANDROID || SI_MAC #define SANITIZER_INTERCEPT_LIBIO_INTERNALS SI_LINUX_NOT_ANDROID @@ -287,7 +293,7 @@ #ifndef SANITIZER_INTERCEPT_DLOPEN_DLCLOSE #define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE \ - SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC + SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC || SI_BSDSUNIX #endif #define SANITIZER_INTERCEPT_GETPASS SI_LINUX_NOT_ANDROID || SI_MAC @@ -295,30 +301,30 @@ #define SANITIZER_INTERCEPT_MLOCKX SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_FOPENCOOKIE SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_SEM SI_LINUX || SI_FREEBSD +#define SANITIZER_INTERCEPT_SEM SI_LINUX || SI_FREEBSD || SI_BSDSUNIX #define SANITIZER_INTERCEPT_PTHREAD_SETCANCEL SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_MINCORE SI_LINUX #define SANITIZER_INTERCEPT_PROCESS_VM_READV SI_LINUX -#define SANITIZER_INTERCEPT_CTERMID SI_LINUX || SI_MAC || SI_FREEBSD -#define SANITIZER_INTERCEPT_CTERMID_R SI_MAC || SI_FREEBSD +#define SANITIZER_INTERCEPT_CTERMID SI_LINUX || SI_MAC || SI_FREEBSD || SI_BSDSUNIX +#define SANITIZER_INTERCEPT_CTERMID_R SI_MAC || SI_FREEBSD || SI_BSDSUNIX #define SANITIZER_INTERCEPTOR_HOOKS SI_LINUX #define SANITIZER_INTERCEPT_RECV_RECVFROM SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_SEND_SENDTO SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX -#define SANITIZER_INTERCEPT_STAT (SI_FREEBSD || SI_MAC || SI_ANDROID) +#define SANITIZER_INTERCEPT_STAT (SI_FREEBSD || SI_MAC || SI_ANDROID || SI_BSDSUNIX) #define SANITIZER_INTERCEPT___XSTAT !SANITIZER_INTERCEPT_STAT && SI_NOT_WINDOWS #define SANITIZER_INTERCEPT___XSTAT64 SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT___LXSTAT SANITIZER_INTERCEPT___XSTAT #define SANITIZER_INTERCEPT___LXSTAT64 SI_LINUX_NOT_ANDROID -#define SANITIZER_INTERCEPT_UTMP SI_NOT_WINDOWS && !SI_MAC && !SI_FREEBSD -#define SANITIZER_INTERCEPT_UTMPX SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD +#define SANITIZER_INTERCEPT_UTMP SI_NOT_WINDOWS && !SI_MAC && !SI_FREEBSD && !SI_BSDSUNIX +#define SANITIZER_INTERCEPT_UTMPX SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD || SI_BSDSUNIX -#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO (!SI_FREEBSD && !SI_MAC) -#define SANITIZER_INTERCEPT_MEMALIGN (!SI_FREEBSD && !SI_MAC) -#define SANITIZER_INTERCEPT_PVALLOC (!SI_FREEBSD && !SI_MAC) -#define SANITIZER_INTERCEPT_CFREE (!SI_FREEBSD && !SI_MAC) +#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO (!SI_FREEBSD && !SI_MAC && !SI_BSDSUNIX) +#define SANITIZER_INTERCEPT_MEMALIGN (!SI_FREEBSD && !SI_MAC && !SI_BSDSUNIX) +#define SANITIZER_INTERCEPT_PVALLOC (!SI_FREEBSD && !SI_MAC && !SI_BSDSUNIX) +#define SANITIZER_INTERCEPT_CFREE (!SI_FREEBSD && !SI_MAC && !SI_BSDSUNIX) #endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H --- lib/sanitizer_common/sanitizer_platform.h.orig 2016-10-29 07:14:18.000000000 +1100 +++ lib/sanitizer_common/sanitizer_platform.h 2020-05-21 23:32:38.934116000 +1000 @@ -14,7 +14,7 @@ #define SANITIZER_PLATFORM_H #if !defined(__linux__) && !defined(__FreeBSD__) && \ - !defined(__APPLE__) && !defined(_WIN32) + !defined(__APPLE__) && !defined(_WIN32) && !defined(__BSDSUniX__) # error "This operating system is not supported" #endif @@ -24,6 +24,12 @@ # define SANITIZER_LINUX 0 #endif +#if defined(__BSDSUniX__) +# define SANITIZER_BSDSUNIX 1 +#else +# define SANITIZER_BSDSUNIX 0 +#endif + #if defined(__FreeBSD__) # define SANITIZER_FREEBSD 1 #else @@ -79,7 +85,7 @@ # define SANITIZER_ANDROID 0 #endif -#define SANITIZER_POSIX (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC) +#define SANITIZER_POSIX (SANITIZER_FREEBSD || SANITIZER_BSDSUNIX || SANITIZER_LINUX || SANITIZER_MAC) #if __LP64__ || defined(_WIN64) # define SANITIZER_WORDSIZE 64 --- lib/sanitizer_common/sanitizer_linux_libcdep.cc.orig 2017-01-10 04:39:31.000000000 +1100 +++ lib/sanitizer_common/sanitizer_linux_libcdep.cc 2020-05-21 23:35:41.928083000 +1000 @@ -14,12 +14,13 @@ #include "sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_LINUX +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX #include "sanitizer_allocator_internal.h" #include "sanitizer_atomic.h" #include "sanitizer_common.h" #include "sanitizer_flags.h" +#include "sanitizer_bsdsunix.h" #include "sanitizer_freebsd.h" #include "sanitizer_linux.h" #include "sanitizer_placement_new.h" @@ -33,7 +34,7 @@ #include #include -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #include #include #define pthread_getattr_np pthread_attr_get_np @@ -152,7 +153,7 @@ #endif } -#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO +#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_BSDSUNIX static uptr g_tls_size; #ifdef __i386__ @@ -180,7 +181,7 @@ } #else void InitTlsSize() { } -#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO +#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_BSDSUNIX #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \ || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__)) \ @@ -316,7 +317,7 @@ } #endif // (x86_64 || i386 || MIPS) && SANITIZER_LINUX -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX static void **ThreadSelfSegbase() { void **segbase = 0; # if defined(__i386__) @@ -326,7 +327,7 @@ // sysarch(AMD64_GET_FSBASE, segbase); __asm __volatile("movq %%fs:0, %0" : "=r" (segbase)); # else -# error "unsupported CPU arch for FreeBSD platform" +# error "unsupported CPU arch for FreeBSD/BSDSUniX platforms" # endif return segbase; } @@ -334,7 +335,7 @@ uptr ThreadSelf() { return (uptr)ThreadSelfSegbase()[2]; } -#endif // SANITIZER_FREEBSD +#endif // SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if !SANITIZER_GO static void GetTls(uptr *addr, uptr *size) { @@ -351,7 +352,7 @@ *addr = 0; *size = 0; # endif -#elif SANITIZER_FREEBSD +#elif SANITIZER_FREEBSD || SANITIZER_BSDSUNIX void** segbase = ThreadSelfSegbase(); *addr = 0; *size = 0; @@ -375,7 +376,7 @@ #if !SANITIZER_GO uptr GetTlsSize() { -#if SANITIZER_FREEBSD || SANITIZER_ANDROID +#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_BSDSUNIX uptr addr, size; GetTls(&addr, &size); return size; @@ -410,7 +411,7 @@ #endif } -# if !SANITIZER_FREEBSD +# if !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX typedef ElfW(Phdr) Elf_Phdr; # elif SANITIZER_WORDSIZE == 32 && __FreeBSD_version <= 902001 // v9.2 # define Elf_Phdr XElf32_Phdr --- lib/sanitizer_common/sanitizer_linux.h.orig 2016-10-06 20:58:11.000000000 +1100 +++ lib/sanitizer_common/sanitizer_linux.h 2020-05-21 23:36:01.113153000 +1000 @@ -14,7 +14,7 @@ #define SANITIZER_LINUX_H #include "sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_LINUX +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX #include "sanitizer_common.h" #include "sanitizer_internal_defs.h" #include "sanitizer_posix.h" @@ -89,5 +89,5 @@ void ForEachMappedRegion(link_map *map, void (*cb)(const void *, uptr)); } // namespace __sanitizer -#endif // SANITIZER_FREEBSD || SANITIZER_LINUX +#endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX #endif // SANITIZER_LINUX_H --- lib/sanitizer_common/sanitizer_libignore.cc.orig 2017-01-11 11:54:26.000000000 +1100 +++ lib/sanitizer_common/sanitizer_libignore.cc 2020-05-21 23:36:15.512487000 +1000 @@ -9,7 +9,7 @@ #include "sanitizer_platform.h" -#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || SANITIZER_BSDSUNIX #include "sanitizer_libignore.h" #include "sanitizer_flags.h" @@ -125,4 +125,4 @@ } // namespace __sanitizer -#endif // #if SANITIZER_FREEBSD || SANITIZER_LINUX +#endif // #if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_BSDSUNIX --- lib/sanitizer_common/sanitizer_internal_defs.h.orig 2017-01-09 14:51:42.000000000 +1100 +++ lib/sanitizer_common/sanitizer_internal_defs.h 2020-05-21 23:36:38.958092000 +1000 @@ -95,7 +95,7 @@ // _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls // like pread and mmap, as opposed to pread64 and mmap64. // FreeBSD, Mac and Linux/x86-64 are special. -#if SANITIZER_FREEBSD || SANITIZER_MAC || \ +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_BSDSUNIX ||\ (SANITIZER_LINUX && defined(__x86_64__)) typedef u64 OFF_T; #else --- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig 2016-12-28 08:30:20.000000000 +1100 +++ lib/sanitizer_common/sanitizer_common_interceptors.inc 2020-05-21 23:37:18.918136000 +1000 @@ -63,7 +63,7 @@ #define va_copy(dst, src) ((dst) = (src)) #endif // _WIN32 -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #define pthread_setname_np pthread_set_name_np #define inet_aton __inet_aton #define inet_pton __inet_pton @@ -2065,7 +2065,7 @@ return res; } // On FreeBSD id_t is always 64-bit wide. -#if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) +#if (SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && (SANITIZER_WORDSIZE == 32) INTERCEPTOR_WITH_SUFFIX(int, waitid, int idtype, long long id, void *infop, int options) { #else --- lib/sanitizer_common/CMakeLists.txt.orig 2017-01-12 12:37:35.000000000 +1100 +++ lib/sanitizer_common/CMakeLists.txt 2020-05-14 09:14:02.958380000 +1000 @@ -20,6 +20,7 @@ sanitizer_printf.cc sanitizer_procmaps_common.cc sanitizer_procmaps_freebsd.cc + sanitizer_procmaps_bsdsunix.cc sanitizer_procmaps_linux.cc sanitizer_procmaps_mac.cc sanitizer_stackdepot.cc --- cmake/config-ix.cmake.orig 2020-05-22 13:00:25.959836000 +1000 +++ cmake/config-ix.cmake 2020-05-22 13:03:37.363409000 +1000 @@ -435,7 +435,7 @@ list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}") if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND - (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR + (OS_NAME MATCHES "Android|Darwin|Linux|BSDSUniX|FreeBSD" OR (OS_NAME MATCHES "Windows" AND (NOT MINGW AND NOT CYGWIN)))) set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE) else() @@ -454,7 +454,7 @@ set(COMPILER_RT_HAS_ASAN FALSE) endif() -if (OS_NAME MATCHES "Linux|FreeBSD|Windows") +if (OS_NAME MATCHES "Linux|BSDSUniX|FreeBSD|Windows") set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE) else() set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE) @@ -470,7 +470,7 @@ endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Linux|FreeBSD") + OS_NAME MATCHES "Linux|BSDSUniX|FreeBSD") set(COMPILER_RT_HAS_LSAN TRUE) else() set(COMPILER_RT_HAS_LSAN FALSE) @@ -484,28 +484,28 @@ endif() if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows") + OS_NAME MATCHES "Darwin|Linux|BSDSUniX|FreeBSD|Windows") set(COMPILER_RT_HAS_PROFILE TRUE) else() set(COMPILER_RT_HAS_PROFILE FALSE) endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD") + OS_NAME MATCHES "Darwin|Linux|BSDSUniX|FreeBSD") set(COMPILER_RT_HAS_TSAN TRUE) else() set(COMPILER_RT_HAS_TSAN FALSE) endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows") + OS_NAME MATCHES "Darwin|Linux|BSDSUniX|FreeBSD|Windows") set(COMPILER_RT_HAS_UBSAN TRUE) else() set(COMPILER_RT_HAS_UBSAN FALSE) endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND SAFESTACK_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD") + OS_NAME MATCHES "Darwin|Linux|BSDSUniX|FreeBSD") set(COMPILER_RT_HAS_SAFESTACK TRUE) else() set(COMPILER_RT_HAS_SAFESTACK FALSE) --- lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig 2020-05-25 18:50:23.232519000 +1000 +++ lib/sanitizer_common/sanitizer_platform_limits_posix.h 2020-05-25 18:53:20.221232000 +1000 @@ -18,7 +18,7 @@ #include "sanitizer_internal_defs.h" #include "sanitizer_platform.h" -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX // FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that // incorporates the map structure. # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ @@ -34,7 +34,7 @@ namespace __sanitizer { extern unsigned struct_utsname_sz; extern unsigned struct_stat_sz; -#if !SANITIZER_FREEBSD && !SANITIZER_IOS +#if !SANITIZER_FREEBSD && !SANITIZER_IOS && !SANITIZER_BSDSUNIX extern unsigned struct_stat64_sz; #endif extern unsigned struct_rusage_sz; @@ -117,7 +117,7 @@ const unsigned struct_kexec_segment_sz = 4 * sizeof(unsigned long); #endif // SANITIZER_LINUX -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if defined(__powerpc64__) || defined(__s390__) const unsigned struct___old_kernel_stat_sz = 0; @@ -174,11 +174,11 @@ int data; #elif SANITIZER_LINUX uptr data[4]; -#elif SANITIZER_FREEBSD +#elif SANITIZER_FREEBSD || SANITIZER_BSDSUNIX u32 data[4]; #endif }; -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if SANITIZER_ANDROID struct __sanitizer_mallinfo { @@ -300,7 +300,7 @@ #endif #endif }; -#elif SANITIZER_FREEBSD +#elif SANITIZER_FREEBSD || SANITIZER_BSDSUNIX struct __sanitizer_ipc_perm { unsigned int cuid; unsigned int cgid; @@ -323,12 +323,12 @@ }; #endif -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID extern unsigned struct_msqid_ds_sz; extern unsigned struct_mq_attr_sz; extern unsigned struct_timex_sz; extern unsigned struct_statvfs_sz; -#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID struct __sanitizer_iovec { void *iov_base; @@ -378,7 +378,7 @@ char *pw_passwd; int pw_uid; int pw_gid; -#if SANITIZER_MAC || SANITIZER_FREEBSD +#if SANITIZER_MAC || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX long pw_change; char *pw_class; #endif @@ -387,10 +387,10 @@ #endif char *pw_dir; char *pw_shell; -#if SANITIZER_MAC || SANITIZER_FREEBSD +#if SANITIZER_MAC || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX long pw_expire; #endif -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX int pw_fields; #endif }; @@ -444,7 +444,7 @@ }; #endif -#if SANITIZER_MAC || SANITIZER_FREEBSD +#if SANITIZER_MAC || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX struct __sanitizer_msghdr { void *msg_name; unsigned msg_namelen; @@ -483,6 +483,12 @@ unsigned short d_reclen; // more fields that we don't care about }; +#elif SANITIZER_BSDSUNIX + struct __sanitizer_dirent { + unsigned int d_fileno; + unsigned short d_reclen; + // more fields that we don't care about + }; #elif SANITIZER_FREEBSD struct __sanitizer_dirent { #if __FreeBSD_version < 1200031 @@ -520,7 +526,7 @@ #endif // 'clock_t' is 32 bits wide on x64 FreeBSD -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX typedef int __sanitizer_clock_t; #elif defined(__x86_64__) && !defined(_LP64) typedef long long __sanitizer_clock_t; @@ -532,7 +538,7 @@ typedef int __sanitizer_clockid_t; #endif -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)\ || defined(__mips__) typedef unsigned __sanitizer___kernel_uid_t; @@ -582,7 +588,7 @@ // The size is determined by looking at sizeof of real sigset_t on linux. uptr val[128 / sizeof(uptr)]; }; -#elif SANITIZER_FREEBSD +#elif SANITIZER_FREEBSD || SANITIZER_BSDSUNIX struct __sanitizer_sigset_t { // uint32_t * 4 unsigned int __bits[4]; @@ -621,14 +627,14 @@ }; #else // !SANITIZER_ANDROID struct __sanitizer_sigaction { -#if defined(__mips__) && !SANITIZER_FREEBSD +#if defined(__mips__) && !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX unsigned int sa_flags; #endif union { void (*sigaction)(int sig, void *siginfo, void *uctx); void (*handler)(int sig); }; -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX int sa_flags; __sanitizer_sigset_t sa_mask; #else @@ -667,7 +673,7 @@ }; #endif // !SANITIZER_ANDROID -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX typedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t; #elif defined(__mips__) struct __sanitizer_kernel_sigset_t { @@ -714,7 +720,7 @@ extern int af_inet6; uptr __sanitizer_in_addr_sz(int af); -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX struct __sanitizer_dl_phdr_info { uptr dlpi_addr; const char *dlpi_name; @@ -730,7 +736,7 @@ int ai_family; int ai_socktype; int ai_protocol; -#if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD +#if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX unsigned ai_addrlen; char *ai_canonname; void *ai_addr; @@ -756,7 +762,7 @@ short revents; }; -#if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD +#if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX typedef unsigned __sanitizer_nfds_t; #else typedef unsigned long __sanitizer_nfds_t; @@ -776,7 +782,7 @@ int (*gl_lstat)(const char *, void *); int (*gl_stat)(const char *, void *); }; -# elif SANITIZER_FREEBSD +# elif SANITIZER_FREEBSD || SANITIZER_BSDSUNIX struct __sanitizer_glob_t { uptr gl_pathc; uptr gl_matchc; @@ -790,9 +796,9 @@ int (*gl_lstat)(const char*, void* /* struct stat* */); int (*gl_stat)(const char*, void* /* struct stat* */); }; -# endif // SANITIZER_FREEBSD +# endif // SANITIZER_FREEBSD || SANITIZER_BSDSUNIX -# if SANITIZER_LINUX || SANITIZER_FREEBSD +# if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX extern int glob_nomatch; extern int glob_altdirfunc; # endif @@ -804,7 +810,7 @@ uptr we_wordc; char **we_wordv; uptr we_offs; -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_BSDSUNIX char *we_strings; uptr we_nbytes; #endif @@ -861,7 +867,7 @@ extern int ptrace_geteventmsg; #endif -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID extern unsigned struct_shminfo_sz; extern unsigned struct_shm_info_sz; extern int shmctl_ipc_stat; @@ -870,7 +876,7 @@ extern int shmctl_shm_stat; #endif -#if !SANITIZER_MAC && !SANITIZER_FREEBSD +#if !SANITIZER_MAC && !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX extern unsigned struct_utmp_sz; #endif #if !SANITIZER_ANDROID @@ -998,7 +1004,7 @@ extern unsigned struct_vt_stat_sz; #endif // SANITIZER_LINUX -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX extern unsigned struct_copr_buffer_sz; extern unsigned struct_copr_debug_buf_sz; extern unsigned struct_copr_msg_sz; @@ -1010,7 +1016,7 @@ extern unsigned struct_seq_event_rec_sz; extern unsigned struct_synth_info_sz; extern unsigned struct_vt_mode_sz; -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD|| SANITIZER_BSDSUNIX #if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned struct_ax25_parms_struct_sz; @@ -1032,10 +1038,10 @@ extern unsigned struct_unimapinit_sz; #endif // SANITIZER_LINUX && !SANITIZER_ANDROID -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID extern unsigned struct_audio_buf_info_sz; extern unsigned struct_ppp_stats_sz; -#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID #if !SANITIZER_ANDROID && !SANITIZER_MAC extern unsigned struct_sioc_sg_req_sz; @@ -1092,7 +1098,7 @@ extern unsigned IOCTL_TIOCSPGRP; extern unsigned IOCTL_TIOCSTI; extern unsigned IOCTL_TIOCSWINSZ; -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID extern unsigned IOCTL_SIOCGETSGCNT; extern unsigned IOCTL_SIOCGETVIFCNT; #endif @@ -1255,7 +1261,7 @@ extern unsigned IOCTL_VT_RESIZEX; extern unsigned IOCTL_VT_SENDSIG; #endif // SANITIZER_LINUX -#if SANITIZER_LINUX || SANITIZER_FREEBSD +#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX extern unsigned IOCTL_MTIOCGET; extern unsigned IOCTL_MTIOCTOP; extern unsigned IOCTL_SIOCADDRT; @@ -1356,7 +1362,7 @@ extern unsigned IOCTL_VT_RELDISP; extern unsigned IOCTL_VT_SETMODE; extern unsigned IOCTL_VT_WAITACTIVE; -#endif // SANITIZER_LINUX || SANITIZER_FREEBSD +#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX #if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned IOCTL_CYGETDEFTHRESH; @@ -1445,7 +1451,7 @@ extern unsigned IOCTL_TIOCSSERIAL; #endif // SANITIZER_LINUX && !SANITIZER_ANDROID -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID +#if (SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_BSDSUNIX) && !SANITIZER_ANDROID extern unsigned IOCTL_GIO_SCRNMAP; extern unsigned IOCTL_KDDISABIO; extern unsigned IOCTL_KDENABIO; --- lib/sanitizer_common/sanitizer_procmaps_bsdsunix.cc.orig 2020-05-25 22:35:31.336964000 +1000 +++ lib/sanitizer_common/sanitizer_procmaps_bsdsunix.cc 2020-05-25 22:36:45.870204000 +1000 @@ -0,0 +1,86 @@ +//===-- sanitizer_procmaps_bsdsunix.cc -------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Information about the process mappings (BSDSUniX-specific parts). +//===----------------------------------------------------------------------===// + +#include "sanitizer_platform.h" +#if SANITIZER_BSDSUNIX +#include "sanitizer_common.h" +#include "sanitizer_bsdsunix.h" +#include "sanitizer_procmaps.h" + +#include +#include +#include + +#if SANITIZER_BSDSUNIX && (SANITIZER_WORDSIZE == 32) +# include +#endif + +namespace __sanitizer { + +void ReadProcMaps(ProcSelfMapsBuff *proc_maps) { + const int Mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid() }; + size_t Size = 0; + int Err = sysctl(Mib, 4, NULL, &Size, NULL, 0); + CHECK_EQ(Err, 0); + CHECK_GT(Size, 0); + + size_t MmapedSize = Size * 4 / 3; + void *VmMap = MmapOrDie(MmapedSize, "ReadProcMaps()"); + Size = MmapedSize; + Err = sysctl(Mib, 4, VmMap, &Size, NULL, 0); + CHECK_EQ(Err, 0); + + proc_maps->data = (char*)VmMap; + proc_maps->mmaped_size = MmapedSize; + proc_maps->len = Size; +} + +bool MemoryMappingLayout::Next(uptr *start, uptr *end, uptr *offset, + char filename[], uptr filename_size, + uptr *protection, ModuleArch *arch, u8 *uuid) { + CHECK(!arch && "not implemented"); + CHECK(!uuid && "not implemented"); + char *last = proc_self_maps_.data + proc_self_maps_.len; + if (current_ >= last) return false; + uptr dummy; + if (!start) start = &dummy; + if (!end) end = &dummy; + if (!offset) offset = &dummy; + if (!protection) protection = &dummy; + struct kinfo_vmentry *VmEntry = (struct kinfo_vmentry*)current_; + + *start = (uptr)VmEntry->kve_start; + *end = (uptr)VmEntry->kve_end; + *offset = (uptr)VmEntry->kve_offset; + + *protection = 0; + if ((VmEntry->kve_protection & KVME_PROT_READ) != 0) + *protection |= kProtectionRead; + if ((VmEntry->kve_protection & KVME_PROT_WRITE) != 0) + *protection |= kProtectionWrite; + if ((VmEntry->kve_protection & KVME_PROT_EXEC) != 0) + *protection |= kProtectionExecute; + + if (filename != NULL && filename_size > 0) { + internal_snprintf(filename, + Min(filename_size, (uptr)PATH_MAX), + "%s", VmEntry->kve_path); + } + + current_ += VmEntry->kve_structsize; + + return true; +} + +} // namespace __sanitizer + +#endif // SANITIZER_BSDSUNIX --- lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc.orig 2016-08-01 05:27:46.000000000 +1000 +++ lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc 2020-05-26 14:35:59.727484000 +1000 @@ -62,7 +62,7 @@ EXPECT_STREQ("_TtSd", DemangleSwiftAndCXX("_TtSd")); // Check that the rest demangles properly. EXPECT_STREQ("f1(char*, int)", DemangleSwiftAndCXX("_Z2f1Pci")); -#if !SANITIZER_FREEBSD // QoI issue with libcxxrt on FreeBSD +#if !SANITIZER_FREEBSD && !SANITIZER_BSDSUNIX // QoI issue with libcxxrt on FreeBSD/BSDSUniX EXPECT_STREQ("foo", DemangleSwiftAndCXX("foo")); #endif EXPECT_STREQ("", DemangleSwiftAndCXX("")); --- lib/sanitizer_common/tests/sanitizer_test_utils.h.orig 2014-12-22 23:29:40.000000000 +1100 +++ lib/sanitizer_common/tests/sanitizer_test_utils.h 2020-05-26 14:37:35.380522000 +1000 @@ -102,7 +102,7 @@ #endif #if !defined(__APPLE__) && !defined(__FreeBSD__) && \ - !defined(__ANDROID__) && !defined(_WIN32) + !defined(__ANDROID__) && !defined(_WIN32) && !defined(__BSDSUniX__) # define SANITIZER_TEST_HAS_MEMALIGN 1 # define SANITIZER_TEST_HAS_PVALLOC 1 # define SANITIZER_TEST_HAS_MALLOC_USABLE_SIZE 1 @@ -118,7 +118,7 @@ # define SANITIZER_TEST_HAS_STRNLEN 0 #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__BSDSUniX__) # define SANITIZER_TEST_HAS_PRINTF_L 1 #else # define SANITIZER_TEST_HAS_PRINTF_L 0