aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2021-06-15sim: switch modules.c & version.c to stamp filesMike Frysinger5-7/+26
This fixes remaking of these files and avoids unnecessary rebuilds. Also add both to `make clean` to match other stamp files.
2021-06-14sim: mn10300: enable -WerrorMike Frysinger3-106/+113
Now that all warnings are fixed in this port, enable -Werror by default.
2021-06-14sim: mn10300: switch abort to sim_engine_abortMike Frysinger2-1/+5
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-14sim: erc32: fix build w/out F_{G,S}ETFLMike Frysinger3-2/+13
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-14sim: erc32: fix build w/out termios.hMike Frysinger2-0/+20
Add conditional logic around termios.h usage to fix builds on systems that don't have it (e.g. Windows).
2021-06-14sim: drop redundant SIM_AC_OPTION_WARNINGSMike Frysinger27-214/+250
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-14sim: enable silent rules in common buildsMike Frysinger8-30/+84
We only do the common code as automake simplifies the logic.
2021-06-14gnulib: define the path to gnulib's parent dirMike Frysinger2-2/+7
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-13sim: ppc: use common version.o tooMike Frysinger2-7/+10
The common version.o we're building can be used for the ppc subdir, so switch it over too.
2021-06-13sim: rx: move cycle-accurate settings to CPPFLAGSMike Frysinger5-10/+15
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-12sim: start unifying portability shimsMike Frysinger12-19/+157
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-12sim: unify sim-load.o buildingMike Frysinger6-5/+74
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-12sim: rx: replace cycle-stats with common profile settingsMike Frysinger7-63/+29
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-12sim: assume sys/select.h always existsMike Frysinger13-15/+25
Now that gnulib provides this, assume it exists.
2021-06-12sim: erc32: replace caddr_t with void*Mike Frysinger2-10/+18
This BSDism was never accepted into standards, so replace it with the portable void* type instead.
2021-06-12sim: erc32/ppc: fix handling of $EXEEXTMike Frysinger4-6/+14
2021-06-12sim: overhaul alignment settings managementMike Frysinger136-1616/+334
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-12sim: unify bug & package settingsMike Frysinger105-2785/+165
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-12sim: unify debug/stdio/trace/profile build settingsMike Frysinger73-4742/+244
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-12sim: split debug/stdio/trace/profile options into dedicated m4 filesMike Frysinger6-95/+178
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-12sim: ppc: unify header & function & type tests tooMike Frysinger8-1081/+902
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-12sim: ppc: unify env settings tooMike Frysinger6-45/+23
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-12sim: unify environment build settingsMike Frysinger100-993/+100
Move the --sim-enable-environment option up to the common dir so we only test & export it once across all ports.
2021-06-12sim: unify assert build settingsMike Frysinger131-869/+222
Move the --sim-enable-assert option up to the common dir so we only test & export it once across all ports.
2021-06-12sim: unify platform function & header testsMike Frysinger109-17440/+1478
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-09sim: cleanup obsolete NULL fallbackMike Frysinger13-42/+19
We require C11 which defines NULL, so drop the inconsistent set of fallback defines in the codebase.
2021-06-09sim: mn10300: tweak engine halt hookMike Frysinger2-1/+5
The hook is a void func, so defining it to 0 triggers warnings, and isn't really needed.
2021-06-09sim: nrun: tweak init of callback endianMike Frysinger2-5/+11
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-09sim: bpf: use CURRENT_TARGET_BYTE_ORDERMike Frysinger3-3/+10
Code should be going through this macro rather than accessing the underlying value directly.
2021-06-09sim: cgen: inline cgen_init logicMike Frysinger20-89/+62
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-08sim: igen: harmonize tool variablesMike Frysinger8-20/+41
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-08sim: v850: assume chown is availableMike Frysinger5-11/+9
Now that gnulib provides a wrapper, assume it always exists.
2021-06-05sim: common: start dedicated local.mkMike Frysinger8-31/+150
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-02sim m32c: Include defs.h in m32c.opc and r8c.opc.John Baldwin3-0/+9
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-05-29sim: ppc: enable -Wno-format for mingw targetsMike Frysinger3-0/+13
This mirrors what we do for other builds already.
2021-05-29sim: ppc: avoid shadowing errnoMike Frysinger5-16/+16
If the OS headers define the "errno" symbol, it breaks some of these funcs that were using "int errno" itself. Rename local vars to "err" to avoid that, and delete the old "extern int errno".
2021-05-29sim: v850: add pointer casts for execv on WindowsMike Frysinger2-2/+6
The execv prototypes on Windows via mingw64 include extra const markings on the argv/envp pointers than what POSIX specifies. Cast them to void* as a hack to get it working on all platforms.
2021-05-29sim: mn10300: add SIGTRAP fallbackMike Frysinger2-0/+7
This is a bit of a hack, but it matches the hack we use in other places in the sim currently. This fixes building for e.g. Windows. The signal fallback logic needs a bit of love in general at some point across all sim code.
2021-05-29sim: pull in extra gnulib libs tooMike Frysinger2-1/+5
Some modules might require extra linking depending on the platform (e.g. Windows might need -lws2_32), so include the existing extra gnulib libs setting.
2021-05-29sim: mips: fix build w/out dv-sockserMike Frysinger2-3/+9
Make sure we don't fail to build when dv-socker is unavailable.
2021-05-29sim: frv: fix up a bunch of prototype warningsMike Frysinger7-6/+41
Some were missing, some were unused, and some were partially renamed.
2021-05-29sim: frv: fix compiler parentheses suggestions warningsMike Frysinger4-25/+39
Newer gcc warns when writing statements like (a && b || c && d), so add more parentheses to make it (and the reader) happy.
2021-05-29sim: sh: fix a few compiler warningsMike Frysinger2-2/+7
2021-05-29sim: m32c: rename open symbol to avoid collisionsMike Frysinger2-4/+10
If the header files define open(), make sure our local open var doesn't shadow it.
2021-05-29sim: leverage gnulibMike Frysinger5-3/+33
We use getline, so leverage gnulib to provide fallback implementation.
2021-05-28sim: bfin: fix the otp fix fixMike Frysinger2-2/+6
Need to shift the upper 32-bits and not just combine directly with the lower 32-bits.
2021-05-28sim: h8300 add special case test.Yoshinori Sato10-16/+520
* addb.s: Add special case reg,<@reg+ / @reg- / @+reg / @-reg>. * andb.s: Likewise. * cmpb.s: Likewise. * orb.s: Likewise. * subb.s: Likewise. * xorb.s: Likewise. * movb.s: Add special case reg,<@reg+ / @reg- / @+reg / @-reg> @reg+,@reg+ / @-reg,@-reg. * movw.s: Likewise. * movl.s: Likewise.
2021-05-28sim: h8300 Fixed different behavior in preinc/predec.Yoshinori Sato3-3/+60
* sim-main.h (h8_typecodes): Add operand type OP_REG_DEC, OP_REG_INC. * compile.c (decode): Rewrite oprand type for specific case. (fetch_1): Add handling OP_REG_DEC and OP_REG_INC. (step_once): Fix operand fetch order.
2021-05-24opcodes: cris: move desc & opc files from sim/Mike Frysinger5-3339/+13
All other cgen ports keep their generated desc & opc files under opcodes/, so move the cris files over too. The cris-opc.c file, while not generated, is already here to complement.
2021-05-23sim: cris: fix memory setup typosMike Frysinger2-1/+5
The cleanup to use BFD_VMA_FMT also adjusted this line, but used the incorrect format: while BFD_VMA_FMT needs an explicit "x", PRIx32 does not, so the spurious "x" here confused the parser and broke execution.