2024-01-12 23:30:44 +08:00
|
|
|
dnl Copyright (C) 1997-2024 Free Software Foundation, Inc.
|
2021-02-07 11:51:30 +08:00
|
|
|
dnl
|
|
|
|
dnl This program is free software; you can redistribute it and/or modify
|
|
|
|
dnl it under the terms of the GNU General Public License as published by
|
|
|
|
dnl the Free Software Foundation; either version 3 of the License, or
|
|
|
|
dnl (at your option) any later version.
|
|
|
|
dnl
|
|
|
|
dnl This program is distributed in the hope that it will be useful,
|
|
|
|
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
dnl GNU General Public License for more details.
|
|
|
|
dnl
|
|
|
|
dnl You should have received a copy of the GNU General Public License
|
|
|
|
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
dnl
|
|
|
|
dnl --enable-sim-endian={yes,no,big,little} is for simulators
|
|
|
|
dnl that support both big and little endian targets.
|
|
|
|
AC_DEFUN([SIM_AC_OPTION_ENDIAN],
|
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.
2021-06-16 07:51:52 +08:00
|
|
|
[dnl
|
|
|
|
AC_MSG_CHECKING([whether to force sim endianness])
|
|
|
|
sim_endian=
|
2021-02-07 11:51:30 +08:00
|
|
|
AC_ARG_ENABLE(sim-endian,
|
|
|
|
[AS_HELP_STRING([--enable-sim-endian=endian],
|
|
|
|
[Specify target byte endian orientation])],
|
|
|
|
[case "${enableval}" in
|
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.
2021-06-16 07:51:52 +08:00
|
|
|
b*|B*) sim_endian="BFD_ENDIAN_BIG";;
|
|
|
|
l*|L*) sim_endian="BFD_ENDIAN_LITTLE";;
|
|
|
|
yes | no) ;;
|
|
|
|
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian");;
|
|
|
|
esac])dnl
|
|
|
|
AC_DEFINE_UNQUOTED([WITH_TARGET_BYTE_ORDER],
|
|
|
|
[${sim_endian:-BFD_ENDIAN_UNKNOWN}], [Sim endian settings])
|
|
|
|
AC_MSG_RESULT([${sim_alignment:-no}])
|
|
|
|
])dnl
|