aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2021-11-28sim: testsuite: drop most specific istarget checksMike Frysinger42-47/+42
We'll rely on the toolchain probing to determine whether each arch's tests can be run rather the current configure target. This allows testing all of the ports in a multitarget configuration. For now, we don't reformat the files entirely to make it easier to review, and in case we need to make adjustments. Once this feels like it's stable, we can flatten the code a bit by removing the if statement entirely.
2021-11-28sim: testsuite: support parallel executionMike Frysinger2-10/+80
Break up the dejagnu logic so that we can parallelize the testsuite. This takes a page from gcc & gdb where each .exp is run in isolation instead of in serial. For most targets, this doesn't make much of a difference as they only have a single .exp. A few (like cris & frv) have multiple .exp though and will see a bit of a speed up. The real gain is when testing a multitarget build. This way we can run all the targets in parallel and cut the execution time a bit. On my system, it goes from ~155sec to ~100sec. We can gain further speedups by splitting up some of the larger .exp files into smaller groups. We'll do that in a followup though.
2021-11-28sim: testsuite: expand arch specific toolchain settingsMike Frysinger3-7/+63
Leverage the new per-port toolchain settings to initialize the env for eeach set of tests. This allows us to run all the tests in a multitarget build if the user sets up the vars. If they don't, we can still skip all the tests.
2021-11-28sim: testsuite: setup per-port toolchain settings for multitarget buildMike Frysinger5-3/+895
Gas does not support multitarget builds -- it still only supports a single input & output format. ld is a bit better, but requires manual flags to select the right output. This makes it impossible to run the complete testsuite in a multitarget build. To address this limitation, create a suite of FOR_TARGET variables so these can be set to precompiled as & ld programs. It requires a bit of setup ahead of time, but it's a one-time cost, and makes running the full testsuite at once much easier.
2021-11-28sim: add checks to core headers to prevent incorrect common buildingMike Frysinger3-2/+8
Some of the core sim headers rely on the SIM_AC_OPTION_BITSIZE macro which can change the size of core types. Since these haven't been unified across ports, add checks to make sure they aren't accidentally included when building for all ports. This caught the sim-load file using poisoned headers that it didn't actually need.
2021-11-28sim: unify syscall.o buildingMike Frysinger3-1/+22
Now that we've unified all the syscall tables, this file does not rely on any port-specific settings, so move it up to building as part of the common step so we only do it once in a multibuild.
2021-11-28sim: drop unused gentmap & nltvals.def logicMike Frysinger6-422/+31
Now that all ports have switched to target-newlib-* files, there's no need for these files & generating things at build time. So punt the logic and make target-newlib-syscall a hard requirement.
2021-11-28sim: mcore: switch to new target-newlib-syscallMike Frysinger2-3/+5
Use the new target-newlib-syscall module. This is needed to merge all the architectures into a single build, and mcore has a custom syscall table for its newlib/libgloss port.
2021-11-28sim: riscv: switch to new target-newlib-syscallMike Frysinger2-3/+2
Use the new target-newlib-syscall module. This is needed to merge all the architectures into a single build, and riscv has a custom syscall table for its newlib/libgloss port.
2021-11-28sim: cr16: switch to new target-newlib-syscallMike Frysinger3-51/+28
Use the new target-newlib-syscall module. This is needed to merge all the architectures into a single build, and cr16 has a custom syscall table for its newlib/libgloss port. This allows cleaning up the syscall ifdef logic. We know these will always exist now.
2021-11-28sim: d10v: switch to new target-newlib-syscallMike Frysinger3-36/+26
Use the new target-newlib-syscall module. This is needed to merge all the architectures into a single build, and d10v has a custom syscall table for its newlib/libgloss port. This allows cleaning up the syscall ifdef logic. We know these will always exist now.
2021-11-28sim: sh: switch to new target-newlib-syscallMike Frysinger2-25/+23
Use the new target-newlib-syscall module. This is needed to merge all the architectures into a single build, and sh has a custom syscall table for its newlib/libgloss port.
2021-11-28sim: v850: switch to new target-newlib-syscallMike Frysinger3-67/+26
Use the new target-newlib-syscall module. This is needed to merge all the architectures into a single build, and v850 has a custom syscall table for its newlib/libgloss port. This allows cleaning up the syscall ifdef logic. We know these will always exist now.
2021-11-28sim: iq2000/lm32/m32c/moxie/rx: switch to new target-newlib-syscall.hMike Frysinger5-35/+35
Use the new target-newlib-syscall.h to provide the target syscall defines. These code paths are written specifically for the newlib ABI rather than being generalized, so switching them to the defines rather than trying to go through the dynamic callback conversion seems like the best trade-off for now. Might have to reconsider this in the future.
2021-11-28sim: nltvals: pull target syscalls out into a dedicated source fileMike Frysinger9-65/+987
Like we just did for pulling out the errno map, pull out the syscall maps into a dedicated common file. Most newlib ports are using the same syscall map, but not all, which means we have to do a bit more work to migrate. This commit adds the maps and switches the ports using the common default syscall table over to it. Ports using unique syscall tables are still using the old targ-map.c logic. Switching common ports over is easy by checking NL_TARGET, but the ppc code needs a bit more cleanup here hence its larger diff.
2021-11-28sim: frv: resolve syscalls dynamicallyMike Frysinger1-2/+1
Avoid use of TARGET_<syscall> defines and rely on the callback layers to resolve these dynamically so we can support multiple syscall layers instead of assuming the newlib/libgloss numbers all the time.
2021-11-28sim: mn10300: resolve syscalls dynamicallyMike Frysinger3-5/+4
Avoid use of TARGET_<syscall> defines and rely on the callback layers to resolve these dynamically so we can support multiple syscall layers instead of assuming the newlib/libgloss numbers all the time.
2021-11-28sim: nltvals: drop i960Mike Frysinger2-26/+2
This port was dropped from gdb/bfd/sim years ago, so stop including its syscall constants too.
2021-11-28sim: moxie: fix datadir handlingMike Frysinger1-1/+1
Expand the value at `make` time rather than configure generation time so that we handle $(datarootdir) setting properly.
2021-11-27sim: hw: mark hw_descriptors constMike Frysinger2-2/+2
2021-11-27sim: testsuite: add dedicated flag for init toolchain testsMike Frysinger2-6/+15
As we setup more reliable CC_FOR_TARGET variables for each target, the bfin way of overriding it to stuff custom CFLAGS doesn't scale well. Add a dedicated CFLAGS_FOR_TARGET_init setting that each set of tests can setup if they want to add custom options.
2021-11-27sim: testsuite: clean up arch specific toolchain settingsMike Frysinger3-4/+14
In a multitarget build, we process all targets in order, so make sure the toolchain settings from one don't leak into the next.
2021-11-27sim: cris: always search for local rvdummy toolMike Frysinger1-8/+2
If the board info sets the sim to a basename that is found via $PATH (which is the default dejagnu behavior), the logic here to use its dirname to find rvdummy fails because it looks for `./rvdummy`. So switch it to always use the local build of rvdummy which is the one we want to be testing against in the first place. If we get a request for testing against a different setup, we can figure out & document the needs at that point, and then setup some config knobs to control it.
2021-11-26sim: testsuite: fix bits-gen EXEEXT handlingMike Frysinger2-8/+8
Add missing $(EXEEXT) to dependencies on bits-gen. These are actually build-only tools, but automake doesn't allow for build & host tools, so the rules are re-using EXEEXT.
2021-11-26sim: testsuite: initial support for OS-specific testsMike Frysinger107-107/+158
We usually test against the newlib/libgloss environment, but for a few ports that also support Linux apps, we want to test that logic too. A lot of the C code is written such that it works with either newlib/libgloss or glibc/linux toolchains, but we have some tests that end up being Linux-specific. Cris has been using the target tuple as a rough proxy for this (where cris*-*-elf is assumed to be newlib/libgloss, and everything else is glibc/linux), but that is a bit too rough, and it doesn't work in a multitarget build. So lets create a few stub files that we can do compile tests with to detect the different setups, and then let tests declare which one they require (if they require any at all).
2021-11-26sim: testsuite: unify basic C compiler checksMike Frysinger4-40/+53
Both bfin & cris ports test the C compiler to see if it works, but in their own way. Unify the checks in the common code so we can leverage them in more ports in the future, and collapse the bfin & cris code.
2021-11-26sim: testsuite: rework sim_init usageMike Frysinger44-26/+109
The sim_init function was called by runtest for each test when --tool was set to sim. When we changed to --tool '' to collapse the testsuite dir, the init function was no longer called on every test. However, it was still being called explicitly by config/default.exp. It's not clear why that explicit call ever existed since, in the past, it meant it was redundant. Lets drop the single sim_init call in config/default.exp and move it out to all our tests. This replicates the runtest behavior so we can setup variables on a per-test basis which allows us to recollapse the sim_path logic back. We'll also leverage this in the future for toolchain setup. Also add a few comments clarifying the overall runtime behavior.
2021-11-26sim: cris: fix testsuite hang when sim is missingMike Frysinger2-0/+9
If the cris sim hasn't been built yet, trying to run its testsuite will hang indefinitely. The common sim APIs already have this, so copy it over to the cris forks of the test+run functions.
2021-11-26sim: testsuite: fix objdir handlingMike Frysinger9-42/+46
The tests assume that the cwd is the objdir directory and write its intermediates to there all the time. When using runtest's --objdir setting though, this puts the files in the wrong place. This isn't a big problem currently as we never change --objdir, but in order to support parallel test execution, we're going to start setting that option, so clean up the code ahead of time. We also have to tweak some of the cris tests which were making assumptions about the argv[0] value.
2021-11-26sim: testsuite: rename global_sim_options to SIMFLAGS_FOR_TARGETMike Frysinger5-37/+19
Now that all the other toolchain settings have been renamed to match the dejagnu settings of XXX_FOR_TARGET, rename global_sim_options to SIMFLAGS_FOR_TARGET too.
2021-11-26sim: testsuite: replace global_ld_options with LDFLAGS_FOR_TARGETMike Frysinger6-30/+14
Only a few tests actually use global_ld_options, but we can replace the sim-specific settings with the dejagnu common LDFLAGS_FOR_TARGET and get the same result.
2021-11-26sim: testsuite: replace global_as_options with ASFLAGS_FOR_TARGETMike Frysinger4-18/+8
Only a few tests actually use global_as_options, but we can replace the sim-specific settings with the dejagnu common ASFLAGS_FOR_TARGET and get the same result.
2021-11-26sim: testsuite: drop unused global_cc_optionsMike Frysinger1-5/+1
Nothing in the testsuite is using this setting, so let's drop it. Any code that wants to set compiler flags can use CFLAGS_FOR_TARGET instead to get the same effect.
2021-11-26sim: testsuite: punt unused toolchain variablesMike Frysinger3-44/+3
These haven't been used in over 20 years. The sim testsuite used to run these tools itself directly, but back in ~1999 it switched to the dejagnu helpers (e.g. target_assemble & target_link), and the dejagnu logic only utilizes XXX_FOR_TARGET variables. Punt them here to avoid confusion with dead code.
2021-11-25sim: mips: avoid _ namespaceMike Frysinger1-3/+3
Some C libraries export _P symbols in their headers (like older newlib and its ctype.h), so use P_ instead to avoid conflicts.
2021-11-20sim: v850: fix cpu_option testsuite handlingMike Frysinger2-20/+15
The v850 testsuite code has been testing the $opt variable, but this was never actually set anywhere globally or v850-specific. Instead, this was a random variable leaking out of the sh testsuite code. As far as I can tell, it has always been this way. That means the code only ever tested the v850 cpu target (which is the default). This failure can be easily seen in practice by running the v850 code in isolation and seeing it crash: $ runtest v850/allinsns.exp ... Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using ../../../sim/testsuite/config/default.exp as tool-and-target-specific interface file. WARNING: Assuming target board is the local machine (which is probably wrong). You may need to set your DEJAGNU environment variable. Running ../../../sim/testsuite/v850/allinsns.exp ... ERROR: tcl error sourcing ../../../sim/testsuite/v850/allinsns.exp. ERROR: tcl error code TCL LOOKUP VARNAME opt ERROR: can't read "opt": no such variable while executing "switch -regexp -- $opt { Backing up a bit, the reason for this logic in the first place is because the common sim testsuite code makes an assumption about the assembler options with cpu_option -- the option and its value are always separated by an =. This is not the case with v850. So tweak the core sim logic a bit to support omitting the = so that we can switch v850 to the standard all_machs setting and avoid opt entirely.
2021-11-20 Fix intermittent failures on the H8, particularly H8/SX tests.Jeff Law1-1/+2
The upstream GCC tester has showed spurious execution failures on the H8 target for the H8/SX multilibs. I suspected memory corruption or an uninitialized variable early as the same binary would sometimes work and sometimes it got the wrong result. Worse yet, the point where the test determined it was getting the wrong result would change. Because it only happened on the H8/SX variant I was able to zero in on the "mova" support and the "short form" of those instructions in particular. As the code stands it checks if code->op3.type == 0 to try and identify cases where op3 wasn't filled in and thus we've got the short form of the mova instruction. But for the short-form of those instructions we never set any of the "op3" data structure. We get whatever was lying around -- it's usually zero and thus things usually work, but if the stale data was nonzero, then we'd fail to recognize the instruction as a short-form and fail to set up the various fields appropriately. I initially initialized the op3.type field to zero, but didn't like that because it was inconsistent with how other operands were initialized. Bringing consistency meant using -1 as the initializer value and adjusting the check for short form mova appropriately. I've had this in the upstream GCC tester for perhaps a year at this point and haven't seen any of the intermittent failures again.
2021-11-19sim: bfin: fix short --env usage in testsuiteMike Frysinger4-4/+4
Now that we have more than one option that matches "--env", the test config here doesn't work. Use the explicit --environment.
2021-11-19sim: install various doc filesMike Frysinger8-14/+330
2021-11-18sim: use program_transform_name for libsimMike Frysinger1-1/+1
Instead of always using target_alias as a prefix on the name, use program_transform_name instead so that the library is scoped in the same way as the run program.
2021-11-18sim: avoid installing headers when there is no simMike Frysinger4-48/+72
If we aren't building any sims, don't install the sim headers as they won't be useful to anyone.
2021-11-16sim: testsuite: add support for $pwd replacementsMike Frysinger19-20/+18
Extend the common test framework to support $pwd replacements in settings. This allows replacing the custom cris @exedir@ with it.
2021-11-16sim: cris: replace @srcdir@ test extension with $srcdir/$subdirMike Frysinger6-11/+9
The common framework supports $srcdir & $subdir replacements already, so replace the custom @srcdir@ logic with those. Since the replace happens in slurp_options that cris already uses, we don't have any logic to port over there. We have to duplicate that into the cris slurp_rv helper though.
2021-11-16sim: cris: drop custom "dynamic" test fieldMike Frysinger7-17/+0
This tag is used to force tests to be built dynamically (i.e. without -static linking). This is because cris-sim.exp in dejagnu turns on static linking in ldflags. The default configs and runtest flags shouldn't load these boards. If these settings are still needed, we should figure out a different way of suppressing the stock settings wholesale. We want these to all pass out of the box with little to no configuration so that they can run in a multitarget build. With dropping "dynamic", it'll be easier to merge the custom cris test logic with the common sim test logic.
2021-11-16sim: testsuite: add more silent build rulesMike Frysinger2-4/+16
site.exp is still verbose, but that comes from automake, so have to get it fixed upstream.
2021-11-16sim: cr16: fix build on gcc-12 (NULL comparison)Sergei Trofimovich2-4/+3
On gcc-12 build fails as: sim/cr16/interp.c: In function 'lookup_hash': sim/cr16/interp.c:89:25: error: the comparison will always evaluate as 'true' for the address of 'mnimonic' will never be NULL [-Werror=address] 89 | if ((h->ops->mnimonic != NULL) && | ^~ 'mnimonic' is a sharr array within ops. It can never be NULL. While at it renamed 'mnimonic' to 'mnemonic'.
2021-11-16sim: run: support concise env var settingsMike Frysinger2-2/+23
Support the same syntax as other common utilities where env vars can be specified before the program to be run without an explicit option. This behavior can be suppressed by using the -- marker.
2021-11-16sim: nrun: add --env-{set,unset,clear} command line optionsMike Frysinger5-10/+107
Provide explicit control over the program's environment with the basic set/unset/clear options. These are a bit clunky to use, but they're functional. The env set operation is split out into a separate function as it'll be used in the next commit. With these in place, we can adjust the custom cris testsuite to use the now standard options and not its one-off hack.
2021-11-16sim: syscall: hoist argc/argn/argnlen to common codeMike Frysinger2-33/+40
Now that the callback framework supports argv & envp, we can move the Blackfin implementation of these syscalls to the common code.
2021-11-16sim: syscall: fix argvlen & argv implementationMike Frysinger1-42/+50
Now that we have access to the argv & envp strings, finish implementing these syscalls. Delete unused variables, fix tbuf by incrementing the pointer instead of setting to the length, and make sure we don't write more data than the bufsize says is available.