aboutsummaryrefslogtreecommitdiff
path: root/SDKs
diff options
context:
space:
mode:
Diffstat (limited to 'SDKs')
-rw-r--r--SDKs/darwin/usr/include/errno.h17
-rw-r--r--SDKs/darwin/usr/include/string.h21
-rw-r--r--SDKs/darwin/usr/include/sys/errno.h31
3 files changed, 69 insertions, 0 deletions
diff --git a/SDKs/darwin/usr/include/errno.h b/SDKs/darwin/usr/include/errno.h
new file mode 100644
index 000000000000..f06e53713398
--- /dev/null
+++ b/SDKs/darwin/usr/include/errno.h
@@ -0,0 +1,17 @@
+/* ===-- errno.h - stub SDK header for compiler-rt --------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ * ===-----------------------------------------------------------------------===
+ *
+ * This is a stub SDK header file. This file is not part of the interface of
+ * this library nor an official version of the appropriate SDK header. It is
+ * intended only to stub the features of this header required by compiler-rt.
+ *
+ * ===-----------------------------------------------------------------------===
+ */
+
+#include <sys/errno.h>
diff --git a/SDKs/darwin/usr/include/string.h b/SDKs/darwin/usr/include/string.h
index c7da1f57ba57..c6ab5d8e5876 100644
--- a/SDKs/darwin/usr/include/string.h
+++ b/SDKs/darwin/usr/include/string.h
@@ -28,4 +28,25 @@ char *strdup(const char *);
size_t strlen(const char *);
char *strncpy(char *, const char *, size_t);
+/* Determine the appropriate strerror() function. */
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+# if defined(__i386)
+# define __STRERROR_NAME "_strerror$UNIX2003"
+# elif defined(__x86_64__) || defined(__arm)
+# define __STRERROR_NAME "_strerror"
+# else
+# error "unrecognized architecture for targetting OS X"
+# endif
+#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
+# if defined(__i386) || defined (__x86_64) || defined(__arm)
+# define __STRERROR_NAME "_strerror"
+# else
+# error "unrecognized architecture for targetting iOS"
+# endif
+#else
+# error "unrecognized architecture for targetting Darwin"
+#endif
+
+char *strerror(int) __asm(__STRERROR_NAME);
+
#endif /* __STRING_H__ */
diff --git a/SDKs/darwin/usr/include/sys/errno.h b/SDKs/darwin/usr/include/sys/errno.h
new file mode 100644
index 000000000000..4befe385535a
--- /dev/null
+++ b/SDKs/darwin/usr/include/sys/errno.h
@@ -0,0 +1,31 @@
+/* ===-- errno.h - stub SDK header for compiler-rt --------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ * ===-----------------------------------------------------------------------===
+ *
+ * This is a stub SDK header file. This file is not part of the interface of
+ * this library nor an official version of the appropriate SDK header. It is
+ * intended only to stub the features of this header required by compiler-rt.
+ *
+ * ===-----------------------------------------------------------------------===
+ */
+
+#ifndef _SYS_ERRNO_H_
+#define _SYS_ERRNO_H_
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+extern int *__error(void);
+#define errno (*__error())
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif