diff -Nuar gcc-2.95.4.orig/gcc/Makefile.in gcc-2.95.4/gcc/Makefile.in
--- gcc-2.95.4.orig/gcc/Makefile.in	Tue Jan 30 23:02:49 2001
+++ gcc-2.95.4/gcc/Makefile.in	Thu Jan  9 12:21:02 2003
@@ -884,20 +884,20 @@
 # We call this executable `xgcc' rather than `gcc'
 # to avoid confusion if the current directory is in the path
 # and CC is `gcc'.  It is renamed to `gcc' when it is installed.
-xgcc$(exeext): gcc.o gccspec.o version.o intl.o prefix.o \
+xgcc$(exeext): gcc.o gccspec.o version.o intl.o prefix.o cross_update_cpu.o \
    version.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o gccspec.o intl.o \
-	  prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
+	  prefix.o cross_update_cpu.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
 
 # We call this executable `xcpp' rather than `cpp'
 # since the real preprocessor is named `cpp'.  It too is renamed
 # when it is installed.
 # The only difference from xgcc is that it's linked with cppspec.o
 # instead of gccspec.o.
-cpp$(exeext): gcc.o cppspec.o version.o intl.o prefix.o \
+cpp$(exeext): gcc.o cppspec.o version.o intl.o prefix.o cross_update_cpu.o \
    version.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o cppspec.o intl.o \
-	  prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
+	  prefix.o cross_update_cpu.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
 
 # Dump a specs file to make -B./ read these specs over installed ones.
 specs: xgcc$(exeext)
@@ -1449,6 +1449,11 @@
 	-DPREFIX=\"$(prefix)\" \
 	  -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'`
 
+cross_update_cpu.o: cross_update_cpu.c
+	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+	-DTARGET_FAMILY_CPU="\"$(CROSS_COMPILE)\"" \
+	-c `echo $(srcdir)/cross_update_cpu.c | sed 's,^\./,,'`
+
 convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
 
 tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h
diff -Nuar gcc-2.95.4.orig/gcc/config/mips/linux.h gcc-2.95.4/gcc/config/mips/linux.h
--- gcc-2.95.4.orig/gcc/config/mips/linux.h	Thu May 20 14:51:36 1999
+++ gcc-2.95.4/gcc/config/mips/linux.h	Thu Jan  9 12:29:17 2003
@@ -67,7 +67,8 @@
 
 
 #undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC "-KPIC"
+#define SUBTARGET_ASM_SPEC "%{mno-abicalls:%{membedded-pic:-KPIC}} \
+	%{!mno-abicalls:%{!fno-PIC:%{!fno-pic:-KPIC}}} "
 
 /* Undefine the following which were defined in elf.h.  This will cause the linux
    port to continue to use collect2 for constructors/destructors.  These may be removed
@@ -97,3 +98,29 @@
 #undef DTOR_LIST_END
 
 /*  End of undefines to turn off .ctor/.dtor section support */
+// To generate crtbegin and crtend that use .init and .fini sections
+#define INIT_SECTION_ASM_OP     ".section\t.init"
+#define FINI_SECTION_ASM_OP     ".section\t.fini"
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "-Dmips -Acpu(mips) -Amachine(mips) \
+	-Dunix -Asystem(unix) -D__ELF__ -Dlinux -Asystem(linux) \
+	-Asystem(posix) -DMIPSEB -D__PIC__ -D__pic__"
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "\
+	%{mno-abicalls:%{!membedded-pic:-U__PIC__ -U__pic__}} \
+	%{fno-pic:-U__PIC__ -U__pic__} %{fno-PIC:-U__PIC__ -U__pic__} \
+	%{mcpu=r4kc:-DR4KC -D_R4KC -D__R4KC} \
+	%{!mcpu=r4kc:-DR3000 -D_R3000 -D__R3000}"
+
+#undef LIB_SPEC
+#define LIB_SPEC \
+	"%{shared: -lc} \
+	%{!shared: %{pthread:-lpthread} \
+	%{profile:-lc_p} %{!profile: -lc}}"
+
+#undef DEFAULT_VTABLE_THUNKS
+#define DEFAULT_VTABLE_THUNKS 1
+
+#define HANDLE_SYSV_PRAGMA
diff -Nuar gcc-2.95.4.orig/gcc/config/mips/mips.c gcc-2.95.4/gcc/config/mips/mips.c
--- gcc-2.95.4.orig/gcc/config/mips/mips.c	Thu May 20 14:51:36 1999
+++ gcc-2.95.4/gcc/config/mips/mips.c	Thu Jan  9 12:30:11 2003
@@ -4232,6 +4232,8 @@
 	    mips_cpu = PROCESSOR_R4600;
 	  else if (!strcmp (p, "4650"))
 	    mips_cpu = PROCESSOR_R4650;
