Commit Graph

4234 Commits

Author SHA1 Message Date
Mike Frysinger
7b2298cbd8 sim: mips: fix uninitialized register use
In the default case, this code will read from this variable before
it is initialized as a dummy access.  Set it to 0 to fix the compiler
warning.
2021-06-16 01:51:32 -04:00
Mike Frysinger
a8a3d90792 sim: drop obsolete AC_EXEEXT call
The current autoconf 2.69 defines this to nothing because the logic
in AC_PROG_CC takes care of it all the time now.  Delete the call.
2021-06-16 01:29:41 -04:00
Mike Frysinger
46f0c0c6cc sim: ppc: use common sim-assert setting
The common sim code already sets this up for us, so no need to
duplicate the logic.
2021-06-16 01:24:20 -04:00
Mike Frysinger
956f0babcd sim: ppc: 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.

This was done for all the other ports years ago, so catch ppc up.
2021-06-16 01:22:50 -04:00
Mike Frysinger
1b828ebe53 sim: ppc: replace local __attribute__ fallback
The common ansidecl.h provides fallbacks for these so we don't need to.
2021-06-16 01:14:53 -04:00
Mike Frysinger
69ff2dac7a sim: ppc: use common ATTRIBUTE_PRINTF macros
Use the common ansidecl.h macros to replace our ad-hoc printf attributes.
2021-06-16 01:14:05 -04:00
Mike Frysinger
3547f99a30 sim: ppc: use common ATTRIBUTE_PACKED macro
Drop local packed attribute with the common ansidecl.h define.
2021-06-16 01:11:08 -04:00
Mike Frysinger
6e57d02532 sim: ppc: replace local NORETURN macros with common one
Drop local NORETURN macro with the common ansidecl.h ATTRIBUTE_NORETURN define.
2021-06-16 01:10:11 -04:00
Mike Frysinger
f6428ce423 sim: ppc: replace local UNUSED macros with common one
Drop local UNUSED macro with the common ansidecl.h ATTRIBUTE_UNUSED define.
2021-06-16 01:08:43 -04:00
Mike Frysinger
b778e6b079 sim: ppc: replace local CONCAT macros with common ones
Drop local copies of CONCAT macros that the common ansidecl.h provides.
2021-06-16 01:06:28 -04:00
Mike Frysinger
5976569641 sim: ppc: change bool variable name to boolean
This is a reserved type with stdbool.h.
2021-06-16 01:05:10 -04:00
Mike Frysinger
430456e347 sim: ppc: drop host endian configure option
The --enable-sim-hostendian flag was purely so people had an escape route
for when cross-compiling.  This is because historically, AC_C_BIGENDIAN
did not work in those cases.  That was fixed a while ago though, so we can
require that macro everywhere now and simplify a good bit of code.

This was done for all the other ports years ago, so catch ppc up.
2021-06-16 01:03:54 -04:00
Mike Frysinger
dae666c968 sim: mips: fix format warnings when setting up memory
The majority of these inputs are not long's, so don't use %lx.
This fixes compiler warnings about type mismatches.
2021-06-16 00:50:56 -04:00
Mike Frysinger
52d37d2c91 sim: drop arch-specific config.h
All of the settings in here are handled by the common top-level
config.h, so drop the individual arch-config.h files entirely.

This will also help guarantee that we don't add any new arch
specific defines that would affect common code which will help
with the effort of unifying them.
2021-06-16 00:22:53 -04:00
Mike Frysinger
bcaa61f7c8 sim: move dv-sockser define to CPPFLAGS
This is the only define left in m4/ that is not in the common config.h,
so move it to sim_hw_cflags so we can drop the arch-specific config.h.
2021-06-15 23:27:14 -04:00
Mike Frysinger
015f7b7462 sim: switch modules.c & version.c to stamp files
This fixes remaking of these files and avoids unnecessary rebuilds.

