diff mbox

sim: convert to bfd_endian [committed]

Message ID 1451798329-5628-1-git-send-email-vapier@gentoo.org
State Committed
Headers show

Commit Message

Mike Frysinger Jan. 3, 2016, 5:18 a.m. UTC
Rather than re-invent endian defines, as well as maintain our own list
of OS & arch-specific includes, punt all that logic in favor of the bfd
ones already set up and maintained elsewhere.  We already rely on the
bfd library, so leveraging the endian aspect should be fine.
---
 sim/aarch64/ChangeLog           |   4 +
 sim/aarch64/configure           |  34 +++----
 sim/arm/ChangeLog               |   5 ++
 sim/arm/configure               |  34 +++----
 sim/arm/wrapper.c               |   2 +-
 sim/avr/ChangeLog               |   6 ++
 sim/avr/configure               |  36 ++++----
 sim/avr/configure.ac            |   2 +-
 sim/bfin/ChangeLog              |   6 ++
 sim/bfin/configure              |  36 ++++----
 sim/bfin/configure.ac           |   2 +-
 sim/common/ChangeLog            |  41 +++++++++
 sim/common/acinclude.m4         |  34 +++----
 sim/common/cgen-ops.h           |  10 +--
 sim/common/nrun.c               |   2 +-
 sim/common/sim-config.c         |  44 +++++-----
 sim/common/sim-config.h         | 190 +++-------------------------------------
 sim/common/sim-endian.c         |   8 +-
 sim/common/sim-events.c         |  12 +--
 sim/common/sim-events.h         |   6 +-
 sim/common/sim-n-core.h         |   4 +-
 sim/common/sim-n-endian.h       |  10 +--
 sim/common/sim-options.c        |   8 +-
 sim/cr16/ChangeLog              |   6 ++
 sim/cr16/configure              |  36 ++++----
 sim/cr16/configure.ac           |   2 +-
 sim/cris/ChangeLog              |   7 ++
 sim/cris/arch.h                 |   2 -
 sim/cris/configure              |  36 ++++----
 sim/cris/configure.ac           |   2 +-
 sim/d10v/ChangeLog              |   4 +
 sim/d10v/configure              |  34 +++----
 sim/erc32/ChangeLog             |   4 +
 sim/erc32/configure             |  12 +--
 sim/frv/ChangeLog               |   9 ++
 sim/frv/arch.h                  |   2 -
 sim/frv/configure               |  36 ++++----
 sim/frv/configure.ac            |   2 +-
 sim/frv/frv.c                   |   4 +-
 sim/ft32/ChangeLog              |   6 ++
 sim/ft32/configure              |  36 ++++----
 sim/ft32/configure.ac           |   2 +-
 sim/h8300/ChangeLog             |   5 ++
 sim/h8300/configure             |  24 ++---
 sim/h8300/configure.ac          |   2 +-
 sim/iq2000/ChangeLog            |   6 ++
 sim/iq2000/arch.h               |   2 -
 sim/iq2000/configure            |  36 ++++----
 sim/iq2000/configure.ac         |   2 +-
 sim/lm32/ChangeLog              |   6 ++
 sim/lm32/arch.h                 |   2 -
 sim/lm32/configure              |  36 ++++----
 sim/lm32/configure.ac           |   2 +-
 sim/m32r/ChangeLog              |   9 ++
 sim/m32r/arch.h                 |   2 -
 sim/m32r/configure              |  36 ++++----
 sim/m32r/configure.ac           |   2 +-
 sim/m32r/traps-linux.c          |   4 +-
 sim/m68hc11/ChangeLog           |   5 ++
 sim/m68hc11/configure           |  36 ++++----
 sim/m68hc11/configure.ac        |   2 +-
 sim/mcore/ChangeLog             |   4 +
 sim/mcore/configure             |  34 +++----
 sim/microblaze/ChangeLog        |   4 +
 sim/microblaze/configure        |  34 +++----
 sim/mips/ChangeLog              |   7 ++
 sim/mips/configure              |  52 +++++------
 sim/mips/configure.ac           |  16 ++--
 sim/mips/sim-main.h             |   2 +-
 sim/mn10300/ChangeLog           |   6 ++
 sim/mn10300/configure           |  36 ++++----
 sim/mn10300/configure.ac        |   2 +-
 sim/moxie/ChangeLog             |   5 ++
 sim/moxie/configure             |  36 ++++----
 sim/moxie/configure.ac          |   2 +-
 sim/msp430/ChangeLog            |   6 ++
 sim/msp430/configure            |  24 ++---
 sim/msp430/configure.ac         |   2 +-
 sim/sh/ChangeLog                |   7 ++
 sim/sh/configure                |  34 +++----
 sim/sh/interp.c                 |   4 +-
 sim/sh64/ChangeLog              |   6 ++
 sim/sh64/arch.h                 |   2 -
 sim/sh64/configure              |  36 ++++----
 sim/sh64/configure.ac           |   2 +-
 sim/testsuite/ChangeLog         |   5 ++
 sim/testsuite/common/bits-gen.c |   2 +-
 sim/v850/ChangeLog              |   6 ++
 sim/v850/configure              |  36 ++++----
 sim/v850/configure.ac           |   2 +-
 90 files changed, 712 insertions(+), 699 deletions(-)
diff mbox

Patch

diff --git a/sim/aarch64/ChangeLog b/sim/aarch64/ChangeLog
index fbbf562..b16bb61 100644
--- a/sim/aarch64/ChangeLog
+++ b/sim/aarch64/ChangeLog
@@ -1,3 +1,7 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure: Regenerate.
+
 2015-12-27  Mike Frysinger  <vapier@gentoo.org>
 
 	* interp.c (sim_dis_read): Change private_data to application_data.