+	  else if (!strcmp (p, "4kc") || !strcmp (p, "4Kc"))
+            mips_cpu = PROCESSOR_R4KC;
 	  break;
 
 	case '5':
diff -Nuar gcc-2.95.4.orig/gcc/config/mips/mips.h gcc-2.95.4/gcc/config/mips/mips.h
--- gcc-2.95.4.orig/gcc/config/mips/mips.h	Thu May 20 14:51:36 1999
+++ gcc-2.95.4/gcc/config/mips/mips.h	Thu Jan  9 12:31:44 2003
@@ -69,7 +69,8 @@
   PROCESSOR_R4600,
   PROCESSOR_R4650,
   PROCESSOR_R5000,
-  PROCESSOR_R8000
+  PROCESSOR_R8000,
+  PROCESSOR_R4KC
 };
 
 /* Recast the cpu class to be the cpu attribute.  */
@@ -359,6 +360,8 @@
 /* generate mips 3900 insns */
 #define TARGET_MIPS3900         (target_flags & MASK_MIPS3900)
 
+#define TARGET_MIPS4KC          (mips_arch == PROCESSOR_R4KC)
+
 					/* Mips vs. GNU assembler */
 #define TARGET_GAS		(target_flags & MASK_GAS)
 #define TARGET_UNIX_ASM		(!TARGET_GAS)
diff -Nuar gcc-2.95.4.orig/gcc/config/rs6000/rs6000.c gcc-2.95.4/gcc/config/rs6000/rs6000.c
--- gcc-2.95.4.orig/gcc/config/rs6000/rs6000.c	Tue Jan 30 23:04:08 2001
+++ gcc-2.95.4/gcc/config/rs6000/rs6000.c	Thu Jan  9 12:21:02 2003
@@ -217,6 +217,9 @@
 	 {"403", PROCESSOR_PPC403,
 	    MASK_POWERPC | MASK_SOFT_FLOAT | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN,
 	    POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64},
+	 {"405pm", PROCESSOR_PPC403,
+	    MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN,
+	    POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64},
 	 {"505", PROCESSOR_MPCCORE,
 	    MASK_POWERPC | MASK_NEW_MNEMONICS,
 	    POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64},
