Commit fdd775b3bf

Andrew Kelley <andrew@ziglang.org>
2020-11-09 04:15:08
macOS libc headers: add xlocale.h and Block.h
These are both included by libcxx.
1 parent eed5814
lib/libc/include/x86_64-macos-gnu/xlocale/__wctype.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE___WCTYPE_H_
+#define _XLOCALE___WCTYPE_H_
+
+#include <__wctype.h>
+#include <xlocale/_ctype.h>
+
+#if !defined(_DONT_USE_CTYPE_INLINE_) && \
+    (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
+
+__DARWIN_WCTYPE_TOP_inline int
+iswalnum_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_A|_CTYPE_D, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswalpha_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_A, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswcntrl_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_C, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswctype_l(wint_t _wc, wctype_t _charclass, locale_t _l)
+{
+	return (__istype_l(_wc, _charclass, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswdigit_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_D, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswgraph_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_G, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswlower_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_L, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswprint_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_R, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswpunct_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_P, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswspace_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_S, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswupper_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_U, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswxdigit_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_X, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline wint_t
+towlower_l(wint_t _wc, locale_t _l)
+{
+        return (__tolower_l(_wc, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline wint_t
+towupper_l(wint_t _wc, locale_t _l)
+{
+        return (__toupper_l(_wc, _l));
+}
+
+#else /* not using inlines */
+
+__BEGIN_DECLS
+int	iswalnum_l(wint_t, locale_t);
+int	iswalpha_l(wint_t, locale_t);
+int	iswcntrl_l(wint_t, locale_t);
+int	iswctype_l(wint_t, wctype_t, locale_t);
+int	iswdigit_l(wint_t, locale_t);
+int	iswgraph_l(wint_t, locale_t);
+int	iswlower_l(wint_t, locale_t);
+int	iswprint_l(wint_t, locale_t);
+int	iswpunct_l(wint_t, locale_t);
+int	iswspace_l(wint_t, locale_t);
+int	iswupper_l(wint_t, locale_t);
+int	iswxdigit_l(wint_t, locale_t);
+wint_t	towlower_l(wint_t, locale_t);
+wint_t	towupper_l(wint_t, locale_t);
+__END_DECLS
+
+#endif /* using inlines */
+
+__BEGIN_DECLS
+wctype_t
+	wctype_l(const char *, locale_t);
+__END_DECLS
+
+#endif /* _XLOCALE___WCTYPE_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_ctype.h
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__CTYPE_H_
+#define _XLOCALE__CTYPE_H_
+
+#include <_ctype.h>
+#include <_xlocale.h>
+
+/*
+ * Use inline functions if we are allowed to and the compiler supports them.
+ */
+#if !defined(_DONT_USE_CTYPE_INLINE_) && \
+    (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
+
+/* See comments in <machine/_type.h> about __darwin_ct_rune_t. */
+__BEGIN_DECLS
+unsigned long		___runetype_l(__darwin_ct_rune_t, locale_t);
+__darwin_ct_rune_t	___tolower_l(__darwin_ct_rune_t, locale_t);
+__darwin_ct_rune_t	___toupper_l(__darwin_ct_rune_t, locale_t);
+__END_DECLS
+
+__BEGIN_DECLS
+int             	__maskrune_l(__darwin_ct_rune_t, unsigned long, locale_t);
+__END_DECLS
+
+__DARWIN_CTYPE_inline int
+__istype_l(__darwin_ct_rune_t _c, unsigned long _f, locale_t _l)
+{
+	return !!(isascii(_c) ? (_DefaultRuneLocale.__runetype[_c] & _f)
+		: __maskrune_l(_c, _f, _l));
+}
+
+__DARWIN_CTYPE_inline __darwin_ct_rune_t
+__toupper_l(__darwin_ct_rune_t _c, locale_t _l)
+{
+	return isascii(_c) ? _DefaultRuneLocale.__mapupper[_c]
+		: ___toupper_l(_c, _l);
+}
+
+__DARWIN_CTYPE_inline __darwin_ct_rune_t
+__tolower_l(__darwin_ct_rune_t _c, locale_t _l)
+{
+	return isascii(_c) ? _DefaultRuneLocale.__maplower[_c]
+		: ___tolower_l(_c, _l);
+}
+
+__DARWIN_CTYPE_inline int
+__wcwidth_l(__darwin_ct_rune_t _c, locale_t _l)
+{
+	unsigned int _x;
+
+	if (_c == 0)
+		return (0);
+	_x = (unsigned int)__maskrune_l(_c, _CTYPE_SWM|_CTYPE_R, _l);
+	if ((_x & _CTYPE_SWM) != 0)
+		return ((_x & _CTYPE_SWM) >> _CTYPE_SWS);
+	return ((_x & _CTYPE_R) != 0 ? 1 : -1);
+}
+
+#ifndef _EXTERNALIZE_CTYPE_INLINES_
+
+__DARWIN_CTYPE_TOP_inline int
+digittoint_l(int c, locale_t l)
+{
+	return (__maskrune_l(c, 0x0F, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isalnum_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_A|_CTYPE_D, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isalpha_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_A, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isblank_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_B, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+iscntrl_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_C, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isdigit_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_D, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isgraph_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_G, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+ishexnumber_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_X, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isideogram_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_I, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+islower_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_L, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isnumber_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_D, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isphonogram_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_Q, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isprint_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_R, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+ispunct_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_P, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isrune_l(int c, locale_t l)
+{
+	return (__istype_l(c, 0xFFFFFFF0L, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isspace_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_S, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isspecial_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_T, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isupper_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_U, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+isxdigit_l(int c, locale_t l)
+{
+	return (__istype_l(c, _CTYPE_X, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+tolower_l(int c, locale_t l)
+{
+        return (__tolower_l(c, l));
+}
+
+__DARWIN_CTYPE_TOP_inline int
+toupper_l(int c, locale_t l)
+{
+        return (__toupper_l(c, l));
+}
+#endif /* _EXTERNALIZE_CTYPE_INLINES_ */
+
+#else /* not using inlines */
+
+__BEGIN_DECLS
+int     digittoint_l(int, locale_t);
+int     isalnum_l(int, locale_t);
+int     isalpha_l(int, locale_t);
+int     isblank_l(int, locale_t);
+int     iscntrl_l(int, locale_t);
+int     isdigit_l(int, locale_t);
+int     isgraph_l(int, locale_t);
+int     ishexnumber_l(int, locale_t);
+int     isideogram_l(int, locale_t);
+int     islower_l(int, locale_t);
+int     isnumber_l(int, locale_t);
+int     isphonogram_l(int, locale_t);
+int     isprint_l(int, locale_t);
+int     ispunct_l(int, locale_t);
+int     isrune_l(int, locale_t);
+int     isspace_l(int, locale_t);
+int     isspecial_l(int, locale_t);
+int     isupper_l(int, locale_t);
+int     isxdigit_l(int, locale_t);
+int     tolower_l(int, locale_t);
+int     toupper_l(int, locale_t);
+__END_DECLS
+#endif /* using inlines */
+
+#endif /* _XLOCALE__CTYPE_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_inttypes.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__INTTYPES_H_
+#define _XLOCALE__INTTYPES_H_
+
+#include <sys/cdefs.h>
+#include <stdint.h>
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+intmax_t  strtoimax_l(const char * __restrict nptr, char ** __restrict endptr,
+		int base, locale_t);
+uintmax_t strtoumax_l(const char * __restrict nptr, char ** __restrict endptr,
+		int base, locale_t);
+intmax_t  wcstoimax_l(const wchar_t * __restrict nptr,
+		wchar_t ** __restrict endptr, int base, locale_t);
+uintmax_t wcstoumax_l(const wchar_t * __restrict nptr,
+		wchar_t ** __restrict endptr, int base, locale_t);
+
+/* Poison the following routines if -fshort-wchar is set */
+#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
+#pragma GCC poison wcstoimax_l wcstoumax_l
+#endif
+__END_DECLS
+
+#endif /* _XLOCALE__INTTYPES_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_langinfo.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__LANGINFO_H_
+#define _XLOCALE__LANGINFO_H_
+
+#include <sys/cdefs.h>
+#include <_types/_nl_item.h>
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+char	*nl_langinfo_l(nl_item, locale_t);
+__END_DECLS
+
+#endif /* _XLOCALE__LANGINFO_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_monetary.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2005, 2009 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__MONETARY_H_
+#define _XLOCALE__MONETARY_H_
+
+#include <sys/cdefs.h>
+#include <_types.h>
+#include <sys/_types/_size_t.h>
+#include <sys/_types/_ssize_t.h>
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+ssize_t	strfmon_l(char *, size_t, locale_t, const char *, ...)
+		__strfmonlike(4, 5);
+__END_DECLS
+
+#endif /* _XLOCALE__MONETARY_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_regex.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__REGEX_H_
+#define _XLOCALE__REGEX_H_
+
+#ifndef _REGEX_H_
+#include <_regex.h>
+#endif // _REGEX_H_
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+
+int	regcomp_l(regex_t * __restrict, const char * __restrict, int,
+	    locale_t __restrict)
+	    __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+
+int	regncomp_l(regex_t * __restrict, const char * __restrict, size_t,
+	    int, locale_t __restrict)
+	    __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+int	regwcomp_l(regex_t * __restrict, const wchar_t * __restrict,
+	    int, locale_t __restrict)
+	    __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+int	regwnexec_l(const regex_t * __restrict, const wchar_t * __restrict,
+	    size_t, size_t, regmatch_t __pmatch[ __restrict], int,
+	    locale_t __restrict)
+	    __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
+
+__END_DECLS
+
+#endif /* _XLOCALE__REGEX_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_stdio.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2005, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__STDIO_H_
+#define _XLOCALE__STDIO_H_
+
+#include <_stdio.h>
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+
+int	 fprintf_l(FILE * __restrict, locale_t __restrict, const char * __restrict, ...)
+        __printflike(3, 4);
+int	 fscanf_l(FILE * __restrict, locale_t __restrict, const char * __restrict, ...)
+        __scanflike(3, 4);
+int	 printf_l(locale_t __restrict, const char * __restrict, ...)
+        __printflike(2, 3);
+int	 scanf_l(locale_t __restrict, const char * __restrict, ...)
+        __scanflike(2, 3);
+int	 sprintf_l(char * __restrict, locale_t __restrict, const char * __restrict, ...)
+        __printflike(3, 4) __swift_unavailable("Use snprintf_l instead.");
+int	 sscanf_l(const char * __restrict, locale_t __restrict, const char * __restrict, ...) 
+        __scanflike(3, 4);
+int	 vfprintf_l(FILE * __restrict, locale_t __restrict, const char * __restrict, va_list)
+        __printflike(3, 0);
+int	 vprintf_l(locale_t __restrict, const char * __restrict, va_list)
+        __printflike(2, 0);
+int	 vsprintf_l(char * __restrict, locale_t __restrict, const char * __restrict, va_list)
+        __printflike(3, 0) __swift_unavailable("Use vsnprintf_l instead.");
+
+#if __DARWIN_C_LEVEL >= 200112L || defined(__cplusplus)
+int	 snprintf_l(char * __restrict, size_t, locale_t __restrict, const char * __restrict, ...)
+        __printflike(4, 5);
+int	 vfscanf_l(FILE * __restrict, locale_t __restrict, const char * __restrict, va_list)
+        __scanflike(3, 0);
+int	 vscanf_l(locale_t __restrict, const char * __restrict, va_list)
+        __scanflike(2, 0);
+int	 vsnprintf_l(char * __restrict, size_t, locale_t __restrict, const char * __restrict, va_list)
+        __printflike(4, 0);
+int	 vsscanf_l(const char * __restrict, locale_t __restrict, const char * __restrict, va_list)
+        __scanflike(3, 0);
+#endif
+
+#if __DARWIN_C_LEVEL >= 200809L || defined(__cplusplus)
+int	 dprintf_l(int, locale_t __restrict, const char * __restrict, ...)
+        __printflike(3, 4) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+int	 vdprintf_l(int, locale_t __restrict, const char * __restrict, va_list)
+        __printflike(3, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+#endif
+
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL || defined(__cplusplus)
+int	 asprintf_l(char ** __restrict, locale_t __restrict, const char * __restrict, ...)
+        __printflike(3, 4);
+int	 vasprintf_l(char ** __restrict, locale_t __restrict, const char * __restrict, va_list)
+        __printflike(3, 0);
+#endif
+
+__END_DECLS
+
+
+#endif /* _XLOCALE__STDIO_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_stdlib.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__STDLIB_H_
+#define _XLOCALE__STDLIB_H_
+
+#include <sys/cdefs.h>
+#include <sys/_types/_size_t.h>
+#include <sys/_types/_wchar_t.h>
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+double	 atof_l(const char *, locale_t);
+int	 atoi_l(const char *, locale_t);
+long	 atol_l(const char *, locale_t);
+#if !__DARWIN_NO_LONG_LONG
+long long
+	 atoll_l(const char *, locale_t);
+#endif /* !__DARWIN_NO_LONG_LONG */
+int	 mblen_l(const char *, size_t, locale_t);
+size_t	 mbstowcs_l(wchar_t * __restrict , const char * __restrict, size_t,
+	    locale_t);
+int	 mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
+	    locale_t);
+double	 strtod_l(const char *, char **, locale_t) __DARWIN_ALIAS(strtod_l);
+float	 strtof_l(const char *, char **, locale_t) __DARWIN_ALIAS(strtof_l);
+long	 strtol_l(const char *, char **, int, locale_t);
+long double
+	 strtold_l(const char *, char **, locale_t);
+long long
+	 strtoll_l(const char *, char **, int, locale_t);
+#if !__DARWIN_NO_LONG_LONG
+long long
+	 strtoq_l(const char *, char **, int, locale_t);
+#endif /* !__DARWIN_NO_LONG_LONG */
+unsigned long
+	 strtoul_l(const char *, char **, int, locale_t);
+unsigned long long
+	 strtoull_l(const char *, char **, int, locale_t);
+#if !__DARWIN_NO_LONG_LONG
+unsigned long long
+	 strtouq_l(const char *, char **, int, locale_t);
+#endif /* !__DARWIN_NO_LONG_LONG */
+size_t	 wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t,
+	    locale_t);
+int	 wctomb_l(char *, wchar_t, locale_t);
+
+/* Poison the following routines if -fshort-wchar is set */
+#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
+#pragma GCC poison mbstowcs_l mbtowc_l wcstombs_l wctomb_l
+#endif
+__END_DECLS
+
+#endif /* _XLOCALE__STDLIB_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_string.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__STRING_H_
+#define _XLOCALE__STRING_H_
+
+#include <sys/cdefs.h>
+#include <sys/_types/_size_t.h>
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+int	 strcoll_l(const char *, const char *, locale_t);
+size_t	 strxfrm_l(char *, const char *, size_t, locale_t);
+int	 strcasecmp_l(const char *, const char *, locale_t);
+char    *strcasestr_l(const char *, const char *, locale_t);
+int	 strncasecmp_l(const char *, const char *, size_t, locale_t);
+__END_DECLS
+
+#endif /* _XLOCALE__STRING_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_time.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2005, 2009 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__TIME_H_
+#define _XLOCALE__TIME_H_
+
+#include <sys/cdefs.h>
+#include <sys/_types/_size_t.h>
+#include <_types.h>
+#include <_xlocale.h>
+
+__BEGIN_DECLS
+size_t	 strftime_l(char * __restrict, size_t, const char * __restrict,
+		const struct tm * __restrict, locale_t)
+		__DARWIN_ALIAS(strftime_l) __strftimelike(3);
+char	*strptime_l(const char * __restrict, const char * __restrict,
+		struct tm * __restrict, locale_t) 
+		__DARWIN_ALIAS(strptime_l) __strftimelike(2);
+__END_DECLS
+
+#endif /* _XLOCALE__TIME_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_wchar.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__WCHAR_H_
+#define _XLOCALE__WCHAR_H_
+
+#include <_stdio.h>
+#include <_xlocale.h>
+#include <sys/_types/_mbstate_t.h>
+
+/* Initially added in Issue 4 */
+__BEGIN_DECLS
+wint_t	btowc_l(int, locale_t);
+wint_t	fgetwc_l(FILE *, locale_t);
+wchar_t	*fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t);
+wint_t	fputwc_l(wchar_t, FILE *, locale_t);
+int	fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t);
+int	fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+int	fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+wint_t	getwc_l(FILE *, locale_t);
+wint_t	getwchar_l(locale_t);
+size_t	mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict,
+	    locale_t);
+size_t	mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+int	mbsinit_l(const mbstate_t *, locale_t);
+size_t	mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+wint_t	putwc_l(wchar_t, FILE *, locale_t);
+wint_t	putwchar_l(wchar_t, locale_t);
+int	swprintf_l(wchar_t * __restrict, size_t n, locale_t,
+		const wchar_t * __restrict, ...);
+int	swscanf_l(const wchar_t * __restrict, locale_t,
+		const wchar_t * __restrict, ...);
+wint_t	ungetwc_l(wint_t, FILE *, locale_t);
+int	vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
+		__darwin_va_list);
+int	vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
+		const wchar_t * __restrict, __darwin_va_list);
+int	vwprintf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
+size_t	wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict,
+	    locale_t);
+int	wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
+size_t	wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict,
+		const struct tm * __restrict, locale_t)
+		__DARWIN_ALIAS(wcsftime_l);
+size_t	wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+double	wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
+long	wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+	    locale_t);
+unsigned long
+	wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+	    locale_t);
+int	wcswidth_l(const wchar_t *, size_t, locale_t);
+size_t	wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t,
+	    locale_t);
+int	wctob_l(wint_t, locale_t);
+int	wcwidth_l(wchar_t, locale_t);
+int	wprintf_l(locale_t, const wchar_t * __restrict, ...);
+int	wscanf_l(locale_t, const wchar_t * __restrict, ...);
+__END_DECLS
+ 
+ 
+ 
+/* Additional functionality provided by:
+ * POSIX.1-2001
+ */
+
+#if __DARWIN_C_LEVEL >= 200112L
+__BEGIN_DECLS
+int	vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
+		__darwin_va_list);
+int	vswscanf_l(const wchar_t * __restrict, locale_t,
+		const wchar_t * __restrict, __darwin_va_list);
+int	vwscanf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
+float	wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
+long double
+	wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
+#if !__DARWIN_NO_LONG_LONG
+long long
+	wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+	    locale_t);
+unsigned long long
+	wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+	    locale_t);
+#endif /* !__DARWIN_NO_LONG_LONG */
+__END_DECLS
+#endif /* __DARWIN_C_LEVEL >= 200112L */
+
+
+
+/* Additional functionality provided by:
+ * POSIX.1-2008
+ */
+
+#if __DARWIN_C_LEVEL >= 200809L
+__BEGIN_DECLS
+size_t	mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict, locale_t);
+int     wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+int     wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t n, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+size_t	wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict, locale_t);
+__END_DECLS
+#endif /* __DARWIN_C_LEVEL >= 200809L */
+
+
+
+/* Darwin extensions */
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+__BEGIN_DECLS
+wchar_t	*fgetwln_l(FILE * __restrict, size_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+__END_DECLS
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
+
+
+
+/* Poison the following routines if -fshort-wchar is set */
+#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
+#pragma GCC poison fgetwln_l fgetws_l fputwc_l fputws_l fwprintf_l fwscanf_l mbrtowc_l mbsnrtowcs_l mbsrtowcs_l putwc_l putwchar_l swprintf_l swscanf_l vfwprintf_l vfwscanf_l vswprintf_l vswscanf_l vwprintf_l vwscanf_l wcrtomb_l wcscoll_l wcsftime_l wcsftime_l wcsnrtombs_l wcsrtombs_l wcstod_l wcstof_l wcstol_l wcstold_l wcstoll_l wcstoul_l wcstoull_l wcswidth_l wcsxfrm_l wcwidth_l wprintf_l wscanf_l
+#endif
+
+#endif /* _XLOCALE__WCHAR_H_ */
lib/libc/include/x86_64-macos-gnu/xlocale/_wctype.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__WCTYPE_H_
+#define _XLOCALE__WCTYPE_H_
+
+#include <__wctype.h>
+#include <_types/_wctrans_t.h>
+#include <xlocale/_ctype.h>
+
+#if !defined(_DONT_USE_CTYPE_INLINE_) && \
+    (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
+
+__DARWIN_WCTYPE_TOP_inline int
+iswblank_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_B, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswhexnumber_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_X, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswideogram_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_I, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswnumber_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_D, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswphonogram_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_Q, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswrune_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, 0xFFFFFFF0L, _l));
+}
+
+__DARWIN_WCTYPE_TOP_inline int
+iswspecial_l(wint_t _wc, locale_t _l)
+{
+	return (__istype_l(_wc, _CTYPE_T, _l));
+}
+
+#else /* not using inlines */
+
+__BEGIN_DECLS
+int	iswblank_l(wint_t, locale_t);
+wint_t	iswhexnumber_l(wint_t, locale_t);
+wint_t	iswideogram_l(wint_t, locale_t);
+wint_t	iswnumber_l(wint_t, locale_t);
+wint_t	iswphonogram_l(wint_t, locale_t);
+wint_t	iswrune_l(wint_t, locale_t);
+wint_t	iswspecial_l(wint_t, locale_t);
+__END_DECLS
+
+#endif /* using inlines */
+
+__BEGIN_DECLS
+wint_t	nextwctype_l(wint_t, wctype_t, locale_t);
+wint_t	towctrans_l(wint_t, wctrans_t, locale_t);
+wctrans_t
+	wctrans_l(const char *, locale_t);
+__END_DECLS
+
+#endif /* _XLOCALE__WCTYPE_H_ */
lib/libc/include/x86_64-macos-gnu/_xlocale.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef __XLOCALE_H_
+#define __XLOCALE_H_
+
+#include <sys/cdefs.h>
+
+struct _xlocale; /* forward reference */
+typedef struct _xlocale *		locale_t;
+
+__BEGIN_DECLS
+int		___mb_cur_max(void);
+int		___mb_cur_max_l(locale_t);
+__END_DECLS
+
+#endif /* __XLOCALE_H_ */
lib/libc/include/x86_64-macos-gnu/Block.h
@@ -0,0 +1,64 @@
+/*
+ *  Block.h
+ *
+ * Copyright (c) 2008-2010 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LLVM_LICENSE_HEADER@
+ *
+ */
+
+#ifndef _Block_H_
+#define _Block_H_
+
+#if !defined(BLOCK_EXPORT)
+#   if defined(__cplusplus)
+#       define BLOCK_EXPORT extern "C" 
+#   else
+#       define BLOCK_EXPORT extern
+#   endif
+#endif
+
+#include <Availability.h>
+#include <TargetConditionals.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+// Create a heap based copy of a Block or simply add a reference to an existing one.
+// This must be paired with Block_release to recover memory, even when running
+// under Objective-C Garbage Collection.
+BLOCK_EXPORT void *_Block_copy(const void *aBlock)
+    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+
+// Lose the reference, and if heap based and last reference, recover the memory
+BLOCK_EXPORT void _Block_release(const void *aBlock)
+    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+
+
+// Used by the compiler. Do not call this function yourself.
+BLOCK_EXPORT void _Block_object_assign(void *, const void *, const int)
+    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+
+// Used by the compiler. Do not call this function yourself.
+BLOCK_EXPORT void _Block_object_dispose(const void *, const int)
+    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+
+// Used by the compiler. Do not use these variables yourself.
+BLOCK_EXPORT void * _NSConcreteGlobalBlock[32]
+    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+BLOCK_EXPORT void * _NSConcreteStackBlock[32]
+    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+
+
+#if __cplusplus
+}
+#endif
+
+// Type correct macros
+
+#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
+#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
+
+
+#endif
lib/libc/include/x86_64-macos-gnu/TargetConditionals.h
@@ -0,0 +1,502 @@
+/*
+ * Copyright (c) 2000-2014 by Apple Inc.. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+ 
+/*
+     File:       TargetConditionals.h
+ 
+     Contains:   Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone
+     
+                 Note:  TargetConditionals.h in 3.4 Universal Interfaces works
+                        with all compilers.  This header only recognizes compilers
+                        known to run on Mac OS X.
+  
+*/
+
+#ifndef __TARGETCONDITIONALS__
+#define __TARGETCONDITIONALS__
+
+/****************************************************************************************************
+
+    TARGET_CPU_*    
+    These conditionals specify which microprocessor instruction set is being
+    generated.  At most one of these is true, the rest are false.
+
+        TARGET_CPU_PPC          - Compiler is generating PowerPC instructions for 32-bit mode
+        TARGET_CPU_PPC64        - Compiler is generating PowerPC instructions for 64-bit mode
+        TARGET_CPU_68K          - Compiler is generating 680x0 instructions
+        TARGET_CPU_X86          - Compiler is generating x86 instructions for 32-bit mode
+        TARGET_CPU_X86_64       - Compiler is generating x86 instructions for 64-bit mode
+        TARGET_CPU_ARM          - Compiler is generating ARM instructions for 32-bit mode
+        TARGET_CPU_ARM64        - Compiler is generating ARM instructions for 64-bit mode
+        TARGET_CPU_MIPS         - Compiler is generating MIPS instructions
+        TARGET_CPU_SPARC        - Compiler is generating Sparc instructions
+        TARGET_CPU_ALPHA        - Compiler is generating Dec Alpha instructions
+
+
+    TARGET_OS_* 
+    These conditionals specify in which Operating System the generated code will
+    run.  Indention is used to show which conditionals are evolutionary subclasses.  
+    
+    The MAC/WIN32/UNIX conditionals are mutually exclusive.
+    The IOS/TV/WATCH conditionals are mutually exclusive.
+    
+    
+        TARGET_OS_WIN32           - Generated code will run under 32-bit Windows
+        TARGET_OS_UNIX            - Generated code will run under some Unix (not OSX) 
+        TARGET_OS_MAC             - Generated code will run under Mac OS X variant
+           TARGET_OS_OSX          - Generated code will run under OS X devices
+           TARGET_OS_IPHONE          - Generated code for firmware, devices, or simulator
+              TARGET_OS_IOS             - Generated code will run under iOS 
+              TARGET_OS_TV              - Generated code will run under Apple TV OS
+              TARGET_OS_WATCH           - Generated code will run under Apple Watch OS
+              TARGET_OS_BRIDGE          - Generated code will run under Bridge devices
+              TARGET_OS_MACCATALYST     - Generated code will run under macOS
+           TARGET_OS_SIMULATOR      - Generated code will run under a simulator
+       
+        TARGET_OS_EMBEDDED        - DEPRECATED: Use TARGET_OS_IPHONE and/or TARGET_OS_SIMULATOR instead
+        TARGET_IPHONE_SIMULATOR   - DEPRECATED: Same as TARGET_OS_SIMULATOR
+        TARGET_OS_NANO            - DEPRECATED: Same as TARGET_OS_WATCH
+
+      +----------------------------------------------------------------+
+      |                TARGET_OS_MAC                                   |
+      | +---+  +-----------------------------------------------------+ |
+      | |   |  |          TARGET_OS_IPHONE                           | |
+      | |OSX|  | +-----+ +----+ +-------+ +--------+ +-------------+ | |
+      | |   |  | | IOS | | TV | | WATCH | | BRIDGE | | MACCATALYST | | |
+      | |   |  | +-----+ +----+ +-------+ +--------+ +-------------+ | |
+      | +---+  +-----------------------------------------------------+ |
+      +----------------------------------------------------------------+
+
+    TARGET_RT_* 
+    These conditionals specify in which runtime the generated code will
+    run. This is needed when the OS and CPU support more than one runtime
+    (e.g. Mac OS X supports CFM and mach-o).
+
+        TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
+        TARGET_RT_BIG_ENDIAN    - Generated code uses big endian format for integers    
+        TARGET_RT_64_BIT        - Generated code uses 64-bit pointers    
+        TARGET_RT_MAC_CFM       - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
+        TARGET_RT_MAC_MACHO     - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used
+        
+
+****************************************************************************************************/
+ 
+ /*
+ * TARGET_OS conditionals can be enabled via clang preprocessor extensions:
+ *
+ *      __is_target_arch
+ *      __is_target_vendor
+ *      __is_target_os
+ *      __is_target_environment
+ *
+ *  “-target=x86_64-apple-ios12-macabi”
+ *      TARGET_OS_MAC=1
+ *      TARGET_OS_IPHONE=1
+ *      TARGET_OS_IOS=1
+ *      TARGET_OS_MACCATALYST=1
+ *
+ *  “-target=x86_64-apple-ios12-simulator”
+ *      TARGET_OS_MAC=1
+ *      TARGET_OS_IPHONE=1
+ *      TARGET_OS_IOS=1
+ *      TARGET_OS_SIMULATOR=1
+ *
+ * DYNAMIC_TARGETS_ENABLED indicates that the core TARGET_OS macros were enabled via clang preprocessor extensions.
+ * If this value is not set, the macro enablements will fall back to the static behavior.
+ * It is disabled by default.
+ */
+
+#if defined(__has_builtin)
+ #if __has_builtin(__is_target_arch)
+  #if __has_builtin(__is_target_vendor)
+   #if __has_builtin(__is_target_os)
+    #if __has_builtin(__is_target_environment)
+
+    /* “-target=x86_64-apple-ios12-macabi” */
+    #if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi)
+        #define TARGET_OS_OSX               0
+        #define TARGET_OS_IPHONE            1
+        #define TARGET_OS_IOS               1
+        #define TARGET_OS_WATCH             0
+        
+        #define TARGET_OS_TV                0
+        #define TARGET_OS_SIMULATOR         0
+        #define TARGET_OS_EMBEDDED          0    
+        #define TARGET_OS_RTKIT             0
+        #define TARGET_OS_MACCATALYST       1
+        #define TARGET_OS_MACCATALYST            1
+        #ifndef TARGET_OS_UIKITFORMAC
+         #define TARGET_OS_UIKITFORMAC      1
+        #endif
+        #define TARGET_OS_DRIVERKIT         0
+        #define DYNAMIC_TARGETS_ENABLED     1
+    #endif 
+
+    /* “-target=x86_64-apple-ios12-simulator” */
+    #if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(simulator)
+        #define TARGET_OS_OSX               0
+        #define TARGET_OS_IPHONE            1
+        #define TARGET_OS_IOS               1
+        #define TARGET_OS_WATCH             0
+        
+        #define TARGET_OS_TV                0
+        #define TARGET_OS_SIMULATOR         1
+        #define TARGET_OS_EMBEDDED          0    
+        #define TARGET_OS_RTKIT             0
+        #define TARGET_OS_MACCATALYST       0
+        #define TARGET_OS_MACCATALYST            0
+        #ifndef TARGET_OS_UIKITFORMAC
+         #define TARGET_OS_UIKITFORMAC      0
+        #endif
+        #define TARGET_OS_DRIVERKIT         0
+        #define DYNAMIC_TARGETS_ENABLED     1
+    #endif 
+
+    /* -target=x86_64-apple-driverkit19.0 */
+    #if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(driverkit)
+        #define TARGET_OS_OSX               0
+        #define TARGET_OS_IPHONE            0
+        #define TARGET_OS_IOS               0
+        #define TARGET_OS_WATCH             0
+        
+        #define TARGET_OS_TV                0
+        #define TARGET_OS_SIMULATOR         0
+        #define TARGET_OS_EMBEDDED          0
+        #define TARGET_OS_RTKIT             0
+        #define TARGET_OS_MACCATALYST       0
+        #define TARGET_OS_MACCATALYST            0
+        #ifndef TARGET_OS_UIKITFORMAC
+         #define TARGET_OS_UIKITFORMAC      0
+        #endif
+        #define TARGET_OS_DRIVERKIT         1
+        #define DYNAMIC_TARGETS_ENABLED     1
+    #endif
+
+    #endif /* #if __has_builtin(__is_target_environment) */
+   #endif /* #if __has_builtin(__is_target_os) */
+  #endif /* #if __has_builtin(__is_target_vendor) */
+ #endif /* #if __has_builtin(__is_target_arch) */
+#endif /* #if defined(__has_builtin) */
+
+
+#ifndef DYNAMIC_TARGETS_ENABLED
+ #define DYNAMIC_TARGETS_ENABLED   0
+#endif /* DYNAMIC_TARGETS_ENABLED */
+
+/*
+ *    gcc based compiler used on Mac OS X
+ */
+#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
+    #define TARGET_OS_MAC               1
+    #define TARGET_OS_WIN32             0
+    #define TARGET_OS_UNIX              0
+
+    #if !DYNAMIC_TARGETS_ENABLED
+        #define TARGET_OS_OSX               1
+        #define TARGET_OS_IPHONE            0
+        #define TARGET_OS_IOS               0
+        #define TARGET_OS_WATCH             0
+        
+        #define TARGET_OS_TV                0
+        #define TARGET_OS_MACCATALYST       0
+        #define TARGET_OS_MACCATALYST            0
+        #ifndef TARGET_OS_UIKITFORMAC
+         #define TARGET_OS_UIKITFORMAC      0
+        #endif
+        #define TARGET_OS_SIMULATOR         0
+        #define TARGET_OS_EMBEDDED          0 
+        #define TARGET_OS_RTKIT             0 
+        #define TARGET_OS_DRIVERKIT         0
+    #endif
+    
+    #define TARGET_IPHONE_SIMULATOR     TARGET_OS_SIMULATOR /* deprecated */
+    #define TARGET_OS_NANO              TARGET_OS_WATCH /* deprecated */ 
+    #define TARGET_ABI_USES_IOS_VALUES  (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST)
+    #if defined(__ppc__)
+        #define TARGET_CPU_PPC          1
+        #define TARGET_CPU_PPC64        0
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          0
+        #define TARGET_CPU_X86_64       0
+        #define TARGET_CPU_ARM          0
+        #define TARGET_CPU_ARM64        0
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0   
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_LITTLE_ENDIAN 0
+        #define TARGET_RT_BIG_ENDIAN    1
+        #define TARGET_RT_64_BIT        0
+        #ifdef __MACOS_CLASSIC__
+           #define TARGET_RT_MAC_CFM    1
+           #define TARGET_RT_MAC_MACHO  0
+        #else
+           #define TARGET_RT_MAC_CFM    0
+           #define TARGET_RT_MAC_MACHO  1
+       #endif
+    #elif defined(__ppc64__) 
+        #define TARGET_CPU_PPC          0
+        #define TARGET_CPU_PPC64        1
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          0
+        #define TARGET_CPU_X86_64       0
+        #define TARGET_CPU_ARM          0
+        #define TARGET_CPU_ARM64        0
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0   
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_LITTLE_ENDIAN 0
+        #define TARGET_RT_BIG_ENDIAN    1
+        #define TARGET_RT_64_BIT        1
+        #define TARGET_RT_MAC_CFM       0
+        #define TARGET_RT_MAC_MACHO     1
+    #elif defined(__i386__) 
+        #define TARGET_CPU_PPC          0
+        #define TARGET_CPU_PPC64        0
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          1
+        #define TARGET_CPU_X86_64       0
+        #define TARGET_CPU_ARM          0
+        #define TARGET_CPU_ARM64        0
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_MAC_CFM       0
+        #define TARGET_RT_MAC_MACHO     1
+        #define TARGET_RT_LITTLE_ENDIAN 1
+        #define TARGET_RT_BIG_ENDIAN    0
+        #define TARGET_RT_64_BIT        0
+    #elif defined(__x86_64__) 
+        #define TARGET_CPU_PPC          0
+        #define TARGET_CPU_PPC64        0
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          0
+        #define TARGET_CPU_X86_64       1
+        #define TARGET_CPU_ARM          0
+        #define TARGET_CPU_ARM64        0
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_MAC_CFM       0
+        #define TARGET_RT_MAC_MACHO     1
+        #define TARGET_RT_LITTLE_ENDIAN 1
+        #define TARGET_RT_BIG_ENDIAN    0
+        #define TARGET_RT_64_BIT        1
+    #elif defined(__arm__) 
+        #define TARGET_CPU_PPC          0
+        #define TARGET_CPU_PPC64        0
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          0
+        #define TARGET_CPU_X86_64       0
+        #define TARGET_CPU_ARM          1
+        #define TARGET_CPU_ARM64        0
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_MAC_CFM       0
+        #define TARGET_RT_MAC_MACHO     1
+        #define TARGET_RT_LITTLE_ENDIAN 1
+        #define TARGET_RT_BIG_ENDIAN    0
+        #define TARGET_RT_64_BIT        0
+    #elif defined(__arm64__)
+        #define TARGET_CPU_PPC          0
+        #define TARGET_CPU_PPC64        0
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          0
+        #define TARGET_CPU_X86_64       0
+        #define TARGET_CPU_ARM          0
+        #define TARGET_CPU_ARM64        1
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_MAC_CFM       0
+        #define TARGET_RT_MAC_MACHO     1
+        #define TARGET_RT_LITTLE_ENDIAN 1
+        #define TARGET_RT_BIG_ENDIAN    0
+        #if __LP64__
+          #define TARGET_RT_64_BIT      1
+        #else
+          #define TARGET_RT_64_BIT      0
+        #endif
+    #else
+        #error unrecognized GNU C compiler
+    #endif
+
+
+
+/*
+ *   CodeWarrior compiler from Metrowerks/Motorola
+ */
+#elif defined(__MWERKS__)
+    #define TARGET_OS_MAC               1
+    #define TARGET_OS_WIN32             0
+    #define TARGET_OS_UNIX              0
+    #define TARGET_OS_EMBEDDED          0
+    #if defined(__POWERPC__)
+        #define TARGET_CPU_PPC          1
+        #define TARGET_CPU_PPC64        0
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          0
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_LITTLE_ENDIAN 0
+        #define TARGET_RT_BIG_ENDIAN    1
+    #elif defined(__INTEL__)
+        #define TARGET_CPU_PPC          0
+        #define TARGET_CPU_PPC64        0
+        #define TARGET_CPU_68K          0
+        #define TARGET_CPU_X86          1
+        #define TARGET_CPU_MIPS         0
+        #define TARGET_CPU_SPARC        0
+        #define TARGET_CPU_ALPHA        0
+        #define TARGET_RT_LITTLE_ENDIAN 1
+        #define TARGET_RT_BIG_ENDIAN    0
+    #else
+        #error unknown Metrowerks CPU type
+    #endif
+    #define TARGET_RT_64_BIT            0
+    #ifdef __MACH__
+        #define TARGET_RT_MAC_CFM       0
+        #define TARGET_RT_MAC_MACHO     1
+    #else
+        #define TARGET_RT_MAC_CFM       1
+        #define TARGET_RT_MAC_MACHO     0
+    #endif
+
+/*
+ *   unknown compiler
+ */
+#else
+    #if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC
+        #define TARGET_CPU_PPC64    0
+        #define TARGET_CPU_68K      0
+        #define TARGET_CPU_X86      0
+        #define TARGET_CPU_X86_64   0
+        #define TARGET_CPU_ARM      0
+        #define TARGET_CPU_ARM64    0
+        #define TARGET_CPU_MIPS     0
+        #define TARGET_CPU_SPARC    0
+        #define TARGET_CPU_ALPHA    0
+    #elif defined(TARGET_CPU_PPC64) && TARGET_CPU_PPC64
+        #define TARGET_CPU_PPC      0
+        #define TARGET_CPU_68K      0
+        #define TARGET_CPU_X86      0
+        #define TARGET_CPU_X86_64   0
+        #define TARGET_CPU_ARM      0
+        #define TARGET_CPU_ARM64    0
+        #define TARGET_CPU_MIPS     0
+        #define TARGET_CPU_SPARC    0
+        #define TARGET_CPU_ALPHA    0
+    #elif defined(TARGET_CPU_X86) && TARGET_CPU_X86
+        #define TARGET_CPU_PPC      0
+        #define TARGET_CPU_PPC64    0
+        #define TARGET_CPU_X86_64   0
+        #define TARGET_CPU_68K      0
+        #define TARGET_CPU_ARM      0
+        #define TARGET_CPU_ARM64    0
+        #define TARGET_CPU_MIPS     0
+        #define TARGET_CPU_SPARC    0
+        #define TARGET_CPU_ALPHA    0
+    #elif defined(TARGET_CPU_X86_64) && TARGET_CPU_X86_64
+        #define TARGET_CPU_PPC      0
+        #define TARGET_CPU_PPC64    0
+        #define TARGET_CPU_X86      0
+        #define TARGET_CPU_68K      0
+        #define TARGET_CPU_ARM      0
+        #define TARGET_CPU_ARM64    0
+        #define TARGET_CPU_MIPS     0
+        #define TARGET_CPU_SPARC    0
+        #define TARGET_CPU_ALPHA    0
+    #elif defined(TARGET_CPU_ARM) && TARGET_CPU_ARM
+        #define TARGET_CPU_PPC      0
+        #define TARGET_CPU_PPC64    0
+        #define TARGET_CPU_X86      0
+        #define TARGET_CPU_X86_64   0
+        #define TARGET_CPU_68K      0
+        #define TARGET_CPU_ARM64    0
+        #define TARGET_CPU_MIPS     0
+        #define TARGET_CPU_SPARC    0
+        #define TARGET_CPU_ALPHA    0
+    #elif defined(TARGET_CPU_ARM64) && TARGET_CPU_ARM64
+        #define TARGET_CPU_PPC      0
+        #define TARGET_CPU_PPC64    0
+        #define TARGET_CPU_X86      0
+        #define TARGET_CPU_X86_64   0
+        #define TARGET_CPU_68K      0
+        #define TARGET_CPU_ARM      0
+        #define TARGET_CPU_MIPS     0
+        #define TARGET_CPU_SPARC    0
+        #define TARGET_CPU_ALPHA    0
+    #else
+        /*
+            NOTE:   If your compiler errors out here then support for your compiler 
+            has not yet been added to TargetConditionals.h.  
+            
+            TargetConditionals.h is designed to be plug-and-play.  It auto detects
+            which compiler is being run and configures the TARGET_ conditionals
+            appropriately.  
+            
+            The short term work around is to set the TARGET_CPU_ and TARGET_OS_
+            on the command line to the compiler (e.g. -DTARGET_CPU_MIPS=1 -DTARGET_OS_UNIX=1)
+            
+            The long term solution is to add a new case to this file which
+            auto detects your compiler and sets up the TARGET_ conditionals.
+            Then submit the changes to Apple Computer.
+        */
+        #error TargetConditionals.h: unknown compiler (see comment above)
+        #define TARGET_CPU_PPC    0
+        #define TARGET_CPU_68K    0
+        #define TARGET_CPU_X86    0
+        #define TARGET_CPU_ARM    0
+        #define TARGET_CPU_ARM64  0
+        #define TARGET_CPU_MIPS   0
+        #define TARGET_CPU_SPARC  0
+        #define TARGET_CPU_ALPHA  0
+    #endif
+    #define TARGET_OS_MAC                1
+    #define TARGET_OS_WIN32              0
+    #define TARGET_OS_UNIX               0
+    #define TARGET_OS_EMBEDDED           0
+    #if TARGET_CPU_PPC || TARGET_CPU_PPC64
+        #define TARGET_RT_BIG_ENDIAN     1
+        #define TARGET_RT_LITTLE_ENDIAN  0
+    #else
+        #define TARGET_RT_BIG_ENDIAN     0
+        #define TARGET_RT_LITTLE_ENDIAN  1
+    #endif
+    #if TARGET_CPU_PPC64 || TARGET_CPU_X86_64
+        #define TARGET_RT_64_BIT         1
+    #else
+        #define TARGET_RT_64_BIT         0
+    #endif
+    #ifdef __MACH__
+        #define TARGET_RT_MAC_MACHO      1
+        #define TARGET_RT_MAC_CFM        0
+    #else
+        #define TARGET_RT_MAC_MACHO      0
+        #define TARGET_RT_MAC_CFM        1
+    #endif
+    
+#endif
+
+#endif  /* __TARGETCONDITIONALS__ */
lib/libc/include/x86_64-macos-gnu/xlocale.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE_H_
+#define _XLOCALE_H_
+
+#include <sys/cdefs.h>
+
+#ifndef _USE_EXTENDED_LOCALES_
+#define _USE_EXTENDED_LOCALES_
+#endif /* _USE_EXTENDED_LOCALES_ */
+
+#include <_locale.h>
+#include <_xlocale.h>
+
+#define LC_ALL_MASK			(  LC_COLLATE_MASK \
+					 | LC_CTYPE_MASK \
+					 | LC_MESSAGES_MASK \
+					 | LC_MONETARY_MASK \
+					 | LC_NUMERIC_MASK \
+					 | LC_TIME_MASK )
+#define LC_COLLATE_MASK			(1 << 0)
+#define LC_CTYPE_MASK			(1 << 1)
+#define LC_MESSAGES_MASK		(1 << 2)
+#define LC_MONETARY_MASK		(1 << 3)
+#define LC_NUMERIC_MASK			(1 << 4)
+#define LC_TIME_MASK			(1 << 5)
+
+#define _LC_NUM_MASK			6
+#define _LC_LAST_MASK			(1 << (_LC_NUM_MASK - 1))
+
+#define LC_GLOBAL_LOCALE		((locale_t)-1)
+#define LC_C_LOCALE				((locale_t)NULL)
+
+#ifdef MB_CUR_MAX
+#undef MB_CUR_MAX
+#define MB_CUR_MAX			(___mb_cur_max())
+#ifndef MB_CUR_MAX_L
+#define MB_CUR_MAX_L(x)			(___mb_cur_max_l(x))
+#endif /* !MB_CUR_MAX_L */
+#endif /* MB_CUR_MAX */
+
+__BEGIN_DECLS
+extern const locale_t _c_locale;
+
+locale_t	duplocale(locale_t);
+int		freelocale(locale_t);
+struct lconv *	localeconv_l(locale_t);
+locale_t	newlocale(int, __const char *, locale_t);
+__const char *	querylocale(int, locale_t);
+locale_t	uselocale(locale_t);
+__END_DECLS
+
+#ifdef _CTYPE_H_
+#include <xlocale/_ctype.h>
+#endif /* _CTYPE_H_ */
+#ifdef __WCTYPE_H_
+#include <xlocale/__wctype.h>
+#endif /* __WCTYPE_H_ */
+#ifdef _INTTYPES_H_
+#include <xlocale/_inttypes.h>
+#endif /* _INTTYPES_H_ */
+#ifdef _LANGINFO_H_
+#include <xlocale/_langinfo.h>
+#endif /* _LANGINFO_H_ */
+#ifdef _MONETARY_H_
+#include <xlocale/_monetary.h>
+#endif /* _MONETARY_H_ */
+#ifdef _REGEX_H_
+#include <xlocale/_regex.h>
+#endif /* _REGEX_H_ */
+#ifdef _STDIO_H_
+#include <xlocale/_stdio.h>
+#endif /* _STDIO_H_ */
+#ifdef _STDLIB_H_
+#include <xlocale/_stdlib.h>
+#endif /* _STDLIB_H_ */
+#ifdef _STRING_H_
+#include <xlocale/_string.h>
+#endif /*STRING_CTYPE_H_ */
+#ifdef _TIME_H_
+#include <xlocale/_time.h>
+#endif /* _TIME_H_ */
+#ifdef _WCHAR_H_
+#include <xlocale/_wchar.h>
+#endif /*WCHAR_CTYPE_H_ */
+#ifdef _WCTYPE_H_
+#include <xlocale/_wctype.h>
+#endif /* _WCTYPE_H_ */
+
+#endif /* _XLOCALE_H_ */