[compiler-rt] c9174f6 - [compiler-rt] fix asan buildbot failure on unit test for darwin

David CARLIER via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 28 10:49:01 PDT 2021


Author: David CARLIER
Date: 2021-10-28T18:48:54+01:00
New Revision: c9174f63b64698be2b497f371294fcad576bbbc3

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

LOG: [compiler-rt] fix asan buildbot failure on unit test for darwin

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Posix/mmap_write_exec.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/mmap_write_exec.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/mmap_write_exec.cpp
index fb0af88cfe5a..eec2161573a7 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/mmap_write_exec.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/mmap_write_exec.cpp
@@ -7,6 +7,9 @@
 // TODO: Fix option on Android, it hangs there for unknown reasons.
 // XFAIL: android
 
+#if defined(__APPLE__)
+#include <Availability.h>
+#endif
 #include <pthread.h>
 #include <stdio.h>
 #include <sys/mman.h>
@@ -32,7 +35,10 @@ int main(int argc, char **argv) {
   (void)mprotect(q, 64, PROT_READ | PROT_EXEC);
   // CHECK-NOT: Sanitizer
 #if defined(__APPLE__)
+#  if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+      __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
   pthread_jit_write_protect_np(false);
+#  endif
   char *c = (char *)mmap(0, 128, PROT_WRITE | PROT_EXEC,
 		         MAP_ANONYMOUS | MAP_PRIVATE | MAP_JIT, -1, 0);
   // CHECK-NOT: Sanitizer


        


More information about the llvm-commits mailing list