--- trunk/tools/llvm-readobj/ObjDumper.cpp.orig	2019-07-11 18:34:31.000000000 -0700
+++ trunk/tools/llvm-readobj/ObjDumper.cpp	2019-07-11 18:34:44.000000000 -0700
@@ -21,6 +21,20 @@
 #include "llvm/Support/raw_ostream.h"
 #include <map>
 
+#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 {
 
 ObjDumper::ObjDumper(ScopedPrinter &Writer) : W(Writer) {}
