aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
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.
2021-11-16sim: callback: expose argv & environMike Frysinger13-10/+73
Pass the existing strings data to the callbacks so that common libgloss syscalls can be implemented (which we'll do shortly).
2021-11-16sim: keep track of program environment stringsMike Frysinger14-7/+85
We've been passing the environment strings to sim_create_inferior, but most ports don't do anything with them. A few will use ad-hoc logic to stuff the stack for user-mode programs, but that's it. Let's formalize this across the board by storing the strings in the normal sim state. This will allow (in future commits) supporting more functionality in the run interface, and to unify some of the libgloss syscalls.
2021-11-16sim: iq2000: fix some missing prototypes warningsMike Frysinger4-5/+10
Turns out some of these were hiding real bugs like not passing the pc variable down.
2021-11-15sim: cris: make error message test a little more flexibleMike Frysinger1-1/+1
The point of this test is to just make sure the usage text is shown, not the exact details of the usage text. So shorten the output test to match the beginning. This fixes breakage when the output changed slightly to include [--].
2021-11-15sim: run: fix crash in argc==0 error situationMike Frysinger1-7/+17
The new argv processing code assumed that we were always passed a command line. If we weren't, make sure we don't crash before we get a chance to output an error message about incorrect usage.
2021-11-15sim: cris: touch up rvdummy handlingMike Frysinger1-2/+2
Add quiet build support and make sure it's removed with `make clean`.
2021-11-15sim: cris: replace custom "dest" test field with new --argv0Mike Frysinger4-8/+5
The #dest field used in the cris testsuite is a bit of hack to set the argv[0] for the tests to read out later on. Now that the sim has an option to set argv[0] explicitly, we don't need this custom field, so let's drop it to harmonize the testsuites a little.
2021-11-15sim: run: add --argv0 option to control argv[0]Mike Frysinger4-4/+27
We default argv[0] to the program we run which is a standard *NIX convention, but sometimes we want to be able to control the argv[0] setting independently (especially for programs that inspect argv[0] to change their behavior or output). Add an option to control it.
2021-11-15sim: split program path out of argv vectorMike Frysinger31-119/+40
We use the program argv to both find the program to run (argv[0]) and to hold the arguments to the program. Most of the time this is fine, but if we want to let programs specify argv[0] independently (which is possible in standard *NIX programs), this double duty doesn't work. So let's split the path to the program to run out into a separate field by itself. This simplifies the various sim_open funcs too. By itself, this code is more of a logical cleanup than something that is super useful. But it will open up customization of argv[0] in a follow up commit. Split the changes to make it easier to review.
2021-11-15sim: bfin: fix mach/xfail usage in testsMike Frysinger4-6/+6
Set the mach to the right value all the time, and update xfail to say the test fails on all targets. WIth multitarget testing, the idea of target here doesn't make much sense.
2021-11-13sim: sh: fix switch-bool warningsMike Frysinger1-51/+28
This code triggers -Werror=switch-bool warnings with <=gcc-5 versions. Rework it to use if statements instead as it also simplifies a bit.
2021-11-13sim: sh: rework carry checks to not rely on integer overflowsMike Frysinger1-4/+4
In <=gcc-7 versions, -fstrict-overflow is enabled by default, and that triggers warnings in this code that relies on integer overflows to test for carries. Change the logic to test against the limit directly.
2021-11-11sim: testsuite: drop sim_compile cover functionMike Frysinger2-14/+1
Most code isn't using this, and the only call site (in one cris file) can use target_compile directly. So switch it over to simplify.
2021-11-11sim: cris: stop testing a.out explicitly [ld/13900]Mike Frysinger1-14/+0
Since gcc dropped support for a.out starting with 4.4.0 in 2009, it's been impossible to verify this code actually still works. Since it crashes in ld, and it uses a config option that no other tests uses and we want to remove, drop the test to avoid all the trouble.
2021-11-11sim: io: tweak compiler workaround with error outputMike Frysinger1-3/+3
Outputting an extra space broke a cris test. Change the workaround to use %s with an empty string to avoid the compiler warning but not output an extra space.
2021-11-10sim: testsuite: delete unused arm remote host logicMike Frysinger3-24/+0
There's no need to sync testutils.inc with remote hosts. The one we have in the source tree is all we need and only thing we test. Delete it to simplify.
2021-11-10sim: synacor: simplify test generationMike Frysinger2-7/+4
Objcopy was used to create a binary file of just the executable code since the environment requires code to based at address 0. We can accomplish the same thing with the -Ttext=0 flag, so switch to that to get rid of custom logic.
2021-11-10sim: frv: flip trapdump default back to offMike Frysinger2-2/+2
When I refactored this by scoping it to sim-frv-xxx in commit e7954ef5e5ed90fb7d28c013518f4c2e6bcd20a1 ("sim: frv: scope the unique configure flag"), I changed the default from off to on. While the feature is nice for developers, it breaks a bunch of tests which aren't expecting this extra output. So flip it back to off by default.
2021-11-09sim: sh: simplify testsuite a bitMike Frysinger8-82/+12
Switch from the centralized list in the exp file to each test declaring its own requirements which they're already (mostly) doing. This will increase coverage slightly by running more tests in more configurations since the hardcoded exp list was a little out of date. We have to mark the psh* tests as shdsp only (to match what the exp file was doing), mark the fsca & fsrra tests as failing (since they weren't even being run by the exp file), and to fix the expected output & status of the fail test.
2021-11-08sim: cris: clean up missing func prototype warningsMike Frysinger4-6/+6
Move some unused funcs under existing #if 0 protection, mark a few local funcs as static, and add missing prototypes for the rest which are used from other files. This fixes all the fatal warnings in the mloop files so we can turn -Werror on here fully.
2021-11-06sim: sh: fix conversion of PC to an integerMike Frysinger1-1/+1
On LLP64 targets where sizeof(long) != sizeof(void*), this code fails: sim/sh/interp.c:704:24: error: cast from pointer to integer of different size -Werror=pointer-to-int-cast] 704 | do { memstalls += ((((long) PC & 3) != 0) ? (n) : ((n) - 1)); } while (0) | ^ Since this code simply needs to check alignment, cast it using uintptr_t which is the right type for this.
2021-11-06sim: sh: clean up time(NULL) callMike Frysinger1-1/+1
Casting 0 to a pointer via (long *) doesn't work on LLP64 targets: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] It's also unnecessary here. We can simply pass NULL like every other bit of code does.
2021-11-06sim: sh: break utime logic out of _WIN32 checkMike Frysinger1-1/+8
Some _WIN32 targets provide utime (like mingw), so move the header include out from _WIN32 and under the specific HAVE_UTIME_H check.
2021-11-06sim: sh: drop errno externMike Frysinger1-1/+0
This isn't needed on any reasonable target nowadays, and no other source does this, and breaks with some mingw targets, so punt the extern entirely.
2021-11-06sim: sh: fix isnan redefinition with mingw targetsMike Frysinger1-0/+2
The code assumes that all _WIN32 targets are the same and can define isnan to _isnan. For mingw targets, they provide an isnan define already, so no need for the fallback here.
2021-11-06sim: arm/bfin/rx: undefine page size from system headersMike Frysinger3-0/+5
Some targets (like cygwin) will export page size defines that clash with our local usage here. Undefine the system one to fix building for these targets.
2021-11-06sim: ppc: switch to libiberty environ.hMike Frysinger1-2/+2
Drop our compat code and assume environ exists to simplify. We did this for all other targets already, but ppc was missed.
2021-11-06sim: sh: enable -Werror everywhereMike Frysinger1-3/+0
With most of the warnings fixed in interp.c, we can enable -Werror here too now. There are some -Wmaybe-uninitialized warnings still lurking that look legitimate, but we don't flag those are fatal, and I don't have the expertise to dive into each opcode to figure out the right way to clean them up.
2021-11-06sim: sh: fix uninitialized variable usage with pdmsbMike Frysinger1-1/+1
This block of code relies on i to control which bits to test and how many times to run through the loop, but it never actually initialized it. There is another chunk of code that handles the pdmsb instruction that sets i to 16, so use that here too assuming it's correct. The programming manual suggests this is the right value too, but I am by no means a SuperH DSP expert. The tests are still passing though ...
2021-11-06sim: sh: constify a few read-only lookup tablesMike Frysinger1-6/+6
2021-11-06sim: sh: fix various parentheses warningsMike Frysinger2-11/+11
Add parentheses to a bunch of places where the compiler suggests we do to avoid confusion to most readers.
2021-11-06sim: sh: fix unused-value warningsMike Frysinger1-3/+3
These macro expansions are deliberate in not using the computed value so that they trigger side-effects (possible invalid memory accesses) but while otherwise being noops. Add a (void) cast so the compiler knows these are intentional.
2021-11-06sim: sh: rework register layout with anonymous unions & structsMike Frysinger3-90/+82
Now that we require C11, we can leverage anonymous unions & structs to fix a long standing issue with the SH register layout. The use of sregs.i for sh-dsp has generated a lot of compiler warnings about the access being out of bounds -- it only has 7 elements declared, but code goes beyond that to reach into the fregs that follow. But now that we have anonymous unions, we can reduce the nested names and have sregs cover all of these registers.
2021-11-06sim: mips: use sim_fpu_to{32,64}u to fix build warningsTiezhu Yang2-7/+4
Since the first argument type is unsigned32 or unsigned64, just use sim_fpu_to{32,64}u instead of sim_fpu_to{32,64}i to fix the following build warnings: CC cp1.o .../sim/mips/cp1.c: In function 'convert': .../sim/mips/cp1.c:1425:32: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign] status |= sim_fpu_to32i (&result32, &wop, round); ^~~~~~~~~ In file included from .../sim/mips/sim-main.h:67, from .../sim/mips/cp1.c:46: .../sim/mips/../common/sim-fpu.h:270:22: note: expected 'signed32 *' {aka 'int *'} but argument is of type 'unsigned32 *' {aka 'unsigned int *'} INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f, ^~~~~~~~~~~~~ .../sim/mips/cp1.c:1429:32: warning: pointer targets in passing argument 1 of 'sim_fpu_to64i' differ in signedness [-Wpointer-sign] status |= sim_fpu_to64i (&result64, &wop, round); ^~~~~~~~~ In file included from .../sim/mips/sim-main.h:67, from .../sim/mips/cp1.c:46: .../sim/mips/../common/sim-fpu.h:274:22: note: expected 'signed64 *' {aka 'long int *'} but argument is of type 'unsigned64 *' {aka 'long unsigned int *'} INLINE_SIM_FPU (int) sim_fpu_to64i (signed64 *i, const sim_fpu *f, ^~~~~~~~~~~~~ .../sim/mips/cp1.c: In function 'convert_ps': .../sim/mips/cp1.c:1528:34: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign] status_u |= sim_fpu_to32i (&res_u, &wop_u, round); ^~~~~~ In file included from .../sim/mips/sim-main.h:67, from .../sim/mips/cp1.c:46: .../sim/mips/../common/sim-fpu.h:270:22: note: expected 'signed32 *' {aka 'int *'} but argument is of type 'unsigned32 *' {aka 'unsigned int *'} INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f, ^~~~~~~~~~~~~ .../sim/mips/cp1.c:1529:34: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign] status_l |= sim_fpu_to32i (&res_l, &wop_l, round); ^~~~~~ In file included from .../sim/mips/sim-main.h:67, from .../sim/mips/cp1.c:46: .../sim/mips/../common/sim-fpu.h:270:22: note: expected 'signed32 *' {aka 'int *'} but argument is of type 'unsigned32 *' {aka 'unsigned int *'} INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f, ^~~~~~~~~~~~~ Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>