sim: overhaul & unify endian settings management

The m4 macro has 2 args: the "wire" settings (which represents the
hardwired port behavior), and the default settings (which are used
if nothing else is specified).  If none are specified, the arch is
expected to support both, and the value will be probed based on the
user runtime options or the input program.

Only two arches today set the default value (bpf & mips).  We can
probably let this go as it only shows up in one scenario: the sim
is invoked, but with no inputs, and no user endian selection.  This
means bpf will not behave like the other arches: an error is shown
and forces the user to make a choice.  If an input program is used
though, we'll still switch the default to that.  This allows us to
remove the WITH_DEFAULT_TARGET_BYTE_ORDER setting.

For the ports that set a "wire" endian, move it to the runtime init
of the respective sim_open calls.  This allows us to change the
WITH_TARGET_BYTE_ORDER to purely a user-selected configure setting
if they want to force a specific endianness.

With all the endian logic moved to runtime selection, we can move
the configure call up to the common dir so we only process it once
across all ports.

The ppc arch was picking the wire endian based on the target used,
but since we weren't doing that for other biendian arches, we can
let this go too.  We'll rely on the input selecting the endian, or
make the user decide.
This commit is contained in:
Mike Frysinger
2021-06-15 19:51:52 -04:00
parent 4470708442
commit f9a4d54332
151 changed files with 348 additions and 1721 deletions

View File

@ -1,3 +1,8 @@
2021-06-17 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Delete SIM_AC_OPTION_ENDIAN call.
* aclocal.m4, configure: Regenerate.
2021-06-16 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

1
sim/arm/aclocal.m4 vendored
View File

@ -110,7 +110,6 @@ m4_include([../../ltsugar.m4])
m4_include([../../ltversion.m4])
m4_include([../../lt~obsolete.m4])
m4_include([../m4/sim_ac_common.m4])
m4_include([../m4/sim_ac_option_endian.m4])
m4_include([../m4/sim_ac_option_hardware.m4])
m4_include([../m4/sim_ac_option_inline.m4])
m4_include([../m4/sim_ac_option_warnings.m4])

59
sim/arm/configure vendored
View File

@ -636,7 +636,6 @@ sim_default_model
sim_scache
sim_float
sim_bitsize
sim_alignment
cgen_breaks
MAINT
MAINTAINER_MODE_FALSE
@ -753,8 +752,7 @@ WARN_CFLAGS
sim_inline
sim_hw
sim_hw_objs
sim_hw_cflags
sim_endian'
sim_hw_cflags'
ac_subst_files=''
ac_user_opts='
enable_option_checking
@ -768,7 +766,6 @@ with_gnu_ld
enable_libtool_lock
enable_maintainer_mode
enable_sim_inline
enable_sim_endian
enable_werror
enable_build_warnings
enable_sim_build_warnings
@ -1411,8 +1408,6 @@ Optional Features:
sometimes confusing) to the casual installer
--enable-sim-inline=inlines
Specify which functions should be inlined
--enable-sim-endian=endian
Specify target byte endian orientation
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings if gcc is used
--enable-sim-build-warnings
@ -10742,7 +10737,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10745 "configure"
#line 10740 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -10848,7 +10843,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10851 "configure"
#line 10846 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11144,52 +11139,6 @@ fi
wire_endian=""
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=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=BFD_ENDIAN_${wire_endian}"
else
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=BFD_ENDIAN_UNKNOWN"
fi
fi;;
no) if test x"$default_endian" != x; then
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=BFD_ENDIAN_${wire_endian}"
else
echo "No default endian for target $target" 1>&6
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="";;
esac
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
echo "Setting endian flags = $sim_endian" 6>&1
fi
else
if test x"$default_endian" != x; then
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=BFD_ENDIAN_${wire_endian}"
else
sim_endian=
fi
fi
fi
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@ -11412,8 +11361,6 @@ ac_config_commands="$ac_config_commands stamp-h"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure

View File

@ -4,6 +4,4 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
SIM_AC_COMMON
SIM_AC_OPTION_ENDIAN
SIM_AC_OUTPUT