diff --git src/ld/Options.cpp.orig src/ld/Options.cpp
index 3fea3a0..63a9919 100644
--- src/ld/Options.cpp.orig
+++ src/ld/Options.cpp
@@ -49,6 +49,32 @@
 // from FunctionNameDemangle.h
 extern "C" size_t fnd_get_demangled_name(const char *mangledName, char *outputBuffer, size_t length);
 
+#ifndef strnlen
+size_t
+strnlen (const char *s, size_t len)
+{
+    size_t i;
+
+    for(i = 0; i < len && s[i]; i++)
+        ;
+    return i;
+}
+#endif
+
+#ifndef strndup
+char *
+strndup (const char *old, size_t sz)
+{
+  size_t len = strnlen (old, sz);
+  char *t    = (char *)malloc(len + 1);
+
+  if (t != NULL) {
+    memcpy (t, old, len);
+    t[len] = '\0';
+  }
+  return t;
+}
+#endif
 
 // upward dependency on lto::version()
 namespace lto {
