diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp index 63b0ca28a1f40..890d6c11c4076 100644 --- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp @@ -8,12 +8,14 @@ // //===----------------------------------------------------------------------===// +#include "sanitizer_common/sanitizer_platform.h" +#if SANITIZER_POSIX + #include "rtsan/rtsan_interceptors.h" #include "interception/interception.h" #include "sanitizer_common/sanitizer_allocator_dlsym.h" #include "sanitizer_common/sanitizer_allocator_internal.h" -#include "sanitizer_common/sanitizer_platform.h" #include "sanitizer_common/sanitizer_platform_interceptors.h" #include "interception/interception.h" @@ -608,3 +610,5 @@ void __rtsan::InitializeInterceptors() { INTERCEPT_FUNCTION(recvfrom); INTERCEPT_FUNCTION(shutdown); } + +#endif // SANITIZER_POSIX diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp index f7a281f13e2ff..6233c3e91800e 100644 --- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp @@ -8,9 +8,11 @@ // //===----------------------------------------------------------------------===// +#include "sanitizer_common/sanitizer_platform.h" +#if SANITIZER_POSIX + #include "gtest/gtest.h" -#include "sanitizer_common/sanitizer_platform.h" #include "sanitizer_common/sanitizer_platform_interceptors.h" #include "rtsan_test_utilities.h" @@ -704,3 +706,5 @@ TEST(TestRtsanInterceptors, ShutdownOnASocketDiesWhenRealtime) { ExpectRealtimeDeath(Func, "shutdown"); ExpectNonRealtimeSurvival(Func); } + +#endif // SANITIZER_POSIX