diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h @@ -456,7 +456,7 @@ #define SANITIZER_INTERCEPT_CTERMID_R (SI_MAC || SI_FREEBSD || SI_SOLARIS) #define SANITIZER_INTERCEPTOR_HOOKS \ - (SI_LINUX || SI_MAC || SI_WINDOWS || SI_NETBSD) + (SI_LINUX || SI_MAC || SI_WINDOWS || SI_NETBSD || SI_SOLARIS) #define SANITIZER_INTERCEPT_RECV_RECVFROM SI_POSIX #define SANITIZER_INTERCEPT_SEND_SENDTO SI_POSIX #define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt --- a/compiler-rt/test/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt @@ -65,6 +65,9 @@ if(${tool} STREQUAL "asan") list(REMOVE_ITEM TEST_ARCH sparc sparcv9) endif() + if(OS_NAME MATCHES "SunOS" AND ${tool} STREQUAL "asan") + list(REMOVE_ITEM TEST_ARCH x86_64) + endif() # TODO(dliew): We should iterate over the different # Apple platforms, not just macOS. diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp @@ -1,5 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t // UNSUPPORTED: linux +// fgetln is BSD-only. +// UNSUPPORTED: solaris #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp @@ -2,6 +2,8 @@ // REQUIRES: stable-runtime // XFAIL: android && asan +// No libutil. +// UNSUPPORTED: solaris #include #include @@ -14,6 +16,8 @@ #include #include #include +#elif defined(__sun__) && defined(__svr4__) +#include #else #include #endif diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp @@ -81,7 +81,7 @@ setgrent(); test(&getgrent); -#if !defined(__APPLE__) +#if !defined(__APPLE__) && !(defined(__sun__) && defined(__svr4__)) setpwent(); test_r(&getpwent_r); setgrent(); diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/lstat.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/lstat.cpp --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/lstat.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/lstat.cpp @@ -8,7 +8,11 @@ struct stat st; assert(!lstat("/dev/null", &st)); +#if defined(__sun__) && defined(__svr4__) + assert(S_ISLNK(st.st_mode)); +#else assert(S_ISCHR(st.st_mode)); +#endif return 0; } diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/uname.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/uname.c --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/uname.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/uname.c @@ -7,7 +7,7 @@ int main() { struct utsname buf; int err = uname(&buf); - assert(err == 0); + assert(err >= 0); printf("%s %s %s %s %s\n", buf.sysname, buf.nodename, buf.release, buf.version, buf.machine); } diff --git a/compiler-rt/test/sanitizer_common/lit.common.cfg.py b/compiler-rt/test/sanitizer_common/lit.common.cfg.py --- a/compiler-rt/test/sanitizer_common/lit.common.cfg.py +++ b/compiler-rt/test/sanitizer_common/lit.common.cfg.py @@ -70,7 +70,7 @@ config.suffixes = ['.c', '.cpp'] -if config.host_os not in ['Linux', 'Darwin', 'NetBSD', 'FreeBSD']: +if config.host_os not in ['Linux', 'Darwin', 'NetBSD', 'FreeBSD', 'SunOS']: config.unsupported = True if not config.parallelism_group: diff --git a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py --- a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py +++ b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py @@ -30,7 +30,7 @@ config.suffixes = ['.c', '.cpp'] # Check that the host supports UndefinedBehaviorSanitizerMinimal tests -if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin', 'OpenBSD']: # TODO: Windows +if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin', 'OpenBSD', 'SunOS']: # TODO: Windows config.unsupported = True # Don't target x86_64h if the test machine can't execute x86_64h binaries.