diff -urN gcc-3.0.4.orig/gcc/config/mips/iris3.h gcc-3.0.4/gcc/config/mips/iris3.h
--- gcc-3.0.4.orig/gcc/config/mips/iris3.h	2000-11-03 00:29:11.000000000 +0100
+++ gcc-3.0.4/gcc/config/mips/iris3.h	2003-11-21 09:45:18.000000000 +0100
@@ -34,6 +34,10 @@
 #define LIB_SPEC	\
 	"%{!p:%{!pg:%{!static:%{!g*:-lc_s}} -lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s"
 
+/* Include library with missing ANSI calls with libgcc */
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "-laux332 -lgcc"
+
 #define MACHINE_TYPE	"Silicon Graphics Mips"
 
 /* Always use 1 for .file number.  I [meissner@osf.org] wonder why
diff -urN gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/atomicity.h gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/atomicity.h
--- gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/atomicity.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/atomicity.h	2001-02-28 01:04:04.000000000 +0100
@@ -0,0 +1,62 @@
+// Low-level functions for atomic operations: Generic version  -*- C++ -*-
+
+// Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H	1
+
+typedef int _Atomic_word;
+
+static inline _Atomic_word
+__attribute__ ((__unused__))
+__exchange_and_add (_Atomic_word* __mem, int __val)
+{
+  _Atomic_word __result = *__mem;
+  *__mem += __val;
+  return __result;
+}
+
+static inline void
+__attribute__ ((__unused__))
+__atomic_add (_Atomic_word* __mem, int __val)
+{
+  *__mem += __val;
+}
+
+static inline int
+__attribute__ ((__unused__))
+__compare_and_swap (long *__p, long __oldval, long __newval)
+{
+  if (*__p != __oldval)
+    return 0;
+
+  *__p = __newval;
+  return 1;
+}
+
+#endif /* atomicity.h */
diff -urN gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_base.h gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_base.h
--- gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_base.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_base.h	2001-03-16 04:31:44.000000000 +0100
@@ -0,0 +1,55 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+  
+// Information as gleaned from /usr/include/ctype.h on irix 5.2
+  
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef unsigned int*      	__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef unsigned char	mask;
+    static const mask upper    	= _U;
+    static const mask lower 	= _L;
+    static const mask alpha 	= _U | _L;
+    static const mask digit 	= _N;
+    static const mask xdigit 	= _X;
+    static const mask space 	= _S;
+    static const mask print 	= _U | _L | _N | _P | _B;
+    static const mask graph 	= _U | _L | _N | _P;
+    static const mask cntrl 	= _C;
+    static const mask punct 	= _P;
+    static const mask alnum 	= _U | _L | _N;
+  };
diff -urN gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_inline.h gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_inline.h
--- gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_inline.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_inline.h	2001-03-16 04:31:44.000000000 +0100
@@ -0,0 +1,72 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+  
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+  
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  { return (_M_table)[__c] & __m; }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    while (__low < __high)
+      *__vec++ = (_M_table)[*__low++];
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && !((_M_table)[*__low] & __m))
+      ++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && ((_M_table + 1)[*__low] & __m) != 0)
+      ++__low;
+    return __low;
+  }
+
+
+
+
+
diff -urN gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_noninline.h gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_noninline.h
--- gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_noninline.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/ctype_noninline.h	2001-03-16 04:31:44.000000000 +0100
@@ -0,0 +1,71 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+  
+// Information as gleaned from /usr/include/ctype.h
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+    _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), 
+    _M_table(!__table ? __ctype : __table)
+  { }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  { return _toupper(__c); }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = do_toupper(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  { return _tolower(__c); }
+
+  const char* 
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = do_tolower(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
diff -urN gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/os_defines.h gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/os_defines.h
--- gcc-3.0.4.orig/libstdc++-v3/config/os/irix/irix3.3/bits/os_defines.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.0.4/libstdc++-v3/config/os/irix/irix3.3/bits/os_defines.h	2001-03-16 04:31:44.000000000 +0100
@@ -0,0 +1,58 @@
+// Specific definitions for IRIX  -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _GLIBCPP_OS_DEFINES
+#define _GLIBCPP_OS_DEFINES
+
+/* System-specific #define, typedefs, corrections, etc, go here.  This
+   file will come before all others. */
+
+/* We need large file support.  There are two ways to turn it on:
+   by defining either _LARGEFILE64_SOURCE or _SGI_SOURCE.  However,
+   it does not actually work to define only the former, as then
+   <sys/stat.h> is invalid: `st_blocks' is defined to be a macro,
+   but then used as a field name.  So, we have to turn on 
+   _SGI_SOURCE.  That only works if _POSIX_SOURCE is turned off,
+   so we have to explicitly turn it off.  (Some of the libio C files
+   explicitly try to turn it on.)  _SGI_SOURCE is actually turned on 
+   implicitly via the command-line.  */
+#undef _POSIX_SOURCE
+
+#define __off_t off_t
+#define __off64_t off64_t
+#define __ssize_t ssize_t
+
+/* GCC does not use thunks on IRIX.  */
+#define _G_USING_THUNKS 0
+
+#endif
+
+
+
diff -urN gcc-3.0.4.orig/libstdc++-v3/configure.target gcc-3.0.4/libstdc++-v3/configure.target
--- gcc-3.0.4.orig/libstdc++-v3/configure.target	2002-01-18 23:59:10.000000000 +0100
+++ gcc-3.0.4/libstdc++-v3/configure.target	2003-11-26 15:26:36.000000000 +0100
@@ -80,10 +80,14 @@
   linux* | gnu*)
     os_include_dir="config/os/gnu-linux"
     ;;
-  irix[1-6] | irix[1-5].* | irix6.[0-4])
-   # This is known to work on at least IRIX 5.2 and 6.3.
-   os_include_dir="config/os/irix/irix5.2"
-   ;;
+  irix[3-4] | irix[3-4].*)
+    # This is known to work on IRIX 3.3 and 4.0.
+    os_include_dir="config/os/irix/irix3.3"
+    ;;
+  irix[5-6] | irix5.* | irix6.[0-4])
+    # This is known to work on at least IRIX 5.2 and 6.3.
+    os_include_dir="config/os/irix/irix5.2"
+    ;;
   irix6.5)
     os_include_dir="config/os/irix/irix6.5"
     ;;
