diff -ur gdb-6.6-orig/gdb/arch-utils.c gdb-6.6/gdb/arch-utils.c --- gdb-6.6-orig/gdb/arch-utils.c 2006-11-10 13:20:35.000000000 -0600 +++ gdb-6.6/gdb/arch-utils.c 2007-02-22 12:43:03.000000000 -0600 @@ -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 Only in gdb-6.6/gdb: arch-utils.c.orig diff -ur gdb-6.6-orig/gdb/arch-utils.h gdb-6.6/gdb/arch-utils.h --- gdb-6.6-orig/gdb/arch-utils.h 2006-11-10 13:20:35.000000000 -0600 +++ gdb-6.6/gdb/arch-utils.h 2007-02-22 11:23:31.000000000 -0600 @@ -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); Only in gdb-6.6/gdb: arch-utils.h.orig diff -ur gdb-6.6-orig/gdb/remote-sim.c gdb-6.6/gdb/remote-sim.c --- gdb-6.6-orig/gdb/remote-sim.c 2006-11-10 13:20:36.000000000 -0600 +++ gdb-6.6/gdb/remote-sim.c 2007-02-22 11:23:31.000000000 -0600 @@ -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");