[rtems-crossrpms commit] New.

Ralf Corsepius ralf at rtems.org
Fri Feb 17 09:05:55 UTC 2012


Module:    rtems-crossrpms
Branch:    master
Commit:    f657b4acb3085add1644247c9242f6db0ebbb9ee
Changeset: http://git.rtems.org/rtems-crossrpms/commit/?id=f657b4acb3085add1644247c9242f6db0ebbb9ee

Author:    Ralf Corsépius <ralf.corsepius at rtems.org>
Date:      Fri Feb 17 09:58:38 2012 +0100

New.

---

 patches/newlib-1.20.0-rtems4.11-20120217.diff | 4271 +++++++++++++++++++++++++
 1 files changed, 4271 insertions(+), 0 deletions(-)

diff --git a/patches/newlib-1.20.0-rtems4.11-20120217.diff b/patches/newlib-1.20.0-rtems4.11-20120217.diff
new file mode 100644
index 0000000..ff78a14
--- /dev/null
+++ b/patches/newlib-1.20.0-rtems4.11-20120217.diff
@@ -0,0 +1,4271 @@
+diff -Naur newlib-1.20.0.orig/config/ChangeLog newlib-1.20.0/config/ChangeLog
+--- newlib-1.20.0.orig/config/ChangeLog	2011-12-19 14:20:23.000000000 +0100
++++ newlib-1.20.0/config/ChangeLog	2012-02-17 06:28:14.719873396 +0100
+@@ -1,3 +1,8 @@
++2011-12-20  Andreas Schwab  <schwab at linux-m68k.org>
++
++	* warnings.m4 (ACX_PROG_CC_WARNING_OPTS): Avoid leading dash in
++	expr call.
++
+ 2011-12-19  Andreas Schwab  <schwab at linux-m68k.org>
+ 
+ 	* warnings.m4 (ACX_PROG_CC_WARNING_OPTS)
+diff -Naur newlib-1.20.0.orig/config/warnings.m4 newlib-1.20.0/config/warnings.m4
+--- newlib-1.20.0.orig/config/warnings.m4	2011-12-19 14:20:23.000000000 +0100
++++ newlib-1.20.0/config/warnings.m4	2012-02-17 06:28:14.719873396 +0100
+@@ -32,7 +32,7 @@
+   # Do the check with the no- prefix removed since gcc silently
+   # accepts any -Wno-* option on purpose
+   case $real_option in
+-    -Wno-*) option=-W`expr $real_option : '-Wno-\(.*\)'` ;;
++    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
+     *) option=$real_option ;;
+   esac
+   AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
+diff -Naur newlib-1.20.0.orig/libgloss/arm/linux-crt0.c newlib-1.20.0/libgloss/arm/linux-crt0.c
+--- newlib-1.20.0.orig/libgloss/arm/linux-crt0.c	2011-07-13 17:06:21.000000000 +0200
++++ newlib-1.20.0/libgloss/arm/linux-crt0.c	2012-02-17 06:28:14.730873329 +0100
+@@ -18,8 +18,10 @@
+ 	".global _start\n"
+ 	".type _start, %function\n"
+ 	"_start:\n"
+-	"\tadr r0, _start_thumb+1\n"
++	"\tldr r0, .LC0\n"
+ 	"\tbx r0\n"
++	".LC0:\n"
++	"\t.word _start_thumb\n"
+ 	".size _start, .-_start\n");
+ 
+ __attribute__((naked, used))
+diff -Naur newlib-1.20.0.orig/libgloss/bfin/_exit.c newlib-1.20.0/libgloss/bfin/_exit.c
+--- newlib-1.20.0.orig/libgloss/bfin/_exit.c	1970-01-01 01:00:00.000000000 +0100
++++ newlib-1.20.0/libgloss/bfin/_exit.c	2012-02-17 06:28:14.730873329 +0100
+@@ -0,0 +1,25 @@
++/*
++ * C library support files for the Blackfin processor
++ *
++ * Copyright (C) 2012 Analog Devices, Inc.
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++#include <_ansi.h>
++
++_VOID
++_DEFUN (_exit, (rc),
++	int rc)
++{
++  while (1)
++    asm volatile ("EXCPT 0;");
++}
+diff -Naur newlib-1.20.0.orig/libgloss/bfin/include/sys/anomaly_macros_rtl.h newlib-1.20.0/libgloss/bfin/include/sys/anomaly_macros_rtl.h
+--- newlib-1.20.0.orig/libgloss/bfin/include/sys/anomaly_macros_rtl.h	2010-10-18 01:52:49.000000000 +0200
++++ newlib-1.20.0/libgloss/bfin/include/sys/anomaly_macros_rtl.h	2012-02-17 06:28:14.731873329 +0100
+@@ -12,7 +12,7 @@
+ 
+ /************************************************************************
+  *
+- * anomaly_macros_rtl.h : $Revision: 1.3 $
++ * anomaly_macros_rtl.h : $Revision$
+  *
+  * (c) Copyright 2005-2009 Analog Devices, Inc.  All rights reserved.
+  *
+diff -Naur newlib-1.20.0.orig/libgloss/bfin/Makefile.in newlib-1.20.0/libgloss/bfin/Makefile.in
+--- newlib-1.20.0.orig/libgloss/bfin/Makefile.in	2011-12-18 19:41:20.000000000 +0100
++++ newlib-1.20.0/libgloss/bfin/Makefile.in	2012-02-17 06:28:14.730873329 +0100
+@@ -74,7 +74,7 @@
+ BOARD_BSP	= libbfinbsp.a
+ BOARD_CRT0S	= basiccrt.o basiccrts.o
+ BOARD_CRT0S	+= basiccrt561.o basiccrt561s.o basiccrt561b.o
+-BOARD_OBJS	= clear_cache_range.o
++BOARD_OBJS	= clear_cache_range.o _exit.o
+ BOARD_TEST	=
+ BOARD_INSTALL	= install-board
+ 
+diff -Naur newlib-1.20.0.orig/libgloss/ChangeLog newlib-1.20.0/libgloss/ChangeLog
+--- newlib-1.20.0.orig/libgloss/ChangeLog	2011-12-18 19:41:20.000000000 +0100
++++ newlib-1.20.0/libgloss/ChangeLog	2012-02-17 06:28:14.729873331 +0100
+@@ -1,4 +1,14 @@
+-2011-12-18  Mike Frysinger  <vapier at gentoo.org>
++2012-01-23  Stuart Henderson  <stuart.henderson at analog.com>
++
++	* bfin/_exit.c: New file.
++	* bfin/Makefile.in (BOARD_OBJS): Add _exit.o.
++
++2012-01-17  Bin Cheng  <bin.cheng at arm.com>
++
++	* arm/linux-crt0.c: Use ldr instead of adr to get address of
++	_start_thumb.
++
++2011-12-18  Steve Kilbane  <stephen.kilbane at analog.com>
+ 
+ 	* bfin/clear_cache_range.c: New file.
+ 	* bfin/Makefile.in (SIM_OBJS): Add clear_cache_range.o.
+diff -Naur newlib-1.20.0.orig/libgloss/hp74x/pa_stub.c newlib-1.20.0/libgloss/hp74x/pa_stub.c
+--- newlib-1.20.0.orig/libgloss/hp74x/pa_stub.c	2000-03-17 23:48:50.000000000 +0100
++++ newlib-1.20.0/libgloss/hp74x/pa_stub.c	2012-02-17 06:28:14.731873329 +0100
+@@ -2,7 +2,7 @@
+ *******************************************************************************
+ *
+ * File:         pa_stub.c
+-* RCS:          $Header: /cvs/src/src/libgloss/hp74x/pa_stub.c,v 1.1 2000/03/17 22:48:50 ranjith Exp $
++* RCS:          $Header$
+ * Description:  main routines for PA RISC monitor stub
+ * Author:       Robert Quist
+ * Created:      Mon Nov  1 10:00:36 1993
+diff -Naur newlib-1.20.0.orig/libgloss/m68k/fido.h newlib-1.20.0/libgloss/m68k/fido.h
+--- newlib-1.20.0.orig/libgloss/m68k/fido.h	2006-12-18 22:48:18.000000000 +0100
++++ newlib-1.20.0/libgloss/m68k/fido.h	2012-02-17 06:28:14.732873339 +0100
+@@ -11,9 +11,9 @@
+  *    Wed, 1 June 2005 David L. Deis [DD]
+  *
+  *  @par CVS-Info:
+- *    $Revision: 1.2 $
+- *    $Author: jjohnstn $
+- *    $Date: 2006/12/18 21:48:18 $
++ *    $Revision$
++ *    $Author$
++ *    $Date$
+  *
+  *  @par Description:
+  *  Contains board-specific and onchip memory-mapped register and internal
+diff -Naur newlib-1.20.0.orig/libgloss/mt/startup-16-003.S newlib-1.20.0/libgloss/mt/startup-16-003.S
+--- newlib-1.20.0.orig/libgloss/mt/startup-16-003.S	2006-03-22 13:47:59.000000000 +0100
++++ newlib-1.20.0/libgloss/mt/startup-16-003.S	2012-02-17 06:28:14.732873339 +0100
+@@ -1,5 +1,5 @@
+ /*
+- * $Header: /cvs/src/src/libgloss/mt/startup-16-003.S,v 1.2 2006/03/22 12:47:59 nathan Exp $
++ * $Header$
+  *
+  * interrupt_vectors.s -- the interrupt handler jump table. 
+  *
+diff -Naur newlib-1.20.0.orig/libgloss/mt/startup-64-001.S newlib-1.20.0/libgloss/mt/startup-64-001.S
+--- newlib-1.20.0.orig/libgloss/mt/startup-64-001.S	2005-12-12 12:16:41.000000000 +0100
++++ newlib-1.20.0/libgloss/mt/startup-64-001.S	2012-02-17 06:28:14.733873338 +0100
+@@ -1,5 +1,5 @@
+ /*
+- * $Header: /cvs/src/src/libgloss/mt/startup-64-001.S,v 1.1 2005/12/12 11:16:41 nathan Exp $
++ * $Header$
+  *
+  * interrupt_vectors.s -- the interrupt handler jump table. 
+  *
+diff -Naur newlib-1.20.0.orig/newlib/ChangeLog newlib-1.20.0/newlib/ChangeLog
+--- newlib-1.20.0.orig/newlib/ChangeLog	2011-12-19 23:03:17.000000000 +0100
++++ newlib-1.20.0/newlib/ChangeLog	2012-02-17 06:28:14.741873397 +0100
+@@ -1,3 +1,50 @@
++2012-02-15  Christopher Faylor  <me.newlib2012 at cgf.cx>
++
++	* configure.host: Fix typo: xdir_dir -> xdr_dir.
++
++2012-02-09  Eric Blake  <eblake at redhat.com>
++
++	* libc/include/_ansi.h (_ELIDABLE_INLINE): Fix C99 mode.
++
++2012-02-09  Sebastian Huber <sebastian.huber at embedded-brains.de>
++
++	* libc/sys/rtems/sys/utime.h: Include <sys/types.h> to provide a
++	definition of time_h.
++
++2012-01-13  Yaakov Selkowitz  <yselkowitz at users.sourceforge.net>
++
++	* libc/stdio/sprintf.c: Document 'm' conversion specifier.
++	* libc/stdio/swprintf.c: Ditto.
++	* libc/stdio/vfprintf.c (_VFPRINTF_R) [_GLIBC_EXTENSION]: Handle 'm'
++	conversion specifier.
++	* libc/stdio/vfwprintf.c (_VFWPRINTF_R) [_GLIBC_EXTENSION]: Ditto.
++
++2012-01-12  Yaakov Selkowitz  <yselkowitz at users.sourceforge.net>
++
++	* libc/include/tgmath.h: New header.
++
++2012-01-09  Yaakov Selkowitz  <yselkowitz at users.sourceforge.net>
++
++	* libc/include/sys/unistd.h [__CYGWIN__] (get_current_dir_name):
++	Declare.
++
++2012-01-09  Yaakov Selkowitz  <yselkowitz at users.sourceforge.net>
++
++	* libc/include/complex.h: Fix "/*" within comment warning.
++
++2012-01-09  Corinna Vinschen  <vinschen at redhat.com>
++
++	* libc/include/process.h: Remove Cygwin-only header.
++
++2012-01-03  Viachaslau Kulakouski  <Viachaslau.Kulakouski at oracle.com>
++
++	* libc/stdlib/__atexit.c: Refer to __atexit_lock instead of lock.
++
++2011-12-20  Aleksandr Platonov  <pam at oktetlabs.ru>
++
++	* libc/stdio/fvwrite.c (__sfvwrite_r): Set __SMBF flag to avoid double 
++	free in fclose.  Enhance comment.
++
+ 2011-12-19  Jeff Johnston  <jjohnstn at redhat.com>
+ 
+ 	* NEWS: Update with 1.20.0 info.
+@@ -16,14 +63,6 @@
+ 	* libm/libm.texinfo: Ditto.
+ 	* libc/sys/linux/shared.ld: Add VERS_1.20
+ 
+-2011-12-13  Richard Earnshaw  <rearnsha at arm.com>
+-	    Thomas Klein  <th.r.klein at web.de>
+-
+-	* libc/sys/arm/crt0.S: Manually set the target architecture
+-	when compiling for Thumb1 on EABI targets.
+-	Don't use SWI on M-profile cores.
+-	Avoid v6-only Thumb-1 MOV instruction.
+-
+ 2011-12-12  Akio Idehara  <zbe64533 at gmail.com>
+ 
+ 	* libc/time/strftime.c (get_era_info): Fix off-by-one error in month
+@@ -48,51 +87,16 @@
+ 	* libc/iconv/ccs/Makefile.am: Add missing backslash.
+ 	* libc/iconv/ccs/Makefile.in: Regenerate.
+ 
+-2011-10-18  Dr David Alan Gilbert  <david.gilbert at linaro.org>
+-
+-	* libc/machine/arm/Makefile.am (lib_a_SOURCES): Add memchr-stub.c,
+-	memchr.S.
+-	* libc/machine/arm/arm_asm.h: Add ifdef to allow it to be included
+-	in .S files.
+-	* libc/machine/arm/memchr-stub.c: New file - just selects what to
+-	compile.
+-	* libc/machine/arm/memchr.S: New file - ARMv6t2/v7 version.
+-
+-	* libc/machine/arm/Makefile.am (lib_a_SOURCES): Add strlen-armv7.S.
+-	* libc/machine/arm/strlen-armv7.S: New file.
+-	* libc/machine/arm/strlen.c: Add ifdef optimised code so it isn't
+-	for v7 or 6t2.
+-
+-	* libc/machine/arm/Makefile.in: Regenerate.
+-
+ 2011-10-11  Steven Abner <pheonix at zoomtown.com>
+ 
+ 	* libc/time/mktm_r.c: (__tzcalc_limits) Fix Julian day calculation.
+ 	* libc/time/mktime.c: (mktime) Fix tm_yday, tm_mday updating when
+ 	timezone causes roll over.
+ 
+-2011-10-10  Nick Clifton  <nickc at redhat.com>
+-
+-	* libc/sys/arm/crt0.S: Synchronise with libgloss version.
+-	* libc/sys/arm/arm.h: Imported from libgloss.
+-
+ 2011-10-04  Greta Yorsh  <Greta.Yorsh at arm.com>
+ 
+ 	* testsuite/newlib.string/memcpy-1.c: New test.
+ 
+-2011-10-04  Nick Clifton  <nickc at redhat.com>
+-
+-	* libc/machine/arm/memcpy.S: Fix unaligned access copying.
+-
+-2011-09-29  Greta Yorsh  <Greta.Yorsh at arm.com>
+-
+-	* libc/machine/arm/memcpy.S: New file.  Contains a hand coded
+-	memcpy function optimized for the cortex-a15.
+-	* libc/machine/arm/memcpy-stub.c: New file.
+-	* libc/machine/arm/Makefile.am (lib_a_SOURCES): Add memcpy-stub.c,
+-	memcpy.S.
+-	* libc/machine/arm/Makefile.in: Regenerate.
+-
+ 2011-09-08  Jeff Johnston  <jjohnstn at redhat.com>
+ 
+ 	* testsuite/lib/flags.exp: Add logic to add the
+@@ -492,16 +496,6 @@
+ 	* libm/math/w_tgamma.c: Only build ifndef _DOUBLE_IS_32BITS.
+ 	* libm/math/wf_tgamma.c: Map tgamma to tgammaf, ifdef _DOUBLE_IS_32BITS.
+ 
+-2011-01-12  Jeff Johnston  <jjohnstn at redhat.com>
+-
+-	* configure.host: Add noinclude variable to allow specification
+-	of header files to remove from installation.
+-	* acinclude.m4: Provide NO_INCLUDE_LIST variable based on
+-	noinclude variable in configure.host.
+-	* configure: Regenerated.
+-	* Makefile.am: Remove all header files in NO_INCLUDE_LIST.
+-	* Makefile.in: Regenerated.
+-
+ 2011-01-12  Yaakov Selkowitz  <yselkowitz at users.sourceforge.net>
+ 
+ 	* libc/sys/linux/sys/signal.h (sig_t): Move from here...
+diff -Naur newlib-1.20.0.orig/newlib/ChangeLog.rtems newlib-1.20.0/newlib/ChangeLog.rtems
+--- newlib-1.20.0.orig/newlib/ChangeLog.rtems	1970-01-01 01:00:00.000000000 +0100
++++ newlib-1.20.0/newlib/ChangeLog.rtems	2012-02-17 06:28:14.743873443 +0100
+@@ -0,0 +1,146 @@
++2011-12-16	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/include/sys/time.h: Add adjtime.
++	* libc/include/sys/resource.h: Add getrusage.
++
++2011-10-06	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/sys/rtems/machine/_types.h (_ssize_t): Special case __ARM_EABI__.
++
++2011-08-11	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/stdio/tmpnam.c: Use PRIxPTR instead of %x.
++
++2011-08-11	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/search/hcreate_r.c: #ifdef 0 unused vars ie, idx.
++
++2011-04-19  Ralf Corsépius <ralf.corsepius at rtems.org>
++
++	* libc/include/stdint.h: Rework SIZE_MAX.
++
++2011-02-07  Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/include/stdlib.h: More ansi-compliance.
++
++2011-02-01  Ralf Corsépius  <ralf.corsepius at rtems.org>
++	
++	* libc/include/stdio.h: More ansi-compliance.
++
++	* libc/include/stdlib.h: Remove atoff.
++	* libc/stdlib/atoff.c: Remove.
++	* libc/stdlib/atof.c: Remove atoff.
++	* libc/stdlib/Makefile.am: Remove atoff.
++	* libc/stdlib/Makefile.in: Regenerate.
++
++	* libc/include/stdio.h: Make fdopen accessible to c99.
++
++2011-01-11  Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/include/string.h: Remove Cygwin DEFS_H kludge.
++
++2011-01-07	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/stdio/open_memstream.c: Replace 64 * 1024 with 0x10000 to 
++	avoid integer overflow on h8300.
++
++2011-01-05	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/stdio/tmpnam.c: Include <stdint.h>.
++	Use intptr_t instead of _POINTER_INT for improved portability.
++	* libc/misc/__dprintf.c: Include <stdint.h>
++	Use intptr_t instead of _POINTER_INT for improved portability.
++
++2011-01-05	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libm/common/s_round.c: Cast const int to __int32_t.
++
++2011-01-04	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libm/math/e_scalb.c: Include <limits.h>.
++	Don't rely on 65000 being a valid int.
++
++2011-01-04	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/posix/readdir.c:	Include <stdint.h>.
++	Cast to intptr_t instead of int.
++
++2011-01-04	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/string/memccpy.c, libc/string/memchr.c,
++	libc/string/memcmp.c, libc/string/memcpy.c,
++	libc/string/memmove.c, libc/string/mempcpy.c,
++	libc/string/memset.c, libc/string/stpcpy.c,
++	libc/string/stpncpy.c, libc/string/strcpy.c,
++	libc/string/strlen.c, libc/string/strncat.c,
++	libc/string/strncpy.c (UNALIGNED):
++	Include <stdint.h>.
++	Cast to intptr_t instead of long.
++
++2011-01-04	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* Makefile.am: Don't install include/rpc/*.h.
++	* Makefile.in: Regenerate.
++	* libc/Makefile.am: Install include/rpc/xdr.h include/rpc/types.h. 
++	* libc/Makefile.in: Regenerate.
++
++2010-12-31  Ralf Corsepius  <ralf.corsepius at rtems.org>
++
++	* doc/makedoc.c: Add cludge to make makedoc 64bit compliant.
++
++2010-12-30	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/include/signal.h: Don't provide sighandler_t.
++
++2010-12-29	Ralf Corsépius  <ralf.corsepius at rtems.org>
++
++	* libc/include/sys/dir.h: Remove.
++
++2010-08-10	Ralf Corsépius <ralf.corsepius at rtems.org>
++
++	PR 1475/newlib:
++	* libc/include/stdint.h: Fall back to compute SIZE_MAX based on
++	__SIZEOF_SIZE_T__ and __CHAR_BIT__ if available.
++
++2010-08-04	Ralf Corsépius <ralf.corsepius at rtems.org>
++
++	* libc/string/strcat.c: 
++	Include <stdint.h>. Use uintptr_t instead of long in ALIGNED.
++	* libc/string/strchr.c, libc/string/strcmp.c, libc/string/strncmp.c:
++	Include <stdint.h>. Use uintptr_t instead of long in UNALIGNED.
++
++2010-03-25	Ralf Corsépius <ralf.corsepius at rtems.org>
++
++	* libc/include/string.h: Remove bcmp, bcopy, bzero, ffs, index, rindex,
++	strcasecmp, strncasecmp (Moved to strings.h).
++	Remove strcmpi, stricmp, strncmpi, strnicmp.
++
++2009-12-18  Ralf Corsépius <ralf.corsepius at rtems.org>
++
++	* libc/search/db_local.h:
++	Use __uint32_t instead of u_int (prototype mismatches).
++	* libc/search/extern.h (__buf_init): 
++	Use __uint32_t instead of int (16 bit target portability).
++	* libc/search/hash_buf.c: Use ptrdiff_t instead of __uint32_t,
++	use __uint32_t instead of int (16 bit target portability).
++	* libc/search/hash.h: Use __uint32_it instead of int
++	(16 bit target portability).
++	* libm/common/modfl.c: Add cast to (double*) to avoid GCC warning.
++
++2009-10-29  Ralf Corsépius <ralf.corsepius at rtems.org>
++
++	* libc/include/inttypes.h: 
++	Rework logic to determine PRI*PTR.
++	Prefer long64 over longlong64.
++	* libc/include/machine/_default_types.h: 
++	Sync logic for __int32 with stdint.h (Prefer long over int).
++	* libc/include/stdint.h:
++	Remove __SPU__ hack.
++	Prefer int for int16_t (sync with _default_types.h).
++	Rework intptr_t determination.
++
++2009-03-09  Ralf Corsépius <ralf.corsepius at rtems.org>
++
++	* libc/machine/powerpc/times.c: Remove.
++	* libc/machine/powerpc/Makefile.am: Remove times.c.
++	* libc/machine/powerpc/Makefile.in: Regenerate.
+diff -Naur newlib-1.20.0.orig/newlib/configure.host newlib-1.20.0/newlib/configure.host
+--- newlib-1.20.0.orig/newlib/configure.host	2011-11-29 07:33:48.000000000 +0100
++++ newlib-1.20.0/newlib/configure.host	2012-02-17 06:28:14.745873471 +0100
+@@ -46,7 +46,6 @@
+ #   crt1_dir            directory where crt1 object is found
+ #   have_crt0		"yes"/"no" if crt0 is/isn't provided.
+ #			"" if crt0 is provided when sys_dir is set
+-#   noinclude		list of include files to not install
+ 
+ newlib_cflags=
+ libm_machine_dir=
+@@ -59,7 +58,6 @@
+ xdr_dir=
+ syscall_dir=
+ unix_dir=
+-noinclude=
+ mach_add_setjmp=
+ crt1=
+ crt1_dir=
+@@ -787,11 +785,6 @@
+ 	fi
+ fi
+ 
+-# Remove rpc headers if xdr_dir not specified
+-if [ "x${xdir_dir}" = "x" ]; then
+-	noinclude="${noinclude} rpc/types.h rpc/xdr.h"
+-fi
+-
+ if test -z "${have_crt0}" && test -n "${sys_dir}"; then
+   have_crt0="yes"
+ fi
+diff -Naur newlib-1.20.0.orig/newlib/doc/makedoc.c newlib-1.20.0/newlib/doc/makedoc.c
+--- newlib-1.20.0.orig/newlib/doc/makedoc.c	2009-03-25 22:16:04.000000000 +0100
++++ newlib-1.20.0/newlib/doc/makedoc.c	2012-02-17 06:28:14.745873471 +0100
+@@ -57,7 +57,7 @@
+ {
+     char *ptr;
+     unsigned int write_idx;
+-    unsigned int size;
++    size_t size;
+ } string_type;
+ 
+ 
+@@ -68,7 +68,7 @@
+ 
+ static void DEFUN(init_string_with_size,(buffer, size),
+ 	   string_type *buffer AND
+-	   unsigned int size )
++	   size_t size )
+ {
+   buffer->write_idx = 0;
+   buffer->size = size;
+@@ -219,8 +219,8 @@
+ stinst_type *pc;
+ stinst_type sstack[STACK];
+ stinst_type *ssp = &sstack[0];
+-int istack[STACK];
+-int *isp = &istack[0];
++long istack[STACK];
++long *isp = &istack[0];
+ 
+ typedef int *word_type;
+ 
+@@ -270,7 +270,7 @@
+ {
+     isp++;
+     pc++;
+-    *isp = (int)(*pc);
++    *isp = (long)(*pc);
+     pc++;
+     
+ }
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/_ansi.h newlib-1.20.0/newlib/libc/include/_ansi.h
+--- newlib-1.20.0.orig/newlib/libc/include/_ansi.h	2009-12-17 20:43:43.000000000 +0100
++++ newlib-1.20.0/newlib/libc/include/_ansi.h	2012-02-17 06:28:14.746873484 +0100
+@@ -113,21 +113,24 @@
+   to emit the function body unless the address is explicitly
+   taken.  However this behaviour is changing to match the C99
+   standard, which uses 'extern inline' to indicate that the
+-  function body *must* be emitted.  If we are using GCC, but do
+-  not have the new behaviour, we need to use extern inline; if
+-  we are using a new GCC with the C99-compatible behaviour, or
+-  a non-GCC compiler (which we will have to hope is C99, since
+-  there is no other way to achieve the effect of omitting the
+-  function if it isn't referenced) we just use plain 'inline',
+-  which c99 defines to mean more-or-less the same as the Gnu C
+-  'extern inline'.  */
++  function body *must* be emitted.  Likewise, a function declared
++  without either 'extern' or 'static' defaults to extern linkage
++  (C99 6.2.2p5), and the compiler may choose whether to use the
++  inline version or call the extern linkage version (6.7.4p6).
++  If we are using GCC, but do not have the new behaviour, we need
++  to use extern inline; if we are using a new GCC with the
++  C99-compatible behaviour, or a non-GCC compiler (which we will
++  have to hope is C99, since there is no other way to achieve the
++  effect of omitting the function if it isn't referenced) we use
++  'static inline', which c99 defines to mean more-or-less the same
++  as the Gnu C 'extern inline'.  */
+ #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
+ /* We're using GCC, but without the new C99-compatible behaviour.  */
+ #define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__))
+ #else
+-/* We're using GCC in C99 mode, or an unknown compiler which 
++/* We're using GCC in C99 mode, or an unknown compiler which
+   we just have to hope obeys the C99 semantics of inline.  */
+-#define _ELIDABLE_INLINE __inline__
++#define _ELIDABLE_INLINE static __inline__
+ #endif
+ 
+ #endif /* _ANSIDECL_H_ */
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/complex.h newlib-1.20.0/newlib/libc/include/complex.h
+--- newlib-1.20.0.orig/newlib/libc/include/complex.h	2010-10-08 12:35:13.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/complex.h	2012-02-17 06:28:14.747873496 +0100
+@@ -77,7 +77,7 @@
+ 
+ /* 7.3.8 Power and absolute-value functions */
+ /* 7.3.8.1 The cabs functions */
+-/*#ifndef __LIBM0_SOURCE__
++/*#ifndef __LIBM0_SOURCE__ */
+ /* avoid conflict with historical cabs(struct complex) */
+ /* double cabs(double complex) __RENAME(__c99_cabs);
+    float cabsf(float complex) __RENAME(__c99_cabsf);
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/inttypes.h newlib-1.20.0/newlib/libc/include/inttypes.h
+--- newlib-1.20.0.orig/newlib/libc/include/inttypes.h	2009-01-19 23:02:06.000000000 +0100
++++ newlib-1.20.0/newlib/libc/include/inttypes.h	2012-02-17 06:28:14.747873496 +0100
+@@ -242,15 +242,17 @@
+ #define SCNxMAX		__SCNMAX(x)
+ 
+ /* ptr types */
+-#if __have_long64
+-#define __PRIPTR(x) __STRINGIFY(l##x)
+-#define __SCNPTR(x) __STRINGIFY(l##x)
+-#elif __have_longlong64
+-#define __PRIPTR(x) __STRINGIFY(ll##x)
+-#define __SCNPTR(x) __STRINGIFY(ll##x)
++#if INTPTR_MAX == INT64_MAX
++#define __PRIPTR(x) __PRI64(x)
++#define __SCNPTR(x) __SCN64(x)
++#elif INTPTR_MAX == INT32_MAX
++#define __PRIPTR(x) __PRI32(x)
++#define __SCNPTR(x) __SCN32(x)
++#elif INTPTR_MAX == INT16_MAX
++#define __PRIPTR(x) __PRI16(x)
++#define __SCNPTR(x) __SCN16(x)
+ #else
+-#define __PRIPTR(x) __STRINGIFY(x)
+-#define __SCNPTR(x) __STRINGIFY(x)
++#error cannot determine PRI*PTR
+ #endif
+ 
+ #define PRIdPTR		__PRIPTR(d)
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/machine/_default_types.h newlib-1.20.0/newlib/libc/include/machine/_default_types.h
+--- newlib-1.20.0.orig/newlib/libc/include/machine/_default_types.h	2008-06-12 00:14:54.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/machine/_default_types.h	2012-02-17 06:28:14.747873496 +0100
+@@ -54,14 +54,14 @@
+ #endif
+ #endif
+ 
+-#if __EXP(INT_MAX) == 0x7fffffffL
+-typedef signed int __int32_t;
+-typedef unsigned int __uint32_t;
+-#define ___int32_t_defined 1
+-#elif __EXP(LONG_MAX) == 0x7fffffffL
++#if __EXP(LONG_MAX) == 0x7fffffffL
+ typedef signed long __int32_t;
+ typedef unsigned long __uint32_t;
+ #define ___int32_t_defined 1
++#elif __EXP(INT_MAX) == 0x7fffffffL
++typedef signed int __int32_t;
++typedef unsigned int __uint32_t;
++#define ___int32_t_defined 1
+ #elif __EXP(SHRT_MAX) == 0x7fffffffL
+ typedef signed short __int32_t;
+ typedef unsigned short __uint32_t;
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/process.h newlib-1.20.0/newlib/libc/include/process.h
+--- newlib-1.20.0.orig/newlib/libc/include/process.h	2011-08-19 16:29:34.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/process.h	1970-01-01 01:00:00.000000000 +0100
+@@ -1,37 +0,0 @@
+-/* process.h.  Define spawn family of functions as provided by Cygwin.
+-   The original file of this name is a MS/DOS invention. */
+-
+-#ifndef __PROCESS_H_
+-#define __PROCESS_H_
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-/* For the exec functions, include unistd.h. */
+-
+-int spawnl(int mode, const char *path, const char *argv0, ...);
+-int spawnle(int mode, const char *path, const char *argv0, ... /*, char * const *envp */);
+-int spawnlp(int mode, const char *path, const char *argv0, ...);
+-int spawnlpe(int mode, const char *path, const char *argv0, ... /*, char * const *envp */);
+-
+-int spawnv(int mode, const char *path, const char * const *argv);
+-int spawnve(int mode, const char *path, const char * const *argv, const char * const *envp);
+-int spawnvp(int mode, const char *path, const char * const *argv);
+-int spawnvpe(int mode, const char *path, const char * const *argv, const char * const *envp);
+-
+-int cwait(int *, int, int);
+-
+-#define _P_WAIT		1
+-#define _P_NOWAIT	2	/* always generates error */
+-#define _P_OVERLAY	3
+-#define _P_NOWAITO	4
+-#define _P_DETACH	5
+-
+-#define WAIT_CHILD 1
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/signal.h newlib-1.20.0/newlib/libc/include/signal.h
+--- newlib-1.20.0.orig/newlib/libc/include/signal.h	2011-05-04 13:26:21.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/signal.h	2012-02-17 06:28:14.751873560 +0100
+@@ -7,10 +7,6 @@
+ _BEGIN_STD_C
+ 
+ typedef int	sig_atomic_t;		/* Atomic entity type (ANSI) */
+-#ifndef _POSIX_SOURCE
+-typedef _sig_func_ptr sig_t;		/* BSD naming */
+-typedef _sig_func_ptr sighandler_t;	/* glibc naming */
+-#endif /* !_POSIX_SOURCE */
+ 
+ #define SIG_DFL ((_sig_func_ptr)0)	/* Default action */
+ #define SIG_IGN ((_sig_func_ptr)1)	/* Ignore action */
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/stdint.h newlib-1.20.0/newlib/libc/include/stdint.h
+--- newlib-1.20.0.orig/newlib/libc/include/stdint.h	2009-04-24 23:55:07.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/stdint.h	2012-02-17 06:28:14.751873560 +0100
+@@ -33,7 +33,7 @@
+ /* Check if "long" is 64bit or 32bit wide */
+ #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+ #define __have_long64 1
+-#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
++#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff
+ #define __have_long32 1
+ #endif
+ 
+@@ -49,14 +49,14 @@
+ #define __int_least8_t_defined 1
+ #endif
+ 
+-#if __STDINT_EXP(SHRT_MAX) == 0x7fff
+-typedef signed short int16_t;
+-typedef unsigned short uint16_t;
+-#define __int16_t_defined 1
+-#elif __STDINT_EXP(INT_MAX) == 0x7fff
++#if __STDINT_EXP(INT_MAX) == 0x7fff
+ typedef signed int int16_t;
+ typedef unsigned int uint16_t;
+ #define __int16_t_defined 1
++#elif __STDINT_EXP(SHRT_MAX) == 0x7fff
++typedef signed short int16_t;
++typedef unsigned short uint16_t;
++#define __int16_t_defined 1
+ #elif __STDINT_EXP(SCHAR_MAX) == 0x7fff
+ typedef signed char int16_t;
+ typedef unsigned char uint16_t;
+@@ -239,6 +239,29 @@
+  * GCC doesn't provide an appropriate macro for [u]intptr_t
+  * For now, use __PTRDIFF_TYPE__
+  */
++#if defined(__SIZEOF_POINTER__)
++#if __SIZEOF_POINTER__ == 8
++  typedef int64_t intptr_t;
++  typedef uint64_t uintptr_t;
++#define INTPTR_MAX INT64_MAX
++#define INTPTR_MIN INT64_MIN
++#define UINTPTR_MAX UINT64_MAX
++#elif __SIZEOF_POINTER__ == 4
++  typedef int32_t intptr_t;
++  typedef uint32_t uintptr_t;
++#define INTPTR_MAX INT32_MAX
++#define INTPTR_MIN INT32_MIN
++#define UINTPTR_MAX UINT32_MAX
++#elif __SIZEOF_POINTER__ == 2
++  typedef int16_t intptr_t;
++  typedef uint16_t uintptr_t;
++#define INTPTR_MAX INT16_MAX
++#define INTPTR_MIN INT16_MIN
++#define UINTPTR_MAX UINT16_MAX
++#else
++#error cannot determine intptr_t
++#endif
++#else
+ #if defined(__PTRDIFF_TYPE__)
+ typedef signed __PTRDIFF_TYPE__ intptr_t;
+ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
+@@ -260,6 +283,7 @@
+ #define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1)
+ #define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
+ #endif
++#endif
+ 
+ /* Limits of Specified-Width Integer Types */
+ 
+@@ -408,6 +432,8 @@
+ /* This must match size_t in stddef.h, currently long unsigned int */
+ #ifdef __SIZE_MAX__
+ #define SIZE_MAX __SIZE_MAX__
++#elif defined(__SIZEOF_SIZE_T__) && defined(__CHAR_BIT__)
++#define SIZE_MAX (((1UL << (__SIZEOF_SIZE_T__ * __CHAR_BIT__ - 1)) - 1) * 2 + 1)
+ #else
+ #define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
+ #endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/stdio.h newlib-1.20.0/newlib/libc/include/stdio.h
+--- newlib-1.20.0.orig/newlib/libc/include/stdio.h	2010-02-26 10:41:43.000000000 +0100
++++ newlib-1.20.0/newlib/libc/include/stdio.h	2012-02-17 06:28:14.751873560 +0100
+@@ -308,7 +308,7 @@
+  * Routines in POSIX 1003.1:2001.
+  */
+ 
+-#ifndef __STRICT_ANSI__
++#if (!defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L))
+ #ifndef _REENT_ONLY
+ FILE *	_EXFUN(fdopen, (int, const char *));
+ #endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/stdlib.h newlib-1.20.0/newlib/libc/include/stdlib.h
+--- newlib-1.20.0.orig/newlib/libc/include/stdlib.h	2010-07-19 20:21:11.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/stdlib.h	2012-02-17 06:28:14.752873575 +0100
+@@ -38,7 +38,7 @@
+   long rem; /* remainder */
+ } ldiv_t;
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L)
+ typedef struct
+ {
+   long long int quot; /* quotient */
+@@ -63,13 +63,12 @@
+ int	_EXFUN(abs,(int));
+ int	_EXFUN(atexit,(_VOID (*__func)(_VOID)));
+ double	_EXFUN(atof,(const char *__nptr));
+-#ifndef __STRICT_ANSI__
+-float	_EXFUN(atoff,(const char *__nptr));
+-#endif
+ int	_EXFUN(atoi,(const char *__nptr));
+-int	_EXFUN(_atoi_r,(struct _reent *, const char *__nptr));
+ long	_EXFUN(atol,(const char *__nptr));
++#ifndef __STRICT_ANSI__
++int	_EXFUN(_atoi_r,(struct _reent *, const char *__nptr));
+ long	_EXFUN(_atol_r,(struct _reent *, const char *__nptr));
++#endif /* ! __STRICT_ANSI__ */
+ _PTR	_EXFUN(bsearch,(const _PTR __key,
+ 		       const _PTR __base,
+ 		       size_t __nmemb,
+@@ -80,10 +79,10 @@
+ _VOID	_EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn)));
+ _VOID	_EXFUN_NOTHROW(free,(_PTR));
+ char *  _EXFUN(getenv,(const char *__string));
++#ifndef __STRICT_ANSI__
+ char *	_EXFUN(_getenv_r,(struct _reent *, const char *__string));
+ char *	_EXFUN(_findenv,(_CONST char *, int *));
+ char *	_EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *));
+-#ifndef __STRICT_ANSI__
+ extern char *suboptarg;			/* getsubopt(3) external variable */
+ int	_EXFUN(getsubopt,(char **, char * const *, char **));
+ #endif
+@@ -91,16 +90,16 @@
+ ldiv_t	_EXFUN(ldiv,(long __numer, long __denom));
+ _PTR	_EXFUN_NOTHROW(malloc,(size_t __size));
+ int	_EXFUN(mblen,(const char *, size_t));
+-int	_EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *));
+ int	_EXFUN(mbtowc,(wchar_t *, const char *, size_t));
+-int	_EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *));
+ int	_EXFUN(wctomb,(char *, wchar_t));
+-int	_EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, _mbstate_t *));
+ size_t	_EXFUN(mbstowcs,(wchar_t *, const char *, size_t));
+-size_t	_EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *));
+ size_t	_EXFUN(wcstombs,(char *, const wchar_t *, size_t));
+-size_t	_EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, _mbstate_t *));
+ #ifndef __STRICT_ANSI__
++int	_EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *));
++int	_EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *));
++int	_EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, _mbstate_t *));
++size_t	_EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *));
++size_t	_EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, _mbstate_t *));
+ #ifndef _REENT_ONLY
+ char *	_EXFUN(mkdtemp,(char *));
+ int	_EXFUN(mkostemp,(char *, int));
+@@ -133,10 +132,11 @@
+ # endif
+ #endif
+ long	_EXFUN(strtol,(const char *__n, char **__end_PTR, int __base));
+-long	_EXFUN(_strtol_r,(struct _reent *,const char *__n, char **__end_PTR, int __base));
+ unsigned long _EXFUN(strtoul,(const char *__n, char **__end_PTR, int __base));
++#ifndef __STRICT_ANSI__
+ unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *__n, char **__end_PTR, int __base));
+-
++long	_EXFUN(_strtol_r,(struct _reent *,const char *__n, char **__end_PTR, int __base));
++#endif /* !__STRICT_ANSI__ */
+ int	_EXFUN(system,(const char *__string));
+ 
+ #ifndef __STRICT_ANSI__
+@@ -163,33 +163,39 @@
+ int	_EXFUN(rand_r,(unsigned *__seed));
+ 
+ double _EXFUN(drand48,(_VOID));
+-double _EXFUN(_drand48_r,(struct _reent *));
+ double _EXFUN(erand48,(unsigned short [3]));
+-double _EXFUN(_erand48_r,(struct _reent *, unsigned short [3]));
+ long   _EXFUN(jrand48,(unsigned short [3]));
+-long   _EXFUN(_jrand48_r,(struct _reent *, unsigned short [3]));
+ _VOID  _EXFUN(lcong48,(unsigned short [7]));
+-_VOID  _EXFUN(_lcong48_r,(struct _reent *, unsigned short [7]));
+ long   _EXFUN(lrand48,(_VOID));
+-long   _EXFUN(_lrand48_r,(struct _reent *));
+ long   _EXFUN(mrand48,(_VOID));
+-long   _EXFUN(_mrand48_r,(struct _reent *));
+ long   _EXFUN(nrand48,(unsigned short [3]));
+-long   _EXFUN(_nrand48_r,(struct _reent *, unsigned short [3]));
+ unsigned short *
+        _EXFUN(seed48,(unsigned short [3]));
++_VOID  _EXFUN(srand48,(long));
++long long _EXFUN(atoll,(const char *__nptr));
++#ifndef __STRICT_ANSI__
++double _EXFUN(_drand48_r,(struct _reent *));
++double _EXFUN(_erand48_r,(struct _reent *, unsigned short [3]));
++long   _EXFUN(_jrand48_r,(struct _reent *, unsigned short [3]));
++_VOID  _EXFUN(_lcong48_r,(struct _reent *, unsigned short [7]));
++long   _EXFUN(_lrand48_r,(struct _reent *));
++long   _EXFUN(_mrand48_r,(struct _reent *));
++long   _EXFUN(_nrand48_r,(struct _reent *, unsigned short [3]));
+ unsigned short *
+        _EXFUN(_seed48_r,(struct _reent *, unsigned short [3]));
+-_VOID  _EXFUN(srand48,(long));
+ _VOID  _EXFUN(_srand48_r,(struct _reent *, long));
+-long long _EXFUN(atoll,(const char *__nptr));
+ long long _EXFUN(_atoll_r,(struct _reent *, const char *__nptr));
++#endif /* ! __STRICT_ANSI__ */
++#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L)
+ long long _EXFUN(llabs,(long long));
+ lldiv_t	_EXFUN(lldiv,(long long __numer, long long __denom));
+ long long _EXFUN(strtoll,(const char *__n, char **__end_PTR, int __base));
+-long long _EXFUN(_strtoll_r,(struct _reent *, const char *__n, char **__end_PTR, int __base));
+ unsigned long long _EXFUN(strtoull,(const char *__n, char **__end_PTR, int __base));
++#endif
++#ifndef __STRICT_ANSI__
++long long _EXFUN(_strtoll_r,(struct _reent *, const char *__n, char **__end_PTR, int __base));
+ unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__n, char **__end_PTR, int __base));
++#endif /* ! __STRICT_ANSI__ */
+ 
+ #ifndef __CYGWIN__
+ _VOID	_EXFUN(cfree,(_PTR));
+@@ -203,6 +209,7 @@
+ 
+ #endif /* ! __STRICT_ANSI__ */
+ 
++#ifndef __STRICT_ANSI__
+ char *	_EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**));
+ #ifndef __CYGWIN__
+ _PTR	_EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t));
+@@ -214,6 +221,7 @@
+ int	_EXFUN(_system_r,(struct _reent *, const char *));
+ 
+ _VOID	_EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *));
++#endif /* ! __STRICT_ANSI__ */
+ 
+ /* On platforms where long double equals double.  */
+ #ifdef _LDBL_EQ_DBL
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/string.h newlib-1.20.0/newlib/libc/include/string.h
+--- newlib-1.20.0.orig/newlib/libc/include/string.h	2011-06-10 20:30:38.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/string.h	2012-02-17 06:28:14.752873575 +0100
+@@ -50,18 +50,11 @@
+ #ifndef __STRICT_ANSI__
+ char 	*_EXFUN(strtok_r,(char *, const char *, char **));
+ 
+-int	 _EXFUN(bcmp,(const void *, const void *, size_t));
+-void	 _EXFUN(bcopy,(const void *, void *, size_t));
+-void	 _EXFUN(bzero,(void *, size_t));
+-int	 _EXFUN(ffs,(int));
+-char 	*_EXFUN(index,(const char *, int));
+ _PTR	 _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
+ _PTR	 _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
+ _PTR	 _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
+-char 	*_EXFUN(rindex,(const char *, int));
+ char 	*_EXFUN(stpcpy,(char *, const char *));
+ char 	*_EXFUN(stpncpy,(char *, const char *, size_t));
+-int	 _EXFUN(strcasecmp,(const char *, const char *));
+ char	*_EXFUN(strcasestr,(const char *, const char *));
+ char 	*_EXFUN(strchrnul,(const char *, int));
+ char 	*_EXFUN(strdup,(const char *));
+@@ -84,14 +77,11 @@
+ #endif
+ size_t	 _EXFUN(strlcat,(char *, const char *, size_t));
+ size_t	 _EXFUN(strlcpy,(char *, const char *, size_t));
+-int	 _EXFUN(strncasecmp,(const char *, const char *, size_t));
+ size_t	 _EXFUN(strnlen,(const char *, size_t));
+ char 	*_EXFUN(strsep,(char **, const char *));
+ char	*_EXFUN(strlwr,(char *));
+ char	*_EXFUN(strupr,(char *));
+-#ifndef DEFS_H	/* Kludge to work around problem compiling in gdb */
+-char  *_EXFUN(strsignal, (int __signo));
+-#endif
++char	*_EXFUN(strsignal, (int __signo));
+ #ifdef __CYGWIN__
+ int     _EXFUN(strtosigno, (const char *__name));
+ #endif
+@@ -113,20 +103,6 @@
+ 			 (char *) memcpy (__out, __in, __len-1);}))
+ #endif /* _GNU_SOURCE && __GNUC__ */
+ 
+-/* These function names are used on Windows and perhaps other systems.  */
+-#ifndef strcmpi
+-#define strcmpi strcasecmp
+-#endif
+-#ifndef stricmp
+-#define stricmp strcasecmp
+-#endif
+-#ifndef strncmpi
+-#define strncmpi strncasecmp
+-#endif
+-#ifndef strnicmp
+-#define strnicmp strncasecmp
+-#endif
+-
+ #endif /* ! __STRICT_ANSI__ */
+ 
+ #include <sys/string.h>
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/sys/_default_fcntl.h newlib-1.20.0/newlib/libc/include/sys/_default_fcntl.h
+--- newlib-1.20.0.orig/newlib/libc/include/sys/_default_fcntl.h	2010-01-14 19:49:13.000000000 +0100
++++ newlib-1.20.0/newlib/libc/include/sys/_default_fcntl.h	2012-02-17 06:28:14.753873590 +0100
+@@ -51,8 +51,6 @@
+ #define O_BINARY	_FBINARY
+ #define O_TEXT		_FTEXT
+ #define O_NOINHERIT	_FNOINHERIT
+-/* O_CLOEXEC is the Linux equivalent to O_NOINHERIT */
+-#define O_CLOEXEC	_FNOINHERIT
+ 
+ /* The windows header files define versions with a leading underscore.  */
+ #define _O_RDONLY	O_RDONLY
+@@ -124,9 +122,6 @@
+ #define	F_CNVT 		12	/* Convert a fhandle to an open fd */
+ #define	F_RSETLKW 	13	/* Set or Clear remote record-lock(Blocking) */
+ #endif	/* !_POSIX_SOURCE */
+-#ifdef __CYGWIN__
+-#define	F_DUPFD_CLOEXEC	14	/* As F_DUPFD, but set close-on-exec flag */
+-#endif
+ 
+ /* fcntl(2) flags (l_type field of flock structure) */
+ #define	F_RDLCK		1	/* read lock */
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/sys/dir.h newlib-1.20.0/newlib/libc/include/sys/dir.h
+--- newlib-1.20.0.orig/newlib/libc/include/sys/dir.h	2010-08-11 20:14:54.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/sys/dir.h	1970-01-01 01:00:00.000000000 +0100
+@@ -1,10 +0,0 @@
+-/* BSD predecessor of POSIX.1 <dirent.h> and struct dirent */
+-
+-#ifndef _SYS_DIR_H_
+-#define _SYS_DIR_H_
+-
+-#include <dirent.h>
+-
+-#define direct dirent
+-
+-#endif /*_SYS_DIR_H_*/
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/sys/resource.h newlib-1.20.0/newlib/libc/include/sys/resource.h
+--- newlib-1.20.0.orig/newlib/libc/include/sys/resource.h	2000-02-17 20:39:46.000000000 +0100
++++ newlib-1.20.0/newlib/libc/include/sys/resource.h	2012-02-17 06:28:14.753873590 +0100
+@@ -6,10 +6,22 @@
+ #define	RUSAGE_SELF	0		/* calling process */
+ #define	RUSAGE_CHILDREN	-1		/* terminated child processes */
+ 
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ struct rusage {
+   	struct timeval ru_utime;	/* user time used */
+ 	struct timeval ru_stime;	/* system time used */
+ };
+ 
++#if defined(__rtems__)
++int _EXFUN(getrusage,(int who, struct rusage *usage));
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++
+ #endif
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/sys/time.h newlib-1.20.0/newlib/libc/include/sys/time.h
+--- newlib-1.20.0.orig/newlib/libc/include/sys/time.h	2009-10-09 20:43:12.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/sys/time.h	2012-02-17 06:28:14.753873590 +0100
+@@ -78,6 +78,11 @@
+ int _EXFUN(setitimer, (int __which, const struct itimerval *__value,
+ 					struct itimerval *__ovalue));
+ 
++#if defined(__rtems__)
++/* BSD function used by RTEMS code */
++int _EXFUN(adjtime,(const struct timeval *, struct timeval *));
++#endif
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/sys/unistd.h newlib-1.20.0/newlib/libc/include/sys/unistd.h
+--- newlib-1.20.0.orig/newlib/libc/include/sys/unistd.h	2011-08-19 16:29:34.000000000 +0200
++++ newlib-1.20.0/newlib/libc/include/sys/unistd.h	2012-02-17 06:28:14.753873590 +0100
+@@ -71,6 +71,9 @@
+ long    _EXFUN(fpathconf, (int __fd, int __name ));
+ int     _EXFUN(fsync, (int __fd));
+ int     _EXFUN(fdatasync, (int __fd));
++#if defined(__CYGWIN__)
++char *  _EXFUN(get_current_dir_name, (void));
++#endif
+ char *  _EXFUN(getcwd, (char *__buf, size_t __size ));
+ #if defined(__CYGWIN__)
+ int	_EXFUN(getdomainname ,(char *__name, size_t __len));
+diff -Naur newlib-1.20.0.orig/newlib/libc/include/tgmath.h newlib-1.20.0/newlib/libc/include/tgmath.h
+--- newlib-1.20.0.orig/newlib/libc/include/tgmath.h	1970-01-01 01:00:00.000000000 +0100
++++ newlib-1.20.0/newlib/libc/include/tgmath.h	2012-02-17 06:28:14.754873605 +0100
+@@ -0,0 +1,185 @@
++/* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/tgmath.h.html */
++/*-
++ * Copyright (c) 2004 Stefan Farfeleder.
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * $FreeBSD$
++ */
++
++#ifndef _TGMATH_H_
++#define	_TGMATH_H_
++
++#include <complex.h>
++#include <math.h>
++
++#ifdef log2
++#undef log2
++#endif
++
++/*
++ * This implementation of <tgmath.h> requires two implementation-dependent
++ * macros to be defined:
++ * __tg_impl_simple(x, y, z, fn, fnf, fnl, ...)
++ *	Invokes fnl() if the corresponding real type of x, y or z is long
++ *	double, fn() if it is double or any has an integer type, and fnf()
++ *	otherwise.
++ * __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...)
++ *	Invokes [c]fnl() if the corresponding real type of x, y or z is long
++ *	double, [c]fn() if it is double or any has an integer type, and
++ *	[c]fnf() otherwise.  The function with the 'c' prefix is called if
++ *	any of x, y or z is a complex number.
++ * Both macros call the chosen function with all additional arguments passed
++ * to them, as given by __VA_ARGS__.
++ *
++ * Note that these macros cannot be implemented with C's ?: operator,
++ * because the return type of the whole expression would incorrectly be long
++ * double complex regardless of the argument types.
++ */
++
++/* requires GCC >= 3.1 */
++#if !defined(__GNUC__) || __GNUC__ < 3 || \
++	(__GNUC__ == 3 && __GNUC_MINOR__ < 1)
++#error "<tgmath.h> not implemented for this compiler"
++#endif
++
++#define	__tg_type(__e, __t)						\
++	__builtin_types_compatible_p(__typeof__(__e), __t)
++#define	__tg_type3(__e1, __e2, __e3, __t)				\
++	(__tg_type(__e1, __t) || __tg_type(__e2, __t) || 		\
++	 __tg_type(__e3, __t))
++#define	__tg_type_corr(__e1, __e2, __e3, __t)				\
++	(__tg_type3(__e1, __e2, __e3, __t) || 				\
++	 __tg_type3(__e1, __e2, __e3, __t _Complex))
++#define	__tg_integer(__e1, __e2, __e3)					\
++	(((__typeof__(__e1))1.5 == 1) || ((__typeof__(__e2))1.5 == 1) ||	\
++	 ((__typeof__(__e3))1.5 == 1))
++#define	__tg_is_complex(__e1, __e2, __e3)				\
++	(__tg_type3(__e1, __e2, __e3, float _Complex) ||		\
++	 __tg_type3(__e1, __e2, __e3, double _Complex) ||		\
++	 __tg_type3(__e1, __e2, __e3, long double _Complex) ||		\
++	 __tg_type3(__e1, __e2, __e3, __typeof__(_Complex_I)))
++
++#ifdef _LDBL_EQ_DBL
++#define	__tg_impl_simple(x, y, z, fn, fnf, fnl, ...)			\
++	__builtin_choose_expr(__tg_type_corr(x, y, z, long double),	\
++	    fnl(__VA_ARGS__), __builtin_choose_expr(			\
++		__tg_type_corr(x, y, z, double) || __tg_integer(x, y, z),\
++		fn(__VA_ARGS__), fnf(__VA_ARGS__)))
++#else
++#define	__tg_impl_simple(__x, __y, __z, __fn, __fnf, __fnl, ...)	\
++	(__tg_type_corr(__x, __y, __z, double) || __tg_integer(__x, __y, __z)) \
++		? __fn(__VA_ARGS__) : __fnf(__VA_ARGS__)
++#endif
++
++#define	__tg_impl_full(__x, __y, __z, __fn, __fnf, __fnl, __cfn, __cfnf, __cfnl, ...)	\
++	__builtin_choose_expr(__tg_is_complex(__x, __y, __z),		\
++	    __tg_impl_simple(__x, __y, __z, __cfn, __cfnf, __cfnl, __VA_ARGS__),	\
++	    __tg_impl_simple(__x, __y, __z, __fn, __fnf, __fnl, __VA_ARGS__))
++
++/* Macros to save lots of repetition below */
++#define	__tg_simple(__x, __fn)						\
++	__tg_impl_simple(__x, __x, __x, __fn, __fn##f, __fn##l, __x)
++#define	__tg_simple2(__x, __y, __fn)					\
++	__tg_impl_simple(__x, __x, __y, __fn, __fn##f, __fn##l, __x, __y)
++#define	__tg_simplev(__x, __fn, ...)					\
++	__tg_impl_simple(__x, __x, __x, __fn, __fn##f, __fn##l, __VA_ARGS__)
++#define	__tg_full(__x, __fn)						\
++	__tg_impl_full(__x, __x, __x, __fn, __fn##f, __fn##l, c##__fn, c##__fn##f, c##__fn##l, __x)
++
++/* 7.22#4 -- These macros expand to real or complex functions, depending on
++ * the type of their arguments. */
++#define	acos(__x)		__tg_full(__x, acos)
++#define	asin(__x)		__tg_full(__x, asin)
++#define	atan(__x)		__tg_full(__x, atan)
++#define	acosh(__x)		__tg_full(__x, acosh)
++#define	asinh(__x)		__tg_full(__x, asinh)
++#define	atanh(__x)		__tg_full(__x, atanh)
++#define	cos(__x)		__tg_full(__x, cos)
++#define	sin(__x)		__tg_full(__x, sin)
++#define	tan(__x)		__tg_full(__x, tan)
++#define	cosh(__x)		__tg_full(__x, cosh)
++#define	sinh(__x)		__tg_full(__x, sinh)
++#define	tanh(__x)		__tg_full(__x, tanh)
++#define	exp(__x)		__tg_full(__x, exp)
++#define	log(__x)		__tg_full(__x, log)
++#define	pow(__x, __y)		__tg_impl_full(__x, __x, __y, pow, powf, powl,	\
++						cpow, cpowf, cpowl, __x, __y)
++#define	sqrt(__x)		__tg_full(__x, sqrt)
++
++/* "The corresponding type-generic macro for fabs and cabs is fabs." */
++#define	fabs(__x)		__tg_impl_full(__x, __x, __x, fabs, fabsf, fabsl,	\
++						cabs, cabsf, cabsl, __x)
++
++/* 7.22#5 -- These macros are only defined for arguments with real type. */
++#define	atan2(__x, __y)		__tg_simple2(__x, __y, atan2)
++#define	cbrt(__x)		__tg_simple(__x, cbrt)
++#define	ceil(__x)		__tg_simple(__x, ceil)
++#define	copysign(__x, __y)	__tg_simple2(__x, __y, copysign)
++#define	erf(__x)		__tg_simple(__x, erf)
++#define	erfc(__x)		__tg_simple(__x, erfc)
++#define	exp2(__x)		__tg_simple(__x, exp2)
++#define	expm1(__x)		__tg_simple(__x, expm1)
++#define	fdim(__x, __y)		__tg_simple2(__x, __y, fdim)
++#define	floor(__x)		__tg_simple(__x, floor)
++#define	fma(__x, __y, __z)	__tg_impl_simple(__x, __y, __z, fma, fmaf, fmal, \
++						 __x, __y, __z)
++#define	fmax(__x, __y)		__tg_simple2(__x, __y, fmax)
++#define	fmin(__x, __y)		__tg_simple2(__x, __y, fmin)
++#define	fmod(__x, __y)		__tg_simple2(__x, __y, fmod)
++#define	frexp(__x, __y)		__tg_simplev(__x, frexp, __x, __y)
++#define	hypot(__x, __y)		__tg_simple2(__x, __y, hypot)
++#define	ilogb(__x)		__tg_simple(__x, ilogb)
++#define	ldexp(__x, __y)		__tg_simplev(__x, ldexp, __x, __y)
++#define	lgamma(__x)		__tg_simple(__x, lgamma)
++#define	llrint(__x)		__tg_simple(__x, llrint)
++#define	llround(__x)		__tg_simple(__x, llround)
++#define	log10(__x)		__tg_simple(__x, log10)
++#define	log1p(__x)		__tg_simple(__x, log1p)
++#define	log2(__x)		__tg_simple(__x, log2)
++#define	logb(__x)		__tg_simple(__x, logb)
++#define	lrint(__x)		__tg_simple(__x, lrint)
++#define	lround(__x)		__tg_simple(__x, lround)
++#define	nearbyint(__x)		__tg_simple(__x, nearbyint)
++#define	nextafter(__x, __y)	__tg_simple2(__x, __y, nextafter)
++/* not yet implemented even for _LDBL_EQ_DBL platforms
++#define	nexttoward(__x, __y)	__tg_simplev(__x, nexttoward, __x, __y)
++*/
++#define	remainder(__x, __y)	__tg_simple2(__x, __y, remainder)
++#define	remquo(__x, __y, __z)	__tg_impl_simple(__x, __x, __y, remquo, remquof,	\
++						 remquol, __x, __y, __z)
++#define	rint(__x)		__tg_simple(__x, rint)
++#define	round(__x)		__tg_simple(__x, round)
++#define	scalbn(__x, __y)	__tg_simplev(__x, scalbn, __x, __y)
++#define	scalbln(__x, __y)	__tg_simplev(__x, scalbln, __x, __y)
++#define	tgamma(__x)		__tg_simple(__x, tgamma)
++#define	trunc(__x)		__tg_simple(__x, trunc)
++
++/* 7.22#6 -- These macros always expand to complex functions. */
++#define	carg(__x)		__tg_simple(__x, carg)
++#define	cimag(__x)		__tg_simple(__x, cimag)
++#define	conj(__x)		__tg_simple(__x, conj)
++#define	cproj(__x)		__tg_simple(__x, cproj)
++#define	creal(__x)		__tg_simple(__x, creal)
++
++#endif /* !_TGMATH_H_ */
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/arm_asm.h newlib-1.20.0/newlib/libc/machine/arm/arm_asm.h
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/arm_asm.h	2011-10-18 13:35:17.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/arm_asm.h	2012-02-17 06:28:14.755873620 +0100
+@@ -62,22 +62,7 @@
+ 
+ 
+ /* Now some macros for common instruction sequences.  */
+-#ifdef __ASSEMBLER__
+-.macro  RETURN     cond=
+-#if defined (_ISA_ARM_4T) || defined (_ISA_THUMB_1)
+-	bx\cond	lr
+-#else
+-	mov\cond pc, lr
+-#endif
+-.endm
+-
+-.macro optpld	base, offset=#0
+-#if defined (_ISA_ARM_7)
+-	pld	[\base, \offset]
+-#endif
+-.endm
+ 
+-#else
+ asm(".macro  RETURN	cond=\n\t"
+ #if defined (_ISA_ARM_4T) || defined (_ISA_THUMB_1)
+     "bx\\cond	lr\n\t"
+@@ -93,6 +78,5 @@
+ #endif
+     ".endm"
+     );
+-#endif
+ 
+ #endif /* ARM_ASM__H */
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/Makefile.am newlib-1.20.0/newlib/libc/machine/arm/Makefile.am
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/Makefile.am	2011-10-18 13:35:17.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/Makefile.am	2012-02-17 06:28:14.754873605 +0100
+@@ -8,9 +8,7 @@
+ 
+ noinst_LIBRARIES = lib.a
+ 
+-lib_a_SOURCES = setjmp.S access.c strlen.c strcmp.c strcpy.c \
+-	        memcpy.S memcpy-stub.c memchr-stub.c memchr.S \
+-		strlen.c strlen-armv7.S
++lib_a_SOURCES = setjmp.S access.c strlen.c strcmp.c strcpy.c
+ lib_a_CCASFLAGS=$(AM_CCASFLAGS)
+ lib_a_CFLAGS = $(AM_CFLAGS)
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/Makefile.in newlib-1.20.0/newlib/libc/machine/arm/Makefile.in
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/Makefile.in	2011-10-18 13:35:17.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/Makefile.in	2012-02-17 06:28:14.755873620 +0100
+@@ -54,10 +54,7 @@
+ lib_a_LIBADD =
+ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT) \
+ 	lib_a-strlen.$(OBJEXT) lib_a-strcmp.$(OBJEXT) \
+-	lib_a-strcpy.$(OBJEXT) lib_a-memcpy.$(OBJEXT) \
+-	lib_a-memcpy-stub.$(OBJEXT) lib_a-memchr-stub.$(OBJEXT) \
+-	lib_a-memchr.$(OBJEXT) lib_a-strlen.$(OBJEXT) \
+-	lib_a-strlen-armv7.$(OBJEXT)
++	lib_a-strcpy.$(OBJEXT)
+ lib_a_OBJECTS = $(am_lib_a_OBJECTS)
+ DEFAULT_INCLUDES = -I. at am__isrc@
+ depcomp =
+@@ -178,10 +175,7 @@
+ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+ AM_CCASFLAGS = $(INCLUDES)
+ noinst_LIBRARIES = lib.a
+-lib_a_SOURCES = setjmp.S access.c strlen.c strcmp.c strcpy.c \
+-	        memcpy.S memcpy-stub.c memchr-stub.c memchr.S \
+-		strlen.c strlen-armv7.S
+-
++lib_a_SOURCES = setjmp.S access.c strlen.c strcmp.c strcpy.c
+ lib_a_CCASFLAGS = $(AM_CCASFLAGS)
+ lib_a_CFLAGS = $(AM_CFLAGS)
+ ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
+@@ -250,24 +244,6 @@
+ lib_a-setjmp.obj: setjmp.S
+ 	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-setjmp.obj `if test -f 'setjmp.S'; then $(CYGPATH_W) 'setjmp.S'; else $(CYGPATH_W) '$(srcdir)/setjmp.S'; fi`
+ 
+-lib_a-memcpy.o: memcpy.S
+-	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy.o `test -f 'memcpy.S' || echo '$(srcdir)/'`memcpy.S
+-
+-lib_a-memcpy.obj: memcpy.S
+-	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy.obj `if test -f 'memcpy.S'; then $(CYGPATH_W) 'memcpy.S'; else $(CYGPATH_W) '$(srcdir)/memcpy.S'; fi`
+-
+-lib_a-memchr.o: memchr.S
+-	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memchr.o `test -f 'memchr.S' || echo '$(srcdir)/'`memchr.S
+-
+-lib_a-memchr.obj: memchr.S
+-	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memchr.obj `if test -f 'memchr.S'; then $(CYGPATH_W) 'memchr.S'; else $(CYGPATH_W) '$(srcdir)/memchr.S'; fi`
+-
+-lib_a-strlen-armv7.o: strlen-armv7.S
+-	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen-armv7.o `test -f 'strlen-armv7.S' || echo '$(srcdir)/'`strlen-armv7.S
+-
+-lib_a-strlen-armv7.obj: strlen-armv7.S
+-	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen-armv7.obj `if test -f 'strlen-armv7.S'; then $(CYGPATH_W) 'strlen-armv7.S'; else $(CYGPATH_W) '$(srcdir)/strlen-armv7.S'; fi`
+-
+ .c.o:
+ 	$(COMPILE) -c $<
+ 
+@@ -298,18 +274,6 @@
+ lib_a-strcpy.obj: strcpy.c
+ 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy.obj `if test -f 'strcpy.c'; then $(CYGPATH_W) 'strcpy.c'; else $(CYGPATH_W) '$(srcdir)/strcpy.c'; fi`
+ 
+-lib_a-memcpy-stub.o: memcpy-stub.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy-stub.o `test -f 'memcpy-stub.c' || echo '$(srcdir)/'`memcpy-stub.c
+-
+-lib_a-memcpy-stub.obj: memcpy-stub.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy-stub.obj `if test -f 'memcpy-stub.c'; then $(CYGPATH_W) 'memcpy-stub.c'; else $(CYGPATH_W) '$(srcdir)/memcpy-stub.c'; fi`
+-
+-lib_a-memchr-stub.o: memchr-stub.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memchr-stub.o `test -f 'memchr-stub.c' || echo '$(srcdir)/'`memchr-stub.c
+-
+-lib_a-memchr-stub.obj: memchr-stub.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memchr-stub.obj `if test -f 'memchr-stub.c'; then $(CYGPATH_W) 'memchr-stub.c'; else $(CYGPATH_W) '$(srcdir)/memchr-stub.c'; fi`
+-
+ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ 	unique=`for i in $$list; do \
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/memchr.S newlib-1.20.0/newlib/libc/machine/arm/memchr.S
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/memchr.S	2011-10-18 13:35:17.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/memchr.S	1970-01-01 01:00:00.000000000 +0100
+@@ -1,166 +0,0 @@
+-/* Copyright (c) 2010-2011, Linaro Limited
+-   All rights reserved.
+-
+-   Redistribution and use in source and binary forms, with or without
+-   modification, are permitted provided that the following conditions
+-   are met:
+-
+-      * Redistributions of source code must retain the above copyright
+-      notice, this list of conditions and the following disclaimer.
+-
+-      * Redistributions in binary form must reproduce the above copyright
+-      notice, this list of conditions and the following disclaimer in the
+-      documentation and/or other materials provided with the distribution.
+-
+-      * Neither the name of Linaro Limited nor the names of its
+-      contributors may be used to endorse or promote products derived
+-      from this software without specific prior written permission.
+-
+-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-   Written by Dave Gilbert <david.gilbert at linaro.org>
+-
+-   This memchr routine is optimised on a Cortex-A9 and should work on
+-   all ARMv7 processors.   It has a fast path for short sizes, and has
+-   an optimised path for large data sets; the worst case is finding the
+-   match early in a large data set. */
+-
+-@ 2011-02-07 david.gilbert at linaro.org
+-@    Extracted from local git a5b438d861
+-@ 2011-07-14 david.gilbert at linaro.org
+-@    Import endianness fix from local git ea786f1b
+-@ 2011-10-11 david.gilbert at linaro.org
+-@    Import from cortex-strings bzr rev 63
+-@    Flip to ldrd (as suggested by Greta Yorsh)
+-@    Make conditional on CPU type
+-@    tidy
+-
+-	.syntax unified
+-	.arch armv7-a
+-
+-#include "arm_asm.h"
+-
+-@ NOTE: This ifdef MUST match the one in memchr-stub.c
+-#if defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__)
+-
+-@ this lets us check a flag in a 00/ff byte easily in either endianness
+-#ifdef __ARMEB__
+-#define CHARTSTMASK(c) 1<<(31-(c*8))
+-#else
+-#define CHARTSTMASK(c) 1<<(c*8)
+-#endif
+-	.text
+-	.thumb
+-
+-@ ---------------------------------------------------------------------------
+-	.thumb_func
+-	.align 2
+-	.p2align 4,,15
+-	.global memchr
+-	.type memchr,%function
+-memchr:
+-	@ r0 = start of memory to scan
+-	@ r1 = character to look for
+-	@ r2 = length
+-	@ returns r0 = pointer to character or NULL if not found
+-	and	r1,r1,#0xff	@ Don't trust the caller to pass a char
+-
+-	cmp	r2,#16		@ If short don't bother with anything clever
+-	blt	20f 
+-
+-	tst	r0, #7		@ If it's already aligned skip the next bit
+-	beq	10f
+-
+-	@ Work up to an aligned point
+-5:
+-	ldrb	r3, [r0],#1
+-	subs	r2, r2, #1
+-	cmp	r3, r1
+-	beq	50f		@ If it matches exit found
+-	tst	r0, #7
+-	cbz	r2, 40f		@ If we run off the end, exit not found
+-	bne	5b		@ If not aligned yet then do next byte
+-	
+-10:
+-	@ We are aligned, we know we have at least 8 bytes to work with
+-	push	{r4,r5,r6,r7}
+-	orr	r1, r1, r1, lsl #8	@ expand the match word across all bytes
+-	orr	r1, r1, r1, lsl #16
+-	bic	r4, r2, #7	@ Number of double words to work with * 8
+-	mvns	r7, #0		@ all F's
+-	movs	r3, #0
+-	
+-15:
+-	ldrd    r5,r6,[r0],#8
+-	subs	r4, r4, #8
+-	eor	r5,r5, r1	@ r5,r6 have 00's where bytes match the target
+-	eor	r6,r6, r1
+-	uadd8	r5, r5, r7	@ Par add 0xff - sets GE bits for bytes!=0
+-	sel	r5, r3, r7	@ bytes are 00 for none-00 bytes,
+-				@ or ff for 00 bytes - NOTE INVERSION
+-	uadd8	r6, r6, r7	@ Par add 0xff - sets GE bits for bytes!=0
+-	sel	r6, r5, r7	@ chained....bytes are 00 for none-00 bytes
+-				@ or ff for 00 bytes - NOTE INVERSION
+-	cbnz	r6, 60f
+-	bne	15b		@ (Flags from the subs above)
+-
+-	pop	{r4,r5,r6,r7}
+-	and	r1,r1,#0xff	@ r1 back to a single character
+-	and	r2,r2,#7	@ Leave the count remaining as the number
+-				@ after the double words have been done
+- 
+-20:
+-	cbz	r2, 40f		@ 0 length or hit the end already then not found
+-
+-21:  @ Post aligned section, or just a short call
+-	ldrb	r3,[r0],#1
+-	subs	r2,r2,#1
+-	eor	r3,r3,r1	@ r3 = 0 if match - doesn't break flags from sub
+-	cbz	r3, 50f
+-	bne	21b		@ on r2 flags
+-
+-40:
+-	movs	r0,#0		@ not found
+-	bx	lr
+-
+-50:
+-	subs	r0,r0,#1	@ found
+-	bx	lr
+-
+-60:  @ We're here because the fast path found a hit 
+-     @ now we have to track down exactly which word it was
+-	@ r0 points to the start of the double word after the one tested
+-	@ r5 has the 00/ff pattern for the first word, r6 has the chained value
+-	cmp	r5, #0
+-	itte	eq
+-	moveq	r5, r6		@ the end is in the 2nd word
+-	subeq	r0,r0,#3	@ Points to 2nd byte of 2nd word
+-	subne	r0,r0,#7	@ or 2nd byte of 1st word
+-
+-	@ r0 currently points to the 2nd byte of the word containing the hit
+-	tst	r5, # CHARTSTMASK(0)	@ 1st character
+-	bne	61f
+-	adds	r0,r0,#1
+-	tst	r5, # CHARTSTMASK(1)	@ 2nd character
+-	ittt	eq
+-	addeq	r0,r0,#1
+-	tsteq	r5, # (3<<15)		@ 2nd & 3rd character
+-	@ If not the 3rd must be the last one
+-	addeq	r0,r0,#1
+-
+-61:
+-	pop	{r4,r5,r6,r7}
+-	subs	r0,r0,#1
+-	bx	lr
+-
+-#endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/memchr-stub.c newlib-1.20.0/newlib/libc/machine/arm/memchr-stub.c
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/memchr-stub.c	2011-10-18 13:35:17.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/memchr-stub.c	1970-01-01 01:00:00.000000000 +0100
+@@ -1,42 +0,0 @@
+-/* Copyright (c) 2010-2011, Linaro Limited
+-   All rights reserved.
+-
+-   Redistribution and use in source and binary forms, with or without
+-   modification, are permitted provided that the following conditions
+-   are met:
+-
+-      * Redistributions of source code must retain the above copyright
+-      notice, this list of conditions and the following disclaimer.
+-
+-      * Redistributions in binary form must reproduce the above copyright
+-      notice, this list of conditions and the following disclaimer in the
+-      documentation and/or other materials provided with the distribution.
+-
+-      * Neither the name of Linaro Limited nor the names of its
+-      contributors may be used to endorse or promote products derived
+-      from this software without specific prior written permission.
+-
+-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-*/
+-
+-#include "arm_asm.h"
+-
+-
+-/* Note: This ifdef MUST match the one in memchr.S */
+-#if defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__)
+-  /* Do nothing - the memchr.S will get used */
+-#else
+-  /* For an older CPU we just fall back to the .c code */
+-#include "../../string/memchr.c"
+-#endif
+-
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/memcpy.S newlib-1.20.0/newlib/libc/machine/arm/memcpy.S
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/memcpy.S	2011-10-04 18:02:25.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/memcpy.S	1970-01-01 01:00:00.000000000 +0100
+@@ -1,423 +0,0 @@
+-/*
+- * Copyright (c) 2011 ARM Ltd
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. The name of the company may not be used to endorse or promote
+- *    products derived from this software without specific prior written
+- *    permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-#if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) || \
+-     (!(defined (__ARM_ARCH_7A__))))
+-
+-        /* Do nothing here. See memcpy-stub.c in the same directory. */
+-
+-#else
+-	/* Prototype: void *memcpy (void *dst, const void *src, size_t count).  */
+-
+-        /* Use the version of memcpy implemented using LDRD and STRD.
+-           This version is tuned for Cortex-A15.
+-           This might not be the best for other ARMv7-A CPUs,
+-           but there is no predefine to distinguish between
+-           different CPUs in the same architecture,
+-           and this version is better than the plain memcpy provided in newlib.
+-
+-           Therefore, we use this version for all ARMv7-A CPUS.  */
+-
+-        /* To make the same code compile for both ARM and Thumb instruction
+-	   sets, switch to unified syntax at the beginning of this function.
+-           However, by using the same code, we may be missing optimization
+-	   opportunities.  For instance, in LDRD/STRD instructions, the first
+-	   destination register must be even and the second consecutive in
+-	   ARM state, but not in Thumb state.  */
+-
+-        .syntax         unified
+-
+-#if defined (__thumb__)
+-        .thumb
+-        .thumb_func
+-#endif
+-
+-        .global memcpy
+-        .type   memcpy, %function
+-memcpy:
+-
+-       /* Assumes that n >= 0, and dst, src are valid pointers.
+-          If there is at least 8 bytes to copy, use LDRD/STRD.
+-          If src and dst are misaligned with different offsets,
+-          first copy byte by byte until dst is aligned,
+-          and then copy using LDRD/STRD and shift if needed.
+-          When less than 8 left, copy a word and then byte by byte.  */
+-
+-       /* Save registers (r0 holds the return value):
+-          optimized push {r0, r4, r5, lr}.
+-          To try and improve performance, stack layout changed,
+-          i.e., not keeping the stack looking like users expect
+-          (highest numbered register at highest address).  */
+-        push {r0, lr}
+-        strd r4, r5, [sp, #-8]!
+-
+-       /* TODO: Add debug frame directives.
+-          We don't need exception unwind directives, because the code below
+-	  does not throw any exceptions and does not call any other functions.
+-          Generally, newlib functions like this lack debug information for
+-	  assembler source.  */
+-
+-        /* Get copying of tiny blocks out of the way first.  */
+-        /* Is there at least 4 bytes to copy?  */
+-        subs    r2, r2, #4
+-        blt     copy_less_than_4                 /* If n < 4.  */
+-
+-        /* Check word alignment.  */
+-        ands    ip, r0, #3                       /* ip = last 2 bits of dst.  */
+-        bne     dst_not_word_aligned             /* If dst is not word-aligned.  */
+-
+-        /* Get here if dst is word-aligned.  */
+-        ands    ip, r1, #3                      /* ip = last 2 bits of src.  */
+-        bne     src_not_word_aligned            /* If src is not word-aligned.  */
+-word_aligned:
+-        /* Get here if source and dst both are word-aligned.
+-           The number of bytes remaining to copy is r2+4.  */
+-
+-        /* Is there is at least 64 bytes to copy?  */
+-        subs    r2, r2, #60
+-        blt     copy_less_than_64                /* If r2 + 4 < 64.  */
+-
+-        /* First, align the destination buffer to 8-bytes,
+-           to make sure double loads and stores don't cross cache line boundary,
+-           as they are then more expensive even if the data is in the cache
+-           (require two load/store issue cycles instead of one).
+-           If only one of the buffers is not 8-bytes aligned,
+-           then it's more important to align dst than src,
+-           because there is more penalty for stores
+-           than loads that cross cacheline boundary.
+-           This check and realignment are only worth doing
+-           if there is a lot to copy.  */
+-
+-        /* Get here if dst is word aligned,
+-           i.e., the 2 least significant bits are 0.
+-           If dst is not 2w aligned (i.e., the 3rd bit is not set in dst),
+-           then copy 1 word (4 bytes).  */
+-        ands    r3, r0, #4
+-        beq     11f                  /* If dst already two-word aligned.  */
+-        ldr     r3, [r1], #4
+-        str     r3, [r0], #4
+-        subs    r2, r2, #4
+-        blt     copy_less_than_64
+-
+-11:
+-        /* TODO: Align to cacheline (useful for PLD optimization).  */
+-
+-        /* Every loop iteration copies 64 bytes.  */
+-1:
+-        .irp    offset, #0, #8, #16, #24, #32, #40, #48, #56
+-        ldrd    r4, r5, [r1, \offset]
+-        strd    r4, r5, [r0, \offset]
+-        .endr
+-
+-        add     r0, r0, #64
+-        add     r1, r1, #64
+-        subs    r2, r2, #64
+-        bge     1b                            /* If there is more to copy.  */
+-
+-copy_less_than_64:
+-
+-        /* Get here if less than 64 bytes to copy, -64 <= r2 < 0.
+-           Restore the count if there is more than 7 bytes to copy.  */
+-        adds    r2, r2, #56
+-        blt     copy_less_than_8
+-
+-        /* Copy 8 bytes at a time.  */
+-2:
+-        ldrd    r4, r5, [r1], #8
+-        strd    r4, r5, [r0], #8
+-        subs    r2, r2, #8
+-        bge     2b                            /* If there is more to copy.  */
+-
+-copy_less_than_8:
+-
+-        /* Get here if less than 8 bytes to copy, -8 <= r2 < 0.
+-           Check if there is more to copy.  */
+-        cmn     r2, #8
+-        beq     return                          /* If r2 + 8 == 0.  */
+-
+-        /* Restore the count if there is more than 3 bytes to copy.  */
+-        adds    r2, r2, #4
+-        blt     copy_less_than_4
+-
+-        /* Copy 4 bytes.  */
+-        ldr     r3, [r1], #4
+-        str     r3, [r0], #4
+-
+-copy_less_than_4:
+-        /* Get here if less than 4 bytes to copy, -4 <= r2 < 0.  */
+-
+-        /* Restore the count, check if there is more to copy.  */
+-        adds    r2, r2, #4
+-        beq     return                          /* If r2 == 0.  */
+-
+-        /* Get here with r2 is in {1,2,3}={01,10,11}.  */
+-        /* Logical shift left r2, insert 0s, update flags.  */
+-        lsls    r2, r2, #31
+-
+-        /* Copy byte by byte.
+-           Condition ne means the last bit of r2 is 0.
+-           Condition cs means the second to last bit of r2 is set,
+-           i.e., r2 is 1 or 3.  */
+-        itt     ne
+-        ldrbne  r3, [r1], #1
+-        strbne  r3, [r0], #1
+-
+-        itttt   cs
+-        ldrbcs  r4, [r1], #1
+-        ldrbcs  r5, [r1]
+-        strbcs  r4, [r0], #1
+-        strbcs  r5, [r0]
+-
+-return:
+-        /* Restore registers: optimized pop {r0, r4, r5, pc}   */
+-        ldrd r4, r5, [sp], #8
+-        pop {r0, pc}           /* This is the only return point of memcpy.  */
+-
+-#ifndef __ARM_FEATURE_UNALIGNED
+-
+-       /* The following assembly macro implements misaligned copy in software.
+-          Assumes that dst is word aligned, src is at offset "pull" bits from
+-	  word, push = 32 - pull, and the number of bytes that remain to copy
+-	  is r2 + 4, r2 >= 0.  */
+-
+-       /* In the code below, r2 is the number of bytes that remain to be
+-	  written.  The number of bytes read is always larger, because we have
+-	  partial words in the shift queue.  */
+-
+-        .macro  miscopy pull push shiftleft shiftright
+-
+-        /* Align src to the previous word boundary.  */
+-        bic     r1, r1, #3
+-
+-        /* Initialize the shift queue.  */
+-        ldr     r5, [r1], #4                   /* Load a word from source.  */
+-
+-        subs    r2, r2, #4
+-        blt     6f          /* Go to misaligned copy of less than 8 bytes.  */
+-
+-       /* Get here if there is more than 8 bytes to copy.
+-          The number of bytes to copy is r2+8, r2 >= 0.  */
+-
+-       /* Save registers: push { r6, r7 }.
+-          We need additional registers for LDRD and STRD, because in ARM state
+-          the first destination register must be even and the second
+-	  consecutive.  */
+-       strd     r6, r7, [sp, #-8]!
+-
+-       subs     r2, r2, #56
+-       blt      4f         /* Go to misaligned copy of less than 64 bytes.  */
+-
+-3:
+-       /* Get here if there is more than 64 bytes to copy.
+-          The number of bytes to copy is r2+64, r2 >= 0.  */
+-
+-       /* Copy 64 bytes in every iteration.
+-          Use a partial word from the shift queue.  */
+-        .irp    offset, #0, #8, #16, #24, #32, #40, #48, #56
+-        mov     r6, r5, \shiftleft #\pull
+-        ldrd    r4, r5, [r1, \offset]
+-        orr     r6, r6, r4, \shiftright #\push
+-        mov     r7, r4, \shiftleft #\pull
+-        orr     r7, r7, r5, \shiftright #\push
+-        strd    r6, r7, [r0, \offset]
+-        .endr
+-
+-        add     r1, r1, #64
+-        add     r0, r0, #64
+-        subs    r2, r2, #64
+-        bge     3b
+-
+-4:
+-       /* Get here if there is less than 64 bytes to copy (-64 <= r2 < 0)
+-	  and they are misaligned.  */
+-
+-       /* Restore the count if there is more than 7 bytes to copy.  */
+-        adds    r2, r2, #56
+-
+-       /* If less than 8 bytes to copy,
+-          restore registers saved for this loop: optimized poplt { r6, r7 }. */
+-        itt     lt
+-        ldrdlt  r6, r7, [sp], #8
+-        blt     6f          /* Go to misaligned copy of less than 8 bytes.  */
+-
+-5:
+-        /* Copy 8 bytes at a time.
+-           Use a partial word from the shift queue.  */
+-        mov     r6, r5, \shiftleft #\pull
+-        ldrd    r4, r5, [r1], #8
+-        orr     r6, r6, r4, \shiftright #\push
+-        mov     r7, r4, \shiftleft #\pull
+-        orr     r7, r7, r5, \shiftright #\push
+-        strd    r6, r7, [r0], #8
+-
+-        subs    r2, r2, #8
+-        bge     5b                        /* If there is more to copy.  */
+-
+-        /* Restore registers saved for this loop: optimized pop { r6, r7 }.  */
+-        ldrd    r6, r7, [sp], #8
+-
+-6:
+-        /* Get here if there less than 8 bytes to copy (-8 <= r2 < 0)
+-           and they are misaligned.  */
+-
+-        /* Check if there is more to copy.  */
+-        cmn     r2, #8
+-        beq     return
+-
+-        /* Check if there is less than 4 bytes to copy.  */
+-        cmn     r2, #4
+-
+-        itt     lt
+-        /* Restore src offset from word-align.  */
+-        sublt   r1, r1, #(\push / 8)
+-        blt     copy_less_than_4
+-
+-        /* Use a partial word from the shift queue.  */
+-        mov     r3, r5, \shiftleft #\pull
+-        /* Load a word from src, but without writeback
+-           (this word is not fully written to dst).  */
+-        ldr     r5, [r1]
+-
+-        /* Restore src offset from word-align.  */
+-        add     r1, r1, #(\pull / 8)
+-
+-        /* Shift bytes to create one dst word and store it.  */
+-        orr     r3, r3, r5, \shiftright #\push
+-        str     r3, [r0], #4
+-
+-        /* Use single byte copying of the remaining bytes.  */
+-        b       copy_less_than_4
+-
+-        .endm
+-
+-#endif /* not __ARM_FEATURE_UNALIGNED  */
+-
+-dst_not_word_aligned:
+-
+-       /* Get here when dst is not aligned and ip has the last 2 bits of dst,
+-          i.e., ip is the offset of dst from word.
+-          The number of bytes that remains to copy is r2 + 4,
+-          i.e., there are at least 4 bytes to copy.
+-          Write a partial word (0 to 3 bytes), such that dst becomes
+-	  word-aligned.  */
+-
+-       /* If dst is at ip bytes offset from a word (with 0 < ip < 4),
+-          then there are (4 - ip) bytes to fill up to align dst to the next
+-	  word.  */
+-        rsb     ip, ip, #4                        /* ip = #4 - ip.  */
+-        cmp     ip, #2
+-
+-       /* Copy byte by byte with conditionals.  */
+-        itt     gt
+-        ldrbgt  r3, [r1], #1
+-        strbgt  r3, [r0], #1
+-
+-        itt     ge
+-        ldrbge  r4, [r1], #1
+-        strbge  r4, [r0], #1
+-
+-        ldrb    lr, [r1], #1
+-        strb    lr, [r0], #1
+-
+-       /* Update the count.
+-          ip holds the number of bytes we have just copied.  */
+-        subs    r2, r2, ip                        /* r2 = r2 - ip.  */
+-        blt     copy_less_than_4                  /* If r2 < ip.  */
+-
+-       /* Get here if there are more than 4 bytes to copy.
+-          Check if src is aligned.  If beforehand src and dst were not word
+-	  aligned but congruent (same offset), then now they are both
+-	  word-aligned, and we can copy the rest efficiently (without
+-	  shifting).  */
+-        ands    ip, r1, #3                    /* ip = last 2 bits of src.  */
+-        beq     word_aligned                  /* If r1 is word-aligned.  */
+-
+-src_not_word_aligned:
+-       /* Get here when src is not word-aligned, but dst is word-aligned.
+-          The number of bytes that remains to copy is r2+4.  */
+-
+-#ifdef __ARM_FEATURE_UNALIGNED
+-       /* Copy word by word using LDR when alignment can be done in hardware,
+-          i.e., SCTLR.A is set, supporting unaligned access in LDR and STR.  */
+-        subs    r2, r2, #60
+-        blt     8f
+-
+-7:
+-        /* Copy 64 bytes in every loop iteration.  */
+-        .irp    offset, #0, #4, #8, #12, #16, #20, #24, #28, #32, #36, #40, #44, #48, #52, #56, #60
+-        ldr     r3, [r1, \offset]
+-        str     r3, [r0, \offset]
+-        .endr
+-
+-        add     r0, r0, #64
+-        add     r1, r1, #64
+-        subs    r2, r2, #64
+-        bge     7b
+-
+-8:
+-        /* Get here if less than 64 bytes to copy, -64 <= r2 < 0.
+-           Check if there is more than 3 bytes to copy.  */
+-        adds    r2, r2, #60
+-        blt     copy_less_than_4
+-
+-9:      
+-       /* Get here if there is less than 64 but at least 4 bytes to copy,
+-          where the number of bytes to copy is r2+4.  */
+-        ldr     r3, [r1], #4
+-        str     r3, [r0], #4
+-        subs    r2, r2, #4
+-        bge     9b
+-
+-        b       copy_less_than_4
+-
+-#else /* not __ARM_FEATURE_UNALIGNED  */
+-
+-       /* ip has last 2 bits of src,
+-          i.e., ip is the offset of src from word, and ip > 0.
+-          Compute shifts needed to copy from src to dst.  */
+-        cmp     ip, #2
+-        beq     miscopy_16_16             /* If ip == 2.  */
+-        bge     miscopy_24_8              /* If ip == 3.  */
+-
+-        /* Get here if ip == 1.  */
+-
+-        /* Endian independent macros for shifting bytes within registers.  */
+-
+-#ifndef __ARMEB__
+-miscopy_8_24:   miscopy pull=8 push=24 shiftleft=lsr shiftright=lsl
+-miscopy_16_16:  miscopy pull=16 push=16 shiftleft=lsr shiftright=lsl
+-miscopy_24_8:   miscopy pull=24 push=8 shiftleft=lsr shiftright=lsl
+-#else  /* not __ARMEB__ */
+-miscopy_8_24:   miscopy pull=8 push=24 shiftleft=lsl shiftright=lsr
+-miscopy_16_16:  miscopy pull=16 push=16 shiftleft=lsl shiftright=lsr
+-miscopy_24_8:   miscopy pull=24 push=8 shiftleft=lsl shiftright=lsr
+-#endif  /* not __ARMEB__ */
+-
+-#endif  /* not __ARM_FEATURE_UNALIGNED  */
+-
+-#endif  /* memcpy */
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/memcpy-stub.c newlib-1.20.0/newlib/libc/machine/arm/memcpy-stub.c
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/memcpy-stub.c	2011-09-29 15:28:50.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/memcpy-stub.c	1970-01-01 01:00:00.000000000 +0100
+@@ -1,38 +0,0 @@
+-/*
+- * Copyright (c) 2011 ARM Ltd
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. The name of the company may not be used to endorse or promote
+- *    products derived from this software without specific prior written
+- *    permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-/* The sole purpose of this file is to include the plain memcpy provided in newlib.  
+-   An optimized version of memcpy is provided in the assembly file memcpy.S in this directory. */
+-#if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) || \
+-     (!(defined (__ARM_ARCH_7A__))))
+-
+-#include "../../string/memcpy.c"
+-
+-#else
+-        /* Do nothing. See memcpy.S in this directory. */
+-#endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/strlen-armv7.S newlib-1.20.0/newlib/libc/machine/arm/strlen-armv7.S
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/strlen-armv7.S	2011-10-18 13:35:17.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/strlen-armv7.S	1970-01-01 01:00:00.000000000 +0100
+@@ -1,127 +0,0 @@
+-/* Copyright (c) 2010-2011, Linaro Limited
+-   All rights reserved.
+-
+-   Redistribution and use in source and binary forms, with or without
+-   modification, are permitted provided that the following conditions
+-   are met:
+-
+-      * Redistributions of source code must retain the above copyright
+-      notice, this list of conditions and the following disclaimer.
+-
+-      * Redistributions in binary form must reproduce the above copyright
+-      notice, this list of conditions and the following disclaimer in the
+-      documentation and/or other materials provided with the distribution.
+-
+-      * Neither the name of Linaro Limited nor the names of its
+-      contributors may be used to endorse or promote products derived
+-      from this software without specific prior written permission.
+-
+-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-   Written by Dave Gilbert <david.gilbert at linaro.org>
+-
+-   This strlen routine is optimised on a Cortex-A9 and should work on
+-   all ARMv7 processors.   This routine is reasonably fast for short
+-   strings, but is probably slower than a simple implementation if all
+-   your strings are very short */
+-
+-@ 2011-02-08 david.gilbert at linaro.org
+-@    Extracted from local git 6848613a
+-@ 2011-10-13 david.gilbert at linaro.org
+-@    Extracted from cortex-strings bzr rev 63
+-@      Integrate to newlib, flip to ldrd
+-@      Pull in Endian macro from my memchr
+-
+-#include "arm_asm.h"
+-
+-@ NOTE: This ifdef MUST match the ones in arm/strlen.c
+-@ We fallback to the one in arm/strlen.c for size optimised or
+-@ for older arch's
+-#if defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__) && \
+-    !(defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) || \
+-      (defined (__thumb__) && !defined (__thumb2__)))
+-
+-@ this lets us check a flag in a 00/ff byte easily in either endianness
+-#ifdef __ARMEB__
+-#define CHARTSTMASK(c) 1<<(31-(c*8))
+-#else
+-#define CHARTSTMASK(c) 1<<(c*8)
+-#endif
+-
+- at ------------------------------------------------------------------------------
+-	.syntax unified
+-	.arch armv7-a
+-
+-	.thumb_func
+-	.align 2
+-	.p2align 4,,15
+-	.global strlen
+-	.type strlen,%function
+-strlen:
+-	@ r0 = string
+-	@ returns count of bytes in string not including terminator
+-	mov	r1, r0
+-	push	{ r4,r6 }
+-	mvns	r6, #0		@ all F
+-	movs	r4, #0
+-	tst	r0, #7
+-	beq	2f
+-
+-1:
+-	ldrb	r2, [r1], #1
+-	tst	r1, #7		@ Hit alignment yet?
+-	cbz	r2, 10f		@ Exit if we found the 0
+-	bne	1b
+-
+-	@ So we're now aligned
+-2:
+-	ldrd    r2,r3,[r1],#8
+-	uadd8	r2, r2, r6	@ Par add 0xff - sets the GE bits for bytes!=0
+-	sel	r2, r4, r6	@ bytes are 00 for none-00 bytes,
+-				@ or ff for 00 bytes - NOTE INVERSION
+-	uadd8	r3, r3, r6	@ Par add 0xff - sets the GE bits for bytes!=0
+-	sel	r3, r2, r6	@ chained...bytes are 00 for none-00 bytes,
+-				@ or ff for 00 bytes - NOTE INVERSION
+-	cmp	r3, #0
+-	beq	2b
+-
+-strlenendtmp:
+-	@ One (or more) of the bytes we loaded was 0 - but which one?
+-	@ r2 has the mask corresponding to the first loaded word
+-	@ r3 has a combined mask of the two words - but if r2 was all-non 0 
+-	@ then it's just the 2nd words
+-	cmp	r2, #0
+-	itte	eq
+-	moveq	r2, r3		@ the end is in the 2nd word
+-	subeq	r1,r1,#3
+-	subne	r1,r1,#7
+-
+-	@ r1 currently points to the 2nd byte of the word containing the 0
+-	tst	r2, # CHARTSTMASK(0)	@ 1st character
+-	bne	10f
+-	adds	r1,r1,#1
+-	tst	r2, # CHARTSTMASK(1)	@ 2nd character
+-	ittt	eq
+-	addeq	r1,r1,#1
+-	tsteq	r2, # (3<<15)	@ 2nd & 3rd character
+-	@ If not the 3rd must be the last one
+-	addeq	r1,r1,#1
+-
+-10:
+-	@ r0 is still at the beginning, r1 is pointing 1 byte after the nul
+-	sub	r0, r1, r0
+-	subs	r0, r0, #1
+-	pop	{ r4, r6 }
+-	bx	lr
+-
+-#endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/arm/strlen.c newlib-1.20.0/newlib/libc/machine/arm/strlen.c
+--- newlib-1.20.0.orig/newlib/libc/machine/arm/strlen.c	2011-10-18 13:35:17.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/arm/strlen.c	2012-02-17 06:28:14.756873635 +0100
+@@ -60,8 +60,6 @@
+ }
+ #else
+ 
+-#if !(defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__))
+-
+ size_t __attribute__((naked))
+ strlen (const char* str)
+ {
+@@ -180,4 +178,3 @@
+        "RETURN");
+ }
+ #endif
+-#endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/m68k/memcpy.S newlib-1.20.0/newlib/libc/machine/m68k/memcpy.S
+--- newlib-1.20.0.orig/newlib/libc/machine/m68k/memcpy.S	2010-02-08 18:24:22.000000000 +0100
++++ newlib-1.20.0/newlib/libc/machine/m68k/memcpy.S	2012-02-17 06:28:14.756873635 +0100
+@@ -15,7 +15,7 @@
+ 
+ #include "m68kasm.h"
+ 
+-#if defined (__mcoldfire__) || defined (__mc68010__) || defined (__mc68020__) || defined (__mc68030__) || defined (__mc68040__) || defined (__mc68060__)
++#if defined (__mcoldfire__) || defined (__mcpu32__) || defined (__mc68010__) || defined (__mc68020__) || defined (__mc68030__) || defined (__mc68040__) || defined (__mc68060__)
+ # define MISALIGNED_OK 1
+ #else
+ # define MISALIGNED_OK 0
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/powerpc/Makefile.am newlib-1.20.0/newlib/libc/machine/powerpc/Makefile.am
+--- newlib-1.20.0.orig/newlib/libc/machine/powerpc/Makefile.am	2007-05-24 19:33:35.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/powerpc/Makefile.am	2012-02-17 06:28:14.757873650 +0100
+@@ -10,7 +10,7 @@
+ 
+ AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
+ 
+-lib_a_SOURCES = setjmp.S times.c
++lib_a_SOURCES = setjmp.S
+ lib_a_CCASFLAGS=$(AM_CCASFLAGS)
+ lib_a_CFLAGS=$(AM_CFLAGS)
+ lib_a_LIBADD = @extra_objs@
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/powerpc/Makefile.in newlib-1.20.0/newlib/libc/machine/powerpc/Makefile.in
+--- newlib-1.20.0.orig/newlib/libc/machine/powerpc/Makefile.in	2011-12-19 23:03:30.000000000 +0100
++++ newlib-1.20.0/newlib/libc/machine/powerpc/Makefile.in	2012-02-17 06:28:14.757873650 +0100
+@@ -51,7 +51,7 @@
+ LIBRARIES = $(noinst_LIBRARIES)
+ ARFLAGS = cru
+ lib_a_AR = $(AR) $(ARFLAGS)
+-am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-times.$(OBJEXT)
++am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT)
+ lib_a_OBJECTS = $(am_lib_a_OBJECTS)
+ DEFAULT_INCLUDES = -I. at am__isrc@
+ depcomp =
+@@ -175,7 +175,7 @@
+ AM_CCASFLAGS = $(INCLUDES)
+ noinst_LIBRARIES = lib.a
+ AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
+-lib_a_SOURCES = setjmp.S times.c
++lib_a_SOURCES = setjmp.S
+ lib_a_CCASFLAGS = $(AM_CCASFLAGS)
+ lib_a_CFLAGS = $(AM_CFLAGS)
+ lib_a_LIBADD = @extra_objs@
+@@ -186,7 +186,7 @@
+ all: all-am
+ 
+ .SUFFIXES:
+-.SUFFIXES: .S .c .o .obj
++.SUFFIXES: .S .o .obj
+ am--refresh:
+ 	@:
+ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+@@ -247,18 +247,6 @@
+ lib_a-setjmp.obj: setjmp.S
+ 	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-setjmp.obj `if test -f 'setjmp.S'; then $(CYGPATH_W) 'setjmp.S'; else $(CYGPATH_W) '$(srcdir)/setjmp.S'; fi`
+ 
+-.c.o:
+-	$(COMPILE) -c $<
+-
+-.c.obj:
+-	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+-
+-lib_a-times.o: times.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-times.o `test -f 'times.c' || echo '$(srcdir)/'`times.c
+-
+-lib_a-times.obj: times.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-times.obj `if test -f 'times.c'; then $(CYGPATH_W) 'times.c'; else $(CYGPATH_W) '$(srcdir)/times.c'; fi`
+-
+ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ 	unique=`for i in $$list; do \
+diff -Naur newlib-1.20.0.orig/newlib/libc/machine/powerpc/times.c newlib-1.20.0/newlib/libc/machine/powerpc/times.c
+--- newlib-1.20.0.orig/newlib/libc/machine/powerpc/times.c	2002-07-22 22:26:51.000000000 +0200
++++ newlib-1.20.0/newlib/libc/machine/powerpc/times.c	1970-01-01 01:00:00.000000000 +0100
+@@ -1,36 +0,0 @@
+-/* Time support routines for PowerPC.
+- *
+- * Written by Aldy Hernandez.
+- */
+-
+-#include <_ansi.h>
+-#include <reent.h>
+-#include <sys/time.h>
+-#include <sys/times.h>
+-#include <sys/resource.h>
+-
+-clock_t
+-times (struct tms *tp)
+-{
+-  struct rusage usage;
+-  union {
+-    struct rusage r;
+-    /* Newlib's rusage has only 2 fields.  We need to make room for
+-       when we call the system's rusage.  This should be enough.  */
+-    int filler[32];
+-  } host_ru;
+-
+-  getrusage (RUSAGE_SELF, (void *)&host_ru);
+-
+-  if (tp)
+-    {
+-      tp->tms_utime = host_ru.r.ru_utime.tv_sec * 1000
+-	+ host_ru.r.ru_utime.tv_usec;
+-      tp->tms_stime = host_ru.r.ru_stime.tv_sec * 1000
+-	+ host_ru.r.ru_stime.tv_usec;
+-      tp->tms_cutime = 0;	/* user time, children */
+-      tp->tms_cstime = 0;	/* system time, children */
+-    }
+-
+-  return tp->tms_utime;
+-}
+diff -Naur newlib-1.20.0.orig/newlib/libc/Makefile.am newlib-1.20.0/newlib/libc/Makefile.am
+--- newlib-1.20.0.orig/newlib/libc/Makefile.am	2011-01-05 18:18:16.000000000 +0100
++++ newlib-1.20.0/newlib/libc/Makefile.am	2012-02-17 06:28:14.745873471 +0100
+@@ -36,6 +36,8 @@
+ 
+ if HAVE_XDR_DIR
+ XDR_SUBDIR = xdr
++rpcincludedir = $(tooldir)
++nobase_rpcinclude_HEADERS = include/rpc/xdr.h include/rpc/types.h
+ endif
+ 
+ # The order of SUBDIRS is important for the integrated documentation.
+diff -Naur newlib-1.20.0.orig/newlib/libc/Makefile.in newlib-1.20.0/newlib/libc/Makefile.in
+--- newlib-1.20.0.orig/newlib/libc/Makefile.in	2011-12-19 23:03:19.000000000 +0100
++++ newlib-1.20.0/newlib/libc/Makefile.in	2012-02-17 06:28:14.746873484 +0100
+@@ -17,6 +17,7 @@
+ 
+ 
+ 
++
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
+ pkgincludedir = $(includedir)/@PACKAGE@
+@@ -39,7 +40,8 @@
+ subdir = .
+ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ 	$(top_srcdir)/configure $(am__configure_deps) \
+-	$(srcdir)/../../mkinstalldirs $(libc_TEXINFOS)
++	$(srcdir)/../../mkinstalldirs $(libc_TEXINFOS) \
++	$(am__nobase_rpcinclude_HEADERS_DIST)
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ 	$(top_srcdir)/../../ltoptions.m4 \
+@@ -155,6 +157,10 @@
+   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+ DATA = $(noinst_DATA)
++am__nobase_rpcinclude_HEADERS_DIST = include/rpc/xdr.h \
++	include/rpc/types.h
++am__installdirs = "$(DESTDIR)$(rpcincludedir)"
++HEADERS = $(nobase_rpcinclude_HEADERS)
+ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+   distclean-recursive maintainer-clean-recursive
+ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+@@ -320,6 +326,8 @@
+ @ENABLE_NEWLIB_ICONV_FALSE at NEWLIB_ICONV_LIBS = 
+ @ENABLE_NEWLIB_ICONV_TRUE at NEWLIB_ICONV_LIBS = iconv/ces/lib.$(aext) iconv/ccs/lib.$(aext) iconv/lib/lib.$(aext)
+ @HAVE_XDR_DIR_TRUE at XDR_SUBDIR = xdr
++ at HAVE_XDR_DIR_TRUE@rpcincludedir = $(tooldir)
++ at HAVE_XDR_DIR_TRUE@nobase_rpcinclude_HEADERS = include/rpc/xdr.h include/rpc/types.h
+ 
+ # The order of SUBDIRS is important for the integrated documentation.
+ # Do not change the order without considering the doc impact.
+@@ -638,6 +646,29 @@
+ 	done
+ 
+ clean-info: mostlyclean-aminfo clean-aminfo
++install-nobase_rpcincludeHEADERS: $(nobase_rpcinclude_HEADERS)
++	@$(NORMAL_INSTALL)
++	test -z "$(rpcincludedir)" || $(MKDIR_P) "$(DESTDIR)$(rpcincludedir)"
++	@list='$(nobase_rpcinclude_HEADERS)'; test -n "$(rpcincludedir)" || list=; \
++	$(am__nobase_list) | while read dir files; do \
++	  xfiles=; for file in $$files; do \
++	    if test -f "$$file"; then xfiles="$$xfiles $$file"; \
++	    else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
++	  test -z "$$xfiles" || { \
++	    test "x$$dir" = x. || { \
++	      echo "$(MKDIR_P) '$(DESTDIR)$(rpcincludedir)/$$dir'"; \
++	      $(MKDIR_P) "$(DESTDIR)$(rpcincludedir)/$$dir"; }; \
++	    echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(rpcincludedir)/$$dir'"; \
++	    $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(rpcincludedir)/$$dir" || exit $$?; }; \
++	done
++
++uninstall-nobase_rpcincludeHEADERS:
++	@$(NORMAL_UNINSTALL)
++	@list='$(nobase_rpcinclude_HEADERS)'; test -n "$(rpcincludedir)" || list=; \
++	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
++	test -n "$$files" || exit 0; \
++	echo " ( cd '$(DESTDIR)$(rpcincludedir)' && rm -f" $$files ")"; \
++	cd "$(DESTDIR)$(rpcincludedir)" && rm -f $$files
+ 
+ # This directory's subdirectories are mostly independent; you can cd
+ # into them and run `make' without going through this Makefile.
+@@ -775,9 +806,12 @@
+ 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ check-am:
+ check: check-recursive
+-all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA)
++all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) $(HEADERS)
+ installdirs: installdirs-recursive
+ installdirs-am:
++	for dir in "$(DESTDIR)$(rpcincludedir)"; do \
++	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
++	done
+ install: install-recursive
+ install-exec: install-exec-recursive
+ install-data: install-data-recursive
+@@ -827,7 +861,7 @@
+ 
+ info-am: $(INFO_DEPS)
+ 
+-install-data-am:
++install-data-am: install-nobase_rpcincludeHEADERS
+ 
+ install-dvi: install-dvi-recursive
+ 
+@@ -952,7 +986,8 @@
+ ps-am: $(PSS)
+ 
+ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
+-	uninstall-pdf-am uninstall-ps-am
++	uninstall-nobase_rpcincludeHEADERS uninstall-pdf-am \
++	uninstall-ps-am
+ 
+ .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ 	install-am install-strip tags-recursive
+@@ -966,14 +1001,16 @@
+ 	info-am install install-am install-data install-data-am \
+ 	install-dvi install-dvi-am install-exec install-exec-am \
+ 	install-html install-html-am install-info install-info-am \
+-	install-man install-pdf install-pdf-am install-ps \
+-	install-ps-am install-strip installcheck installcheck-am \
+-	installdirs installdirs-am maintainer-clean \
+-	maintainer-clean-aminfo maintainer-clean-generic mostlyclean \
+-	mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \
+-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+-	uninstall uninstall-am uninstall-dvi-am uninstall-html-am \
+-	uninstall-info-am uninstall-pdf-am uninstall-ps-am
++	install-man install-nobase_rpcincludeHEADERS install-pdf \
++	install-pdf-am install-ps install-ps-am install-strip \
++	installcheck installcheck-am installdirs installdirs-am \
++	maintainer-clean maintainer-clean-aminfo \
++	maintainer-clean-generic mostlyclean mostlyclean-aminfo \
++	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
++	pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
++	uninstall-dvi-am uninstall-html-am uninstall-info-am \
++	uninstall-nobase_rpcincludeHEADERS uninstall-pdf-am \
++	uninstall-ps-am
+ 
+ @USE_LIBTOOL_FALSE at libc.a: $(SUBLIBS)
+ @USE_LIBTOOL_FALSE@	rm -f $@
+diff -Naur newlib-1.20.0.orig/newlib/libc/misc/__dprintf.c newlib-1.20.0/newlib/libc/misc/__dprintf.c
+--- newlib-1.20.0.orig/newlib/libc/misc/__dprintf.c	2008-12-11 18:27:55.000000000 +0100
++++ newlib-1.20.0/newlib/libc/misc/__dprintf.c	2012-02-17 06:28:14.757873650 +0100
+@@ -5,6 +5,7 @@
+ */
+ 
+ #include <_ansi.h>
++#include <stdint.h>
+ #include "ctype.h"
+ #include "reent.h"
+ #include "string.h"
+@@ -131,7 +132,7 @@
+ 	      write_string (unctrl (c));
+ 	      break;
+ 	    case 'p' :
+-	      l = (_POINTER_INT) va_arg (args, char *);
++	      l = (intptr_t) va_arg (args, char *);
+ 	      print_number (16, 1, l);
+ 	      break;
+ 	    case 'd' :
+diff -Naur newlib-1.20.0.orig/newlib/libc/posix/readdir.c newlib-1.20.0/newlib/libc/posix/readdir.c
+--- newlib-1.20.0.orig/newlib/libc/posix/readdir.c	2003-06-06 21:57:51.000000000 +0200
++++ newlib-1.20.0/newlib/libc/posix/readdir.c	2012-02-17 06:28:14.758873665 +0100
+@@ -37,6 +37,7 @@
+ static char sccsid[] = "@(#)readdir.c	5.7 (Berkeley) 6/1/90";
+ #endif /* LIBC_SCCS and not lint */
+ 
++#include <stdint.h>
+ #include <dirent.h>
+ 
+ extern int getdents (int fd, void *dp, int count);
+@@ -75,7 +76,7 @@
+       continue;
+     }
+     dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc);
+-    if ((int)dp & 03) {	/* bogus pointer check */
++    if ((intptr_t)dp & 03) {	/* bogus pointer check */
+ #ifdef HAVE_DD_LOCK
+       __lock_release_recursive(dirp->dd_lock);
+ #endif
+diff -Naur newlib-1.20.0.orig/newlib/libc/search/db_local.h newlib-1.20.0/newlib/libc/search/db_local.h
+--- newlib-1.20.0.orig/newlib/libc/search/db_local.h	2010-03-05 09:55:15.000000000 +0100
++++ newlib-1.20.0/newlib/libc/search/db_local.h	2012-02-17 06:28:14.758873665 +0100
+@@ -102,11 +102,11 @@
+ typedef struct __db {
+ 	DBTYPE type;			/* Underlying db type. */
+ 	int (*close)(struct __db *);
+-	int (*del)(const struct __db *, const DBT *, u_int);
+-	int (*get)(const struct __db *, const DBT *, DBT *, u_int);
+-	int (*put)(const struct __db *, DBT *, const DBT *, u_int);
+-	int (*seq)(const struct __db *, DBT *, DBT *, u_int);
+-	int (*sync)(const struct __db *, u_int);
++	int (*del)(const struct __db *, const DBT *, __uint32_t);
++	int (*get)(const struct __db *, const DBT *, DBT *, __uint32_t);
++	int (*put)(const struct __db *, DBT *, const DBT *, __uint32_t);
++	int (*seq)(const struct __db *, DBT *, DBT *, __uint32_t);
++	int (*sync)(const struct __db *, __uint32_t);
+ 	void *internal;			/* Access method private. */
+ 	int (*fd)(const struct __db *);
+ } DB;
+diff -Naur newlib-1.20.0.orig/newlib/libc/search/extern.h newlib-1.20.0/newlib/libc/search/extern.h
+--- newlib-1.20.0.orig/newlib/libc/search/extern.h	2002-06-20 21:51:31.000000000 +0200
++++ newlib-1.20.0/newlib/libc/search/extern.h	2012-02-17 06:28:14.758873665 +0100
+@@ -43,7 +43,7 @@
+ int	 __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
+ 		int, __uint32_t, SPLIT_RETURN *);
+ int	 __buf_free(HTAB *, int, int);
+-void	 __buf_init(HTAB *, int);
++void	 __buf_init(HTAB *, __uint32_t);
+ __uint32_t	 __call_hash(HTAB *, char *, int);
+ int	 __delpair(HTAB *, BUFHEAD *, int);
+ int	 __expand_table(HTAB *);
+diff -Naur newlib-1.20.0.orig/newlib/libc/search/hash_buf.c newlib-1.20.0/newlib/libc/search/hash_buf.c
+--- newlib-1.20.0.orig/newlib/libc/search/hash_buf.c	2004-05-26 19:57:10.000000000 +0200
++++ newlib-1.20.0/newlib/libc/search/hash_buf.c	2012-02-17 06:28:14.759873680 +0100
+@@ -118,7 +118,7 @@
+ 	int newpage;	/* If prev_bp set, indicates a new overflow page. */
+ {
+ 	BUFHEAD *bp;
+-	__uint32_t is_disk_mask;
++	ptrdiff_t is_disk_mask;
+ 	int is_disk, segment_ndx;
+ 	SEGMENT segp;
+ 
+@@ -298,7 +298,7 @@
+ extern void
+ __buf_init(hashp, nbytes)
+ 	HTAB *hashp;
+-	int nbytes;
++	__uint32_t nbytes;
+ {
+ 	BUFHEAD *bfp;
+ 	int npages;
+diff -Naur newlib-1.20.0.orig/newlib/libc/search/hash.h newlib-1.20.0/newlib/libc/search/hash.h
+--- newlib-1.20.0.orig/newlib/libc/search/hash.h	2008-07-02 20:38:45.000000000 +0200
++++ newlib-1.20.0/newlib/libc/search/hash.h	2012-02-17 06:28:14.758873665 +0100
+@@ -82,7 +82,7 @@
+ 
+ /* Hash Table Information */
+ typedef struct hashhdr {		/* Disk resident portion */
+-	int		magic;		/* Magic NO for hash tables */
++	__uint32_t	magic;		/* Magic NO for hash tables */
+ 	int		version;	/* Version ID */
+ 	__uint32_t	lorder;		/* Byte Order */
+ 	int		bsize;		/* Bucket/Page Size */
+@@ -97,7 +97,7 @@
+ 	int		high_mask;	/* Mask to modulo into entire table */
+ 	int		low_mask;	/* Mask to modulo into lower half of 
+ 					 * table */
+-	int		ffactor;	/* Fill factor */
++	__uint32_t	ffactor;	/* Fill factor */
+ 	int		nkeys;		/* Number of keys in hash table */
+ 	int		hdrpages;	/* Size of table header */
+ 	int		h_charkey;	/* value of hash(CHARKEY) */
+diff -Naur newlib-1.20.0.orig/newlib/libc/search/hcreate_r.c newlib-1.20.0/newlib/libc/search/hcreate_r.c
+--- newlib-1.20.0.orig/newlib/libc/search/hcreate_r.c	2002-07-03 02:33:57.000000000 +0200
++++ newlib-1.20.0/newlib/libc/search/hcreate_r.c	2012-02-17 06:28:14.759873680 +0100
+@@ -123,9 +123,10 @@
+ void
+ hdestroy_r(struct hsearch_data *htab)
+ {
++#if 0
+ 	struct internal_entry *ie;
+ 	size_t idx;
+-
++#endif
+ 	if (htab->htable == NULL)
+ 		return;
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdio/fvwrite.c newlib-1.20.0/newlib/libc/stdio/fvwrite.c
+--- newlib-1.20.0.orig/newlib/libc/stdio/fvwrite.c	2011-06-14 05:56:05.000000000 +0200
++++ newlib-1.20.0/newlib/libc/stdio/fvwrite.c	2012-02-17 06:28:14.759873680 +0100
+@@ -155,8 +155,10 @@
+ 							 newsize);
+ 		      if (!str)
+ 			{
+-			  /* Free buffer which is no longer used.  */
++			  /* Free buffer which is no longer used and clear
++			     __SMBF flag to avoid double free in fclose.  */
+ 			  _free_r (ptr, fp->_bf._base);
++			  fp->_flags &=  ~__SMBF;
+ 			  /* Ensure correct errno, even if free changed it.  */
+ 			  ptr->_errno = ENOMEM;
+ 			  goto err;
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdio/open_memstream.c newlib-1.20.0/newlib/libc/stdio/open_memstream.c
+--- newlib-1.20.0.orig/newlib/libc/stdio/open_memstream.c	2011-01-05 18:38:42.000000000 +0100
++++ newlib-1.20.0/newlib/libc/stdio/open_memstream.c	2012-02-17 06:28:14.760873695 +0100
+@@ -330,9 +330,9 @@
+     c->max *= sizeof(wchar_t);
+   if (c->max < 64)
+     c->max = 64;
+-#if (SIZE_MAX >= 64 * 1024)
+-  else if (c->max > 64 * 1024)
+-    c->max = 64 * 1024;
++#if (SIZE_MAX >= 0x10000)
++  else if (c->max > 0x10000)
++    c->max = 0x10000;
+ #endif
+   *size = 0;
+   *buf = _malloc_r (ptr, c->max);
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdio/sprintf.c newlib-1.20.0/newlib/libc/stdio/sprintf.c
+--- newlib-1.20.0.orig/newlib/libc/stdio/sprintf.c	2009-03-12 11:27:10.000000000 +0100
++++ newlib-1.20.0/newlib/libc/stdio/sprintf.c	2012-02-17 06:28:14.761873710 +0100
+@@ -518,6 +518,10 @@
+ 			implementation is similar to <<%#tx>>), except
+ 			that <<0x>> appears even for the NULL pointer.
+ 
++		o m
++			Prints the output of <<strerror(errno)>>; no
++			argument is required.  A GNU extension.
++
+ 		o-
+ 	O-
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdio/swprintf.c newlib-1.20.0/newlib/libc/stdio/swprintf.c
+--- newlib-1.20.0.orig/newlib/libc/stdio/swprintf.c	2009-03-12 11:27:10.000000000 +0100
++++ newlib-1.20.0/newlib/libc/stdio/swprintf.c	2012-02-17 06:28:14.761873710 +0100
+@@ -498,6 +498,10 @@
+ 			implementation is similar to <<%#tx>>), except
+ 			that <<0x>> appears even for the NULL pointer.
+ 
++		o m
++			Prints the output of <<strerror(errno)>>; no
++			argument is required.  A GNU extension.
++
+ 		o-
+ 	O-
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdio/tmpnam.c newlib-1.20.0/newlib/libc/stdio/tmpnam.c
+--- newlib-1.20.0.orig/newlib/libc/stdio/tmpnam.c	2004-04-23 22:01:55.000000000 +0200
++++ newlib-1.20.0/newlib/libc/stdio/tmpnam.c	2012-02-17 06:28:14.762873725 +0100
+@@ -94,11 +94,13 @@
+ #include <_ansi.h>
+ #include <reent.h>
+ #include <stdio.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <fcntl.h>
+ #include <reent.h>
+ #include <errno.h>
++#include <inttypes.h>
+ 
+ /* Try to open the file specified, if it can't be opened then try
+    another one.  Return nonzero if successful, otherwise zero.  */
+@@ -109,7 +111,7 @@
+        char *result       _AND
+        _CONST char *part1 _AND
+        _CONST char *part2 _AND
+-       int part3          _AND
++       intptr_t part3     _AND
+        int *part4)
+ {
+   /*  Generate the filename and make sure that there isn't one called
+@@ -118,7 +120,7 @@
+   while (1)
+     {
+       int t;
+-      _sprintf_r (ptr, result, "%s/%s%x.%x", part1, part2, part3, *part4);
++      _sprintf_r (ptr, result, "%s/%s%" PRIxPTR ".%x", part1, part2, part3, *part4);
+       (*part4)++;
+       t = _open_r (ptr, result, O_RDONLY, 0);
+       if (t == -1)
+@@ -183,7 +185,7 @@
+   if (filename)
+     {
+       if (! worker (p, filename, dir, prefix,
+-		    _getpid_r (p) ^ (int) (_POINTER_INT) p, &p->_inc))
++		    _getpid_r (p) ^ (intptr_t) p, &p->_inc))
+ 	return NULL;
+     }
+   return filename;
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdio/vfprintf.c newlib-1.20.0/newlib/libc/stdio/vfprintf.c
+--- newlib-1.20.0.orig/newlib/libc/stdio/vfprintf.c	2010-02-15 17:10:28.000000000 +0100
++++ newlib-1.20.0/newlib/libc/stdio/vfprintf.c	2012-02-17 06:28:14.762873725 +0100
+@@ -114,7 +114,7 @@
+ 
+ #if defined(LIBC_SCCS) && !defined(lint)
+ /*static char *sccsid = "from: @(#)vfprintf.c	5.50 (Berkeley) 12/16/92";*/
+-static char *rcsid = "$Id: vfprintf.c,v 1.43 2002/08/13 02:40:06 fitzsim Exp $";
++static char *rcsid = "$Id$";
+ #endif /* LIBC_SCCS and not lint */
+ 
+ /*
+@@ -1225,6 +1225,15 @@
+ 				sign = '-';
+ 			break;
+ #endif /* FLOATING_POINT */
++#ifdef _GLIBC_EXTENSION
++		case 'm':  /* extension */
++			{
++				int dummy;
++				cp = _strerror_r (data, data->_errno, 1, &dummy);
++			}
++			flags &= ~LONGINT;
++			goto string;
++#endif
+ 		case 'n':
+ #ifndef _NO_LONGLONG
+ 			if (flags & QUADINT)
+@@ -1272,8 +1281,11 @@
+ #ifdef _WANT_IO_C99_FORMATS
+ 		case 'S':
+ #endif
+-			sign = '\0';
+ 			cp = GET_ARG (N, ap, char_ptr_t);
++#ifdef _GLIBC_EXTENSION
++string:
++#endif
++			sign = '\0';
+ #ifndef __OPTIMIZE_SIZE__
+ 			/* Behavior is undefined if the user passed a
+ 			   NULL string when precision is not 0.
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdio/vfwprintf.c newlib-1.20.0/newlib/libc/stdio/vfwprintf.c
+--- newlib-1.20.0.orig/newlib/libc/stdio/vfwprintf.c	2011-07-15 19:20:16.000000000 +0200
++++ newlib-1.20.0/newlib/libc/stdio/vfwprintf.c	2012-02-17 06:28:14.763873740 +0100
+@@ -1074,6 +1074,15 @@
+ 				sign = L'-';
+ 			break;
+ #endif /* FLOATING_POINT */
++#ifdef _GLIBC_EXTENSION
++		case L'm':  /* GNU extension */
++			{
++				int dummy;
++				cp = (wchar_t *) _strerror_r (data, data->_errno, 1, &dummy);
++			}
++			flags &= ~LONGINT;
++			goto string;
++#endif
+ 		case L'n':
+ #ifndef _NO_LONGLONG
+ 			if (flags & QUADINT)
+@@ -1118,8 +1127,11 @@
+ #ifdef _WANT_IO_C99_FORMATS
+ 		case L'S':	/* POSIX extension */
+ #endif
+-			sign = '\0';
+ 			cp = GET_ARG (N, ap, wchar_ptr_t);
++#ifdef _GLIBC_EXTENSION
++string:
++#endif
++			sign = '\0';
+ #ifndef __OPTIMIZE_SIZE__
+ 			/* Behavior is undefined if the user passed a
+ 			   NULL string when precision is not 0.
+@@ -1132,7 +1144,7 @@
+ 			else
+ #endif /* __OPTIMIZE_SIZE__ */
+ #ifdef _MB_CAPABLE
+-			if (ch == L's' && !(flags & LONGINT)) {
++			if (ch != L'S' && !(flags & LONGINT)) {
+ 				char *arg = (char *) cp;
+ 				size_t insize = 0, nchars = 0, nconv = 0;
+ 				mbstate_t ps;
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdlib/__atexit.c newlib-1.20.0/newlib/libc/stdlib/__atexit.c
+--- newlib-1.20.0.orig/newlib/libc/stdlib/__atexit.c	2010-04-06 22:20:36.000000000 +0200
++++ newlib-1.20.0/newlib/libc/stdlib/__atexit.c	2012-02-17 06:28:14.764873755 +0100
+@@ -74,7 +74,7 @@
+ 	  if (args == NULL)
+ 	    {
+ #ifndef __SINGLE_THREAD__
+-	      __lock_release(lock);
++	      __lock_release(__atexit_lock);
+ #endif
+ 	      return -1;
+ 	    }
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdlib/atof.c newlib-1.20.0/newlib/libc/stdlib/atof.c
+--- newlib-1.20.0.orig/newlib/libc/stdlib/atof.c	2003-10-20 20:46:37.000000000 +0200
++++ newlib-1.20.0/newlib/libc/stdlib/atof.c	2012-02-17 06:28:14.765873770 +0100
+@@ -1,6 +1,6 @@
+ /*
+ FUNCTION
+-   <<atof>>, <<atoff>>---string to double or float
++   <<atof>> ---string to double
+ 
+ INDEX
+ 	atof
+@@ -10,19 +10,14 @@
+ ANSI_SYNOPSIS
+ 	#include <stdlib.h>
+         double atof(const char *<[s]>);
+-        float atoff(const char *<[s]>);
+ 
+ TRAD_SYNOPSIS
+ 	#include <stdlib.h>
+         double atof(<[s]>)
+         char *<[s]>;
+ 
+-        float atoff(<[s]>)
+-        char *<[s]>;
+-
+ DESCRIPTION
+ <<atof>> converts the initial portion of a string to a <<double>>.
+-<<atoff>> converts the initial portion of a string to a <<float>>.
+ 
+ The functions parse the character string <[s]>,
+ locating a substring which can be converted to a floating-point
+@@ -36,7 +31,6 @@
+ something other than <<+>>, <<->>, <<.>>, or a digit.
+ 
+ <<atof(<[s]>)>> is implemented as <<strtod(<[s]>, NULL)>>.
+-<<atoff(<[s]>)>> is implemented as <<strtof(<[s]>, NULL)>>.
+ 
+ RETURNS
+ <<atof>> returns the converted substring value, if any, as a
+@@ -47,12 +41,9 @@
+ If the correct value would cause underflow, <<0.0>> is returned
+ and <<ERANGE>> is stored in <<errno>>.
+ 
+-<<atoff>> obeys the same rules as <<atof>>, except that it
+-returns a <<float>>.
+-
+ PORTABILITY
+-<<atof>> is ANSI C. <<atof>>, <<atoi>>, and <<atol>> are subsumed by <<strod>>
+-and <<strol>>, but are used extensively in existing code. These functions are
++<<atof>> is ANSI C. <<atof>>, <<atoi>>, and <<atol>> are subsumed by <<strtod>>
++and <<strtol>>, but are used extensively in existing code. These functions are
+ less reliable, but may be faster if the argument is verified to be in a valid
+ range.
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdlib/atoff.c newlib-1.20.0/newlib/libc/stdlib/atoff.c
+--- newlib-1.20.0.orig/newlib/libc/stdlib/atoff.c	2002-12-06 19:58:51.000000000 +0100
++++ newlib-1.20.0/newlib/libc/stdlib/atoff.c	1970-01-01 01:00:00.000000000 +0100
+@@ -1,9 +0,0 @@
+-#include <stdlib.h>
+-#include <_ansi.h>
+-
+-float
+-_DEFUN (atoff, (s),
+-	_CONST char *s)
+-{
+-  return strtof (s, NULL);
+-}
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdlib/Makefile.am newlib-1.20.0/newlib/libc/stdlib/Makefile.am
+--- newlib-1.20.0.orig/newlib/libc/stdlib/Makefile.am	2009-04-16 20:24:35.000000000 +0200
++++ newlib-1.20.0/newlib/libc/stdlib/Makefile.am	2012-02-17 06:28:14.763873740 +0100
+@@ -16,7 +16,6 @@
+ 	assert.c  	\
+ 	atexit.c	\
+ 	atof.c 		\
+-	atoff.c		\
+ 	atoi.c  	\
+ 	atol.c		\
+ 	calloc.c	\
+diff -Naur newlib-1.20.0.orig/newlib/libc/stdlib/Makefile.in newlib-1.20.0/newlib/libc/stdlib/Makefile.in
+--- newlib-1.20.0.orig/newlib/libc/stdlib/Makefile.in	2011-12-19 23:03:36.000000000 +0100
++++ newlib-1.20.0/newlib/libc/stdlib/Makefile.in	2012-02-17 06:28:14.764873755 +0100
+@@ -69,8 +69,7 @@
+ 	lib_a-__ten_mu.$(OBJEXT) lib_a-_Exit.$(OBJEXT) \
+ 	lib_a-abort.$(OBJEXT) lib_a-abs.$(OBJEXT) \
+ 	lib_a-assert.$(OBJEXT) lib_a-atexit.$(OBJEXT) \
+-	lib_a-atof.$(OBJEXT) lib_a-atoff.$(OBJEXT) \
+-	lib_a-atoi.$(OBJEXT) lib_a-atol.$(OBJEXT) \
++	lib_a-atof.$(OBJEXT) lib_a-atoi.$(OBJEXT) lib_a-atol.$(OBJEXT) \
+ 	lib_a-calloc.$(OBJEXT) lib_a-div.$(OBJEXT) \
+ 	lib_a-dtoa.$(OBJEXT) lib_a-dtoastub.$(OBJEXT) \
+ 	lib_a-environ.$(OBJEXT) lib_a-envlock.$(OBJEXT) \
+@@ -132,15 +131,15 @@
+ @HAVE_LONG_DOUBLE_TRUE at am__objects_8 = strtold.lo wcstold.lo
+ am__objects_9 = __adjust.lo __atexit.lo __call_atexit.lo __exp10.lo \
+ 	__ten_mu.lo _Exit.lo abort.lo abs.lo assert.lo atexit.lo \
+-	atof.lo atoff.lo atoi.lo atol.lo calloc.lo div.lo dtoa.lo \
+-	dtoastub.lo environ.lo envlock.lo eprintf.lo exit.lo \
+-	gdtoa-gethex.lo gdtoa-hexnan.lo getenv.lo getenv_r.lo labs.lo \
+-	ldiv.lo ldtoa.lo malloc.lo mblen.lo mblen_r.lo mbstowcs.lo \
+-	mbstowcs_r.lo mbtowc.lo mbtowc_r.lo mlock.lo mprec.lo \
+-	mstats.lo rand.lo rand_r.lo realloc.lo reallocf.lo \
+-	sb_charsets.lo strtod.lo strtol.lo strtoul.lo wcstod.lo \
+-	wcstol.lo wcstoul.lo wcstombs.lo wcstombs_r.lo wctomb.lo \
+-	wctomb_r.lo $(am__objects_8)
++	atof.lo atoi.lo atol.lo calloc.lo div.lo dtoa.lo dtoastub.lo \
++	environ.lo envlock.lo eprintf.lo exit.lo gdtoa-gethex.lo \
++	gdtoa-hexnan.lo getenv.lo getenv_r.lo labs.lo ldiv.lo ldtoa.lo \
++	malloc.lo mblen.lo mblen_r.lo mbstowcs.lo mbstowcs_r.lo \
++	mbtowc.lo mbtowc_r.lo mlock.lo mprec.lo mstats.lo rand.lo \
++	rand_r.lo realloc.lo reallocf.lo sb_charsets.lo strtod.lo \
++	strtol.lo strtoul.lo wcstod.lo wcstol.lo wcstoul.lo \
++	wcstombs.lo wcstombs_r.lo wctomb.lo wctomb_r.lo \
++	$(am__objects_8)
+ am__objects_10 = cxa_atexit.lo cxa_finalize.lo drand48.lo ecvtbuf.lo \
+ 	efgcvt.lo erand48.lo jrand48.lo lcong48.lo lrand48.lo \
+ 	mrand48.lo msize.lo mtrim.lo nrand48.lo rand48.lo seed48.lo \
+@@ -331,13 +330,13 @@
+ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+ GENERAL_SOURCES = __adjust.c __atexit.c __call_atexit.c __exp10.c \
+ 	__ten_mu.c _Exit.c abort.c abs.c assert.c atexit.c atof.c \
+-	atoff.c atoi.c atol.c calloc.c div.c dtoa.c dtoastub.c \
+-	environ.c envlock.c eprintf.c exit.c gdtoa-gethex.c \
+-	gdtoa-hexnan.c getenv.c getenv_r.c labs.c ldiv.c ldtoa.c \
+-	malloc.c mblen.c mblen_r.c mbstowcs.c mbstowcs_r.c mbtowc.c \
+-	mbtowc_r.c mlock.c mprec.c mstats.c rand.c rand_r.c realloc.c \
+-	reallocf.c sb_charsets.c strtod.c strtol.c strtoul.c wcstod.c \
+-	wcstol.c wcstoul.c wcstombs.c wcstombs_r.c wctomb.c wctomb_r.c \
++	atoi.c atol.c calloc.c div.c dtoa.c dtoastub.c environ.c \
++	envlock.c eprintf.c exit.c gdtoa-gethex.c gdtoa-hexnan.c \
++	getenv.c getenv_r.c labs.c ldiv.c ldtoa.c malloc.c mblen.c \
++	mblen_r.c mbstowcs.c mbstowcs_r.c mbtowc.c mbtowc_r.c mlock.c \
++	mprec.c mstats.c rand.c rand_r.c realloc.c reallocf.c \
++	sb_charsets.c strtod.c strtol.c strtoul.c wcstod.c wcstol.c \
++	wcstoul.c wcstombs.c wcstombs_r.c wctomb.c wctomb_r.c \
+ 	$(am__append_1)
+ EXTENDED_SOURCES = \
+ 	cxa_atexit.c	\
+@@ -617,12 +616,6 @@
+ lib_a-atof.obj: atof.c
+ 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atof.obj `if test -f 'atof.c'; then $(CYGPATH_W) 'atof.c'; else $(CYGPATH_W) '$(srcdir)/atof.c'; fi`
+ 
+-lib_a-atoff.o: atoff.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atoff.o `test -f 'atoff.c' || echo '$(srcdir)/'`atoff.c
+-
+-lib_a-atoff.obj: atoff.c
+-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atoff.obj `if test -f 'atoff.c'; then $(CYGPATH_W) 'atoff.c'; else $(CYGPATH_W) '$(srcdir)/atoff.c'; fi`
+-
+ lib_a-atoi.o: atoi.c
+ 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atoi.o `test -f 'atoi.c' || echo '$(srcdir)/'`atoi.c
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/memccpy.c newlib-1.20.0/newlib/libc/string/memccpy.c
+--- newlib-1.20.0.orig/newlib/libc/string/memccpy.c	2010-09-22 05:15:07.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/memccpy.c	2012-02-17 06:28:14.765873770 +0100
+@@ -35,13 +35,14 @@
+ 	*/
+ 
+ #include <_ansi.h>
++#include <stdint.h>
+ #include <stddef.h>
+ #include <string.h>
+ #include <limits.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ /* How many bytes are copied each iteration of the word copy loop.  */
+ #define LITTLEBLOCKSIZE (sizeof (long))
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/memchr.c newlib-1.20.0/newlib/libc/string/memchr.c
+--- newlib-1.20.0.orig/newlib/libc/string/memchr.c	2008-05-27 01:31:08.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/memchr.c	2012-02-17 06:28:14.765873770 +0100
+@@ -38,10 +38,11 @@
+ 
+ #include <_ansi.h>
+ #include <string.h>
++#include <stdint.h>
+ #include <limits.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+-#define UNALIGNED(X) ((long)X & (sizeof (long) - 1))
++#define UNALIGNED(X) ((intptr_t)X & (sizeof (long) - 1))
+ 
+ /* How many bytes are loaded each iteration of the word copy loop.  */
+ #define LBLOCKSIZE (sizeof (long))
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/memcmp.c newlib-1.20.0/newlib/libc/string/memcmp.c
+--- newlib-1.20.0.orig/newlib/libc/string/memcmp.c	2005-03-06 21:40:05.000000000 +0100
++++ newlib-1.20.0/newlib/libc/string/memcmp.c	2012-02-17 06:28:14.765873770 +0100
+@@ -37,11 +37,11 @@
+ */
+ 
+ #include <string.h>
+-
++#include <stdint.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ /* How many bytes are copied each iteration of the word copy loop.  */
+ #define LBLOCKSIZE (sizeof (long))
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/memcpy.c newlib-1.20.0/newlib/libc/string/memcpy.c
+--- newlib-1.20.0.orig/newlib/libc/string/memcpy.c	2010-09-22 05:15:07.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/memcpy.c	2012-02-17 06:28:14.766873786 +0100
+@@ -34,11 +34,12 @@
+ 	*/
+ 
+ #include <_ansi.h>
++#include <stdint.h>
+ #include <string.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ /* How many bytes are copied each iteration of the 4X unrolled loop.  */
+ #define BIGBLOCKSIZE    (sizeof (long) << 2)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/memmove.c newlib-1.20.0/newlib/libc/string/memmove.c
+--- newlib-1.20.0.orig/newlib/libc/string/memmove.c	2010-09-22 05:15:07.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/memmove.c	2012-02-17 06:28:14.766873786 +0100
+@@ -36,13 +36,14 @@
+ */
+ 
+ #include <string.h>
++#include <stdint.h>
+ #include <_ansi.h>
+ #include <stddef.h>
+ #include <limits.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ /* How many bytes are copied each iteration of the 4X unrolled loop.  */
+ #define BIGBLOCKSIZE    (sizeof (long) << 2)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/mempcpy.c newlib-1.20.0/newlib/libc/string/mempcpy.c
+--- newlib-1.20.0.orig/newlib/libc/string/mempcpy.c	2010-09-22 05:15:07.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/mempcpy.c	2012-02-17 06:28:14.766873786 +0100
+@@ -34,10 +34,11 @@
+ #include <stddef.h>
+ #include <limits.h>
+ #include <string.h>
++#include <stdint.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((uintptr_t)Y & (sizeof (long) - 1)))
+ 
+ /* How many bytes are copied each iteration of the 4X unrolled loop.  */
+ #define BIGBLOCKSIZE    (sizeof (long) << 2)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/memset.c newlib-1.20.0/newlib/libc/string/memset.c
+--- newlib-1.20.0.orig/newlib/libc/string/memset.c	2008-05-27 20:44:40.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/memset.c	2012-02-17 06:28:14.767873802 +0100
+@@ -34,9 +34,10 @@
+ */
+ 
+ #include <string.h>
++#include <stdint.h>
+ 
+ #define LBLOCKSIZE (sizeof(long))
+-#define UNALIGNED(X)   ((long)X & (LBLOCKSIZE - 1))
++#define UNALIGNED(X)   ((intptr_t)X & (LBLOCKSIZE - 1))
+ #define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE)
+ 
+ _PTR
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/stpcpy.c newlib-1.20.0/newlib/libc/string/stpcpy.c
+--- newlib-1.20.0.orig/newlib/libc/string/stpcpy.c	2007-06-28 19:07:23.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/stpcpy.c	2012-02-17 06:28:14.767873802 +0100
+@@ -34,6 +34,7 @@
+ */
+ 
+ #include <string.h>
++#include <stdint.h>
+ #include <limits.h>
+ 
+ /*SUPPRESS 560*/
+@@ -41,7 +42,7 @@
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ #if LONG_MAX == 2147483647L
+ #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/stpncpy.c newlib-1.20.0/newlib/libc/string/stpncpy.c
+--- newlib-1.20.0.orig/newlib/libc/string/stpncpy.c	2007-06-28 19:07:23.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/stpncpy.c	2012-02-17 06:28:14.767873802 +0100
+@@ -40,6 +40,7 @@
+ */
+ 
+ #include <string.h>
++#include <stdint.h>
+ #include <limits.h>
+ 
+ /*SUPPRESS 560*/
+@@ -47,7 +48,7 @@
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ #if LONG_MAX == 2147483647L
+ #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strcat.c newlib-1.20.0/newlib/libc/string/strcat.c
+--- newlib-1.20.0.orig/newlib/libc/string/strcat.c	2000-02-17 20:39:48.000000000 +0100
++++ newlib-1.20.0/newlib/libc/string/strcat.c	2012-02-17 06:28:14.767873802 +0100
+@@ -33,12 +33,13 @@
+ 	strcat ansi pure
+ */
+ 
++#include <stdint.h>
+ #include <string.h>
+ #include <limits.h>
+ 
+ /* Nonzero if X is aligned on a "long" boundary.  */
+ #define ALIGNED(X) \
+-  (((long)X & (sizeof (long) - 1)) == 0)
++  (((uintptr_t)X & (sizeof (long) - 1)) == 0)
+ 
+ #if LONG_MAX == 2147483647L
+ #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strchr.c newlib-1.20.0/newlib/libc/string/strchr.c
+--- newlib-1.20.0.orig/newlib/libc/string/strchr.c	2008-05-22 04:31:46.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/strchr.c	2012-02-17 06:28:14.768873818 +0100
+@@ -33,11 +33,12 @@
+ 	strchr ansi pure
+ */
+ 
++#include <stdint.h>
+ #include <string.h>
+ #include <limits.h>
+ 
+ /* Nonzero if X is not aligned on a "long" boundary.  */
+-#define UNALIGNED(X) ((long)X & (sizeof (long) - 1))
++#define UNALIGNED(X) ((uintptr_t)X & (sizeof (long) - 1))
+ 
+ /* How many bytes are loaded each iteration of the word copy loop.  */
+ #define LBLOCKSIZE (sizeof (long))
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strcmp.c newlib-1.20.0/newlib/libc/string/strcmp.c
+--- newlib-1.20.0.orig/newlib/libc/string/strcmp.c	2000-02-17 20:39:48.000000000 +0100
++++ newlib-1.20.0/newlib/libc/string/strcmp.c	2012-02-17 06:28:14.768873818 +0100
+@@ -35,12 +35,13 @@
+ 	strcmp ansi pure
+ */
+ 
++#include <stdint.h>
+ #include <string.h>
+ #include <limits.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((uintptr_t)X & (sizeof (long) - 1)) | ((uintptr_t)Y & (sizeof (long) - 1)))
+ 
+ /* DETECTNULL returns nonzero if (long)X contains a NULL byte. */
+ #if LONG_MAX == 2147483647L
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strcpy.c newlib-1.20.0/newlib/libc/string/strcpy.c
+--- newlib-1.20.0.orig/newlib/libc/string/strcpy.c	2007-05-29 23:26:59.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/strcpy.c	2012-02-17 06:28:14.768873818 +0100
+@@ -32,6 +32,7 @@
+ 	strcpy ansi pure
+ */
+ 
++#include <stdint.h>
+ #include <string.h>
+ #include <limits.h>
+ 
+@@ -40,7 +41,7 @@
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ #if LONG_MAX == 2147483647L
+ #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strlen.c newlib-1.20.0/newlib/libc/string/strlen.c
+--- newlib-1.20.0.orig/newlib/libc/string/strlen.c	2008-05-27 00:56:14.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/strlen.c	2012-02-17 06:28:14.768873818 +0100
+@@ -32,11 +32,12 @@
+ */
+ 
+ #include <_ansi.h>
++#include <stdint.h>
+ #include <string.h>
+ #include <limits.h>
+ 
+ #define LBLOCKSIZE   (sizeof (long))
+-#define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1))
++#define UNALIGNED(X) ((intptr_t)X & (LBLOCKSIZE - 1))
+ 
+ #if LONG_MAX == 2147483647L
+ #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strncat.c newlib-1.20.0/newlib/libc/string/strncat.c
+--- newlib-1.20.0.orig/newlib/libc/string/strncat.c	2005-10-28 23:21:07.000000000 +0200
++++ newlib-1.20.0/newlib/libc/string/strncat.c	2012-02-17 06:28:14.769873834 +0100
+@@ -42,11 +42,12 @@
+ */
+ 
+ #include <string.h>
++#include <stdint.h>
+ #include <limits.h>
+ 
+ /* Nonzero if X is aligned on a "long" boundary.  */
+ #define ALIGNED(X) \
+-  (((long)X & (sizeof (long) - 1)) == 0)
++  (((intptr_t)X & (sizeof (long) - 1)) == 0)
+ 
+ #if LONG_MAX == 2147483647L
+ #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strncmp.c newlib-1.20.0/newlib/libc/string/strncmp.c
+--- newlib-1.20.0.orig/newlib/libc/string/strncmp.c	2000-02-17 20:39:48.000000000 +0100
++++ newlib-1.20.0/newlib/libc/string/strncmp.c	2012-02-17 06:28:14.769873834 +0100
+@@ -36,12 +36,13 @@
+ 	strncmp ansi pure
+ */
+ 
++#include <stdint.h>
+ #include <string.h>
+ #include <limits.h>
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((uintptr_t)X & (sizeof (long) - 1)) | ((uintptr_t)Y & (sizeof (long) - 1)))
+ 
+ /* DETECTNULL returns nonzero if (long)X contains a NULL byte. */
+ #if LONG_MAX == 2147483647L
+diff -Naur newlib-1.20.0.orig/newlib/libc/string/strncpy.c newlib-1.20.0/newlib/libc/string/strncpy.c
+--- newlib-1.20.0.orig/newlib/libc/string/strncpy.c	2000-02-17 20:39:48.000000000 +0100
++++ newlib-1.20.0/newlib/libc/string/strncpy.c	2012-02-17 06:28:14.769873834 +0100
+@@ -38,6 +38,7 @@
+ */
+ 
+ #include <string.h>
++#include <stdint.h>
+ #include <limits.h>
+ 
+ /*SUPPRESS 560*/
+@@ -45,7 +46,7 @@
+ 
+ /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
+ #define UNALIGNED(X, Y) \
+-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
++  (((intptr_t)X & (sizeof (long) - 1)) | ((intptr_t)Y & (sizeof (long) - 1)))
+ 
+ #if LONG_MAX == 2147483647L
+ #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+diff -Naur newlib-1.20.0.orig/newlib/libc/sys/arm/arm.h newlib-1.20.0/newlib/libc/sys/arm/arm.h
+--- newlib-1.20.0.orig/newlib/libc/sys/arm/arm.h	2011-10-10 15:00:25.000000000 +0200
++++ newlib-1.20.0/newlib/libc/sys/arm/arm.h	1970-01-01 01:00:00.000000000 +0100
+@@ -1,62 +0,0 @@
+-/*
+- * Copyright (c) 2011 ARM Ltd
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. The name of the company may not be used to endorse or promote
+- *    products derived from this software without specific prior written
+- *    permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-#ifndef _LIBGLOSS_ARM_H
+-#define _LIBGLOSS_ARM_H
+-
+-/* __thumb2__ stands for thumb on armva7(A/R/M/EM) architectures,
+-   __ARM_ARCH_6M__ stands for armv6-M(thumb only) architecture,
+-   __ARM_ARCH_7M__ stands for armv7-M(thumb only) architecture.
+-   __ARM_ARCH_7EM__ stands for armv7e-M(thumb only) architecture.
+-   There are some macro combinations used many times in libgloss/arm,
+-   like (__thumb2__ || (__thumb__ && __ARM_ARCH_6M__)), so factor
+-   it out and use THUMB_V7_V6M instead, which stands for thumb on
+-   v6-m/v7 arch as the combination does.  */
+-#if defined(__thumb2__) || (defined(__thumb__) && defined(__ARM_ARCH_6M__))
+-# define THUMB_V7_V6M
+-#endif
+-
+-/* The (__ARM_ARCH_7EM__ || __ARM_ARCH_7M__ || __ARM_ARCH_6M__) combination
+-   stands for cortex-M profile architectures, which don't support ARM state.
+-   Factor it out and use THUMB_V7M_V6M instead.  */
+-#if defined(__ARM_ARCH_7M__)     \
+-    || defined(__ARM_ARCH_7EM__) \
+-    || defined(__ARM_ARCH_6M__)
+-# define THUMB_V7M_V6M
+-#endif
+-
+-/* Defined if this target supports the BLX Rm instruction.  */
+-#if  !defined(__ARM_ARCH_2__)   \
+-  && !defined(__ARM_ARCH_3__)	\
+-  && !defined(__ARM_ARCH_3M__)	\
+-  && !defined(__ARM_ARCH_4__)	\
+-  && !defined(__ARM_ARCH_4T__)
+-# define HAVE_CALL_INDIRECT
+-#endif
+-
+-#endif /* _LIBGLOSS_ARM_H */
+diff -Naur newlib-1.20.0.orig/newlib/libc/sys/arm/crt0.S newlib-1.20.0/newlib/libc/sys/arm/crt0.S
+--- newlib-1.20.0.orig/newlib/libc/sys/arm/crt0.S	2011-12-13 23:40:45.000000000 +0100
++++ newlib-1.20.0/newlib/libc/sys/arm/crt0.S	2012-02-17 06:28:14.770873849 +0100
+@@ -1,5 +1,4 @@
+ #include "newlib.h"
+-#include "arm.h"
+ #include "swi.h"
+ 
+ /* ANSI concatenation macros.  */
+@@ -17,37 +16,13 @@
+ #define _fini	__libc_fini_array
+ #endif
+ 
+-#if defined(__ARM_EABI__) && defined(__thumb__) && !defined(__thumb2__)
+-/* For Thumb1 we need to force the architecture to be sure that we get the
+-   correct attributes on the object file; otherwise the assembler will get
+-   confused and mark the object as being v6T2.  */
+-#if defined(__ARM_ARCH_4T__)
+-	.arch armv4t
+-#elif defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__)
+-	/* Nothing in this object requires higher than v5.  */
+-	.arch armv5t
+-#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+-	|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
+-	|| defined(__ARM_ARCH_6ZK__)
+-	/* Nothing in this object requires higher than v6.  */
+-	.arch armv6
+-#elif defined(__ARM_ARCH_6M__)
+-#ifdef ARM_RDP_MONITOR
+-	/* Object file uses SVC, so mark as v6s-m.  */
+-	.arch armv6s-m
+-#else
+-	.arch armv6-m
+-#endif
+-#endif
+-#endif
+-
+ /* .text is used instead of .section .text so it works with arm-aout too.  */
+ 	.text
++#if defined(__thumb2__)
+ 	.syntax unified
+-#ifdef THUMB_V7_V6M
+ 	.thumb
+ .macro FUNC_START name
+-	.global \name
++	.global	\name
+ 	.thumb_func
+ \name:
+ .endm	
+@@ -58,16 +33,6 @@
+ \name:
+ .endm	
+ #endif
+-
+-.macro indirect_call reg
+-#ifdef HAVE_CALL_INDIRECT
+-	blx \reg
+-#else
+-	mov	lr, pc
+-	mov	pc, \reg
+-#endif
+-.endm
+-
+ 	.align 	0
+ 
+ 	FUNC_START	_mainCRTStartup
+@@ -78,141 +43,34 @@
+ 	.fnstart
+ #endif
+ 
+-/* Start by setting up a stack.  */
++/* Start by setting up a stack */
+ #ifdef ARM_RDP_MONITOR
+-	/*  Issue Demon SWI to read stack info.  */
+-	swi	SWI_GetEnv	/*  Returns command line in r0.  */
+-	mov	sp,r1		/*  and the highest memory address in r1.  */
+-
+-	/*  Stack limit is at end of data.  */
+-	/*  Allow slop for stack overflow handling and small frames.  */
+-#ifdef __ARM_ARCH_6M__
+-	ldr	r0, .LC2
+-	adds	r0, #128
+-	adds	r0, #128
+-	mov	sl, r0
+-#else
+-	ldr	sl, .LC2
+-	add	sl, sl, #256
+-#endif
++	/*  Issue Demon SWI to read stack info */
++	swi	SWI_GetEnv	/*  Returns command line in r0 */
++	mov	sp,r1		/*  and the highest memory address in r1 */
++	ldr	sl, .LC2	/*  stack limit is at end of data */
++	add	sl, sl, #256	/*  allow slop for stack overflow handling */
++				/*  and small frames */
+ #else
+ #ifdef ARM_RDI_MONITOR
+-	/*  Issue Angel SWI to read stack info.  */
+-	movs	r0, #AngelSWI_Reason_HeapInfo
+-	adr	r1, .LC0	/*  Point at ptr to 4 words to receive data.  */
+-#ifdef THUMB_V7M_V6M
++	/*  Issue Angel SWI to read stack info */
++	mov	r0, #AngelSWI_Reason_HeapInfo
++	adr	r1, .LC0	/*  point at ptr to 4 words to receive data */
++#if defined(__thumb2__)
+ 	bkpt	AngelSWI
+-#elif defined(__thumb2__)
+-	/*  We are in thumb mode for startup on armv7 architectures.  */
+-	AngelSWIAsm	AngelSWI
+ #else
+-	/*  We are always in ARM mode for startup on pre armv7 archs.  */
++	/*  We are always in ARM mode for startup */
+ 	AngelSWIAsm	AngelSWI_ARM
+ #endif
+-	ldr	r0, .LC0	/*  Point at values read.  */
+-
+-	ldr     r1, [r0, #0]
+-	cmp     r1, #0
+-	bne     .LC32
+-	/* If the heap base value [r0, #0] is 0 then the heap base is actually 
+-	   at the end of program data (i.e. __end__). See:
+-           http://infocenter.arm.com/help/topic/com.arm.doc.dui0471-/Bacbefaa.html
+-	   for more information.  */
+-	ldr     r1, .LC31
+-	str     r1, [r0, #0]
+-.LC32:	
+-	ldr	r1, [r0, #8]
+-	ldr	r2, [r0, #12]
+-	/*  We skip setting sp/sl if 0 returned from semihosting. 
+-	    - According to semihosting docs, if 0 returned from semihosting,
+-	      the system was unable to calculate the real value, so it's ok
+-	      to skip setting sp/sl to 0 here.
+-	    - Considering M-profile processors, We might want to initialize
+-	      sp by the first entry of vector table and return 0 to SYS_HEAPINFO
+-	      semihosting call, which will be skipped here.  */
+-	cmp	r1, #0
+-	beq	.LC26
+-	mov	sp, r1
+-.LC26:
+-	cmp	r2, #0
+-	beq	.LC27
+-
+-	/*  Allow slop for stack overflow handling and small frames.  */
+-#ifdef __ARM_ARCH_6M__
+-	adds	r2, #128
+-	adds	r2, #128
+-	mov	sl, r2
+-#else
+-	add	sl, r2, #256
+-#endif
+-
+-.LC27:
+-#else
+-	/*  Set up the stack pointer to a fixed value.  */
+-	/*  Changes by toralf:
+-	    - Allow linker script to provide stack via __stack symbol - see
+-	      defintion of .Lstack
+-	    - Provide "hooks" that may be used by the application to add
+-	      custom init code - see .Lhwinit and .Lswinit	
+-	    - Go through all execution modes and set up stack for each of them.
+-	      Loosely based on init.s from ARM/Motorola example code.
+-              Note: Mode switch via CPSR is not allowed once in non-privileged
+-		    mode, so we take care not to enter "User" to set up its sp,
+-		    and also skip most operations if already in that mode.  */
+-
+-	ldr	r3, .Lstack
+-	cmp	r3, #0
+-#ifdef __thumb2__
+-	it	eq
+-#endif	
+-#ifdef __ARM_ARCH_6M__
+-	bne	.LC28
+-	ldr	r3, .LC0
+-.LC28:
++	ldr	r0, .LC0	/*  point at values read */
++	ldr	sp, [r0, #8]
++	ldr	sl, [r0, #12]
++	add	sl, sl, #256	/*  allow slop for stack overflow handling */
++				/*  and small frames */
+ #else
+-	ldreq	r3, .LC0
+-#endif
+-	/* Note: This 'mov' is essential when starting in User, and ensures we
+-		 always get *some* sp value for the initial mode, even if we 
+-		 have somehow missed it below (in which case it gets the same
+-		 value as FIQ - not ideal, but better than nothing).  */
+-	mov	sp, r3
+-#ifdef THUMB_V7_V6M
+-	/* XXX Fill in stack assignments for interrupt modes.  */
+-#else
+-	mrs	r2, CPSR
+-	tst	r2, #0x0F	/* Test mode bits - in User of all are 0.  */
+-	beq	.LC23		/* "eq" means r2 AND #0x0F is 0.  */
+-	msr     CPSR_c, #0xD1	/* FIRQ mode, interrupts disabled.  */
++	/*  Set up the stack pointer to a fixed value */
++	ldr	r3, .LC0
+ 	mov 	sp, r3
+-	sub	sl, sp, #0x1000	/* This mode also has its own sl (see below).  */
+-	
+-	mov	r3, sl	
+-	msr     CPSR_c, #0xD7	/* Abort mode, interrupts disabled.  */
+-	mov	sp, r3
+-	sub	r3, r3, #0x1000
+-
+-	msr     CPSR_c, #0xDB	/* Undefined mode, interrupts disabled.  */
+-	mov	sp, r3
+-	sub	r3, r3, #0x1000
+-
+-	msr     CPSR_c, #0xD2	/* IRQ mode, interrupts disabled.  */
+-	mov	sp, r3
+-	sub	r3, r3, #0x2000
+-		
+-	msr     CPSR_c, #0xD3	/* Supervisory mode, interrupts disabled.  */
+-
+-	mov	sp, r3
+-	sub	r3, r3, #0x8000	/* Min size 32k.  */
+-	bic	r3, r3, #0x00FF	/* Align with current 64k block.  */
+-	bic	r3, r3, #0xFF00
+-
+-	str	r3, [r3, #-4]	/* Move value into user mode sp without */ 
+-	ldmdb	r3, {sp}^       /* changing modes, via '^' form of ldm.  */ 
+-	orr	r2, r2, #0xC0	/* Back to original mode, presumably SVC, */
+-	msr	CPSR_c, r2	/* with FIQ/IRQ disable bits forced to 1.  */
+-#endif	
+-.LC23:
+ 	/* Setup a default stack-limit in-case the code has been
+ 	   compiled with "-mapcs-stack-check".  Hard-wiring this value
+ 	   is not ideal, since there is currently no support for
+@@ -220,30 +78,23 @@
+ 	   this default 64k is enough for the program being executed.
+ 	   However, it ensures that this simple crt0 world will not
+ 	   immediately cause an overflow event:  */
+-#ifdef __ARM_ARCH_6M__
+-	movs	r2, #64
+-	lsls	r2, r2, #10
+-	subs	r2, r3, r2
+-	mov	sl, r2
+-#else
+-	sub	sl, r3, #64 << 10	/* Still assumes 256bytes below sl.  */
+-#endif
++	sub	sl, sp, #64 << 10	/* Still assumes 256bytes below sl */
+ #endif
+ #endif
+ 	/* Zero the memory in the .bss section.  */
+-	movs 	a2, #0			/* Second arg: fill value.  */
+-	mov	fp, a2			/* Null frame pointer.  */
+-	mov	r7, a2			/* Null frame pointer for Thumb.  */
++	mov 	a2, #0			/* Second arg: fill value */
++	mov	fp, a2			/* Null frame pointer */
++	mov	r7, a2			/* Null frame pointer for Thumb */
+ 	
+-	ldr	a1, .LC1		/* First arg: start of memory block.  */
++	ldr	a1, .LC1		/* First arg: start of memory block */
+ 	ldr	a3, .LC2	
+-	subs	a3, a3, a1		/* Third arg: length of block.  */
++	sub	a3, a3, a1		/* Third arg: length of block */
+ 	
+ 
+-#if defined(__thumb__) && !defined(THUMB_V7_V6M)
+-	/* Enter Thumb mode...  */
+-	add	a4, pc, #1	/* Get the address of the Thumb block.  */
+-	bx	a4		/* Go there and start Thumb decoding.  */
++#if defined(__thumb__) && !defined(__thumb2__)
++	/* Enter Thumb mode.... */
++	add	a4, pc, #1	/* Get the address of the Thumb block */
++	bx	a4		/* Go there and start Thumb decoding  */
+ 
+ 	.code 16
+ 	.global __change_mode
+@@ -253,41 +104,23 @@
+ 	
+ 	bl	FUNCTION (memset)
+ #if !defined (ARM_RDP_MONITOR) && !defined (ARM_RDI_MONITOR)
+-/* Changes by toralf: Taken from libgloss/m68k/crt0.S
+-   initialize target specific stuff. Only execute these
+-   functions it they exist.  */
+-	ldr	r3, .Lhwinit
+-	cmp	r3, #0
+-	beq	.LC24
+-	indirect_call r3
+-.LC24:	
+-	ldr	r3, .Lswinit
+-	cmp	r3, #0
+-	beq	.LC25
+-	indirect_call r3
+-
+-.LC25:	
+-	movs	r0, #0		/* No arguments.  */
+-	movs	r1, #0		/* No argv either.  */
++	mov	r0, #0		/*  no arguments  */
++	mov	r1, #0		/*  no argv either */
+ #else
+-	/* Need to set up standard file handles.  */
++	/* Need to set up standard file handles */
+ 	bl	FUNCTION (initialise_monitor_handles)
+ 	
+ #ifdef ARM_RDP_MONITOR
+-	swi	SWI_GetEnv	/* Sets r0 to point to the command line.  */
+-	movs	r1, r0
+-#else
+-	movs	r0, #AngelSWI_Reason_GetCmdLine
+-	adr	r1, .LC30	/* Space for command line.  */
+-#ifdef THUMB_V7M_V6M
+-	bkpt	AngelSWI
++	swi	SWI_GetEnv	/*  sets r0 to point to the command line */
++	mov	r1, r0
+ #else
+- 	AngelSWIAsm	AngelSWI
+-#endif
++	mov	r0, #AngelSWI_Reason_GetCmdLine
++	adr	r1, .LC30	/*  Space for command line */
++	AngelSWIAsm	AngelSWI
+ 	ldr	r1, .LC30
+ #endif
+-	/*  Parse string at r1.  */
+-	movs	r0, #0		/* Count of arguments so far.  */
++	/*  Parse string at r1 */
++	mov	r0, #0		/*  count of arguments so far */
+ 	/* Push a NULL argument onto the end of the list.  */
+ #ifdef __thumb__
+ 	push	{r0}
+@@ -295,10 +128,10 @@
+ 	stmfd	sp!, {r0}
+ #endif
+ .LC10:
+-/*  Skip leading blanks.  */
++/*  Skip leading blanks */
+ #ifdef __thumb__
+ 	ldrb	r3, [r1]
+-	adds	r1, #1
++	add	r1, #1
+ #else
+ 	ldrb	r3, [r1], #1
+ #endif
+@@ -307,78 +140,78 @@
+ 	cmp	r3, #' '
+ 	beq	.LC10
+ 
+-/* See whether we are scanning a string.  */
+-	cmp	r3, #'\"'
++/*  See whether we are scanning a string */
++	cmp	r3, #'"'
+ #ifdef __thumb__
+ 	beq	.LC20
+ 	cmp	r3, #'\''
+ 	bne	.LC21
+ .LC20:
+-	movs	r2, r3
++	mov	r2, r3
+ 	b	.LC22
+ 
+ .LC21:
+-	movs	r2, #' '	/* Terminator type.  */
+-	subs	r1, r1, #1	/* Adjust back to point at start char.  */
++	mov	r2, #' '	/*  terminator type */
++	sub	r1, r1, #1	/*  adjust back to point at start char */
+ .LC22:
+ #else
+ 	cmpne	r3, #'\''
+ 	moveq	r2, r3
+-	movne	r2, #' '	/* Terminator type.  */
+-	subne	r1, r1, #1	/* Adjust back to point at start char.  */
++	movne	r2, #' '	/*  terminator type */
++	subne	r1, r1, #1	/*  adjust back to point at start char */
+ #endif
+ 
+-/*  Stack a pointer to the current argument.  */
++/*  Stack a pointer to the current argument */
+ #ifdef __thumb__
+ 	push	{r1}
+ #else
+ 	stmfd	sp!, {r1}
+ #endif
+-	adds	r0, r0, #1
++	add	r0, r0, #1
+ .LC11:
+ #ifdef __thumb__
+ 	ldrb	r3, [r1]
+-	adds	r1, #1
++	add	r1, #1
+ #else
+ 	ldrb	r3, [r1], #1
+ #endif
+ 	cmp	r3, #0
+ 	beq	.LC12
+-	cmp	r2, r3		/* Reached terminator ?  */
++	cmp	r2, r3		/*  reached terminator? */
+ 	bne	.LC11
+-	movs	r2, #0
+-	subs	r3, r1, #1
+-	strb	r2, [r3]	/* Terminate the arg string.  */
++	mov	r2, #0
++	sub	r3, r1, #1
++	strb	r2, [r3]	/*  terminate the arg string */
+ 	b	.LC10
+ 
+ .LC12:
+-	mov	r1, sp		/* Point at stacked arg pointers.  */
+-	/* We've now got the stacked args in order, reverse them.  */
++	mov	r1, sp		/*  point at stacked arg pointers */
++	/* We've now got the stacked args in order reverse the */
+ #ifdef __thumb__
+-	movs	r2, r0
+-	lsls	r2, #2
++	mov	r2, r0
++	lsl	r2, #2
+ 	add	r2, sp
+ 	mov	r3, sp
+ .LC15:	cmp	r2, r3
+ 	bls	.LC14
+-	subs	r2, #4
++	sub	r2, #4
+ 	ldr	r4, [r2]
+ 	ldr	r5, [r3]
+ 	str	r5, [r2]
+ 	str	r4, [r3]
+-	adds	r3, #4
++	add	r3, #4
+ 	b	.LC15
+ .LC14:	
+ 	/* Ensure doubleword stack alignment.  */
+ 	mov	r4, sp
+-	movs	r5, #7
+-	bics	r4, r5
++	mov	r5, #7
++	bic	r4, r5
+ 	mov	sp, r4
+ #else
+-	add	r2, sp, r0, LSL #2	/* End of args.  */
+-	mov	r3, sp			/* Start of args.  */
++	add	r2, sp, r0, LSL #2	/* End of args */
++	mov	r3, sp			/* Start of args */
+ .LC13:	cmp	r2, r3
+-	ldrhi	r4,[r2, #-4]		/* Reverse ends of list.  */
++	ldrhi	r4,[r2, #-4]		/* Reverse ends of list */
+ 	ldrhi	r5, [r3]
+ 	strhi	r5, [r2, #-4]!
+ 	strhi	r4, [r3], #4
+@@ -393,20 +226,21 @@
+ 	   to create constructors and destructors, and for these
+ 	   targets we need to call the _init function and arrange
+ 	   for _fini to be called at program exit.  */
+-	movs	r4, r0
+-	movs	r5, r1
++	mov	r4, r0
++	mov	r5, r1
+ 	ldr	r0, .Lfini
+ 	bl	FUNCTION (atexit)
+ 	bl	FUNCTION (_init)
+-	movs	r0, r4
+-	movs	r1, r5
++	mov	r0, r4
++	mov	r1, r5
+ #endif	
+ 	bl	FUNCTION (main)
+ 
+ 	bl	FUNCTION (exit)		/* Should not return.  */
+ 
+-#if defined(__thumb__) && !defined(THUMB_V7_V6M)
++#if defined(__thumb__) && !defined(__thumb2__)
+ 	/* Come out of Thumb mode.  This code should be redundant.  */
++
+ 	mov	a4, pc
+ 	bx	a4
+ 
+@@ -421,42 +255,20 @@
+ #endif
+ 	
+ 	/* For Thumb, constants must be after the code since only 
+-	   positive offsets are supported for PC relative addresses.  */	
++	   positive offsets are supported for PC relative addresses.  */
++	
+ 	.align 0
+ .LC0:
+ #ifdef ARM_RDI_MONITOR
+ 	.word	HeapBase
+ #else
+ #ifndef ARM_RDP_MONITOR
+-	/* Changes by toralf: Provide alternative "stack" variable whose value
+-	   may be defined externally; .Lstack will be used instead of .LC0 if
+-	   it points to a non-0 value. Also set up references to "hooks" that
+-           may be used by the application to provide additional init code.  */	
+ #ifdef __pe__
+ 	.word	0x800000
+ #else
+-	.word	0x80000			/* Top of RAM on the PIE board.  */
++/*	.word	0x80000	*/		/* Top of RAM on the PIE board.  */
+ #endif
+-
+-.Lstack:	
+-	.word	__stack
+-.Lhwinit:	
+-	.word	FUNCTION (hardware_init_hook)
+-.Lswinit:
+-	.word	FUNCTION (software_init_hook)
+-
+-	/* Set up defaults for the above variables in the form of weak symbols
+-	   - so that application will link correctly, and get value 0 in
+-	   runtime (meaning "ignore setting") for the variables, when the user
+-	   does not provide the symbols. (The linker uses a weak symbol if,
+-	   and only if, a normal version of the same symbol isn't provided
+-	   e.g. by a linker script or another object file).  */	
+-
+-	.weak __stack
+-	.weak FUNCTION (hardware_init_hook) 
+-	.weak FUNCTION (software_init_hook)
+ #endif
+-	
+ #endif
+ #if defined(__ELF__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+ 	/* Protect against unhandled exceptions.  */
+@@ -475,8 +287,6 @@
+ .LC30:
+ 	.word	CommandLine
+ 	.word	255
+-.LC31:
+-	.word	__end__
+ 
+ /*  Workspace for Angel calls.  */
+ 	.data
+diff -Naur newlib-1.20.0.orig/newlib/libc/sys/rtems/machine/_types.h newlib-1.20.0/newlib/libc/sys/rtems/machine/_types.h
+--- newlib-1.20.0.orig/newlib/libc/sys/rtems/machine/_types.h	2010-11-16 18:29:39.000000000 +0100
++++ newlib-1.20.0/newlib/libc/sys/rtems/machine/_types.h	2012-02-17 06:28:14.770873849 +0100
+@@ -13,7 +13,7 @@
+  * could be applied here.
+  */
+ 
+-#if defined(__i386__) || defined(__m32r__) || defined(__h8300__) || defined(__arm__) || defined(__bfin__) || defined(__m68k__)
++#if defined(__i386__) || defined(__m32r__) || defined(__h8300__) || (defined(__arm__) && !defined(__ARM_EABI__)) || defined(__bfin__) || defined(__m68k__)
+ #if defined(__H8300__)
+ typedef signed int _ssize_t;
+ #else
+@@ -23,7 +23,7 @@
+ #elif defined(__sparc__) && defined(__LP64__)
+ typedef long signed int _ssize_t;
+ #define __ssize_t_defined 1
+-#elif defined(__AVR__) || defined(__lm32__) || defined(__m32c__) || defined(__mips__) || defined(__moxie__) || defined(__PPC__) || defined(__sparc__) || defined(__sh__)
++#elif defined(__AVR__) || defined(__lm32__) || defined(__m32c__) || defined(__mips__) || defined(__moxie__) || defined(__PPC__) || defined(__sparc__) || defined(__sh__) || defined(__ARM_EABI__)
+ typedef signed int _ssize_t;
+ #define __ssize_t_defined 1
+ #else
+diff -Naur newlib-1.20.0.orig/newlib/libc/sys/rtems/sys/utime.h newlib-1.20.0/newlib/libc/sys/rtems/sys/utime.h
+--- newlib-1.20.0.orig/newlib/libc/sys/rtems/sys/utime.h	2002-11-07 20:27:36.000000000 +0100
++++ newlib-1.20.0/newlib/libc/sys/rtems/sys/utime.h	2012-02-17 06:28:14.770873849 +0100
+@@ -1,10 +1,12 @@
+ /*
+- *  $Id: utime.h,v 1.1 2002/11/07 19:27:36 jjohnstn Exp $
++ *  $Id$
+  */
+ 
+ #ifndef __UTIME_h__
+ #define __UTIME_h__
+ 
++#include <sys/types.h>
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+diff -Naur newlib-1.20.0.orig/newlib/libm/common/modfl.c newlib-1.20.0/newlib/libm/common/modfl.c
+--- newlib-1.20.0.orig/newlib/libm/common/modfl.c	2009-04-18 00:15:43.000000000 +0200
++++ newlib-1.20.0/newlib/libm/common/modfl.c	2012-02-17 06:28:14.771873863 +0100
+@@ -36,7 +36,7 @@
+ long double
+ modfl (long double x, long double *iptr)
+ {
+-  return modf(x, iptr);
++  return modf(x, (double*) iptr);
+ }
+ #endif
+ 
+diff -Naur newlib-1.20.0.orig/newlib/libm/common/s_round.c newlib-1.20.0/newlib/libm/common/s_round.c
+--- newlib-1.20.0.orig/newlib/libm/common/s_round.c	2009-03-25 20:13:01.000000000 +0100
++++ newlib-1.20.0/newlib/libm/common/s_round.c	2012-02-17 06:28:14.771873863 +0100
+@@ -68,7 +68,7 @@
+           msw &= 0x80000000;
+           if (exponent_less_1023 == -1)
+             /* Result is +1.0 or -1.0. */
+-            msw |= (1023 << 20);
++            msw |= ((__int32_t)1023 << 20);
+           lsw = 0;
+         }
+       else
+diff -Naur newlib-1.20.0.orig/newlib/libm/math/e_scalb.c newlib-1.20.0/newlib/libm/math/e_scalb.c
+--- newlib-1.20.0.orig/newlib/libm/math/e_scalb.c	2000-02-17 20:39:51.000000000 +0100
++++ newlib-1.20.0/newlib/libm/math/e_scalb.c	2012-02-17 06:28:14.771873863 +0100
+@@ -17,6 +17,7 @@
+  * should use scalbn() instead.
+  */
+ 
++#include <limits.h>
+ #include "fdlibm.h"
+ 
+ #ifndef _DOUBLE_IS_32BITS
+@@ -46,8 +47,17 @@
+ 	    else       return x/(-fn);
+ 	}
+ 	if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
++#if (INT_MAX < 65000)
++	if ( fn > (double) INT_MAX) return scalbn(x, INT_MAX);
++#else
+ 	if ( fn > 65000.0) return scalbn(x, 65000);
+-	if (-fn > 65000.0) return scalbn(x,-65000);
++#endif
++
++#if (INT_MIN > -65000)
++        if (fn < (double) INT_MIN) return scalbn(x,INT_MIN);
++#else
++	if (fn < -65000.0) return scalbn(x,-65000);
++#endif
+ 	return scalbn(x,(int)fn);
+ #endif
+ }
+diff -Naur newlib-1.20.0.orig/newlib/Makefile.am newlib-1.20.0/newlib/Makefile.am
+--- newlib-1.20.0.orig/newlib/Makefile.am	2011-05-19 08:04:59.000000000 +0200
++++ newlib-1.20.0/newlib/Makefile.am	2012-02-17 06:28:14.744873458 +0100
+@@ -81,7 +81,7 @@
+ 	libc.a
+ endif
+ 
+-noinst_DATA = stmp-targ-include
++BUILT_SOURCES = stmp-targ-include
+ 
+ toollib_DATA = $(CRT0) $(CRT1)
+ 
+@@ -279,10 +279,6 @@
+ 	     $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
+ 	    else true; fi ; \
+ 	  done; \
+-	  $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \
+-	  for i in $(srcdir)/libc/include/rpc/*.h; do \
+-	   $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \
+-	  done; \
+ 	  $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \
+ 	  for i in $(srcdir)/libc/include/sys/*.h; do \
+ 	   $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
+@@ -330,11 +326,6 @@
+ 	     $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
+ 	    else true; fi ; \
+ 	  done ; \
+-	  for i in $(NO_INCLUDE_LIST); do \
+-	    if [ -f $(DESTDIR)$(tooldir)/include/$$i ]; then \
+-		rm $(DESTDIR)$(tooldir)/include/$$i; \
+-	    else true; fi ; \
+-	  done ; \
+ 	else true; fi
+ 
+ # Force makedoc to be built before building info files.
+diff -Naur newlib-1.20.0.orig/newlib/Makefile.in newlib-1.20.0/newlib/Makefile.in
+--- newlib-1.20.0.orig/newlib/Makefile.in	2011-05-19 08:04:59.000000000 +0200
++++ newlib-1.20.0/newlib/Makefile.in	2012-02-17 06:28:14.744873458 +0100
+@@ -122,7 +122,7 @@
+ 	install-pdf-recursive install-ps-recursive install-recursive \
+ 	installcheck-recursive installdirs-recursive pdf-recursive \
+ 	ps-recursive uninstall-recursive
+-DATA = $(noinst_DATA) $(toollib_DATA)
++DATA = $(toollib_DATA)
+ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+   distclean-recursive maintainer-clean-recursive
+ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+@@ -198,7 +198,6 @@
+ NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
+-NO_INCLUDE_LIST = @NO_INCLUDE_LIST@
+ OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+@@ -352,7 +351,7 @@
+ @USE_LIBTOOL_FALSE at toollib_LIBRARIES = libm.a \
+ @USE_LIBTOOL_FALSE@	libc.a
+ 
+-noinst_DATA = stmp-targ-include
++BUILT_SOURCES = stmp-targ-include
+ toollib_DATA = $(CRT0) $(CRT1)
+ 
+ # The functions ldexp, frexp and modf are traditionally supplied in
+@@ -412,7 +411,7 @@
+ 
+ # dejagnu support
+ RUNTESTFLAGS = 
+-all: newlib.h
++all: $(BUILT_SOURCES) newlib.h
+ 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+ 
+ .SUFFIXES:
+@@ -726,14 +725,16 @@
+ 	done
+ check-am:
+ 	$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+-check: check-recursive
++check: $(BUILT_SOURCES)
++	$(MAKE) $(AM_MAKEFLAGS) check-recursive
+ all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) newlib.h
+ installdirs: installdirs-recursive
+ installdirs-am:
+ 	for dir in "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+-install: install-recursive
++install: $(BUILT_SOURCES)
++	$(MAKE) $(AM_MAKEFLAGS) install-recursive
+ install-exec: install-exec-recursive
+ install-data: install-data-recursive
+ uninstall: uninstall-recursive
+@@ -759,6 +760,7 @@
+ maintainer-clean-generic:
+ 	@echo "This command is intended for maintainers to use"
+ 	@echo "it deletes files that may require special tools to rebuild."
++	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ clean: clean-recursive
+ 
+ clean-am: clean-generic clean-libtool clean-local \
+@@ -834,8 +836,9 @@
+ uninstall-am: uninstall-toollibDATA uninstall-toollibLIBRARIES \
+ 	uninstall-toollibLTLIBRARIES
+ 
+-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check-am \
+-	ctags-recursive install-am install-strip tags-recursive
++.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
++	check-am ctags-recursive install install-am install-strip \
++	tags-recursive
+ 
+ .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ 	all all-am am--refresh check check-DEJAGNU check-am clean \
+@@ -986,10 +989,6 @@
+ 	     $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
+ 	    else true; fi ; \
+ 	  done; \
+-	  $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \
+-	  for i in $(srcdir)/libc/include/rpc/*.h; do \
+-	   $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \
+-	  done; \
+ 	  $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \
+ 	  for i in $(srcdir)/libc/include/sys/*.h; do \
+ 	   $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
+@@ -1037,11 +1036,6 @@
+ 	     $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
+ 	    else true; fi ; \
+ 	  done ; \
+-	  for i in $(NO_INCLUDE_LIST); do \
+-	    if [ -f $(DESTDIR)$(tooldir)/include/$$i ]; then \
+-		rm $(DESTDIR)$(tooldir)/include/$$i; \
+-	    else true; fi ; \
+-	  done ; \
+ 	else true; fi
+ 
+ # Force makedoc to be built before building info files.
+diff -Naur newlib-1.20.0.orig/newlib/testsuite/newlib.string/strcmp-1.c newlib-1.20.0/newlib/testsuite/newlib.string/strcmp-1.c
+--- newlib-1.20.0.orig/newlib/testsuite/newlib.string/strcmp-1.c	1970-01-01 01:00:00.000000000 +0100
++++ newlib-1.20.0/newlib/testsuite/newlib.string/strcmp-1.c	2012-02-17 06:28:14.771873863 +0100
+@@ -0,0 +1,222 @@
++/*
++ * Copyright (c) 2011 ARM Ltd
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ * 3. The name of the company may not be used to endorse or promote
++ *    products derived from this software without specific prior written
++ *    permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
++ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
++ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#include <string.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <stdarg.h>
++
++#ifndef BUFF_SIZE
++#define BUFF_SIZE 1024
++#endif
++
++#ifndef MAX_BLOCK_SIZE
++#define MAX_BLOCK_SIZE 128
++#endif
++
++#ifndef MAX_OFFSET
++#define MAX_OFFSET 3
++#endif
++
++#ifndef MAX_DIFF
++#define MAX_DIFF 8
++#endif
++
++#ifndef MAX_LEN
++#define MAX_LEN 8
++#endif
++
++#ifndef MAX_ZEROS
++#define MAX_ZEROS 8
++#endif
++
++#if (MAX_OFFSET >= 26)
++#error "MAX_OFFSET >= 26"
++#endif
++
++#if (MAX_OFFSET + MAX_BLOCK_SIZE + MAX_DIFF + MAX_LEN + MAX_ZEROS >= BUFF_SIZE)
++#error "Buffer overrun: MAX_OFFSET + MAX_BLOCK_SIZE + MAX_DIFF + MAX_LEN + MAX_ZEROS >= BUFF_SIZE."
++#endif
++
++
++#define TOO_MANY_ERRORS 11
++int errors = 0;
++
++const char *testname = "strcmp";
++
++void
++print_error (char const* msg, ...)
++{
++  errors++;
++  if (errors == TOO_MANY_ERRORS)
++    {
++      fprintf (stderr, "Too many errors.\n");
++    }
++  else if (errors < TOO_MANY_ERRORS)
++    {
++      va_list ap;
++      va_start (ap, msg);
++      vfprintf (stderr, msg, ap);
++      va_end (ap);
++    }
++  else
++    {
++      /* Further errors omitted.  */
++    }
++}
++
++void
++printbuf (char *buf, char *name)
++{
++  int i;
++  printf ("\n %s=", name);
++  for (i = 0; i < BUFF_SIZE; i++)
++    if (buf[i] != 0)
++      printf ("(%d,%c)", i, buf[i]);
++    else
++      printf ("(%d,%s)", i, "\\0");
++  printf ("\n");
++}
++
++int
++main (void)
++{
++  /* Allocate buffers to read and write from.  */
++  char src[BUFF_SIZE], dest[BUFF_SIZE];
++
++  /* Fill the source buffer with non-null values, reproducable random data.  */
++  srand (1539);
++  int i, j, zeros;
++  unsigned sa;
++  unsigned da;
++  unsigned n, m, len;
++  char *p;
++  int ret;
++
++  /* Make calls to strcmp with block sizes ranging between 1 and
++     MAX_BLOCK_SIZE bytes, aligned and misaligned source and destination.  */
++  for (sa = 0; sa <= MAX_OFFSET; sa++)
++    for (da = 0; da <= MAX_OFFSET; da++)
++      for (n = 1; n <= MAX_BLOCK_SIZE; n++)
++	{
++	for (m = 1;  m < n + MAX_DIFF; m++)
++	  for (len = 0; len < MAX_LEN; len++)
++	    for  (zeros = 1; zeros < MAX_ZEROS; zeros++)
++	    {
++	      if (n - m > MAX_DIFF)
++		continue;
++	      /* Make a copy of the source.  */
++	      for (i = 0; i < BUFF_SIZE; i++)
++		{
++		  src[i] = 'A' + (i % 26);
++		  dest[i] = src[i];
++		}
++	      memcpy (dest + da, src + sa, n);
++
++	      /* Make src 0-terminated.  */
++	      p = src + sa + n - 1;
++	      for (i = 0; i < zeros; i++)
++		{
++		  *p++ = '\0';
++		}
++
++	      /* Modify dest.  */
++	      p = dest + da + m - 1;
++	      for (j = 0; j < len; j++)
++		*p++ = 'x';
++	      /* Make dest 0-terminated.  */
++	      *p = '\0';
++
++	      ret = strcmp (src + sa, dest + da);
++
++	      /* Check return value.  */
++	      if (n == m)
++		{
++		  if (len == 0)
++		    {
++		      if (ret != 0)
++			{
++			print_error ("\nFailed: after %s of %u bytes "
++				     "with src_align %u and dst_align %u, "
++				     "dest after %d bytes is modified for %d bytes, "
++				     "return value is %d, expected 0.\n",
++				     testname, n, sa, da, m, len, ret);
++			}
++		    }
++		  else
++		    {
++		      if (ret >= 0)
++			print_error ("\nFailed: after %s of %u bytes "
++				     "with src_align %u and dst_align %u, "
++				     "dest after %d bytes is modified for %d bytes, "
++				     "return value is %d, expected negative.\n",
++				     testname, n, sa, da, m, len, ret);
++		    }
++		}
++	      else if (m > n)
++		{
++		  if (ret >= 0)
++		    {
++		      print_error ("\nFailed: after %s of %u bytes "
++				   "with src_align %u and dst_align %u, "
++				   "dest after %d bytes is modified for %d bytes, "
++				   "return value is %d, expected negative.\n",
++				   testname, n, sa, da, m, len, ret);
++		    }
++		}
++	      else  /* m < n */
++		{
++		  if (len == 0)
++		    {
++		      if (ret <= 0)
++			print_error ("\nFailed: after %s of %u bytes "
++				     "with src_align %u and dst_align %u, "
++				     "dest after %d bytes is modified for %d bytes, "
++				     "return value is %d, expected positive.\n",
++				     testname, n, sa, da, m, len, ret);
++		    }
++		  else
++		    {
++		      if (ret >= 0)
++			print_error ("\nFailed: after %s of %u bytes "
++				     "with src_align %u and dst_align %u, "
++				     "dest after %d bytes is modified for %d bytes, "
++				     "return value is %d, expected negative.\n",
++				     testname, n, sa, da, m, len, ret);
++		    }
++		}
++	    }
++	}
++  printf ("\n");
++  if (errors != 0)
++    {
++      printf ("ERROR. FAILED.\n");
++      abort ();
++    }
++  exit (0);
++}




More information about the vc mailing list