Newlib for Nest Protect 3.1.4
diff --git a/newlib-1.20.0.tar.gz b/newlib-1.20.0.tar.gz
new file mode 100644
index 0000000..cce6d27
--- /dev/null
+++ b/newlib-1.20.0.tar.gz
Binary files differ
diff --git a/newlib.patches/newlib-50.description b/newlib.patches/newlib-50.description
new file mode 100644
index 0000000..d86f4ed
--- /dev/null
+++ b/newlib.patches/newlib-50.description
@@ -0,0 +1 @@
+Fix for __USER_LABEL_PREFIX__ not being concatenated properly by clang preprocessor
diff --git a/newlib.patches/newlib-50.patch b/newlib.patches/newlib-50.patch
new file mode 100644
index 0000000..4f49eb6
--- /dev/null
+++ b/newlib.patches/newlib-50.patch
@@ -0,0 +1,42 @@
+diff -aruN newlib-1.20.0/libgloss/arm/Makefile.in newlib-1.20.0-new//libgloss/arm/Makefile.in
+--- newlib-1.20.0/libgloss/arm/Makefile.in  2011-06-29 08:32:09.000000000 -0700
++++ newlib-1.20.0-new//libgloss/arm/Makefile.in 2012-09-17 18:17:04.011270636 -0700
+@@ -93,7 +93,9 @@
+ # build a test program for each target board. Just trying to get
+ # it to link is a good test, so we ignore all the errors for now.
+ #
+-all: ${CRT0} ${LINUX_CRT0} ${LINUX_BSP} ${REDBOOT_CRT0} ${REDBOOT_OBJS} ${RDPMON_CRT0} ${RDPMON_BSP} ${RDIMON_CRT0} ${RDIMON_BSP}
++all: ${CRT0}
++
++#${LINUX_CRT0} ${LINUX_BSP} ${REDBOOT_CRT0} ${REDBOOT_OBJS} ${RDPMON_CRT0} ${RDPMON_BSP} ${RDIMON_CRT0} ${RDIMON_BSP}
+ 
+ #
+ # here's where we build the test programs for each target
+@@ -146,7 +148,9 @@
+    rm -f Makefile config.status *~
+ 
+ .PHONY: install info install-info clean-info
+-install: ${CRT0_INSTALL} ${LINUX_INSTALL} ${REDBOOT_INSTALL} ${RDPMON_INSTALL} ${RDIMON_INSTALL} ${IQ80310_INSTALL}  ${PID_INSTALL}
++install: ${CRT0_INSTALL} 
++
++#${LINUX_INSTALL} ${REDBOOT_INSTALL} ${RDPMON_INSTALL} ${RDIMON_INSTALL} ${IQ80310_INSTALL}  ${PID_INSTALL}
+ 
+ install-crt0:
+    ${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x
+diff -aruN newlib-1.20.0/newlib/libc/machine/arm/setjmp.S newlib-1.20.0-new//newlib/libc/machine/arm/setjmp.S
+--- newlib-1.20.0/newlib/libc/machine/arm/setjmp.S  2009-05-13 11:31:55.000000000 -0700
++++ newlib-1.20.0-new//newlib/libc/machine/arm/setjmp.S 2012-09-17 18:12:26.807156599 -0700
+@@ -6,11 +6,8 @@
+ #define CONCAT(a, b)  CONCAT2(a, b)
+ #define CONCAT2(a, b) a##b
+ 
+-#ifndef __USER_LABEL_PREFIX__
+-#error  __USER_LABEL_PREFIX__ not defined
+-#endif
++#define SYM(x) _##x
+ 
+-#define SYM(x) CONCAT (__USER_LABEL_PREFIX__, x)
+ 
+ #ifdef __ELF__
+ #define TYPE(x) .type SYM(x),function
+
diff --git a/newlib.patches/newlib-51.description b/newlib.patches/newlib-51.description
new file mode 100644
index 0000000..4adb533
--- /dev/null
+++ b/newlib.patches/newlib-51.description
@@ -0,0 +1 @@
+s/__warning__/deprecated/
diff --git a/newlib.patches/newlib-51.patch b/newlib.patches/newlib-51.patch
new file mode 100644
index 0000000..7d2fb26
--- /dev/null
+++ b/newlib.patches/newlib-51.patch
@@ -0,0 +1,21 @@
+diff -aruN newlib-1.20.0/newlib/libc/include/stdlib.h newlib-1.20.0-new/newlib/libc/include/stdlib.h
+--- newlib-1.20.0/newlib/libc/include/stdlib.h	2010-07-19 11:21:11.000000000 -0700
++++ newlib-1.20.0-new/newlib/libc/include/stdlib.h	2012-09-25 17:54:04.708256826 -0700
+@@ -107,14 +107,14 @@
+ int	_EXFUN(mkostemps,(char *, int, int));
+ int	_EXFUN(mkstemp,(char *));
+ int	_EXFUN(mkstemps,(char *, int));
+-char *	_EXFUN(mktemp,(char *) _ATTRIBUTE ((__warning__ ("the use of `mktemp' is dangerous; use `mkstemp' instead"))));
++char *	_EXFUN(mktemp,(char *) _ATTRIBUTE ((deprecated("the use of `mktemp' is dangerous; use `mkstemp' instead"))));
+ #endif
+ char *	_EXFUN(_mkdtemp_r, (struct _reent *, char *));
+ int	_EXFUN(_mkostemp_r, (struct _reent *, char *, int));
+ int	_EXFUN(_mkostemps_r, (struct _reent *, char *, int, int));
+ int	_EXFUN(_mkstemp_r, (struct _reent *, char *));
+ int	_EXFUN(_mkstemps_r, (struct _reent *, char *, int));
+-char *	_EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((__warning__ ("the use of `mktemp' is dangerous; use `mkstemp' instead"))));
++char *	_EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((deprecated ("the use of `mktemp' is dangerous; use `mkstemp' instead"))));
+ #endif
+ _VOID	_EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR)));
+ int	_EXFUN(rand,(_VOID));
+
diff --git a/newlib.patches/newlib-52.patch b/newlib.patches/newlib-52.patch
new file mode 100644
index 0000000..9afe2d7
--- /dev/null
+++ b/newlib.patches/newlib-52.patch
@@ -0,0 +1,43 @@
+--- newlib-1.20.0/newlib/libc/stdlib/mallocr.c	2010-05-31 12:15:41.000000000 -0700
++++ newlib-1.20.0-new/newlib/libc/stdlib/mallocr.c	2013-05-02 12:03:25.831542637 -0700
+@@ -303,13 +303,22 @@
+ 
+ #include <reent.h>
+ 
++#ifndef MALLOC_LOCK_FUNCTION
++#define MALLOC_LOCK_FUNCTION __malloc_lock
++#endif
++
++#ifndef MALLOC_UNLOCK_FUNCTION
++#define MALLOC_UNLOCK_FUNCTION __malloc_unlock
++#endif
++
+ #define POINTER_UINT unsigned _POINTER_INT
+ #define SEPARATE_OBJECTS
+ #define HAVE_MMAP 0
+ #define MORECORE(size) _sbrk_r(reent_ptr, (size))
+ #define MORECORE_CLEARS 0
+-#define MALLOC_LOCK __malloc_lock(reent_ptr)
+-#define MALLOC_UNLOCK __malloc_unlock(reent_ptr)
++
++#define MALLOC_LOCK MALLOC_LOCK_FUNCTION(reent_ptr)
++#define MALLOC_UNLOCK MALLOC_UNLOCK_FUNCTION(reent_ptr)
+ 
+ #ifdef __CYGWIN__
+ # undef _WIN32
+@@ -325,11 +334,11 @@
+ #endif
+ 
+ #if __STD_C
+-extern void __malloc_lock(struct _reent *);
+-extern void __malloc_unlock(struct _reent *);
++extern void MALLOC_LOCK_FUNCTION(struct _reent *);
++extern void MALLOC_UNLOCK_FUNCTION(struct _reent *);
+ #else
+-extern void __malloc_lock();
+-extern void __malloc_unlock();
++extern void MALLOC_LOCK_FUNCTION();
++extern void MALLOC_UNLOCK_FUNCTION();
+ #endif
+ 
+ #if __STD_C
diff --git a/newlib.url b/newlib.url
new file mode 100644
index 0000000..858e60d
--- /dev/null
+++ b/newlib.url
@@ -0,0 +1 @@
+ftp://sourceware.org/pub/newlib/newlib-1.20.0.tar.gz
diff --git a/newlib.version b/newlib.version
new file mode 100644
index 0000000..3989355
--- /dev/null
+++ b/newlib.version
@@ -0,0 +1 @@
+1.20.0