forked from Imagelibrary/binutils-gdb
Currently, the sim-config module will abort if alignment settings
haven't been specified by the port's configure.ac. This is a bit
weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's
optional to use. Thus everyone invokes it.
There are 4 alignment settings, but really only 2 matters: strict
and nonstrict. The "mixed" setting is just the default ("unset"),
and "forced" isn't used directly by anyone (it's available as a
runtime option for some ports).
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, then the
build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't
called). If default settings are provided, then that is used, but
we allow the user to override at runtime. Otherwise, the "wire"
settings are used and user runtime options to change are ignored.
Most ports specify a default, or set the "wire" to nonstrict. A
few set "wire" to strict, but it's not clear that's necessary as
it doesn't make the code behavior, by default, any different. It
might make things a little faster, but we should provide the user
the choice of the compromises to make: force a specific mode at
compile time for faster runtime, or allow the choice at runtime.
More likely it seems like an oversight when these ports were
initially created, and/or copied & pasted from existing ports.
With all that backstory, let's get to what this commit does.
First kill off the idea of a compile-time default alignment and
set it to nonstrict in the common code. For any ports that want
strict alignment by default, that code is moved to sim_open while
initializing the sim. That means WITH_DEFAULT_ALIGNMENT can be
completely removed.
Moving the default alignment to the runtime also allows removal
of setting the "wire" settings at configure time. Which allows
removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving
that call to common code.
The macro logic can be reworked to not pass WITH_ALIGNMENT as -D
CPPFLAG and instead move it to config.h.
All of these taken together mean we can hoist the macro up to the
top level and share it among all sims so behavior is consistent
among all the ports.
121 lines
3.9 KiB
Plaintext
121 lines
3.9 KiB
Plaintext
dnl Process this file with autoconf to produce a configure script.
|
|
dnl NB: The version here is not used. If gdb ever changes from generating its
|
|
dnl version at build time to autoconf time (like bfd et al do), we can switch.
|
|
AC_INIT([sim], [0],
|
|
[https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
|
|
[], [https://sourceware.org/gdb/wiki/Sim/])
|
|
|
|
dnl Probably should unify PKGVERSION with PACKAGE_* settings from AC_INIT.
|
|
ACX_PKGVERSION([SIM])
|
|
AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
|
|
dnl PACKAGE_BUGREPORT is provided by AC_INIT.
|
|
ACX_BUGURL([$PACKAGE_BUGREPORT])
|
|
AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
|
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
SIM_AC_TOOLCHAIN
|
|
SIM_AC_PLATFORM
|
|
|
|
AM_MAINTAINER_MODE
|
|
AM_INIT_AUTOMAKE
|
|
|
|
# If a cpu ever has more than one simulator to choose from, use
|
|
# --enable-sim=... to choose.
|
|
AC_ARG_ENABLE(sim,
|
|
[AS_HELP_STRING([--enable-sim], [Enable the GNU simulator])],
|
|
[case "${enableval}" in
|
|
yes | no) ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
|
|
esac])
|
|
|
|
AC_ARG_ENABLE([example-sims],
|
|
[AC_HELP_STRING([--enable-example-sims],
|
|
[enable example GNU simulators])])
|
|
|
|
AC_ARG_ENABLE(targets,
|
|
[ --enable-targets alternative target configurations],
|
|
[case "${enableval}" in
|
|
yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
|
|
;;
|
|
no) enable_targets= ;;
|
|
*) enable_targets=$enableval ;;
|
|
esac])
|
|
|
|
dnl Used to keep track of which target (if any) is the default one. This is
|
|
dnl used when installing files to see if they need to be suffixed.
|
|
SIM_PRIMARY_TARGET=
|
|
AC_SUBST(SIM_PRIMARY_TARGET)
|
|
|
|
m4_define([SIM_TARGET], [
|
|
case "${targ}" in
|
|
all|$1)
|
|
if test "${targ}" = "${target}"; then
|
|
SIM_PRIMARY_TARGET=$2
|
|
fi
|
|
AC_CONFIG_SUBDIRS($2)
|
|
$3
|
|
;;
|
|
esac
|
|
])
|
|
|
|
dnl WHEN ADDING ENTRIES TO THIS MATRIX:
|
|
dnl Make sure that the left side always has two dashes. Otherwise you can get
|
|
dnl spurious matches. Even for unambiguous cases, do this as a convention, else
|
|
dnl the table becomes a real mess to understand and maintain.
|
|
if test "${enable_sim}" != no; then
|
|
sim_igen=no
|
|
for targ in `echo $target $enable_targets | sed 's/,/ /g'`
|
|
do
|
|
SIM_TARGET([aarch64*-*-*], [aarch64])
|
|
SIM_TARGET([arm*-*-*], [arm])
|
|
SIM_TARGET([avr*-*-*], [avr])
|
|
SIM_TARGET([bfin-*-*], [bfin])
|
|
SIM_TARGET([bpf-*-*], [bpf])
|
|
SIM_TARGET([cr16*-*-*], [cr16])
|
|
SIM_TARGET([cris-*-* | crisv32-*-*], [cris])
|
|
SIM_TARGET([d10v-*-*], [d10v])
|
|
SIM_TARGET([frv-*-*], [frv])
|
|
SIM_TARGET([h8300*-*-*], [h8300])
|
|
SIM_TARGET([iq2000-*-*], [iq2000])
|
|
SIM_TARGET([lm32-*-*], [lm32])
|
|
SIM_TARGET([m32c-*-*], [m32c])
|
|
SIM_TARGET([m32r-*-*], [m32r])
|
|
SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
|
|
SIM_TARGET([mcore-*-*], [mcore])
|
|
SIM_TARGET([microblaze-*-*], [microblaze])
|
|
SIM_TARGET([mips*-*-*], [mips], [sim_igen=yes])
|
|
SIM_TARGET([mn10300*-*-*], [mn10300], [sim_igen=yes])
|
|
SIM_TARGET([moxie-*-*], [moxie])
|
|
SIM_TARGET([msp430*-*-*], [msp430])
|
|
SIM_TARGET([or1k-*-* | or1knd-*-*], [or1k])
|
|
SIM_TARGET([pru*-*-*], [pru])
|
|
SIM_TARGET([riscv*-*-*], [riscv])
|
|
SIM_TARGET([rl78-*-*], [rl78])
|
|
SIM_TARGET([rx-*-*], [rx])
|
|
SIM_TARGET([sh*-*-*], [sh])
|
|
SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32])
|
|
SIM_TARGET([powerpc*-*-*], [ppc])
|
|
SIM_TARGET([ft32-*-*], [ft32])
|
|
SIM_TARGET([v850*-*-*], [v850], [sim_igen=yes])
|
|
done
|
|
|
|
if test "x${enable_example_sims}" = xyes; then
|
|
AC_CONFIG_SUBDIRS(example-synacor)
|
|
fi
|
|
fi
|
|
AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
|
|
|
|
dnl Standard (and optional) simulator options.
|
|
dnl Eventually all simulators will support these.
|
|
SIM_AC_OPTION_ALIGNMENT
|
|
SIM_AC_OPTION_ASSERT
|
|
SIM_AC_OPTION_DEBUG
|
|
SIM_AC_OPTION_ENVIRONMENT
|
|
SIM_AC_OPTION_PROFILE
|
|
SIM_AC_OPTION_STDIO
|
|
SIM_AC_OPTION_TRACE
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
AC_OUTPUT
|