[compiler-rt] 435d412 - [sanitizer] enable getrandom/getentropy on solaris based systems.

David CARLIER via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 05:13:00 PDT 2023


Author: David CARLIER
Date: 2023-08-28T13:12:07+01:00
New Revision: 435d4124f2740f649f18e980d655cb26bee9d8cd

URL: https://github.com/llvm/llvm-project/commit/435d4124f2740f649f18e980d655cb26bee9d8cd
DIFF: https://github.com/llvm/llvm-project/commit/435d4124f2740f649f18e980d655cb26bee9d8cd.diff

LOG: [sanitizer] enable getrandom/getentropy on solaris based systems.

Reviewers: vitalybuka

Reviewed-By: vitalybuka

Differential Revision: https://reviews.llvm.org/D156578

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
    compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index c740778b6228f0..8c7c00de6d1292 100644
--- 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
index 3e4ef7524c94cf..abd4c82919c347 100644
--- 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
 


        


More information about the llvm-commits mailing list