Skip to content

Commit 435d412

Browse files
committed
[sanitizer] enable getrandom/getentropy on solaris based systems.
Reviewers: vitalybuka Reviewed-By: vitalybuka Differential Revision: https://reviews.llvm.org/D156578
1 parent c1ad5ba commit 435d412

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,12 @@
575575
#define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD)
576576

577577
#define SANITIZER_INTERCEPT_GETRANDOM \
578-
((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
578+
((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD || SI_SOLARIS)
579579
#define SANITIZER_INTERCEPT___CXA_ATEXIT SI_NETBSD
580580
#define SANITIZER_INTERCEPT_ATEXIT SI_NETBSD
581581
#define SANITIZER_INTERCEPT_PTHREAD_ATFORK SI_NETBSD
582582
#define SANITIZER_INTERCEPT_GETENTROPY \
583-
((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
583+
((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD || SI_SOLARIS)
584584
#define SANITIZER_INTERCEPT_QSORT \
585585
(SI_POSIX && !SI_IOSSIM && !SI_WATCHOS && !SI_TVOS && !SI_ANDROID)
586586
#define SANITIZER_INTERCEPT_QSORT_R SI_GLIBC

compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#define __GLIBC_PREREQ(a, b) 0
1010
#endif
1111

12-
#if (defined(__linux__) && __GLIBC_PREREQ(2, 25)) || defined(__FreeBSD__)
12+
#if (defined(__linux__) && __GLIBC_PREREQ(2, 25)) || defined(__FreeBSD__) || \
13+
(defined(__sun) && defined(__svr4__))
1314
#define HAS_GETRANDOM
1415
#endif
1516

0 commit comments

Comments
 (0)