<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff --git a/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp b/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
index 380f2e98..dbfe8ce6 100644
--- a/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
+++ b/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
@@ -11,6 +11,21 @@
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/ErrorHandling.h"
 
+
+#ifdef __APPLE__
+#include &lt;Availability.h&gt;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 1070
+static size_t strnlen(const char *s, size_t maxlen) {
+  size_t l = 0;
+  while (l &lt; maxlen &amp;&amp; *s) {
+    l++;
+    s++;
+  }
+  return l;
+}
+#endif
+#endif
+
 namespace llvm {
 namespace objcopy {
 namespace macho {
diff --git a/tools/llvm-objcopy/MachO/Object.cpp b/tools/llvm-objcopy/MachO/Object.cpp
index d3b4fdc2..3f88377b 100644
--- a/tools/llvm-objcopy/MachO/Object.cpp
+++ b/tools/llvm-objcopy/MachO/Object.cpp
@@ -1,6 +1,20 @@
 #include "Object.h"
 #include "../llvm-objcopy.h"
 
+#ifdef __APPLE__
+#include &lt;Availability.h&gt;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 1070
+static size_t strnlen(const char *s, size_t maxlen) {
+  size_t l = 0;
+  while (l &lt; maxlen &amp;&amp; *s) {
+    l++;
+    s++;
+  }
+  return l;
+}
+#endif
+#endif
+
 namespace llvm {
 namespace objcopy {
 namespace macho {
</pre></body></html>