From c254025f32afe73adf830b96ad1b6abcceb02ac9 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Wed, 27 Dec 2017 23:21:37 -0800
Subject: [PATCH 2001/2002] xray: Define O_CLOEXEC for older SDKs that don't
 have it

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 lib/xray/xray_utils.cc  | 6 ++++++
 lib/xray/xray_x86_64.cc | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git llvm_release_80/projects/compiler-rt/lib/xray/xray_utils.cc macports_release_80/projects/compiler-rt/lib/xray/xray_utils.cc
index 59ba6c308..3496d3b1b 100644
--- llvm_release_80/projects/compiler-rt/lib/xray/xray_utils.cc
+++ macports_release_80/projects/compiler-rt/lib/xray/xray_utils.cc
@@ -37,6 +37,12 @@
 #include <zircon/syscalls.h>
 #endif
 
+#ifdef __APPLE__
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0x1000000
+#endif
+#endif
+
 namespace __xray {
 
 #if SANITIZER_FUCHSIA
diff --git llvm_release_80/projects/compiler-rt/lib/xray/xray_x86_64.cc macports_release_80/projects/compiler-rt/lib/xray/xray_x86_64.cc
index e63ee1b3b..65b59ec61 100644
--- llvm_release_80/projects/compiler-rt/lib/xray/xray_x86_64.cc
+++ macports_release_80/projects/compiler-rt/lib/xray/xray_x86_64.cc
@@ -26,6 +26,12 @@
 #include <tuple>
 #include <unistd.h>
 
+#ifdef __APPLE__
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0x1000000
+#endif
+#endif
+
 namespace __xray {
 
 #if SANITIZER_LINUX
-- 
2.20.1 (Apple Git-116)

