summaryrefslogtreecommitdiff
path: root/sim/rl78
Commit message (Collapse)AuthorAgeFilesLines
* sim: info: convert verbose field to a boolMike Frysinger2023-01-181-1/+1
| | | | | | | The verbose argument has always been an int treated as a bool, so convert it to an explicit bool. Further, update the API docs to match the reality that the verbose value is actually used by some of the internal modules.
* sim: formally assume unistd.h always exists (via gnulib)Mike Frysinger2023-01-161-2/+0
| | | | | | | We have many uses of unistd.h that are unprotected by HAVE_UNISTD_H, so this is more formalizing the reality that we require this header. Since we switched to gnulib, it guarantees that a unistd.h exists for us to include, so we're doubly OK.
* sim: modules.c: fix generation after recent refactorsMike Frysinger2023-01-151-0/+3
| | | | | | | | | | | | | | Add explicit arch-specific modules.c rules to keep the build from generating an incorrect common/modules.c. Otherwise the pattern rules would cascade such that it'd look for $arch/modules.o which turned into common/modules.c which triggered the gen rule. My local testing of this code didn't catch this bug because of how Automake manages .Po (dependency files) in incremental builds -- it was adding extra rules that override the pattern rules which caused the build to generate correct modules.c files. But when building from a cold cache, the pattern rules would force common/modules.c to be used leading to crashes at runtime.
* sim: common: move modules.c to source trackingMike Frysinger2023-01-141-1/+2
| | | | | | This makes sure the arch-specific modules.c wildcard is matched and not the common/%.c so that we compile it correctly. It also makes sure each subdir has depdir logic enabled.
* sim: common: move libcommon.a objects to sourcesMike Frysinger2023-01-141-2/+2
| | | | | | | | | This simplifies the build logic and avoids an Automake bug where the common_libcommon_a_OBJECTS variable isn't set in the arch libsim.a DEPENDENCIES for targets that, alphabetically, come before "common". We aren't affected by that bug with the current code, but as we move things out of SIM_ALL_RECURSIVE_DEPS and rely on finer dependencies, we will trip over it.
* sim: build: drop subdir Makefile.in filesMike Frysinger2023-01-111-22/+0
| | | | These aren't used anymore, so punt them all.
* sim: move arch-specific file compilation of common/ files to top-levelMike Frysinger2023-01-101-2/+2
|
* sim: rl78: move arch-specific file compilation to top-levelMike Frysinger2023-01-101-3/+0
|
* sim: build: drop support for creating libsim.a in subdirsMike Frysinger2023-01-101-4/+0
| | | | | Now that all ports have moved to creating libsim.a in the top-level, drop all the support code to create it in a subdir.
* sim: rl78: move libsim.a creation to top-levelMike Frysinger2023-01-102-14/+22
| | | | | | | | | | | The objects are still compiled in the subdir, but the creation of the archive itself is in the top-level. This is a required step before we can move compilation itself up, and makes it easier to review. The downside is that each object compile is a recursive make instead of a single one. On my 4 core system, it adds ~100msec to the build per port, so it's not great, but it shouldn't be a big deal. This will go away of course once the top-level compiles objects.
* sim: replace -I$srcroot/bfd include with -I$srcrootMike Frysinger2023-01-011-1/+1
| | | | | | Clean up includes a bit by making ports include bfd/ headers explicitly. This matches other projects, and makes it more clear where these headers are coming from.
* Update copyright year range in header of all files managed by GDBJoel Brobecker2023-01-0113-13/+13
| | | | | | | This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
* sim: switch sim_{read,write} APIs to 64-bit all the time [PR sim/7504]Mike Frysinger2022-12-221-4/+4
| | | | | | | | | | | | | | We've been using SIM_ADDR which has always been 32-bit. This means the upper 32-bit address range in 64-bit sims is inaccessible. Use 64-bit addresses all the time since we want the APIs to be stable regardless of the active arch backend (which can be 32 or 64-bit). The length is also 64-bit because it's completely feasible to have a program that is larger than 4 GiB in size/image/runtime. Forcing the caller to manually chunk those accesses up into 4 GiB at a time doesn't seem useful to anyone. Bug: https://sourceware.org/PR7504
* sim: move register headers into sim/ namespace [PR sim/29869]Mike Frysinger2022-12-201-1/+1
| | | | | | | These headers define the register numbers for each port to implement the sim_fetch_register & sim_store_register interfaces. While gdb uses these, the APIs are part of the sim, not gdb. Move the headers out of the gdb/ include namespace and into sim/ instead.
* sim: build: respect AM_MAKEFLAGS when entering subdirsMike Frysinger2022-11-061-1/+1
| | | | | This doesn't matter right now, but it will as we add more flags to the recursive make step to pass state down.
* sim: run: move linking into top-levelMike Frysinger2022-11-051-0/+29
| | | | | | | | | | | | | Automake will run each subdir individually before moving on to the next one. This means that the linking phase, a single threaded process, will not run in parallel with anything else. When we have to link ~32 ports, that's 32 link steps that don't take advantage of parallel systems. On my really old 4-core system, this cuts a multi-target build from ~60 sec to ~30 sec. We eventually want to move all compile+link steps to this common dir anyways, so might as well move linking now for a nice speedup. We use noinst_PROGRAMS instead of bin_PROGRAMS because we're taking care of the install ourselves rather than letting automake process it.
* sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger2022-11-021-2/+2
| | | | | | | When reading/writing arbitrary data to the system's memory, the unsigned char pointer type doesn't make that much sense. Switch it to void so we align a bit with standard C library read/write functions, and to avoid having to sprinkle casts everywhere.
* sim: reg: constify store helperMike Frysinger2022-10-311-1/+1
| | | | These functions only read from memory, so mark the pointer as const.
* sim: constify various integer readersMike Frysinger2022-10-311-1/+1
| | | | These functions only read from memory, so mark the pointer as const.
* sim: common: change sim_read & sim_write to use void* buffersMike Frysinger2022-10-311-2/+2
| | | | | | | When reading/writing arbitrary data to the system's memory, the unsigned char pointer type doesn't make that much sense. Switch it to void so we align a bit with standard C library read/write functions, and to avoid having to sprinkle casts everywhere.
* sim, sim/{m32c,ppc,rl78}: Use getopt_longTsukasa OI2022-10-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Because of a Libiberty hack, getopt on GNU libc (2.25 or earlier) is currently unusable on sim, causing a regression on CentOS 7. This is caused as follows: 1. If HAVE_DECL_GETOPT is defined (getopt declaration with known prototype is detected while configuration), a declaration of getopt in "include/getopt.h" is suppressed. The author started to define HAVE_DECL_GETOPT in sim with the commit 340aa4f6872c ("sim: Check known getopt definition existence"). 2. GNU libc (2.25 or earlier)'s <unistd.h> includes <getopt.h> with a special purpose macro defined to declare only getopt function but due to include path (not tested while configuration), it causes <unistd.h> to include Libiberty's "include/getopt.h". 3. If both 1. and 2. are satisfied, despite that <unistd.h> tries to declare getopt by including <getopt.h>, "include/getopt.h" does not do so, causing getopt function undeclared. Getting rid of "include/getopt.h" (e.g. renaming this header file) is the best solution to avoid hacking but as a short-term solution, this commit replaces getopt with getopt_long under sim/.
* sim/rl78: Add ATTRIBUTE_PRINTFTsukasa OI2022-10-111-2/+2
| | | | | | | | | | | Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
* Don't use BFD_VMA_FMT in gdb and simAlan Modra2022-08-061-11/+11
| | | | | | | Like commit b82817674f, this replaces BFD_VMA_FMT "x" in sim/ with PRIx64 and casts to promote bfd_vma to uint64_t. The one file using BFD_VMA_FMT in gdb/ instead now uses hex_string, and a typo in the warning message is fixed.
* sim: remove use of PTRAlan Modra2022-05-131-1/+1
| | | | | | | PTR will soon disappear from ansidecl.h. Remove uses in sim. Where a PTR cast is used in assignment or function args to a void* I've simply removed the unnecessary (in C) cast rather than replacing with (void *).
* sim: fixes for libopcodes styled disassemblerAndrew Burgess2022-04-041-1/+13
| | | | | | | | | | | | | | | | | | In commit: commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Date: Sat Jan 22 11:38:18 2022 +0000 objdump/opcodes: add syntax highlighting to disassembler output I broke several sim/ targets by forgetting to update their uses of the libopcodes disassembler to take account of the new styled printing. These should all be fixed by this commit. I've not tried to add actual styled output to the simulator traces, instead, the styled print routines just ignore the style and print the output unstyled.
* Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker2022-01-0112-12/+12
| | | | | | | | This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
* sim: m32c/rl78: drop redundant -Wall settingsMike Frysinger2021-12-041-2/+0
| | | | We already turn these on in the configure script.
* sim: rl78: drop obsolete manual dependency rulesMike Frysinger2021-10-311-15/+0
| | | | | We have GNU make generate these for us automatically now, so there's no need to manually specify any deps.
* sim: rename ChangeLog files to ChangeLog-2021Mike Frysinger2021-08-171-0/+0
| | | | | | | | | | | | | | Now that ChangeLog entries are no longer used for sim patches, this commit renames all relevant sim ChangeLog to ChangeLog-2021, similar to what we would do in the context of the "Start of New Year" procedure. The purpose of this change is to avoid people merging ChangeLog entries by mistake when applying existing commits that they are currently working on. Also throw in a .gitignore entry to keep people from adding new ChangeLog files anywhere in the sim tree.
* sim: drop configure scripts for simple portsMike Frysinger2021-06-224-2912/+6
| | | | | | | | | These ports only use the pieces that have been unified, so we can merge them into the common configure script and get rid of their unique one entirely. We still compile & link separate run programs, and have dedicated subdir Makefiles, but the configure script portion is merged.
* sim: unify hardware settingsMike Frysinger2021-06-213-54/+5
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: hw: rework configure option & device selectionMike Frysinger2021-06-212-38/+30
| | | | | | | | | | | | | | | | The sim-hardware configure option allows builders to select a set of device models to enable. But this seems like unnecessary overkill: the existence of individual device models doesn't affect performance at all as they are only enabled at runtime if the config uses them, and individually these are all <5KB a piece. Stripping off a total of ~50KB from a ~1MB binary doesn't seem useful, and it's extremely unlikely anyone will ever bother. So let's simplify the configure/make logic by turning sim-hardware into a boolean option like many of the other sim options. Any ports that have unique device models will declare them in their Makefile instead of at configure time. This will allow us to (eventually) unify the setting into the common dir.
* sim: delete SIM_AC_COMMON macroMike Frysinger2021-06-204-5/+5
| | | | | Now that we've moved all content out to the common file, this is empty and can be deleted it entirely.
* sim: unify general maintainer settingsMike Frysinger2021-06-202-124/+0
| | | | | | | Move these options up to the common dir so we only test & export them once across all ports. This takes a page from the cgen maint logic to make $(MAINT) work for non-automake Makefiles which will allow us to merge it together.
* sim: move sim-inline to the common codeMike Frysinger2021-06-203-36/+5
| | | | | This will allow us to build the common code with the same inline settings as the arch subdirs, and only do the test once.
* sim: unify gettext/intl probing logicMike Frysinger2021-06-192-85/+0
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify toolchain dependency logicMike Frysinger2021-06-192-1109/+1
| | | | | The common dir is already probing this info since it's using automake, so pass it down to the subdirs so they don't have to probe it at all.
* sim: unify toolchain probing logicMike Frysinger2021-06-192-1360/+26
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify bfd library dependency testing logicMike Frysinger2021-06-193-7691/+6
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify various library testing logicMike Frysinger2021-06-192-141/+6
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify -Werror build settingsMike Frysinger2021-06-183-112/+6
| | | | | | 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.
* sim: move -Werror disabling to MakefileMike Frysinger2021-06-182-5/+8
| | | | | | 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.
* sim: overhaul & unify endian settings managementMike Frysinger2021-06-172-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sim: drop obsolete AC_EXEEXT callMike Frysinger2021-06-162-2/+4
| | | | | 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.
* sim: drop arch-specific config.hMike Frysinger2021-06-163-280/+47
| | | | | | | | | 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.
* sim: move dv-sockser define to CPPFLAGSMike Frysinger2021-06-153-8/+5
| | | | | 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.
* sim: unify bug & package settingsMike Frysinger2021-06-123-87/+2
| | | | | | 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.
* sim: unify debug/stdio/trace/profile build settingsMike Frysinger2021-06-122-150/+2
| | | | | | | | | 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.
* sim: unify environment build settingsMike Frysinger2021-06-123-32/+2
| | | | | Move the --sim-enable-environment option up to the common dir so we only test & export it once across all ports.
* sim: unify assert build settingsMike Frysinger2021-06-124-28/+6
| | | | | Move the --sim-enable-assert option up to the common dir so we only test & export it once across all ports.