diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/config.sub newlib-20060117_1116/config.sub
--- newlib-20060117_1116.orig/config.sub	2006-01-17 16:30:04.000000000 +0100
+++ newlib-20060117_1116/config.sub	2006-01-17 11:13:04.000000000 +0100
@@ -268,6 +268,7 @@
 	| mn10200 | mn10300 \
 	| mt \
 	| msp430 \
+    | nios2 \
 	| ns16k | ns32k \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/configure.in newlib-20060117_1116/configure.in
--- newlib-20060117_1116.orig/configure.in	2006-01-17 16:30:06.000000000 +0100
+++ newlib-20060117_1116/configure.in	2006-01-17 11:13:06.000000000 +0100
@@ -665,6 +665,9 @@
   m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
     noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
     ;;
+  nios2-*-*)
+    noconfigdirs="$noconfigdirs target-libiberty target-librx target-libg++ target-libstdc++ target-libio target-libf2c target-libchill target-zlib target-libobjc target-libgloss"
+    ;;
   m68k-*-elf*)
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/newlib/configure.host newlib-20060117_1116/newlib/configure.host
--- newlib-20060117_1116.orig/newlib/configure.host	2006-01-17 16:30:06.000000000 +0100
+++ newlib-20060117_1116/newlib/configure.host	2006-01-18 09:23:13.000000000 +0100
@@ -192,6 +192,9 @@
   mt*)
         machine_dir=mt
         ;;
+  nios2*)
+	machine_dir=nios2
+    ;;
   or16)
 	;;
   or32)
diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/newlib/libc/include/machine/ieeefp.h newlib-20060117_1116/newlib/libc/include/machine/ieeefp.h
--- newlib-20060117_1116.orig/newlib/libc/include/machine/ieeefp.h	2006-01-17 16:30:28.000000000 +0100
+++ newlib-20060117_1116/newlib/libc/include/machine/ieeefp.h	2005-12-25 13:29:49.000000000 +0100
@@ -92,6 +92,10 @@
 #endif
 #endif
 
+#ifdef __NIOS2__
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
 #define __IEEE_BIG_ENDIAN
 #define _FLOAT_ARG float
diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/newlib/libc/include/machine/setjmp.h newlib-20060117_1116/newlib/libc/include/machine/setjmp.h
--- newlib-20060117_1116.orig/newlib/libc/include/machine/setjmp.h	2006-01-17 16:30:06.000000000 +0100
+++ newlib-20060117_1116/newlib/libc/include/machine/setjmp.h	2006-01-17 16:24:35.000000000 +0100
@@ -204,6 +204,11 @@
 #define _JBLEN 16
 #endif
 
+#ifdef __NIOS2__
+#define _JBLEN 40
+#define _JBTYPE unsigned long
+#endif
+
 #ifdef __xstormy16__
 /* 4 GPRs plus SP plus PC. */
 #define _JBLEN 8
diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/newlib/libc/machine/nios2/Makefile.am newlib-20060117_1116/newlib/libc/machine/nios2/Makefile.am
--- newlib-20060117_1116.orig/newlib/libc/machine/nios2/Makefile.am	1970-01-01 01:00:00.000000000 +0100
+++ newlib-20060117_1116/newlib/libc/machine/nios2/Makefile.am	2005-12-30 13:42:00.000000000 +0100
@@ -0,0 +1,12 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+noinst_LIBRARIES = lib.a
+
+lib_a_SOURCES = setjmp.s
+
+ACLOCAL_AMFLAGS = -I ../../..
+CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/newlib/libc/machine/nios2/configure.in newlib-20060117_1116/newlib/libc/machine/nios2/configure.in
--- newlib-20060117_1116.orig/newlib/libc/machine/nios2/configure.in	1970-01-01 01:00:00.000000000 +0100
+++ newlib-20060117_1116/newlib/libc/machine/nios2/configure.in	2005-12-11 13:43:48.000000000 +0100
@@ -0,0 +1,12 @@
+dnl This is the newlib/libc/machine/nios2 configure.in file.
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.5)
+AC_INIT(setjmp.s)
+
+dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. 
+AC_CONFIG_AUX_DIR(../../../..)
+
+NEWLIB_CONFIGURE(../../..)
+
+AC_OUTPUT(Makefile)
diff -NurX newlib-20060117_1116.orig/.cvsignore -x configure -x aclocal.m4 -x Makefile.in -x CVS -x .cvsignore newlib-20060117_1116.orig/newlib/libc/machine/nios2/setjmp.s newlib-20060117_1116/newlib/libc/machine/nios2/setjmp.s
--- newlib-20060117_1116.orig/newlib/libc/machine/nios2/setjmp.s	1970-01-01 01:00:00.000000000 +0100
+++ newlib-20060117_1116/newlib/libc/machine/nios2/setjmp.s	2005-12-03 19:45:23.000000000 +0100
@@ -0,0 +1,54 @@
+;/*
+; * C library -- _setjmp, _longjmp
+; *
+; *      _longjmp(a,v)
+; * will generate a "return(v?v:1)" from
+; * the last call to
+; *      _setjmp(a)
+; * by unwinding the call stack.
+; * The previous signal state is NOT restored.
+; */
+;
+;
+	.section	.text
+	.align	3
+	.globl	setjmp
+	.type	setjmp,@function
+	.globl	longjmp
+	.type	longjmp,@function
+
+
+setjmp:
+	stw	r16, 0(r4)
+	stw	r17, 4(r4)
+	stw	r18, 8(r4)
+	stw	r19, 12(r4)
+	stw	r20, 16(r4)
+	stw	r21, 20(r4)
+	stw	r22, 24(r4)
+	stw	r23, 28(r4)
+	stw	gp, 32(r4)
+	stw	sp, 36(r4)
+	stw	fp, 40(r4)
+	stw	ra, 44(r4)
+	mov	r2, zero
+	ret
+
+longjmp:
+	ldw	r16, 0(r4)
+	ldw	r17, 4(r4)
+	ldw	r18, 8(r4)
+	ldw	r19, 12(r4)
+	ldw	r20, 16(r4)
+	ldw	r21, 20(r4)
+	ldw	r22, 24(r4)
+	ldw	r23, 28(r4)
+	ldw	gp, 32(r4)
+	ldw	sp, 36(r4)
+	ldw	fp, 40(r4)
+	ldw	ra, 44(r4)
+	mov	r2, r5
+	bne	r2, zero, 1f
+	movi	r2, 1	
+1:
+	ret