Also add both to `make clean` to match other stamp files.
2021-06-15 17:06:46 -04:00
Mike Frysinger
79afa8caab sim: mn10300: enable -Werror
Now that all warnings are fixed in this port, enable -Werror by default.
2021-06-14 23:47:01 -04:00
Mike Frysinger
aa077c0d18 sim: mn10300: switch abort to sim_engine_abort
This allows the caller to catch engine aborts if they want, and fixes
the warning about missing stdlib.h include by not using abort().
2021-06-14 23:46:41 -04:00
Mike Frysinger
757b3c2fea sim: erc32: fix build w/out F_{G,S}ETFL
Add conditional logic around fcntl.h F_{G,S}ETFL usage to fix builds
on systems that don't have it (e.g. Windows).  The code is only used
to save & restore limited terminal stdin state.
2021-06-14 23:30:17 -04:00
Mike Frysinger
4df5cdbd3a sim: erc32: fix build w/out termios.h
Add conditional logic around termios.h usage to fix builds on systems
that don't have it (e.g. Windows).
2021-06-14 23:29:11 -04:00
Mike Frysinger
82e6d6bf90 sim: drop redundant SIM_AC_OPTION_WARNINGS
The common code already calls this, so no need to do so in arch dirs.
We leave the calls that disable -Werror.  This will help unify the
configure scripts.
2021-06-14 23:19:52 -04:00
Mike Frysinger
fbe8d1cf5b sim: enable silent rules in common builds
We only do the common code as automake simplifies the logic.
2021-06-14 20:04:44 -04:00
Mike Frysinger
483ab96a1b gnulib: define the path to gnulib's parent dir
The current setting assumes that gnulib is only used by dirs
immediately under the source root.  Trying to build it two or
more levels deep fails.  Switch GNULIB_BUILDDIR to a relative
GNULIB_PARENT_DIR so that it can be used to construct both the
build & source paths.
2021-06-14 18:01:20 -04:00
Mike Frysinger
92a3f61363 sim: ppc: use common version.o too
The common version.o we're building can be used for the ppc subdir,
so switch it over too.
2021-06-13 23:04:22 -04:00
Mike Frysinger
0f318b8478 sim: rx: move cycle-accurate settings to CPPFLAGS
This is the last unique setting that rx has in its config.h, so by
moving this to CPPFLAGS, we can drop its config.h entirely.
2021-06-13 20:33:35 -04:00
Mike Frysinger
ad9cc20970 sim: start unifying portability shims
There are some functions that gnulib does not yet provide fallbacks
for, so start a common file of our own for holding existing stubs.
2021-06-12 23:51:35 -04:00
Mike Frysinger
dd8e16ea7b sim: unify sim-load.o building
Since this file does not rely on any port-specific settings, move it
up to building as part of the common step so we only do it once in a
multibuild.
2021-06-12 23:49:41 -04:00
Mike Frysinger
a687671327 sim: rx: replace cycle-stats with common profile settings
The common sim-profile option controls whether to keep track of
runtime execution (like cycle count), so switch the rx-specific
cycle-stats option over to that.
2021-06-12 22:29:26 -04:00
Mike Frysinger
2726bbc339 sim: assume sys/select.h always exists
Now that gnulib provides this, assume it exists.
2021-06-12 22:19:30 -04:00
Mike Frysinger
a80249d0a9 sim: erc32: replace caddr_t with void*
This BSDism was never accepted into standards, so replace it with the
portable void* type instead.
2021-06-12 21:58:17 -04:00
Mike Frysinger
4218a6dc8b sim: erc32/ppc: fix handling of $EXEEXT 2021-06-12 21:35:23 -04:00
Mike Frysinger
ba307cddcf sim: overhaul alignment settings management
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.
2021-06-12 21:14:50 -04:00
Mike Frysinger
6dd65fc048 sim: unify bug & package settings
Move these options up to the common dir so we only test & export
them once across all ports.  The AC_INIT macro does a lot of the
heavy lifting already which allows further simplification.
2021-06-12 20:24:08 -04:00
Mike Frysinger
04381273a9 sim: unify debug/stdio/trace/profile build settings
Move these options up to the common dir so we only test & export
them once across all ports.