diff --git a/sim/aarch64/configure b/sim/aarch64/configure
index d909324..219d770 100755
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 024f52e..f6989e9 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure: Regenerate.
+	* wrapper.c (init): Change BIG_ENDIAN to BFD_ENDIAN_BIG.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* wrapper.c (sim_store_register): Rename to ...
diff --git a/sim/arm/configure b/sim/arm/configure
index d46ffcb..3fd5d8c 100755
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index 81fb21f..3938f3c 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -140,7 +140,7 @@  init (void)
     {
       ARMul_EmulateInit ();
       state = ARMul_NewState ();
-      state->bigendSig = (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN ? HIGH : LOW);
+      state->bigendSig = (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? HIGH : LOW);
       ARMul_MemoryInit (state, mem_size);
       ARMul_OSInit (state);
       state->verbose = 0;
diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog
index d0f63e5..5fcbea1 100644
--- a/sim/avr/ChangeLog
+++ b/sim/avr/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
 2015-12-27  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-hload.o.
diff --git a/sim/avr/configure b/sim/avr/configure
index fded283..001142f 100755
diff --git a/sim/avr/configure.ac b/sim/avr/configure.ac
index a487225..0857787 100644
--- a/sim/avr/configure.ac
+++ b/sim/avr/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_ENVIRONMENT
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index cc1b3cc..6844035 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
 2015-12-27  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-hload.o.
diff --git a/sim/bfin/configure b/sim/bfin/configure
index 8edee25..9b8dd5d 100755
diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac
index 31cd159..5ae3b81 100644
--- a/sim/bfin/configure.ac
+++ b/sim/bfin/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_DEFAULT_MODEL(bf537)
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 65a0abf..6991786 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,46 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* acinclude.m4 (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to
+	BFD_ENDIAN_BIG, LITTLE_ENDIAN to BFD_ENDIAN_LITTLE, and 0 to
+	BFD_ENDIAN_UNKNOWN.
+	(SIM_AC_OPTION_HOSTENDIAN): Likewise.
+	* cgen-ops.h (SUBWORDXFSI): Change BIG_ENDIAN to BFD_ENDIAN_BIG.
+	(SUBWORDTFSI, JOINSIDF, JOINSIXF, JOINSITF): Likewise.
+	* nrun.c (main): Likewise.
+	* sim-config.c (current_host_byte_order): Change type to enum
+	bfd_endian.  Initialize to BFD_ENDIAN_UNKNOWN.
+	(current_target_byte_order): Likewise.
+	(config_byte_order_to_a): Likewise.  Change BIG_ENDIAN to
+	BFD_ENDIAN_BIG, LITTLE_ENDIAN to BFD_ENDIAN_LITTLE, and 0 to
+	BFD_ENDIAN_UNKNOWN.
+	(sim_config): Change prefered_target_byte_order type to enum
+	bfd_endian.  Change BIG_ENDIAN to BFD_ENDIAN_BIG, LITTLE_ENDIAN
+	to BFD_ENDIAN_LITTLE, and 0 to BFD_ENDIAN_UNKNOWN.
+	* sim-config.h: Change BIG_ENDIAN to BFD_ENDIAN_BIG, LITTLE_ENDIAN
+	to BFD_ENDIAN_LITTLE, and 0 to BFD_ENDIAN_UNKNOWN.
+	Delete all the various arch/OS endian includes & defines.
+	(current_host_byte_order): Change type to enum bfd_endian.
+	(current_target_byte_order): Likewise.
+	(CURRENT_HOST_BYTE_ORDER): Compare to BFD_ENDIAN_UNKNOWN, not 0.
+	(CURRENT_TARGET_BYTE_ORDER): Likewise.
+	* sim-endian.c: Change LITTLE_ENDIAN to BFD_ENDIAN_LITTLE.
+	* sim-events.c (sim_events_watch_sim): Change BIG_ENDIAN to
+	BFD_ENDIAN_BIG, LITTLE_ENDIAN to BFD_ENDIAN_LITTLE, and 0 to
+	BFD_ENDIAN_UNKNOWN.
+	(sim_events_watch_core): Likewise.
+	* sim-events.h: Likewise.
+	* sim-n-core.h (sim_core_read_misaligned_N): Change BIG_ENDIAN to
+	BFD_ENDIAN_BIG.
+	(sim_core_write_misaligned_N): Likewise.
+	* sim-n-endian.h (endian_h2be_N): Likewise.
+	(endian_be2h_N): Likewise.
+	(endian_h2le_N): Change LITTLE_ENDIAN to BFD_ENDIAN_LITTLE.
+	(offset_N): Likewise.
+	* sim-options.c (standard_option_handler): Change LITTLE_ENDIAN to
+	BFD_ENDIAN_LITTLE and BIG_ENDIAN to BFD_ENDIAN_BIG.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* cgen-defs.h (current_state): Delete.
 	* sim-base.h (CURRENT_STATE_REG, CURRENT_STATE): Delete.
 	* sim-utils.c (current_state): Delete.
diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
index ebb6d1b..2af6d5d 100644
--- a/sim/common/acinclude.m4
+++ b/sim/common/acinclude.m4
@@ -449,26 +449,26 @@  AC_ARG_ENABLE(sim-endian,
 [AS_HELP_STRING([--enable-sim-endian=endian],
 		[Specify target byte endian orientation])],
 [case "${enableval}" in
-  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
-  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
+  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG";;
+  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE";;
   yes)	 if test x"$wire_endian" != x; then
-	   sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
+	   sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
 	 else
-           if test x"$default_endian" != x; then
-	     sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
+	  if test x"$default_endian" != x; then
+	     sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
 	   else
 	     echo "No hard-wired endian for target $target" 1>&6
-	     sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
+	     sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
 	   fi
 	 fi;;
   no)	 if test x"$default_endian" != x; then
-	   sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
+	   sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
 	 else
 	   if test x"$wire_endian" != x; then
-	     sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
+	     sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
 	   else
 	     echo "No default endian for target $target" 1>&6
-	     sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
+	     sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
 	   fi
 	 fi;;
   *)	 AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
@@ -477,10 +477,10 @@  if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
   echo "Setting endian flags = $sim_endian" 6>&1
 fi],
 [if test x"$default_endian" != x; then
-  sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
+  sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
 else
   if test x"$wire_endian" != x; then
-    sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
+    sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
   else
     sim_endian=
   fi
@@ -498,9 +498,9 @@  AC_ARG_ENABLE(sim-hostendian,
 [AS_HELP_STRING([--enable-sim-hostendian=end],
 		[Specify host byte endian orientation])],
 [case "${enableval}" in
-  no)	 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
-  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
-  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
+  no)	 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BFD_ENDIAN_UNKNOWN";;
+  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BFD_ENDIAN_BIG";;
+  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BFD_ENDIAN_LITTLE";;
   *)	 AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
 esac
 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
@@ -509,12 +509,12 @@  fi],[
 if test "x$cross_compiling" = "xno"; then
   AC_C_BIGENDIAN
   if test $ac_cv_c_bigendian = yes; then
-    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BFD_ENDIAN_BIG"
   else
-    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BFD_ENDIAN_LITTLE"
   fi
 else
-  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
+  sim_hostendian="-DWITH_HOST_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
 fi])dnl
 ])
 AC_SUBST(sim_hostendian)
diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h
index 9256d8b..7ff1b4d 100644
--- a/sim/common/cgen-ops.h
+++ b/sim/common/cgen-ops.h
@@ -404,7 +404,7 @@  SUBWORDXFSI (XF in, int word)
   /* Note: typedef struct { SI parts[3]; } XF; */
   union { XF in; SI out[3]; } x;
   x.in = in;
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     return x.out[word];
   else
     return x.out[2 - word];
@@ -416,7 +416,7 @@  SUBWORDTFSI (TF in, int word)
   /* Note: typedef struct { SI parts[4]; } TF; */
   union { TF in; SI out[4]; } x;
   x.in = in;
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     return x.out[word];
   else
     return x.out[3 - word];
