summaryrefslogtreecommitdiff
path: root/sim/mips
Commit message (Collapse)AuthorAgeFilesLines
* 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: build: drop most recursive build depsMike Frysinger2023-01-141-2/+1
| | | | | | Now that we build these objects in the top dir & generate modules.c there, we don't need to generate them all first -- we can let the normal dependency graph take care of building things in parallel.
* 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 AM_MAKEFLAGS settingsMike Frysinger2023-01-141-1/+0
| | | | We don't have any recursive builds anymore, so we can drop this logic.
* sim: build: drop subdir Makefile.in filesMike Frysinger2023-01-111-14/+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: mips: move arch-specific file compilation to top-levelMike Frysinger2023-01-101-3/+5
| | | | | The arch-specific compiler flags are duplicated, but they'll be cleaned up once we move all subdir compiles to the top-level.
* sim: build: drop support for creating libsim.a in subdirsMike Frysinger2023-01-101-2/+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: mips: move libsim.a creation to top-levelMike Frysinger2023-01-103-53/+70
| | | | | | | | | | | | | | | 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. The mips code is a little more tricky than others because, for multi-run targets, it generates the list of sources & objects on the fly in the configure script.
* sim: modules: trigger generation from top-levelMike Frysinger2023-01-101-0/+1
| | | | | | | | | | | | | Add rules for tracking generated subdir modules.c files. This doesn't actually generate the file from the top-level, but allows us to add rules that need to be ordered wrt it. Once those changes land, we can rework this to actually generate from the top-level. This currently builds off of the objects that go into the libsim.a as we don't build those from the top-level either. Once we migrate that up, we can switch this to the source files directly. It's a bit hacky overall, but makes it easier to migrate things in smaller chunks, and we aren't going to keep this logic long term.
* sim: mips: add multi source to built sourcesMike Frysinger2023-01-041-0/+4
| | | | | | | The multirun generation mode is a bit of a mess as generated run files depend on generate igen files, all with unknown names ahead of time. In the multirun mode, be lazy and declare all of these generated source files as built sources so they'll be created early on.
* sim: build: move generated headers to built sourcesMike Frysinger2023-01-021-0/+2
| | | | | | | | | | | | | | Automake's automatic header deptracking has a bootstrap problem where it can't detect generated headers when compiling. We've been handling that by adding a custom SIM_ALL_RECURSIVE_DEPS variable, but that only works when building objects recursively in subdirs. As we move those out to the top-level, we don't have any recursive steps anymore. The Automake approach is to declare those headers in BUILT_SOURCES. This isn't completely foolproof as the Automake manual documents: it only activates for `make all`, not `make foo.o`, but that shouldn't be a huge limitation as it only affects the initial compile. After that, rebuilds should work fine.
* sim: replace -I$srcroot/bfd include with -I$srcrootMike Frysinger2023-01-013-4/+4
| | | | | | 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.
* sim: refresh copyright dates a bitMike Frysinger2023-01-011-1/+1
| | | | | Update a few files that were missed, and revert the generated Automake output that uses dates from Automake itself.
* Update copyright year range in header of all files managed by GDBJoel Brobecker2023-01-0122-22/+22
| | | | | | | 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: mips: hoist "multi" igen rules up to common buildsMike Frysinger2022-12-273-124/+103
| | | | | Since these are the last mips igen rules, we can clean up a number of bits in the local Makefile.in.
* sim: mips: hoist "m16" igen rules up to common buildsMike Frysinger2022-12-273-82/+88
|
* sim: mips: hoist "single" igen rules up to common buildsMike Frysinger2022-12-273-48/+52
|
* sim: mips: rename "igen" generation mode to "single"Mike Frysinger2022-12-272-34/+34
| | | | | | | | | | The naming in here has grown organically and is confusing to follow. Originally there was only one set of rules for generating code from the igen sources, so calling it "tmp-igen" and such made sense. But when other multigen modes were added ("m16" & "multi") which also used igen, it's not clear what's common igen and what's specific to this generation mode. So rename the set of rules from "igen" to "single" so it's easier to follow.
* sim: mips: hoist itable igen rules up to common buildsMike Frysinger2022-12-272-35/+50
| | | | Since this rule is pretty simple, hoist it up to the common build.
* sim: mips: unify itable generation (a bit)Mike Frysinger2022-12-272-34/+22
| | | | | | | | | | | | | | | | The m16 & multi targets generate itable once even when all the other modules are generated multiple times. The default igen target will generate itable with everything else out of convenience. This means flags are passed which don't affect the generated itable there. We can unify the itable generation by making sure the right -F/-M filter variables are passed down. Since there's already a dedicated rule & variable in the multi build mode, generalize that and switch the m16 & igen builds over too. I spent a lot of time staring at this code, building for diff mips targets, and exploring all the shell code paths. I think this is safe, but only time (and users) will really tell.
* sim: mips: rename multi_flags to igen_itable_flagsMike Frysinger2022-12-272-9/+9
| | | | | | | This variable is only used to generate the itable files. In preparation for merging the itable logic among all ports, rename "multi_flags" to a more appropriate "igen_itable_flags" variable. There should be no real chagnes here otherwise.
* sim: mips: drop unused micromips igen logicMike Frysinger2022-12-272-155/+0
| | | | | | | | | | | This code appears to be unused since it was first merged. When micromips was enabled, it was via the "MULTI" config, not the "MICROMIPS" config, and the multi configs have sep vars. Since nothing sets SIM_MIPS_GEN=MICROMIPS in the config, all of this should be unreachable, so punt it to simplify. Further, the SIM_MIPS_MICROMIPS16_FLAGS & SIM_MIPS_MICROMIPS_FLAGS settings rely on sim_mips_micromips{,16}_{filter,machine} variables that are never set in the configure script.
* sim: mips: move distclean settings to common buildMike Frysinger2022-12-252-4/+3
| | | | This was missed when mips/configure was merged into the top-level.
* sim: smp: plumb igen flag down to all usersMike Frysinger2022-12-252-6/+4
| | | | | | | | While mips has respected sim_igen_smp at configure time (which was always empty since it defaulted smp to off), no other igen port did. Move this to a makefile variable and plumb it through the common IGEN_RUN variable instead so everyone gets it by default. We also clean up some redundant -N0 setting with multirun mips.
* sim: cpu: change default init to handle all cpusMike Frysinger2022-12-251-1/+1
| | | | | | All the runtimes were only initializing a single CPU. When SMP is enabled, things quickly crash as none of the other CPU structs are setup. Change the default from 0 to the compile time value.
* sim: mips: clean up a bit after mips/configure removalMike Frysinger2022-12-242-5/+3
| | | | | Now that there is no subdir configure script, we can clean up some logic that was spread between the files.
* sim: mips: move igen settings to top-level configureMike Frysinger2022-12-244-3634/+278
| | | | | | | This is the last bit of logic that exists in the mips configure script, so move it to the top-level configure to kill it off. We still have to move the Makefile.in igen logic to local.mk, but this is a required first step for that.
* sim: mips: namespace igen configure varsMike Frysinger2022-12-243-209/+218
| | | | | | | | To prepare moving this logic to the top-level configure, the vars need to be namespaced. Do that here to make it easier to review. Basically sim_xxx -> SIM_MIPS_XXX when a var is exported from the configure script to the Makefile, and sim_xxx -> sim_mips_xxx when the var is internal in the configure script.
* sim: mips: add igen recursive depMike Frysinger2022-12-241-0/+3
| | | | | | Make sure the igen tool exists before trying to compile the mips subdir. This happens to work when mips has a subconfigure, but hits a race condition when that is removed.
* sim: mips: drop unused ENGINE_ISSUE_POSTFIX_HOOKMike Frysinger2022-12-242-8/+0
| | | | | Nothing defines this, and it isn't called in all the engine runtimes, so drop it entirely to avoid confusion.
* sim: igen: drop move-if-changed usageMike Frysinger2022-12-241-178/+83
| | | | | Now that igen itself has this logic, drop these custom build rules to greatly simplify.
* sim: move bfd.h include out of sim-main.hMike Frysinger2022-12-221-1/+0
| | | | | | | | Not all arches include this in sim-main.h, and the ones that do don't actually use bfd defines in the sim-main.h header. Prune it to make sim-main.h simpler so we can kill it off entirely in the future. We add the include to the files that utilize e.g. bfd_vma though.
* sim: mips: trim redundant igen settingsMike Frysinger2022-12-222-18/+0
| | | | | | These variables are setting the same value as the defaults. Trim this redundant logic to make it easier to see the real differences so we can try to keep unifying cases.
* sim: mips: merge mips64* with existing multi-run buildMike Frysinger2022-12-222-10/+4
| | | | | | Change the default (unhandled) mips64* targets to use the existing mips64 multi-run build. It already handles the formats, we just have to list the mips8000 bfd for it.
* sim: mips: merge mips64vr5000 with existing multi-run buildMike Frysinger2022-12-222-8/+2
| | | | | | | The existing mips64vr-* multi-run build already handles mips5000 targets, so reuse that for mips64vr5* targets too. This moves more logic from build-time to runtime so we can have a single binary that supports many targets.
* sim: mips: switch from SIM_ADDR to address_wordMike Frysinger2022-12-222-31/+13
| | | | | | | The latter type matches the address size configured for this sim. Also take the opportunity to simplify printf logic by leveraging PRI* macros.
* sim: mips: merge mips64vr4300 with existing multi-run buildMike Frysinger2022-12-222-8/+2
| | | | | | | The existing mips64vr-* multi-run build already handles mips4300 targets, so reuse that for mips64vr43* targets too. This moves more logic from build-time to runtime so we can have a single binary that supports many targets.
* sim: mips: match target on cpu settingsMike Frysinger2022-12-212-26/+26
| | | | | | We don't need to enforce larger target settings when the only thing the sim should care about is the CPU target. So reduce most of the target matches to only check the CPU.
* sim: mips: move fpu bitsize defines to top-level configureMike Frysinger2022-12-215-69/+16
| | | | | | This drops support for the --enable-sim-float configure option, but it's not clear anyone ever actually used that. Eventually we'll want this to be a runtime option anyways.
* sim: mips: move bitsize defines to top-level configureMike Frysinger2022-12-215-97/+18
| | | | | Since the msb value is always defined as the wordsize-1, stop hardcoding that value directly, and use a CPP value instead.
* sim: mips: move subtarget defines to top-level configureMike Frysinger2022-12-214-41/+35
| | | | | We want to kill off mips/configure entirely. Move this small part out now to get started.
* sim: mips: always resolve active bfd mach dynamicallyMike Frysinger2022-12-213-106/+3
| | | | | | | | Don't assume that the default bfd that we configured for is the one that is always active when running a program. We already have access to the real runtime value, so use it directly. This simplifies the code quite a bit, and will make it easier to support multiple mach's in a single binary.
* sim: build: hoist lists of hw devices upMike Frysinger2022-12-212-2/+5
| | | | | | | | We need these in the top-level to generate libsim.a, but also in the subdirs to generate hw-config.h. Move it to the local.mk, and pass it down when running recursive make. This avoids duplication, and makes it available to both. We can simplify this once we move the various steps up to the top-level too.
* sim: enable common sim_cpu usage everywhereMike Frysinger2022-12-211-2/+0
| | | | | All ports should be migrated now. Drop the SIM_HAVE_COMMON_SIM_CPU knob and require it be used everywhere now.
* sim: mips: invert sim_cpu storageMike Frysinger2022-12-212-73/+90
|
* sim: mips: call Unpredictable instead of setting bogus values [PR sim/29276]Mike Frysinger2022-11-081-2/+2
| | | | | | | | | | The intention of this code seems to be to indicate that this insn should not be used and produces undefined behavior, so instead of setting registers to bogus values, call Unpredictable. This fixes build warnings due to 32-bit/64-bit type conversions, and outputs a log message for users at runtime instead of silent corruption. Bug: https://sourceware.org/PR29276
* sim: run: move linking into top-levelMike Frysinger2022-11-051-0/+25
| | | | | | | | | | | | | 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: mips: simplify fpu configure logicMike Frysinger2022-11-042-22/+14
| | | | | The configure code always defaults to HARD_FLOATING_POINT, so inline that value and drop redundant target checks as a result.