From 469281c821580ff8c89db236b35ef0a7c651633c Mon Sep 17 00:00:00 2001
Date: Mon, 17 May 2021 17:29:16 -0700
Subject: [PATCH 12/24] compiler-rt: add some defs missing in older SDKs

---
 compiler-rt/lib/fuzzer/FuzzerUtilDarwin.cpp        | 8 ++++++++
 compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilDarwin.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilDarwin.cpp
index a5bed658a446..b853462df3d2 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilDarwin.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilDarwin.cpp
@@ -19,6 +19,14 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+// add definition missing on older systems
+#ifndef POSIX_SPAWN_SETSIGMASK
+#define POSIX_SPAWN_SETSIGMASK          0x0008
+#endif
+#ifndef POSIX_SPAWN_SETSIGDEF
+#define POSIX_SPAWN_SETSIGDEF           0x0004
+#endif
+
 // There is no header for this on macOS so declare here
 extern "C" char **environ;
 
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
index 2b53d7d730d7..6950f8757dd0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
@@ -110,6 +110,11 @@ extern "C" int __munmap(void *, size_t) SANITIZER_WEAK_ATTRIBUTE;
 #define VM_MEMORY_SANITIZER 99
 #endif
 
+// From <sys/spawn.h> but not in some SDKs
+#ifndef POSIX_SPAWN_CLOEXEC_DEFAULT
+#define	POSIX_SPAWN_CLOEXEC_DEFAULT	0x4000
+#endif
+
 // XNU on Darwin provides a mmap flag that optimizes allocation/deallocation of
 // giant memory regions (i.e. shadow memory regions).
 #define kXnuFastMmapFd 0x4
-- 
2.21.1 (Apple Git-122.3)

