From 1ac72f0659d64d6a14da862242db0d841d2878d0 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 2 Jan 2016 17:46:16 -0500 Subject: sim: convert to bfd_endian 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/frv/ChangeLog | 9 +++++++++ sim/frv/arch.h | 2 -- sim/frv/configure | 36 ++++++++++++++++++------------------ sim/frv/configure.ac | 2 +- sim/frv/frv.c | 4 ++-- 5 files changed, 30 insertions(+), 23 deletions(-) (limited to 'sim/frv') diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog index a566ba05b1b..dd28834d8ef 100644 --- a/sim/frv/ChangeLog +++ b/sim/frv/ChangeLog @@ -1,3 +1,12 @@ +2016-01-02 Mike Frysinger + + * 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 * reset.c (frv_term): Change current_state to sd. diff --git a/sim/frv/arch.h b/sim/frv/arch.h index 06abe868c64..18d09407771 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 ca3363c6a13..40b8bdfd105 100755 --- a/sim/frv/configure +++ b/sim/frv/configure @@ -12918,31 +12918,31 @@ sim_link_links="${sim_link_links} targ-vals.def" -wire_endian="BIG_ENDIAN" +wire_endian="BIG" default_endian="" # Check whether --enable-sim-endian was given. if test "${enable_sim_endian+set}" = set; then : enableval=$enable_sim_endian; 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;; *) as_fn_error "\"Unknown value $enableval for --enable-sim-endian\"" "$LINENO" 5; sim_endian="";; @@ -12952,10 +12952,10 @@ if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then fi else 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 @@ -13012,9 +13012,9 @@ fi # Check whether --enable-sim-hostendian was given. if test "${enable_sim_hostendian+set}" = set; then : enableval=$enable_sim_hostendian; 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";; *) as_fn_error "\"Unknown value $enableval for --enable-sim-hostendian\"" "$LINENO" 5; sim_hostendian="";; esac if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then @@ -13248,12 +13248,12 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h esac 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 fi diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac index ebaf6ab3b60..ad73eedd556 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 2b78edb2966..594931fadfd 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]); -- cgit v1.2.3-65-gdbad