diff -uNr gdb-6.6.orig/bfd/sysdep.h gdb-6.6-rtems4.8-20070306/bfd/sysdep.h
--- gdb-6.6.orig/bfd/sysdep.h	2005-05-05 20:51:14.000000000 +0200
+++ gdb-6.6-rtems4.8-20070306/bfd/sysdep.h	2007-03-06 13:29:21.000000000 +0100
@@ -135,7 +135,7 @@
 #endif
 
 #if !HAVE_DECL_STRSTR
-extern char *strstr ();
+/* extern char *strstr (); */
 #endif
 
 #ifdef HAVE_FTELLO
diff -uNr gdb-6.6.orig/gdb/arch-utils.c gdb-6.6-rtems4.8-20070306/gdb/arch-utils.c
--- gdb-6.6.orig/gdb/arch-utils.c	2006-11-10 20:20:35.000000000 +0100
+++ gdb-6.6-rtems4.8-20070306/gdb/arch-utils.c	2007-03-06 13:29:21.000000000 +0100
@@ -349,6 +349,15 @@
 };
 static const char *set_endian_string;
 
+enum bfd_endian
+selected_byte_order (void)
+{
+  if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
+    return TARGET_BYTE_ORDER;
+  else
+    return BFD_ENDIAN_UNKNOWN;
+}
+
 /* Called by ``show endian''.  */
 
 static void
diff -uNr gdb-6.6.orig/gdb/arch-utils.h gdb-6.6-rtems4.8-20070306/gdb/arch-utils.h
--- gdb-6.6.orig/gdb/arch-utils.h	2006-11-10 20:20:35.000000000 +0100
+++ gdb-6.6-rtems4.8-20070306/gdb/arch-utils.h	2007-03-06 13:29:21.000000000 +0100
@@ -126,6 +126,10 @@
 
 extern int legacy_register_sim_regno (int regnum);
 
+/* Return the selected byte order, or BFD_ENDIAN_UNKNOWN if no byte
+   order was explicitly selected.  */
+extern enum bfd_endian selected_byte_order (void);
+
 /* Return the selected architecture's name, or NULL if no architecture
    was explicitly selected.  */
 extern const char *selected_architecture_name (void);
diff -uNr gdb-6.6.orig/gdb/ChangeLog.rtems gdb-6.6-rtems4.8-20070306/gdb/ChangeLog.rtems
--- gdb-6.6.orig/gdb/ChangeLog.rtems	1970-01-01 01:00:00.000000000 +0100
+++ gdb-6.6-rtems4.8-20070306/gdb/ChangeLog.rtems	2007-03-06 13:29:21.000000000 +0100
@@ -0,0 +1,6 @@
+2007-02-08  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* arch-utils.c (selected_byte_order): New.
+	* arch-utils.h (selected_byte_order): New prototype.
+	* remote-sim.c (gdbsim_open): Use selected_byte_order.
+
diff -uNr gdb-6.6.orig/gdb/memory-map.c gdb-6.6-rtems4.8-20070306/gdb/memory-map.c
--- gdb-6.6.orig/gdb/memory-map.c	2006-10-05 21:42:31.000000000 +0200
+++ gdb-6.6-rtems4.8-20070306/gdb/memory-map.c	2007-03-06 13:29:21.000000000 +0100
@@ -141,10 +141,10 @@
 	{
 	  if (strcmp (data->property_name, "blocksize") == 0)
 	    {
+	      char *end = NULL;
 	      if (!data->character_data)
 		throw_error (XML_PARSE_ERROR,
 			     _("Empty content of 'property' element"));
-	      char *end = NULL;
 	      data->currently_parsing->attrib.blocksize
 		= strtoul (data->character_data, &end, 0);
 	      if (*end != '\0')
diff -uNr gdb-6.6.orig/gdb/remote-sim.c gdb-6.6-rtems4.8-20070306/gdb/remote-sim.c
--- gdb-6.6.orig/gdb/remote-sim.c	2006-11-10 20:20:36.000000000 +0100
+++ gdb-6.6-rtems4.8-20070306/gdb/remote-sim.c	2007-03-06 13:29:21.000000000 +0100
@@ -504,9 +504,9 @@
 	 + 50) /* slack */ ;
   arg_buf = (char *) alloca (len);
   strcpy (arg_buf, "gdbsim");	/* 7 */
-  /* Specify the byte order for the target when it is both selectable
-     and explicitly specified by the user (not auto detected). */
-  switch (TARGET_BYTE_ORDER)
+  /* Specify the byte order for the target when it is explicitly
+     specified by the user (not auto detected). */
+  switch (selected_byte_order ())
     {
     case BFD_ENDIAN_BIG:
       strcat (arg_buf, " -E big");
diff -uNr gdb-6.6.orig/sim/erc32/erc32.c gdb-6.6-rtems4.8-20070306/sim/erc32/erc32.c
--- gdb-6.6.orig/sim/erc32/erc32.c	1999-04-16 03:35:00.000000000 +0200
+++ gdb-6.6-rtems4.8-20070306/sim/erc32/erc32.c	2007-03-06 13:30:26.000000000 +0100
@@ -413,7 +413,7 @@
     if (rom8) mec_memcfg &= ~0x20000;
     else mec_memcfg |= 0x20000;
 
-    mem_ramsz = (256 * 1024) << ((mec_memcfg >> 10) & 7);
+    mem_ramsz = (512 * 1024) << ((mec_memcfg >> 10) & 7);
     mem_romsz = (128 * 1024) << ((mec_memcfg >> 18) & 7);
 
     if (sparclite_board) {
diff -uNr gdb-6.6.orig/sim/erc32/exec.c gdb-6.6-rtems4.8-20070306/sim/erc32/exec.c
--- gdb-6.6.orig/sim/erc32/exec.c	2005-03-07 12:09:05.000000000 +0100
+++ gdb-6.6-rtems4.8-20070306/sim/erc32/exec.c	2007-03-06 13:29:21.000000000 +0100
@@ -1713,7 +1713,7 @@
     	    sregs->fdp[rs2 | 1] = sregs->fs[rs2 & ~1];
     	    sregs->fdp[rs2 & ~1] = sregs->fs[rs2 | 1];
     default:
-      ;
+      break;
     }
 #endif
 
@@ -1886,7 +1886,7 @@
 	sregs->fs[rd & ~1] = sregs->fdp[rd | 1];
 	sregs->fs[rd | 1] = sregs->fdp[rd & ~1];
     default:
-      ;
+      break;
     }
 #endif
     if (sregs->fpstate == FP_EXC_PE) {