@@ -247,6 +250,9 @@
 	 {"740", PROCESSOR_PPC750,
  	    MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
  	    POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
+	 {"7400", PROCESSOR_PPC750,
+	    MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
+	    POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
 	 {"750", PROCESSOR_PPC750,
  	    MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
  	    POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
diff -Nuar gcc-2.95.4.orig/gcc/config/rs6000/rs6000.h gcc-2.95.4/gcc/config/rs6000/rs6000.h
--- gcc-2.95.4.orig/gcc/config/rs6000/rs6000.h	Thu Jan  4 21:07:38 2001
+++ gcc-2.95.4/gcc/config/rs6000/rs6000.h	Thu Jan  9 12:21:02 2003
@@ -72,6 +72,7 @@
 %{mcpu=rsc1: -D_ARCH_PWR} \
 %{mcpu=401: -D_ARCH_PPC} \
 %{mcpu=403: -D_ARCH_PPC} \
+%{mcpu=405pm: -D_ARCH_PPC} \
 %{mcpu=505: -D_ARCH_PPC} \
 %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
 %{mcpu=602: -D_ARCH_PPC} \
@@ -82,6 +83,7 @@
 %{mcpu=604e: -D_ARCH_PPC} \
 %{mcpu=620: -D_ARCH_PPC} \
 %{mcpu=740: -D_ARCH_PPC} \
+%{mcpu=7400: -D_ARCH_PPC} \
 %{mcpu=750: -D_ARCH_PPC} \
 %{mcpu=801: -D_ARCH_PPC} \
 %{mcpu=821: -D_ARCH_PPC} \
diff -Nuar gcc-2.95.4.orig/gcc/cp/Make-lang.in gcc-2.95.4/gcc/cp/Make-lang.in
--- gcc-2.95.4.orig/gcc/cp/Make-lang.in	Thu May 20 14:51:36 1999
+++ gcc-2.95.4/gcc/cp/Make-lang.in	Thu Jan  9 12:21:02 2003
@@ -87,7 +87,7 @@
 	    $$cp_srcdir/parse.c
 
 # Create the compiler driver for g++.
-GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o 
+GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o cross_update_cpu.o
 g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
 	  $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
diff -Nuar gcc-2.95.4.orig/gcc/cross_update_cpu.c gcc-2.95.4/gcc/cross_update_cpu.c
--- gcc-2.95.4.orig/gcc/cross_update_cpu.c	Thu Jan  1 03:00:00 1970
+++ gcc-2.95.4/gcc/cross_update_cpu.c	Thu Jan  9 12:44:26 2003
@@ -0,0 +1,107 @@
+#include <stdio.h>
+#include <string.h>
+
+/* The following structure sets matching between CROSS_COMPILE macro variable
+ * and --mcpu=<cpu> flag values
+ */
+
+static struct target_cpu {
+  char *target_arch;      /* cpu specification in CROSS_COMPILE */
+  char *cpu_id;           /* cpu specification in the mcpu flag */
+}; 
+
+struct target_cpu ppc_cpu_tbl[] = {
+  {"4xx",  "403" },
+  {"4xxFP","405pm"},
+  {"74xx", "7400"},
+  {"7xx",  "750" },
+  {"82xx", "603" },
+  {"8xx",  "860" }
+};
+
+struct target_cpu arm_cpu_tbl[] = {
+  {"920TDI", "arm9"}
+};
+
+struct target_cpu mips_cpu_tbl[] = {
+  {"4KC", "r4kc"}
+};
+
+void cross_update_cpu(argc, argv)
+  int *argc;
+  char ***argv;
+{
+#ifdef TARGET_FAMILY_CPU
+  int i;
+  char *cpu;
+  char *family_cpu = strdup(TARGET_FAMILY_CPU);
+  char *p;
+  int len;
+
+  p = basename(family_cpu);
+  len = strlen(p);
+  if (*(p + len - 1) == '-') 
+      *(p + len - 1) = '\0';
+
+  if (!strncasecmp(p, "ppc_", 4) || 
+      !strncasecmp(p, "arm_", 4))
+  {
+
+    for (i = 0; i < *argc; i++)
+    {
+      if (!strncmp((*argv)[i], "-mcpu=", 6))
+        break;
+    }
+    if (i == *argc)
+    {
+      /* The user has not specified cpu option - add it */
+      char **newargv = xmalloc((*argc + 1)*sizeof(char *));
+      char *cpu_id = NULL;
+
+      if (!strncasecmp(p, "ppc_", 4)) {
+        cpu = p + 4;
+        for (i = 0; i < sizeof(ppc_cpu_tbl)/sizeof(ppc_cpu_tbl[0]); i++)
+        {
+          if (! strcmp(ppc_cpu_tbl[i].target_arch, cpu)) {
+            cpu_id = ppc_cpu_tbl[i].cpu_id;
+            break;
+          }
+        }
+      }
+      else if (!strncasecmp(p, "arm_", 4)) { 
+        cpu = p + 4;
+        for (i = 0; i < sizeof(arm_cpu_tbl)/sizeof(arm_cpu_tbl[0]); i++)
+        {
+          if (! strcmp(arm_cpu_tbl[i].target_arch, cpu)) {
+            cpu_id = arm_cpu_tbl[i].cpu_id;
+            break;
+          }
+        }
+      }
+      else if (!strncasecmp(p, "mips_", 5)) {
+        cpu = p + 5;
+        for (i = 0; i < sizeof(mips_cpu_tbl)/sizeof(mips_cpu_tbl[0]); i++)
+        {
+          if (! strcmp(mips_cpu_tbl[i].target_arch, cpu)) {
+            cpu_id = mips_cpu_tbl[i].cpu_id;
+            break;
+          }
+        }
+      }
+      if (cpu_id)
+      {
+        newargv[0] = (*argv)[0];
+        newargv[1] = xmalloc(strlen(cpu_id) + 7);
+        strcpy(newargv[1], "-mcpu=");
+        strcat(newargv[1], cpu_id);
+        for (i = 2; i < *argc + 1; i++)
+          newargv[i] = (*argv)[i-1];
+        *argv = newargv;
+        (*argc)++;
+      }
+    }
+  }
+  free(family_cpu);
+#endif
+}
+
diff -Nuar gcc-2.95.4.orig/gcc/gcc.c gcc-2.95.4/gcc/gcc.c
--- gcc-2.95.4.orig/gcc/gcc.c	Fri Oct  5 23:34:14 2001
+++ gcc-2.95.4/gcc/gcc.c	Thu Jan  9 12:21:02 2003
@@ -889,6 +889,8 @@
    {"--write-user-dependencies", "-MMD", 0},
    {"--", "-f", "*j"}
  };
+
+extern void cross_update_cpu(int *, char ***);
 
 /* Translate the options described by *ARGCP and *ARGVP.
    Make a new vector and store it back in *ARGVP,
@@ -4734,6 +4736,8 @@
   temp_filename_length = strlen (temp_filename);
 #endif
 
+  cross_update_cpu(&argc, &argv);
+
   /* Make a table of what switches there are (switches, n_switches).
      Make a table of specified input files (infiles, n_infiles).
      Decode switches that are handled locally.  */
@@ -4875,6 +4879,10 @@
     }
   else
     {
+      add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
+                  "BINUTILS", 0, 0, NULL_PTR);
+      add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
+                  "BINUTILS", 0, 0, NULL_PTR);
       if (!IS_DIR_SEPARATOR (*standard_startfile_prefix) && gcc_exec_prefix)
 	add_prefix (&startfile_prefixes,
 		    concat (gcc_exec_prefix, machine_suffix,
