* gdbarch.sh (TARGET_BYTE_ORDER): Replace by gdbarch_byte_order.
	* ax-gdb.c (gen_bitfield_ref): Likewise.
	* mi/mi-main.c (get_register): Likewise.
	* findvar.c (default_value_from_register, extract_signed_integer)
	(extract_unsigned_integer, extract_long_unsigned_integer)
	(store_signed_integer, store_unsigned_integer): Likewise.
	* regcache.c (regcache_dump): Likewise.
	* value.c (lookup_internalvar, value_of_internalvar)
	(set_internalvar): Likewise.
	* defs.h: Likewise.
	* valprint.c (print_binary_chars, print_octal_chars)
	(print_decimal_chars, print_hex_chars, print_char_chars): Likewise.
	* infcmd.c (default_print_registers_info): Likewise.
	* arch-utils.c (selected_byte_order, show_endian): Likewise.
	* stabsread.c (define_symbol): Likewise.
	* doublest.c (floatformat_from_length, floatformat_from_type)
	(extract_typed_floating, store_typed_floating): Likewise.
	* gdbarch.c, gdbarch.h: Regenerate.
+2007-05-31  Markus Deuling  <deuling@de.ibm.com>
+
+       * gdbarch.sh (TARGET_BYTE_ORDER): Replace by gdbarch_byte_order.
+       * ax-gdb.c (gen_bitfield_ref): Likewise.
+       * mi/mi-main.c (get_register): Likewise.
+       * findvar.c (default_value_from_register, extract_signed_integer)
+       (extract_unsigned_integer, extract_long_unsigned_integer)
+       (store_signed_integer, store_unsigned_integer): Likewise.
+       * regcache.c (regcache_dump): Likewise.
+       * value.c (lookup_internalvar, value_of_internalvar)
+       (set_internalvar): Likewise.
+       * defs.h: Likewise.
+       * valprint.c (print_binary_chars, print_octal_chars)
+       (print_decimal_chars, print_hex_chars, print_char_chars): Likewise.
+       * infcmd.c (default_print_registers_info): Likewise.
+       * arch-utils.c (selected_byte_order, show_endian): Likewise.
+       * stabsread.c (define_symbol): Likewise.
+       * doublest.c (floatformat_from_length, floatformat_from_type)
+       (extract_typed_floating, store_typed_floating): Likewise.
+       * gdbarch.c, gdbarch.h: Regenerate.
+
 2007-05-31  Markus Deuling  <deuling@de.ibm.com>
 
        * gdbarch.sh (CALL_DUMMY_LOCATION): Replace by
 
 selected_byte_order (void)
 {
   if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
-    return TARGET_BYTE_ORDER;
+    return gdbarch_byte_order (current_gdbarch);
   else
     return BFD_ENDIAN_UNKNOWN;
 }
             const char *value)
 {
   if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
-    if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+    if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file, _("The target endianness is set automatically "
                                  "(currently big endian)\n"));
     else
       fprintf_unfiltered (file, _("The target endianness is set automatically "
                           "(currently little endian)\n"));
   else
-    if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+    if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file,
                          _("The target is assumed to be big endian\n"));
     else
 
             the sign/zero extension will wipe them out.
             - If we're in the interior of the word, then there is no garbage
             on either end, because the ref operators zero-extend.  */
-         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+         if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
            gen_left_shift (ax, end - (offset + op_size));
          else
            gen_left_shift (ax, offset - start);
 
    from byte/word byte order.  */
 
 #if !defined (BITS_BIG_ENDIAN)
-#define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+#define BITS_BIG_ENDIAN (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
 #endif
 
 /* In findvar.c.  */
 
 {
   const struct floatformat *format;
   if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
-    format = TARGET_FLOAT_FORMAT[TARGET_BYTE_ORDER];
+    format = TARGET_FLOAT_FORMAT[gdbarch_byte_order (current_gdbarch)];
   else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
-    format = TARGET_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
+    format = TARGET_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)];
   else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
-    format = TARGET_LONG_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
+    format = TARGET_LONG_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)];
   /* On i386 the 'long double' type takes 96 bits,
      while the real number of used bits is only 80,
      both in processor and in memory.  
   else if ((TARGET_LONG_DOUBLE_FORMAT != NULL) 
           && (len * TARGET_CHAR_BIT ==
                TARGET_LONG_DOUBLE_FORMAT[0]->totalsize))
-    format = TARGET_LONG_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
+    format = TARGET_LONG_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)];
   else
     format = NULL;
   if (format == NULL)
 {
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
   if (TYPE_FLOATFORMAT (type) != NULL)
-    return TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER];
+    return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)];
   else
     return floatformat_from_length (TYPE_LENGTH (type));
 }
        specific code? stabs?) so handle that here as a special case.  */
     return extract_floating_by_length (addr, TYPE_LENGTH (type));
 
-  floatformat_to_doublest (TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER],
+  floatformat_to_doublest 
+       (TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)],
                           addr, &retval);
   return retval;
 }
        specific code? stabs?) so handle that here as a special case.  */
     store_floating_by_length (addr, TYPE_LENGTH (type), val);
   else
