--- trunk/tools/llvm-objcopy/MachO/MachOReader.cpp.orig	2019-07-11 18:32:43.000000000 -0700
+++ trunk/tools/llvm-objcopy/MachO/MachOReader.cpp	2019-07-11 18:33:01.000000000 -0700
@@ -13,6 +13,20 @@
 #include "llvm/Object/MachO.h"
 #include <memory>
 
+#ifdef __APPLE__
+#include <Availability.h>
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+static size_t strnlen(const char *s, size_t maxlen) {
+  size_t l = 0;
+  while (l < maxlen && *s) {
+    l++;
+    s++;
+  }
+  return l;
+}
+#endif
+#endif
+
 namespace llvm {
 namespace objcopy {
 namespace macho {
