diff -Naur gcc-3.2.2-20030218.orig/gcc/Makefile.in gcc-3.2.2-20030218/gcc/Makefile.in
--- gcc-3.2.2-20030218.orig/gcc/Makefile.in	Tue Feb 18 15:27:23 2003
+++ gcc-3.2.2-20030218/gcc/Makefile.in	Tue Jul 15 06:22:04 2003
@@ -937,18 +937,18 @@
 # 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)
 
 # cpp is to cpp0 as gcc is to cc1.
 # 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)
@@ -1185,6 +1185,11 @@
     function.h hard-reg-set.h $(BASIC_BLOCK_H) graph.h
 sbitmap.o: sbitmap.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h hard-reg-set.h \
     $(BASIC_BLOCK_H)
+
+cross_update_cpu.o: cross_update_cpu.c
+	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+	-DTARGET_FAMILY_CPU="\"$(CROSS_COMPILE)\"" \
+	-c $(srcdir)/cross_update_cpu.c $(OUTPUT_OPTION)
 
 COLLECT2_OBJS = collect2.o tlink.o hash.o intl.o underscore.o version.o
 COLLECT2_LIBS = @COLLECT2_LIBS@
diff -Naur gcc-3.2.2-20030218.orig/gcc/config/mips/linux.h gcc-3.2.2-20030218/gcc/config/mips/linux.h
--- gcc-3.2.2-20030218.orig/gcc/config/mips/linux.h	Tue Apr 16 15:06:27 2002
+++ gcc-3.2.2-20030218/gcc/config/mips/linux.h	Tue Jul 15 07:02:33 2003
@@ -138,7 +138,7 @@
 -Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
 #else
 #define CPP_PREDEFINES "-DMIPSEB -D_MIPSEB -Dunix -Dmips -D_mips \
--DR3000 -D_R3000 -D__gnu_linux__ -Dlinux -Asystem=posix -Acpu=mips \
+-D__gnu_linux__ -Dlinux -Asystem=posix -Acpu=mips \
 -Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
 #endif
 
@@ -185,6 +185,8 @@
 %{mabi=n32: -D__mips64} \
 %{mabi=64: -U__mips64} \
 %{!mabi*: -U__mips64} \
+%{mcpu=4kc:-DR4KC -D_R4KC -D__R4KC} \
+%{!mcpu=4kc:-DR3000 -D_R3000 -D__R3000} \
 %{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
 %{pthread:-D_REENTRANT}"
diff -Naur gcc-3.2.2-20030218.orig/gcc/config/rs6000/rs6000.c gcc-3.2.2-20030218/gcc/config/rs6000/rs6000.c
--- gcc-3.2.2-20030218.orig/gcc/config/rs6000/rs6000.c	Wed Jan 29 16:23:13 2003
+++ gcc-3.2.2-20030218/gcc/config/rs6000/rs6000.c	Tue Jul 15 06:23:44 2003
@@ -361,6 +361,9 @@
 	 {"405", PROCESSOR_PPC405,
 	    MASK_POWERPC | MASK_SOFT_FLOAT | MASK_NEW_MNEMONICS,
 	    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},
diff -Naur gcc-3.2.2-20030218.orig/gcc/config/rs6000/rs6000.h gcc-3.2.2-20030218/gcc/config/rs6000/rs6000.h
--- gcc-3.2.2-20030218.orig/gcc/config/rs6000/rs6000.h	Thu Aug  8 22:09:18 2002
+++ gcc-3.2.2-20030218/gcc/config/rs6000/rs6000.h	Tue Jul 15 06:24:30 2003
@@ -67,6 +67,7 @@
 %{mcpu=401: -D_ARCH_PPC} \
 %{mcpu=403: -D_ARCH_PPC} \
 %{mcpu=405: -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} \
diff -Naur gcc-3.2.2-20030218.orig/gcc/cp/Make-lang.in gcc-3.2.2-20030218/gcc/cp/Make-lang.in
--- gcc-3.2.2-20030218.orig/gcc/cp/Make-lang.in	Tue Feb  4 01:58:23 2003
+++ gcc-3.2.2-20030218/gcc/cp/Make-lang.in	Tue Jul 15 06:25:11 2003
@@ -71,7 +71,7 @@
 po-generated: $(srcdir)/cp/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 -Naur gcc-3.2.2-20030218.orig/gcc/cross_update_cpu.c gcc-3.2.2-20030218/gcc/cross_update_cpu.c
--- gcc-3.2.2-20030218.orig/gcc/cross_update_cpu.c	Thu Jan  1 03:00:00 1970
+++ gcc-3.2.2-20030218/gcc/cross_update_cpu.c	Tue Jul 15 06:37:49 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", "4kc"}
+};
+
+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 -Naur gcc-3.2.2-20030218.orig/gcc/gcc.c gcc-3.2.2-20030218/gcc/gcc.c
--- gcc-3.2.2-20030218.orig/gcc/gcc.c	Fri Jan 17 20:31:22 2003
+++ gcc-3.2.2-20030218/gcc/gcc.c	Tue Jul 15 06:54:26 2003
@@ -335,6 +335,8 @@
 #if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
 static const char *convert_filename	PARAMS ((const char *, int, int));
 #endif
+
+extern void cross_update_cpu(int *, char ***);
 
 /* The Specs Language
 
@@ -5894,6 +5896,8 @@
   putenv (INIT_ENVIRONMENT);
 #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.  */
@@ -5984,6 +5988,10 @@
     }
   else
     {
+      add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
+		"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+      add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
+		"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
       if (!IS_ABSOLUTE_PATHNAME (standard_startfile_prefix)
 	  && gcc_exec_prefix)
 	add_prefix (&startfile_prefixes,

