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 @@ -575,12 +575,12 @@ #define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD) #define SANITIZER_INTERCEPT_GETRANDOM \ - ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD) + ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD || SI_SOLARIS) #define SANITIZER_INTERCEPT___CXA_ATEXIT SI_NETBSD #define SANITIZER_INTERCEPT_ATEXIT SI_NETBSD #define SANITIZER_INTERCEPT_PTHREAD_ATFORK SI_NETBSD #define SANITIZER_INTERCEPT_GETENTROPY \ - ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD) + ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD || SI_SOLARIS) #define SANITIZER_INTERCEPT_QSORT \ (SI_POSIX && !SI_IOSSIM && !SI_WATCHOS && !SI_TVOS && !SI_ANDROID) #define SANITIZER_INTERCEPT_QSORT_R SI_GLIBC diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c @@ -9,7 +9,8 @@ #define __GLIBC_PREREQ(a, b) 0 #endif -#if (defined(__linux__) && __GLIBC_PREREQ(2, 25)) || defined(__FreeBSD__) +#if (defined(__linux__) && __GLIBC_PREREQ(2, 25)) || defined(__FreeBSD__) || \ + (defined(__sun) && defined(__svr4__)) #define HAS_GETRANDOM #endif