The ppc code needs a little extra care with its trace settings as
it's not exactly the same API as the common code.  The other knobs
are the same though.
2021-06-12 20:07:57 -04:00
Mike Frysinger
497a20bd3b sim: split debug/stdio/trace/profile options into dedicated m4 files
This follows existing organizational structure with one configure option
per m4 file, and will make it easier to move to the common configure dir.
2021-06-12 20:07:57 -04:00
Mike Frysinger
a48ff3efda sim: ppc: unify header & function & type tests too
Since ppc now shares a config.h with the top-level, move all of its
relevant settings up a level.  The ppc port tests a lot more funcs,
but that's because its syscall emulation is a lot more complete.
We'll probably utilize some of these in the common code too.
2021-06-12 14:39:44 -04:00
Mike Frysinger
5629cf2b98 sim: ppc: unify env settings too
The ppc port doesn't share a lot of the common logic, but there are
a few bits that bleed across.  Have it use the common configure for
environment settings too to avoid duplicate define errors after the
recent unification with the other ports.
2021-06-12 12:58:54 -04:00
Mike Frysinger
5ea4547402 sim: unify environment build settings
Move the --sim-enable-environment option up to the common dir so we
only test & export it once across all ports.
2021-06-12 11:01:57 -04:00
Mike Frysinger
dba333c1e4 sim: unify assert build settings
Move the --sim-enable-assert option up to the common dir so we only
test & export it once across all ports.
2021-06-12 10:58:22 -04:00
Mike Frysinger
b15c5d7a51 sim: unify platform function & header tests
Move the various platform tests up a level to avoid duplication
across the ports.  When building multiple versions, this speeds
things up a bit.

For now we move the obvious stuff up a level, but we don't turn
own the config.h entirely just yet -- we still have some tests
related to libraries that need consideration.
2021-06-12 10:45:36 -04:00
Mike Frysinger
943f9baa37 sim: cleanup obsolete NULL fallback
We require C11 which defines NULL, so drop the inconsistent set of
fallback defines in the codebase.
2021-06-09 19:07:09 -04:00
Mike Frysinger
dc3de083d5 sim: mn10300: tweak engine halt hook
The hook is a void func, so defining it to 0 triggers warnings,
and isn't really needed.
2021-06-09 19:06:20 -04:00
Mike Frysinger
cfc6061bd8 sim: nrun: tweak init of callback endian
Allow ports to initialize the callback endian if they want.  This will
allow delegation of the logic out of common code in the future.

Also switch from the CURRENT_TARGET_BYTE_ORDER macro to the underlying
current_target_byte_order storage since the latter has been setup by
the sim-config module based on the same macros.  This will allow the
nrun module to be moved to common building for sharing.
2021-06-09 18:24:59 -04:00
Mike Frysinger
eee649922f sim: bpf: use CURRENT_TARGET_BYTE_ORDER
Code should be going through this macro rather than accessing the
underlying value directly.
2021-06-09 18:23:48 -04:00
Mike Frysinger
906192d785 sim: cgen: inline cgen_init logic
This function has done only one thing: post-process command line
settings to see if profiling or tracing has been enabled, and if
so, set the run_fast_p flag in the simulator state.  That flag is
only used in one place: to select the fast or slow cgen engine.
By inlining the run_fast_p logic to the one place it's used, we
can delete a good amount of logic specific to cgen ports: both
the call to cgen_init and the conditional simulator state.  This
in turn allows us to have a single simulator state struct across
all ports so we can share objects more between them, and makes
the sim_open calls look more consistent.
2021-06-09 18:21:28 -04:00
Mike Frysinger
a55b92be28 sim: igen: harmonize tool variables
Separate the name of the igen program from the options used to run it.
This allows us to avoid duplicating ../igen/igen in Makefiles and reuse
the existing setting in the common Makefile.  This also allows us to
easily harmonize the use of EXEEXT between igen/local.mk and the common
makefiles when cross-compiling for e.g. Windows.
2021-06-08 00:57:58 -04:00
Mike Frysinger
c469a50252 sim: v850: assume chown is available
Now that gnulib provides a wrapper, assume it always exists.
2021-06-08 00:15:56 -04:00
Mike Frysinger
5bea0c3276 sim: common: start dedicated local.mk
This provides a space to generate things that we only need to build
once per-arch.  Some day that will be all of common/, but for now,
we move the version.c management in.
2021-06-05 10:09:27 -04:00
John Baldwin
ea6197bf5f sim m32c: Include defs.h in m32c.opc and r8c.opc.
gnulib can override stdio.h and/or stdlib.h in which case the gnulib
headers require config.h to be included first.

gdb/sim/m32c/ChangeLog:

	* m32c.opc: Include defs.h.
	* r8c.opc: Likewise.
2021-06-02 08:48:09 -07:00
Mike Frysinger
c5b349e1c5 sim: ppc: enable -Wno-format for mingw targets
This mirrors what we do for other builds already.
2021-05-29 18:09:02 -04:00