aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2021-06-18sim: unify -Werror build settingsMike Frysinger107-3524/+324
Move these options up to the common dir so we only test & export them once across all ports. It also enables -Werror usage on the common files we've been pulling out of arch subdirs.
2021-06-18sim: move -Werror disabling to MakefileMike Frysinger84-810/+971
For the ports that still don't build with -Werror, rather than disable the flag at configure time, do it at make time. This will allow us to unify these tests in the common sim configure script.
2021-06-18sim: create a makefile fragment to pass common settings downMike Frysinger9-3/+44
As we merge settings from subdirs into the common configure, we sometimes need to keep the settings working in both dirs. Create a makefile fragment to pass them down so we don't have to run the checks twice. For now, the file is empty, but we'll start moving logic in shortly.
2021-06-18sim: split sim-signal.h include outMike Frysinger78-6/+169
The sim-basics.h is too big and includes too many things. This leads to some arch's sim-main.h having circular loop issues with defs, and makes it hard to separate out common objects from arch-specific defs. By splitting up sim-basics.h and killing off sim-main.h, it'll make it easier to separate out the two.
2021-06-18sim: drop core libiberty.h includeMike Frysinger2-2/+4
This doesn't need to be included for every sim file, so drop it. Every C file that needs it seems to already include it.
2021-06-17sim: overhaul & unify endian settings managementMike Frysinger151-1721/+348
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-17sim: ppc: avoid "PAGE_SIZE" nameMike Frysinger3-4/+9
This define is used for a particular target and depends on the simulated CPU hardware. It has no relation to the host CPU that the sim is running on. So rename the common "PAGE_SIZE" here to better reflect its usage and avoid conflicts with system headers.
2021-06-17sim: mn10300: tweak static inlinesMike Frysinger2-2/+6
Use INLINE2 instead of INLINE to fix builds when -O0 are used -- the latter define is omitted at -O0 levels while the former is always set to inline. These helper funcs are used by defines in here but the defines aren't always called.
2021-06-17sim: split sim/callback.h include outMike Frysinger19-2/+38
The sim-basics.h is too big and includes too many things. This leads to some arch's sim-main.h having circular loop issues with defs, and makes it hard to separate out common objects from arch-specific defs. By splitting up sim-basics.h and killing off sim-main.h, it'll make it easier to separate out the two. Start with splitting out sim/callback.h.
2021-06-16sim: make some rules silent by default in Make-common.inSimon Marchi2-6/+13
Use GDB's silent-rules.mk to make some rules silent by default. These rules cover most of what is built in sim/. gdb/ChangeLog: * silent-rules.mk (ECHO_CCLD, ECHO_AR, ECHO_RANLIB): New. sim/ChangeLog: * common/Make-common.in (COMPILE, libsim.a, run$(EXEEXT), gentmap.o, gentmap): Make rules silent. Change-Id: Idf9ba5beaee10c7c614859ace5fbdcd1de0287db
2021-06-16sim: mips: add printf attribute to trace funcMike Frysinger3-2/+7
This helps catch format errors in code, although they're all clean at this point already.
2021-06-16sim: mips: rework dynamic printf logic to avoid compiler warningsMike Frysinger2-8/+38
The compiler doesn't like passing non-constant strings to printf functions, so tweak the code to always pass one in. This code is a little more verbose, but it's probably the same performance. The macro usage is a bit ugly, but maybe less than copying & pasting the extended conditional format logic.
2021-06-16sim: mips: tweak buffer signMike Frysinger2-1/+6
This model uses unsigned char buffers, but this temporary pointer is declared as signed. Switch it to unsigned since it's just a temporary variable to hold the new pointer.
2021-06-16sim: mips: fix uninitialized register useMike Frysinger2-1/+6
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-16sim: drop obsolete AC_EXEEXT callMike Frysinger67-70/+133
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-16sim: ppc: use common sim-assert settingMike Frysinger4-38/+5
The common sim code already sets this up for us, so no need to duplicate the logic.
2021-06-16sim: ppc: convert to bfd_endianMike Frysinger11-59/+75
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-16sim: ppc: replace local __attribute__ fallbackMike Frysinger3-15/+7
The common ansidecl.h provides fallbacks for these so we don't need to.
2021-06-16sim: ppc: use common ATTRIBUTE_PRINTF macrosMike Frysinger6-5/+23
Use the common ansidecl.h macros to replace our ad-hoc printf attributes.
2021-06-16sim: ppc: use common ATTRIBUTE_PACKED macroMike Frysinger3-6/+12
Drop local packed attribute with the common ansidecl.h define.
2021-06-16sim: ppc: replace local NORETURN macros with common oneMike Frysinger4-6/+12
Drop local NORETURN macro with the common ansidecl.h ATTRIBUTE_NORETURN define.
2021-06-16sim: ppc: replace local UNUSED macros with common oneMike Frysinger5-96/+97
Drop local UNUSED macro with the common ansidecl.h ATTRIBUTE_UNUSED define.
2021-06-16sim: ppc: replace local CONCAT macros with common onesMike Frysinger6-16/+12
Drop local copies of CONCAT macros that the common ansidecl.h provides.
2021-06-16sim: ppc: change bool variable name to booleanMike Frysinger2-1/+5
This is a reserved type with stdbool.h.
2021-06-16sim: ppc: drop host endian configure optionMike Frysinger12-928/+474
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-16sim: mips: fix format warnings when setting up memoryMike Frysinger2-18/+22
The majority of these inputs are not long's, so don't use %lx. This fixes compiler warnings about type mismatches.
2021-06-16sim: drop arch-specific config.hMike Frysinger100-8706/+1478
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-15sim: move dv-sockser define to CPPFLAGSMike Frysinger95-250/+161
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-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.