-    floatformat_from_doublest (TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER],
-                              &val, addr);
+    floatformat_from_doublest
+       (TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)],
+       &val, addr);
 }
 
 /* Convert a floating-point number of type FROM_TYPE from a
 
 
   /* Start at the most significant end of the integer, and work towards
      the least significant.  */
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       p = startaddr;
       /* Do the sign extension once at the start.  */
   /* Start at the most significant end of the integer, and work towards
      the least significant.  */
   retval = 0;
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       for (p = startaddr; p < endaddr; ++p)
        retval = (retval << 8) | *p;
   int len;
 
   len = orig_len;
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       for (p = addr;
           len > (int) sizeof (LONGEST) && p < addr + orig_len;
 
   /* Start at the least significant end of the integer, and work towards
      the most significant.  */
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       for (p = endaddr - 1; p >= startaddr; --p)
        {
 
   /* Start at the least significant end of the integer, and work towards
      the most significant.  */
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       for (p = endaddr - 1; p >= startaddr; --p)
        {
      an integral number of registers.  Otherwise, you need to do
      some fiddling with the last register copied here for little
      endian machines.  */
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG
       && len < register_size (gdbarch, regnum))
     /* Big-endian, and we want less than full size.  */
     set_value_offset (value, register_size (gdbarch, regnum) - len);
 
   fprintf_unfiltered (file,
                       "gdbarch_dump: breakpoint_from_pc = <0x%lx>\n",
                       (long) current_gdbarch->breakpoint_from_pc);
-#ifdef TARGET_BYTE_ORDER
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_BYTE_ORDER # %s\n",
-                      XSTRING (TARGET_BYTE_ORDER));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: byte_order = %s\n",
                       paddr_d (current_gdbarch->byte_order));
 
 
 extern int gdbarch_byte_order (struct gdbarch *gdbarch);
 /* set_gdbarch_byte_order() - not applicable - pre-initialized. */
-#if !defined (GDB_TM_FILE) && defined (TARGET_BYTE_ORDER)
-#error "Non multi-arch definition of TARGET_BYTE_ORDER"
-#endif
-#if !defined (TARGET_BYTE_ORDER)
-#define TARGET_BYTE_ORDER (gdbarch_byte_order (current_gdbarch))
-#endif
 
 extern enum gdb_osabi gdbarch_osabi (struct gdbarch *gdbarch);
 /* set_gdbarch_osabi() - not applicable - pre-initialized. */
 
   cat <<EOF
 i:TARGET_ARCHITECTURE:const struct bfd_arch_info *:bfd_arch_info:::&bfd_default_arch_struct::::TARGET_ARCHITECTURE->printable_name
 #
-i:TARGET_BYTE_ORDER:int:byte_order:::BFD_ENDIAN_BIG
+i::int:byte_order:::BFD_ENDIAN_BIG
 #
 i:TARGET_OSABI:enum gdb_osabi:osabi:::GDB_OSABI_UNKNOWN
 #
 
          for (j = 0; j < register_size (current_gdbarch, i); j++)
            {
              int idx;
-             if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+             if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
                idx = j;
              else
                idx = register_size (current_gdbarch, i) - 1 - j;
 
       ptr = buf + 2;
       for (j = 0; j < register_size (current_gdbarch, regnum); j++)
        {
-         int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j
+         int idx = gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG ? j
          : register_size (current_gdbarch, regnum) - 1 - j;
          sprintf (ptr, "%02x", (unsigned char) buffer[idx]);
          ptr += 2;
 
            {
              regcache_raw_read (regcache, regnum, buf);
              fprintf_unfiltered (file, "0x");
-             dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
+             dump_endian_bytes (file,
+                                gdbarch_byte_order (current_gdbarch), buf,
                                 regcache->descr->sizeof_register[regnum]);
            }
        }
            {
              regcache_cooked_read (regcache, regnum, buf);
              fprintf_unfiltered (file, "0x");
-             dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
+             dump_endian_bytes (file,
+                                gdbarch_byte_order (current_gdbarch), buf,
                                 regcache->descr->sizeof_register[regnum]);
            }
        }
 
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       add_symbol_to_list (sym, &local_symbols);
 
-      if (TARGET_BYTE_ORDER != BFD_ENDIAN_BIG)
+      if (gdbarch_byte_order (current_gdbarch) != BFD_ENDIAN_BIG)
        {
          /* On little-endian machines, this crud is never necessary,
             and, if the extra bytes contain garbage, is harmful.  */
 
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
           p < valaddr + len;
   carry = 0;
 
   fputs_filtered ("0", stream);
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
           p < valaddr + len;
 #define CARRY_LEFT( x ) ((x) % TEN)
 #define SHIFT( x )      ((x) << 4)
 #define START_P \
-        ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) ? valaddr : valaddr + len - 1)
+        ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) ? valaddr : valaddr + len - 1)
 #define NOT_END_P \
-        ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) ? (p < valaddr + len) : (p >= valaddr))
+        ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) ? (p < valaddr + len) : (p >= valaddr))
 #define NEXT_P \
-        ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) ? p++ : p-- )
+        ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) ? p++ : p-- )
 #define LOW_NIBBLE(  x ) ( (x) & 0x00F)
 #define HIGH_NIBBLE( x ) (((x) & 0x0F0) >> 4)
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
   fputs_filtered ("0x", stream);
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
           p < valaddr + len;
 {
   const gdb_byte *p;
 
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
     {
       p = valaddr;
       while (p < valaddr + len - 1 && *p == 0)
 
   var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
   var->name = concat (name, (char *)NULL);
   var->value = allocate_value (builtin_type_void);
-  var->endian = TARGET_BYTE_ORDER;
+  var->endian = gdbarch_byte_order (current_gdbarch);
   release_value (var->value);
   var->next = internalvars;
   internalvars = var;
      point types) are left alone, because they would be too complicated
      to correct.  */
 
-  if (var->endian != TARGET_BYTE_ORDER)
+  if (var->endian != gdbarch_byte_order (current_gdbarch))
     {
       gdb_byte *array = value_contents_raw (val);
       struct type *type = check_typedef (value_enclosing_type (val));
      long.  */
   xfree (var->value);
   var->value = newval;
-  var->endian = TARGET_BYTE_ORDER;
+  var->endian = gdbarch_byte_order (current_gdbarch);
   release_value (newval);
   /* End code which must not call error().  */
 }