@@ -432,7 +432,7 @@  SEMOPS_INLINE DF
 JOINSIDF (SI x0, SI x1)
 {
   union { SI in[2]; DF out; } x;
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     x.in[0] = x0, x.in[1] = x1;
   else
     x.in[1] = x0, x.in[0] = x1;
@@ -443,7 +443,7 @@  SEMOPS_INLINE XF
 JOINSIXF (SI x0, SI x1, SI x2)
 {
   union { SI in[3]; XF out; } x;
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     x.in[0] = x0, x.in[1] = x1, x.in[2] = x2;
   else
     x.in[2] = x0, x.in[1] = x1, x.in[0] = x2;
@@ -454,7 +454,7 @@  SEMOPS_INLINE TF
 JOINSITF (SI x0, SI x1, SI x2, SI x3)
 {
   union { SI in[4]; TF out; } x;
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     x.in[0] = x0, x.in[1] = x1, x.in[2] = x2, x.in[3] = x3;
   else
     x.in[3] = x0, x.in[2] = x1, x.in[1] = x2, x.in[0] = x3;
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 61c3c04..2e47715 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -99,7 +99,7 @@  main (int argc, char **argv)
   /* We can't set the endianness in the callback structure until
      sim_config is called, which happens in sim_open.  */
   default_callback.target_endian
-    = (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN
+    = (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
        ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
 
   /* Was there a program to run?  */
diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c
index ff20983..8e9b1dd 100644
--- a/sim/common/sim-config.c
+++ b/sim/common/sim-config.c
@@ -25,8 +25,8 @@ 
 #include "bfd.h"
 
 
-int current_host_byte_order;
-int current_target_byte_order;
+enum bfd_endian current_host_byte_order = BFD_ENDIAN_UNKNOWN;
+enum bfd_endian current_target_byte_order = BFD_ENDIAN_UNKNOWN;
 int current_stdio;
 
 enum sim_alignments current_alignment;
@@ -40,16 +40,16 @@  int current_floating_point;
 /* map a byte order onto a textual string */
 
 static const char *
-config_byte_order_to_a (int byte_order)
+config_byte_order_to_a (enum bfd_endian byte_order)
 {
   switch (byte_order)
     {
-    case LITTLE_ENDIAN:
+    case BFD_ENDIAN_LITTLE:
       return "LITTLE_ENDIAN";
-    case BIG_ENDIAN:
+    case BFD_ENDIAN_BIG:
       return "BIG_ENDIAN";
-    case 0:
-      return "0";
+    case BFD_ENDIAN_UNKNOWN:
+      return "UNKNOWN_ENDIAN";
     }
   return "UNKNOWN";
 }
@@ -140,7 +140,7 @@  sim_config_default (SIM_DESC sd)
 SIM_RC
 sim_config (SIM_DESC sd)
 {
-  int prefered_target_byte_order;
+  enum bfd_endian prefered_target_byte_order;
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
   /* extract all relevant information */
@@ -149,18 +149,18 @@  sim_config (SIM_DESC sd)
 	 "--architecture"), it'll have no endianness.  */
       || (!bfd_little_endian (STATE_PROG_BFD (sd))
 	  && !bfd_big_endian (STATE_PROG_BFD (sd))))
-    prefered_target_byte_order = 0;
+    prefered_target_byte_order = BFD_ENDIAN_UNKNOWN;
   else
     prefered_target_byte_order = (bfd_little_endian (STATE_PROG_BFD (sd))
-				  ? LITTLE_ENDIAN
-				  : BIG_ENDIAN);
+				  ? BFD_ENDIAN_LITTLE
+				  : BFD_ENDIAN_BIG);
 
   /* set the host byte order */
   current_host_byte_order = 1;
   if (*(char*)(&current_host_byte_order))
-    current_host_byte_order = LITTLE_ENDIAN;
+    current_host_byte_order = BFD_ENDIAN_LITTLE;
   else
-    current_host_byte_order = BIG_ENDIAN;
+    current_host_byte_order = BFD_ENDIAN_BIG;
 
   /* verify the host byte order */
   if (CURRENT_HOST_BYTE_ORDER != current_host_byte_order)
@@ -174,22 +174,22 @@  sim_config (SIM_DESC sd)
 
   /* set the target byte order */
 #if (WITH_TREE_PROPERTIES)
-  if (current_target_byte_order == 0)
+  if (current_target_byte_order == BFD_ENDIAN_UNKNOWN)
     current_target_byte_order
       = (tree_find_boolean_property (root, "/options/little-endian?")
-	 ? LITTLE_ENDIAN
-	 : BIG_ENDIAN);
+	 ? BFD_ENDIAN_LITTLE
+	 : BFD_ENDIAN_BIG);
 #endif
-  if (current_target_byte_order == 0
-      && prefered_target_byte_order != 0)
+  if (current_target_byte_order == BFD_ENDIAN_UNKNOWN
+      && prefered_target_byte_order != BFD_ENDIAN_UNKNOWN)
     current_target_byte_order = prefered_target_byte_order;
-  if (current_target_byte_order == 0)
+  if (current_target_byte_order == BFD_ENDIAN_UNKNOWN)
     current_target_byte_order = WITH_TARGET_BYTE_ORDER;
-  if (current_target_byte_order == 0)
+  if (current_target_byte_order == BFD_ENDIAN_UNKNOWN)
     current_target_byte_order = WITH_DEFAULT_TARGET_BYTE_ORDER;
 
   /* verify the target byte order */
-  if (CURRENT_TARGET_BYTE_ORDER == 0)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_UNKNOWN)
     {
       sim_io_eprintf (sd, "Target byte order unspecified\n");
       return SIM_RC_FAIL;
@@ -198,7 +198,7 @@  sim_config (SIM_DESC sd)
     sim_io_eprintf (sd, "Target (%s) and configured (%s) byte order in conflict\n",
 		  config_byte_order_to_a (current_target_byte_order),
 		  config_byte_order_to_a (CURRENT_TARGET_BYTE_ORDER));
-  if (prefered_target_byte_order != 0
+  if (prefered_target_byte_order != BFD_ENDIAN_UNKNOWN
       && CURRENT_TARGET_BYTE_ORDER != prefered_target_byte_order)
     sim_io_eprintf (sd, "Target (%s) and specified (%s) byte order in conflict\n",
 		  config_byte_order_to_a (CURRENT_TARGET_BYTE_ORDER),
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index a5a8950..fbd9b25 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -30,181 +30,19 @@ 
    particular it defines the macro's:
 
    	WITH_HOST_BYTE_ORDER	The byte order of the host. Could
-				be any of LITTLE_ENDIAN, BIG_ENDIAN
-				or 0 (unknown).  Those macro's also
+				be any of BFD_ENDIAN_LITTLE, BFD_ENDIAN_BIG,
+				or BFD_ENDIAN_UNKNOWN.  Those macro's also
 				need to be defined.
 
  */
 
 
-/* NetBSD:
-
-   NetBSD is easy, everything you could ever want is in a header file
-   (well almost :-) */
-
-#if defined(__NetBSD__)
-# include <machine/endian.h>
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER BYTE_ORDER
-# endif
-# if (BYTE_ORDER != WITH_HOST_BYTE_ORDER)
-#  error "host endian incorrectly configured, check config.h"
-# endif
-#endif
-
-/* Linux is similarly easy.  */
-
-#if defined(__linux__)
-# include <endian.h>
-# if defined(__LITTLE_ENDIAN) && !defined(LITTLE_ENDIAN)
-#  define LITTLE_ENDIAN __LITTLE_ENDIAN
-# endif
-# if defined(__BIG_ENDIAN) && !defined(BIG_ENDIAN)
-#  define BIG_ENDIAN __BIG_ENDIAN
-# endif
-# if defined(__BYTE_ORDER) && !defined(BYTE_ORDER)
-#  define BYTE_ORDER __BYTE_ORDER
-# endif
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER BYTE_ORDER
-# endif
-# if (BYTE_ORDER != WITH_HOST_BYTE_ORDER)
-#  error "host endian incorrectly configured, check config.h"
-# endif
-#endif
-
-/* INSERT HERE - hosts that have available LITTLE_ENDIAN and
-   BIG_ENDIAN macro's */
-
-
-/* Some hosts don't define LITTLE_ENDIAN or BIG_ENDIAN, help them out */
-
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1234
-#endif
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN 4321
-#endif
-
-
-/* SunOS on SPARC:
-
-   Big endian last time I looked */
-
-#if defined(sparc) || defined(__sparc__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER BIG_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
-#  error "sun was big endian last time I looked ..."
-# endif
-#endif
-
-
-/* Random x86
-
-   Little endian last time I looked */
-
-#if defined(i386) || defined(i486) || defined(i586) || defined (i686) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined (__i686__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
-#  error "x86 was little endian last time I looked ..."
-# endif
-#endif
-
 #if (defined (__i486__) || defined (__i586__) || defined (__i686__)) && defined(__GNUC__) && WITH_BSWAP
 #undef  htonl
 #undef  ntohl
 #define htonl(IN) __extension__ ({ int _out; __asm__ ("bswap %0" : "=r" (_out) : "0" (IN)); _out; })
 #define ntohl(IN) __extension__ ({ int _out; __asm__ ("bswap %0" : "=r" (_out) : "0" (IN)); _out; })
 #endif
-
-/* Power or PowerPC running AIX  */
-#if defined(_POWER) && defined(_AIX)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER BIG_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
-#  error "Power/PowerPC AIX was big endian last time I looked ..."
-# endif
-#endif
-
-/* Solaris running PowerPC */
-#if defined(__PPC) && defined(__sun__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
-#  error "Solaris on PowerPCs was little endian last time I looked ..."
-# endif
-#endif
-
-/* HP/PA */
-#if defined(__hppa__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER BIG_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
-#  error "HP/PA was big endian last time I looked ..."
-# endif
-#endif
-
-/* Big endian MIPS */
-#if defined(__MIPSEB__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER BIG_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN)
-#  error "MIPSEB was big endian last time I looked ..."
-# endif
-#endif
-
-/* Little endian MIPS */
-#if defined(__MIPSEL__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
-#  error "MIPSEL was little endian last time I looked ..."
-# endif
-#endif
-
-/* Windows NT */
-#if defined(__WIN32__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
-#  error "Windows NT was little endian last time I looked ..."
-# endif
-#endif
-
-/* Alpha running DEC unix */
-#if defined(__osf__) && defined(__alpha__)
-# if (WITH_HOST_BYTE_ORDER == 0)
-#  undef WITH_HOST_BYTE_ORDER
-#  define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN
-# endif
-# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN)
-#  error "AXP running DEC unix was little endian last time I looked ..."
-# endif
-#endif
-
-
-/* INSERT HERE - additional hosts that do not have LITTLE_ENDIAN and
-   BIG_ENDIAN definitions available.  */
 
 /* Until devices and tree properties are sorted out, tell sim-config.c
    not to call the tree_find_foo fns.  */
@@ -217,28 +55,28 @@ 
    of the host/target it is able to eliminate slower generic endian
    handling code.
 
-   Possible values are 0 (unknown), LITTLE_ENDIAN, BIG_ENDIAN */
+   Possible values are BFD_ENDIAN_UNKNOWN, BFD_ENDIAN_LITTLE, BFD_ENDIAN_BIG.  */
 
 #ifndef WITH_HOST_BYTE_ORDER
-#define WITH_HOST_BYTE_ORDER		0 /*unknown*/
+#define WITH_HOST_BYTE_ORDER		BFD_ENDIAN_UNKNOWN
 #endif
 
 #ifndef WITH_TARGET_BYTE_ORDER
-#define WITH_TARGET_BYTE_ORDER		0 /*unknown*/
+#define WITH_TARGET_BYTE_ORDER		BFD_ENDIAN_UNKNOWN
 #endif
 
 #ifndef WITH_DEFAULT_TARGET_BYTE_ORDER
-#define WITH_DEFAULT_TARGET_BYTE_ORDER 0 /* fatal */
+#define WITH_DEFAULT_TARGET_BYTE_ORDER	BFD_ENDIAN_UNKNOWN
 #endif
 
-extern int current_host_byte_order;
-#define CURRENT_HOST_BYTE_ORDER (WITH_HOST_BYTE_ORDER \
-				 ? WITH_HOST_BYTE_ORDER \
-				 : current_host_byte_order)
-extern int current_target_byte_order;
-#define CURRENT_TARGET_BYTE_ORDER (WITH_TARGET_BYTE_ORDER \
-				   ? WITH_TARGET_BYTE_ORDER \
-				   : current_target_byte_order)
+extern enum bfd_endian current_host_byte_order;
+#define CURRENT_HOST_BYTE_ORDER \
+  (WITH_HOST_BYTE_ORDER != BFD_ENDIAN_UNKNOWN \
+   ? WITH_HOST_BYTE_ORDER : current_host_byte_order)
+extern enum bfd_endian current_target_byte_order;
+#define CURRENT_TARGET_BYTE_ORDER \
+  (WITH_TARGET_BYTE_ORDER != BFD_ENDIAN_UNKNOWN \
+   ? WITH_TARGET_BYTE_ORDER : current_target_byte_order)
 
 
 
diff --git a/sim/common/sim-endian.c b/sim/common/sim-endian.c
index a699577..e8ef534 100644
--- a/sim/common/sim-endian.c
+++ b/sim/common/sim-endian.c
@@ -31,7 +31,7 @@ 
 #define _SWAP_1(SET,RAW) SET (RAW)
 #endif
 
-#if !defined(_SWAP_2) && (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htons)
+#if !defined(_SWAP_2) && (WITH_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) && defined(htons)
 #define _SWAP_2(SET,RAW) SET htons (RAW)
 #endif
 
@@ -39,7 +39,7 @@ 
 #define _SWAP_2(SET,RAW) SET (((RAW) >> 8) | ((RAW) << 8))
 #endif
 
-#if !defined(_SWAP_4) && (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htonl)
+#if !defined(_SWAP_4) && (WITH_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) && defined(htonl)
 #define _SWAP_4(SET,RAW) SET htonl (RAW)
 #endif
 
@@ -93,7 +93,7 @@  INLINE_SIM_ENDIAN\
 (unsigned_8)
 sim_endian_split_16 (unsigned_16 word, int w)
 {
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       return word.a[1 - w];
     }
@@ -110,7 +110,7 @@  sim_endian_join_16 (unsigned_8 h, unsigned_8 l)
 
 {
   unsigned_16 word;
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       word.a[0] = l;
       word.a[1] = h;
diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c
index f29e40c..54d75c2 100644
--- a/sim/common/sim-events.c
+++ b/sim/common/sim-events.c
@@ -635,7 +635,7 @@  sim_events_watch_sim (SIM_DESC sd,
   /* type */
   switch (byte_order)
     {
-    case 0:
+    case BFD_ENDIAN_UNKNOWN:
       switch (nr_bytes)
 	{
 	case 1: new_event->watching = watch_sim_host_1; break;
@@ -645,7 +645,7 @@  sim_events_watch_sim (SIM_DESC sd,
 	default: sim_io_error (sd, "sim_events_watch_sim - invalid nr bytes");
 	}
       break;
-    case BIG_ENDIAN:
+    case BFD_ENDIAN_BIG:
       switch (nr_bytes)
 	{
 	case 1: new_event->watching = watch_sim_be_1; break;
@@ -655,7 +655,7 @@  sim_events_watch_sim (SIM_DESC sd,
 	default: sim_io_error (sd, "sim_events_watch_sim - invalid nr bytes");
 	}
       break;
-    case LITTLE_ENDIAN:
+    case BFD_ENDIAN_LITTLE:
       switch (nr_bytes)
 	{
 	case 1: new_event->watching = watch_sim_le_1; break;
@@ -714,7 +714,7 @@  sim_events_watch_core (SIM_DESC sd,
   /* type */
   switch (byte_order)
     {
-    case 0:
+    case BFD_ENDIAN_UNKNOWN:
       switch (nr_bytes)
 	{
 	case 1: new_event->watching = watch_core_targ_1; break;
@@ -724,7 +724,7 @@  sim_events_watch_core (SIM_DESC sd,
 	default: sim_io_error (sd, "sim_events_watch_core - invalid nr bytes");
 	}
       break;
-    case BIG_ENDIAN:
+    case BFD_ENDIAN_BIG:
       switch (nr_bytes)
 	{
 	case 1: new_event->watching = watch_core_be_1; break;
@@ -734,7 +734,7 @@  sim_events_watch_core (SIM_DESC sd,
 	default: sim_io_error (sd, "sim_events_watch_core - invalid nr bytes");
 	}
       break;
-    case LITTLE_ENDIAN:
+    case BFD_ENDIAN_LITTLE:
       switch (nr_bytes)
 	{
 	case 1: new_event->watching = watch_core_le_1; break;
diff --git a/sim/common/sim-events.h b/sim/common/sim-events.h
index 60e2046..c01cea0 100644
--- a/sim/common/sim-events.h
+++ b/sim/common/sim-events.h
@@ -154,7 +154,8 @@  extern sim_event *sim_events_watch_clock
    true.
 
    HOST_ADDR: pointer into the host address space.
-   BYTE_ORDER: 0 - host endian; BIG_ENDIAN; LITTLE_ENDIAN */
+   BYTE_ORDER: BFD_ENDIAN_UNKNOWN - host endian; BFD_ENDIAN_BIG;
+	       BFD_ENDIAN_LITTLE.  */
 
 extern sim_event *sim_events_watch_sim
 (SIM_DESC sd,
@@ -173,7 +174,8 @@  extern sim_event *sim_events_watch_sim
    true.
 
    CORE_ADDR/MAP: pointer into the target address space.
-   BYTE_ORDER: 0 - current target endian; BIG_ENDIAN; LITTLE_ENDIAN */
+   BYTE_ORDER: BFD_ENDIAN_UNKNOWN - host endian; BFD_ENDIAN_BIG;
+	       BFD_ENDIAN_LITTLE.  */
 
 extern sim_event *sim_events_watch_core
 (SIM_DESC sd,
diff --git a/sim/common/sim-n-core.h b/sim/common/sim-n-core.h
index d67fb9c..0c1cb7a 100644
--- a/sim/common/sim-n-core.h
+++ b/sim/common/sim-n-core.h
@@ -250,7 +250,7 @@  sim_core_read_misaligned_N(sim_cpu *cpu,
 		     read_transfer, sim_core_unaligned_signal);
   if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
     val = SWAP_M (val);
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     val >>= (M - N) * 8;
   PROFILE_COUNT_CORE (cpu, addr, N, map);
   if (TRACE_P (cpu, TRACE_CORE_IDX))
@@ -366,7 +366,7 @@  sim_core_write_misaligned_N(sim_cpu *cpu,
 			   unsigned_M val)
 {
   unsigned_M data = val;
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     data <<= (M - N) * 8;
   if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
     data = SWAP_M (data);
diff --git a/sim/common/sim-n-endian.h b/sim/common/sim-n-endian.h
index 4cfb925..ef7d2ce 100644
--- a/sim/common/sim-n-endian.h
+++ b/sim/common/sim-n-endian.h
@@ -81,7 +81,7 @@  INLINE_SIM_ENDIAN\
 (unsigned_N)
 endian_h2be_N(unsigned_N raw_in)
 {
-  if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) {
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_BIG) {
     return raw_in;
   }
   else {
@@ -95,7 +95,7 @@  INLINE_SIM_ENDIAN\
 (unsigned_N)
 endian_be2h_N(unsigned_N raw_in)
 {
-  if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) {
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_BIG) {
     return raw_in;
   }
   else {
@@ -109,7 +109,7 @@  INLINE_SIM_ENDIAN\
 (unsigned_N)
 endian_h2le_N(unsigned_N raw_in)
 {
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) {
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) {
     return raw_in;
   }
   else {
@@ -123,7 +123,7 @@  INLINE_SIM_ENDIAN\
 (unsigned_N)
 endian_le2h_N(unsigned_N raw_in)
 {
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) {
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) {
     return raw_in;
   }
   else {
@@ -145,7 +145,7 @@  offset_N (unsigned_N *x,
   ASSERT (offset + sizeof_word <= sizeof(unsigned_N));
   ASSERT (word < (sizeof (unsigned_N) / sizeof_word));
   ASSERT ((sizeof (unsigned_N) % sizeof_word) == 0);
-  if (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+  if (WITH_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       out = in + sizeof (unsigned_N) - offset - sizeof_word;
     }
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 1fca5de..e252756 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -197,23 +197,23 @@  standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
     case OPTION_ENDIAN:
       if (strcmp (arg, "big") == 0)
 	{
-	  if (WITH_TARGET_BYTE_ORDER == LITTLE_ENDIAN)
+	  if (WITH_TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
 	    {
 	      sim_io_eprintf (sd, "Simulator compiled for little endian only.\n");
 	      return SIM_RC_FAIL;
 	    }
 	  /* FIXME:wip: Need to set something in STATE_CONFIG.  */
-	  current_target_byte_order = BIG_ENDIAN;
+	  current_target_byte_order = BFD_ENDIAN_BIG;
 	}
       else if (strcmp (arg, "little") == 0)
 	{
-	  if (WITH_TARGET_BYTE_ORDER == BIG_ENDIAN)
+	  if (WITH_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
 	    {
 	      sim_io_eprintf (sd, "Simulator compiled for big endian only.\n");
 	      return SIM_RC_FAIL;
 	    }
 	  /* FIXME:wip: Need to set something in STATE_CONFIG.  */
-	  current_target_byte_order = LITTLE_ENDIAN;
+	  current_target_byte_order = BFD_ENDIAN_LITTLE;
 	}
       else
 	{
diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog
index 44e24fe..130e878 100644
--- a/sim/cr16/ChangeLog
+++ b/sim/cr16/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
 2015-12-27  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-hload.o.
diff --git a/sim/cr16/configure b/sim/cr16/configure
index 676e9a9..c538ede 100755
diff --git a/sim/cr16/configure.ac b/sim/cr16/configure.ac
index ebf8bd3..7464e34 100644
--- a/sim/cr16/configure.ac
+++ b/sim/cr16/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_ENVIRONMENT
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 1e28c12..79ce999 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,5 +1,12 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* arch.h (TARGET_BIG_ENDIAN): Delete.
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-if.c (xprintf, eprintf): Delete.
 	(cris_load_elf_file): Delete callback.  Change xprintf to
 	sim_io_printf and eprintf to sim_io_eprintf.
diff --git a/sim/cris/arch.h b/sim/cris/arch.h
index f765f4a..efd861f 100644
--- a/sim/cris/arch.h
+++ b/sim/cris/arch.h
@@ -24,8 +24,6 @@  This file is part of the GNU simulators.
 #ifndef CRIS_ARCH_H
 #define CRIS_ARCH_H
 
-#define TARGET_BIG_ENDIAN 1
-
 /* Enum declaration for model types.  */
 typedef enum model_type {
   MODEL_CRISV10, MODEL_CRISV32, MODEL_MAX
diff --git a/sim/cris/configure b/sim/cris/configure
index be7f6fc..9914337 100755
diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac
index 4e6b1be..5b384a2 100644
--- a/sim/cris/configure.ac
+++ b/sim/cris/configure.ac
@@ -8,7 +8,7 @@  SIM_AC_COMMON
 # For dv-rv and rvdummy.
 AC_CHECK_HEADERS(sys/socket.h sys/select.h limits.h sys/param.h)
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_SCACHE(16384)
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 6a796bb..1a2f94f 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,7 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure: Regenerate.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* wrapper.c (d10v_reg_store, d10v_reg_fetch): Define.
diff --git a/sim/d10v/configure b/sim/d10v/configure
index d46ffcb..3fd5d8c 100755
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog
index e9a3241..fd23fe6 100644
--- a/sim/erc32/ChangeLog
+++ b/sim/erc32/ChangeLog
@@ -1,3 +1,7 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure: Regenerate.
+
 2015-12-26  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/erc32/configure b/sim/erc32/configure
index 94c6fa4..d12525b 100755
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index a566ba0..dd28834 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,5 +1,14 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* arch.h (TARGET_BIG_ENDIAN): Delete.
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+	* frv.c (frvbf_h_fr_double_get_handler): Change LITTLE_ENDIAN to
+	BFD_ENDIAN_LITTLE.
+	(frvbf_h_fr_double_set_handler): Likewise.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* reset.c (frv_term): Change current_state to sd.
 	* sim-if.c (current_state): Delete.
 	(sim_open): Delete current_state assignment.
diff --git a/sim/frv/arch.h b/sim/frv/arch.h
index 06abe86..18d0940 100644
--- a/sim/frv/arch.h
+++ b/sim/frv/arch.h
@@ -24,8 +24,6 @@  This file is part of the GNU simulators.
 #ifndef FRV_ARCH_H
 #define FRV_ARCH_H
 
-#define TARGET_BIG_ENDIAN 1
-
 /* Enum declaration for model types.  */
 typedef enum model_type {
   MODEL_FRV, MODEL_FR550, MODEL_FR500, MODEL_TOMCAT
diff --git a/sim/frv/configure b/sim/frv/configure
index ca3363c..40b8bdf 100755
diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac
index ebaf6ab..ad73eed 100644
--- a/sim/frv/configure.ac
+++ b/sim/frv/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_SCACHE(16384)
diff --git a/sim/frv/frv.c b/sim/frv/frv.c
index 2b78edb..594931f 100644
--- a/sim/frv/frv.c
+++ b/sim/frv/frv.c
@@ -303,7 +303,7 @@  frvbf_h_fr_double_get_handler (SIM_CPU *current_cpu, UINT fr)
   /* Check the register alignment.  */
   fr = check_fr_register_alignment (current_cpu, fr, 1);
 
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       value.as_sf[1] = GET_H_FR (fr);
       value.as_sf[0] = GET_H_FR (fr + 1);
@@ -329,7 +329,7 @@  frvbf_h_fr_double_set_handler (SIM_CPU *current_cpu, UINT fr, DF newval)
   fr = check_fr_register_alignment (current_cpu, fr, 1);
 
   value.as_df = newval;
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       SET_H_FR (fr    , value.as_sf[1]);
       SET_H_FR (fr + 1, value.as_sf[0]);
diff --git a/sim/ft32/ChangeLog b/sim/ft32/ChangeLog
index 7164c7f..3f30164 100644
--- a/sim/ft32/ChangeLog
+++ b/sim/ft32/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
 2015-12-27  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-hload.o.
diff --git a/sim/ft32/configure b/sim/ft32/configure
index d16b9c5..a12de76 100755
diff --git a/sim/ft32/configure.ac b/sim/ft32/configure.ac
index 2107f74..57573d8 100644
--- a/sim/ft32/configure.ac
+++ b/sim/ft32/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_ENVIRONMENT
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index 7d87d1f..2327bb4 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* compile.c (sim_state_initialize): Delete.
diff --git a/sim/h8300/configure b/sim/h8300/configure
index 79043dc..12b72e4 100755
diff --git a/sim/h8300/configure.ac b/sim/h8300/configure.ac
index 53a02bb..3966160 100644
--- a/sim/h8300/configure.ac
+++ b/sim/h8300/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 
 AC_CHECK_HEADERS(sys/param.h)
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index 07c6ef6..7fbebd5 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,5 +1,11 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* arch.h (TARGET_BIG_ENDIAN): Delete.
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-if.c (sim_open): Delete #if 0 sim_add_option_table call.
 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/iq2000/arch.h b/sim/iq2000/arch.h
index ab26832..3e062db 100644
--- a/sim/iq2000/arch.h
+++ b/sim/iq2000/arch.h
@@ -24,8 +24,6 @@  This file is part of the GNU simulators.
 #ifndef IQ2000_ARCH_H
 #define IQ2000_ARCH_H
 
-#define TARGET_BIG_ENDIAN 1
-
 /* Enum declaration for model types.  */
 typedef enum model_type {
   MODEL_IQ2000, MODEL_MAX
diff --git a/sim/iq2000/configure b/sim/iq2000/configure
index 26937d3..7f6b7bf 100755
diff --git a/sim/iq2000/configure.ac b/sim/iq2000/configure.ac
index 78dcbb6..923ae92 100644
--- a/sim/iq2000/configure.ac
+++ b/sim/iq2000/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_SCACHE(16384)
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index 5aaab31..552e848 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,5 +1,11 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* arch.h (TARGET_BIG_ENDIAN): Delete.
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-if.c (free_state, print_lm32_misc_cpu): Delete prototypes.
 	(lm32_option_handler, OPTION_ENDIAN, lm32_options): Delete.
 	(sim_open): Delete sim_add_option_table call.
diff --git a/sim/lm32/arch.h b/sim/lm32/arch.h
index b2ed4b2..720705a 100644
--- a/sim/lm32/arch.h
+++ b/sim/lm32/arch.h
@@ -24,8 +24,6 @@  This file is part of the GNU simulators.
 #ifndef LM32_ARCH_H
 #define LM32_ARCH_H
 
-#define TARGET_BIG_ENDIAN 1
-
 /* Enum declaration for model types.  */
 typedef enum model_type {
   MODEL_LM32, MODEL_MAX
diff --git a/sim/lm32/configure b/sim/lm32/configure
index be10750..3968c92 100755
diff --git a/sim/lm32/configure.ac b/sim/lm32/configure.ac
index 764c611..90f5e2b 100644
--- a/sim/lm32/configure.ac
+++ b/sim/lm32/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_SCACHE(16384)
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 8b65bb9..7578315 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,5 +1,14 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* arch.h (TARGET_BIG_ENDIAN): Delete.
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+	* traps-linux.c (conv_endian): Change LITTLE_ENDIAN to
+	BFD_ENDIAN_LITTLE.
+	(conv_endian16): Likewise.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-if.c (sim_open): Delete #if 0 sim_add_option_table call.
 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/m32r/arch.h b/sim/m32r/arch.h
index 8341c4c..93e7e2e 100644
--- a/sim/m32r/arch.h
+++ b/sim/m32r/arch.h
@@ -24,8 +24,6 @@  This file is part of the GNU simulators.
 #ifndef M32R_ARCH_H
 #define M32R_ARCH_H
 
-#define TARGET_BIG_ENDIAN 1
-
 /* Enum declaration for model types.  */
 typedef enum model_type {
   MODEL_M32R_D, MODEL_TEST, MODEL_M32RX, MODEL_M32R2
diff --git a/sim/m32r/configure b/sim/m32r/configure
index 5c263da..8742adb 100755
diff --git a/sim/m32r/configure.ac b/sim/m32r/configure.ac
index d92e62b..68fb20d 100644
--- a/sim/m32r/configure.ac
+++ b/sim/m32r/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_SCACHE(16384)
diff --git a/sim/m32r/traps-linux.c b/sim/m32r/traps-linux.c
index f266302..9220451 100644
--- a/sim/m32r/traps-linux.c
+++ b/sim/m32r/traps-linux.c
@@ -136,7 +136,7 @@  conv_endian (unsigned int tvalue)
   unsigned int hvalue;
   unsigned int t1, t2, t3, t4;
 
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       t1 = tvalue & 0xff000000;
       t2 = tvalue & 0x00ff0000;
@@ -160,7 +160,7 @@  conv_endian16 (unsigned short tvalue)
   unsigned short hvalue;
   unsigned short t1, t2;
 
-  if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+  if (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       t1 = tvalue & 0xff00;
       t2 = tvalue & 0x00ff;
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 1df6810..fb9c4bc 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac: Change LITTLE_ENDIAN to BIG_ENDIAN.
diff --git a/sim/m68hc11/configure b/sim/m68hc11/configure
index 3a277d1..df2d872 100755
diff --git a/sim/m68hc11/configure.ac b/sim/m68hc11/configure.ac
index cbfe9e8..aafbb31 100644
--- a/sim/m68hc11/configure.ac
+++ b/sim/m68hc11/configure.ac
@@ -7,7 +7,7 @@  SIM_AC_COMMON
 
 dnl Options available in this module
 SIM_AC_OPTION_INLINE()
-SIM_AC_OPTION_ENDIAN(BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_WARNINGS
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog
index fb80f2c..ce99714 100644
--- a/sim/mcore/ChangeLog
+++ b/sim/mcore/ChangeLog
@@ -1,3 +1,7 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure: Regenerate.
+
 2015-12-27  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-hload.o.
diff --git a/sim/mcore/configure b/sim/mcore/configure
index d46ffcb..3fd5d8c 100755
diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index 9346778..3c21d5e 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,3 +1,7 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure: Regenerate.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* wrapper.c (sim_store_register): Rename to ...
diff --git a/sim/microblaze/configure b/sim/microblaze/configure
index d46ffcb..3fd5d8c 100755
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index a77058e..ba0a50b 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,5 +1,12 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* configure.ac (mips_endian): Change LITTLE_ENDIAN to LITTLE.
+	(default_endian): Likewise.  Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+	* sim-main.h (BigEndianMem): Change BIG_ENDIAN to BFD_ENDIAN_BIG.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* dv-tx3904cpu.c (CPU, SD): Delete.
 
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/mips/configure b/sim/mips/configure
index 6f1d136..c31d65e 100755
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index 7f04473..91e7b0c 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -37,14 +37,14 @@  AC_SUBST(SIM_SUBTARGET)
 mips_endian=
 default_endian=
 case "${target}" in
-  mips64el*-*-*)	mips_endian=LITTLE_ENDIAN ;;
-  mips64vr*el-*-*)      default_endian=LITTLE_ENDIAN ;;
-  mips64*-*-*)          default_endian=BIG_ENDIAN ;;
-  mips16*-*-*)          default_endian=BIG_ENDIAN ;;
-  mipsisa32*-*-*)       default_endian=BIG_ENDIAN ;;
-  mipsisa64*-*-*)       default_endian=BIG_ENDIAN ;;
-  mips*-*-*)            default_endian=BIG_ENDIAN ;;
-  *)                    default_endian=BIG_ENDIAN ;;
+  mips64el*-*-*)        mips_endian=LITTLE ;;
+  mips64vr*el-*-*)      default_endian=LITTLE ;;
+  mips64*-*-*)          default_endian=BIG ;;
+  mips16*-*-*)          default_endian=BIG ;;
+  mipsisa32*-*-*)       default_endian=BIG ;;
+  mipsisa64*-*-*)       default_endian=BIG ;;
+  mips*-*-*)            default_endian=BIG ;;
+  *)                    default_endian=BIG ;;
 esac
 SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
 
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index b7e3072..0ea1234 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -592,7 +592,7 @@  struct sim_state {
 /* Hardware configuration. Affects endianness of LoadMemory and
    StoreMemory and the endianness of Kernel and Supervisor mode
    execution. The value is 0 for little-endian; 1 for big-endian. */
-#define BigEndianMem    (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+#define BigEndianMem    (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
 /*(state & simBE) ? 1 : 0)*/
 
 /* ReverseEndian */
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index d59a7e8..1d05f8d 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* wrapper.c (mn10300_reg_store, mn10300_reg_fetch): Define.
diff --git a/sim/mn10300/configure b/sim/mn10300/configure
index 6e4246e..1fac8bf 100755
diff --git a/sim/mn10300/configure.ac b/sim/mn10300/configure.ac
index 037d405..7d3c223 100644
--- a/sim/mn10300/configure.ac
+++ b/sim/mn10300/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_WARNINGS
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog
index 439b69c..718e804 100644
--- a/sim/moxie/ChangeLog
+++ b/sim/moxie/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* wrapper.c (sim_store_register): Rename to ...
diff --git a/sim/moxie/configure b/sim/moxie/configure
index 3232de3..6990a8f 100755
diff --git a/sim/moxie/configure.ac b/sim/moxie/configure.ac
index 34b80ce..a7f2b82 100644
--- a/sim/moxie/configure.ac
+++ b/sim/moxie/configure.ac
@@ -7,7 +7,7 @@  SIM_AC_COMMON
 
 AC_CHECK_TOOL(DTC, dtc)
 
-SIM_AC_OPTION_ENDIAN(BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_ENVIRONMENT
diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog
index dd9aad0..db8269e 100644
--- a/sim/msp430/ChangeLog
+++ b/sim/msp430/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
 2015-12-27  Mike Frysinger  <vapier@gentoo.org>
 
 	* msp430-sim.c (sim_dis_read): Change private_data to application_data.
diff --git a/sim/msp430/configure b/sim/msp430/configure
index 796741b..229096a 100755
diff --git a/sim/msp430/configure.ac b/sim/msp430/configure.ac
index f24480e..b896ce4 100644
--- a/sim/msp430/configure.ac
+++ b/sim/msp430/configure.ac
@@ -26,7 +26,7 @@  SIM_AC_COMMON
 
 AC_CHECK_HEADERS(getopt.h)
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_INLINE
 SIM_AC_OPTION_WARNINGS
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 0a0bb56..56e9f10 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,10 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure: Regenerate.
+	* interp.c (target_little_endian): Change LITTLE_ENDIAN to
+	BFD_ENDIAN_LITTLE.
+	(host_little_endian): Likewise.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* wrapper.c (sim_store_register): Rename to ...
diff --git a/sim/sh/configure b/sim/sh/configure
index d46ffcb..3fd5d8c 100755
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 3abeda6..f7c4948 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -116,10 +116,10 @@  struct loop_bounds { unsigned char *start, *end; };
 /* These variables are at file scope so that functions other than
    sim_resume can use the fetch/store macros */
 
-#define target_little_endian (CURRENT_TARGET_BYTE_ORDER == LITTLE_ENDIAN)
+#define target_little_endian (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
 static int global_endianw, endianb;
 static int target_dsp;
-#define host_little_endian (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+#define host_little_endian (CURRENT_HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE)
 
 static int maskw = 0;
 static int maskl = 0;
diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog
index 74f89bc..18a1d8a 100644
--- a/sim/sh64/ChangeLog
+++ b/sim/sh64/ChangeLog
@@ -1,5 +1,11 @@ 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
 
+	* arch.h (TARGET_BIG_ENDIAN): Delete.
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change BIG_ENDIAN to BIG.
+	* configure: Regenerate.
+
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-if.c (sim_open): Delete #if 0 sim_add_option_table call.
 
 2016-01-02  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/sh64/arch.h b/sim/sh64/arch.h
index 88cd037..aaa3991 100644
--- a/sim/sh64/arch.h
+++ b/sim/sh64/arch.h
@@ -24,8 +24,6 @@  This file is part of the GNU simulators.
 #ifndef SH_ARCH_H
 #define SH_ARCH_H
 
-#define TARGET_BIG_ENDIAN 1
-
 /* Enum declaration for model types.  */
 typedef enum model_type {
   MODEL_SH2A_NOFPU, MODEL_SH2A_FPU, MODEL_SH4_NOFPU, MODEL_SH4
diff --git a/sim/sh64/configure b/sim/sh64/configure
index 6310f42..7c3b424 100755
diff --git a/sim/sh64/configure.ac b/sim/sh64/configure.ac
index c979458..4da1756 100644
--- a/sim/sh64/configure.ac
+++ b/sim/sh64/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN([], BIG_ENDIAN)
+SIM_AC_OPTION_ENDIAN([], BIG)
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_SCACHE(16384)
diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog
index f790420..63ec3ed 100644
--- a/sim/testsuite/ChangeLog
+++ b/sim/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* common/bits-gen.c (main): Change BIG_ENDIAN to BFD_ENDIAN_BIG and
+	LITTLE_ENDIAN and BFD_ENDIAN_LITTLE.
+
 2015-11-24  Nick Clifton  <nickc@redhat.com>
 
 	* configure: Regenerate.
diff --git a/sim/testsuite/common/bits-gen.c b/sim/testsuite/common/bits-gen.c
index 84e4372..6e7dd75 100644
--- a/sim/testsuite/common/bits-gen.c
+++ b/sim/testsuite/common/bits-gen.c
@@ -233,7 +233,7 @@  main (int argc, char *argv[])
   printf ("#define WITH_TARGET_WORD_BITSIZE %d\n", bitsize);
   printf ("#define WITH_TARGET_WORD_MSB %d\n", msb);
   printf ("#define WITH_HOST_WORD_BITSIZE %d\n", sizeof (int) * 8);
-  printf ("#define WITH_TARGET_BYTE_ORDER %s\n", big_endian ? "BIG_ENDIAN" : "LITTLE_ENDIAN");
+  printf ("#define WITH_TARGET_BYTE_ORDER %s\n", big_endian ? "BFD_ENDIAN_BIG" : "BFD_ENDIAN_LITTLE");
   printf ("\n");
   printf ("#define SIM_BITS_INLINE (ALL_H_INLINE)\n");
   printf ("\n");
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index 2b66488..d21492b 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-01-02  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_ENDIAN): Change LITTLE_ENDIAN to
+	LITTLE.
+	* configure: Regenerate.
+
 2015-12-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* wrapper.c (v850_reg_store, v850_reg_fetch): Define.
diff --git a/sim/v850/configure b/sim/v850/configure
index 97113c3..c1e449a 100755
diff --git a/sim/v850/configure.ac b/sim/v850/configure.ac
index 1471eeb..0ac54e0 100644
--- a/sim/v850/configure.ac
+++ b/sim/v850/configure.ac
@@ -5,7 +5,7 @@  sinclude(../common/acinclude.m4)
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(,NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
 SIM_AC_OPTION_WARNINGS