aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2021-05-08sim: h8300: clean up various warningsMike Frysinger4-8/+21
A random grab bag of minor fixes to enable -Werror for this port. Disable h8_set_macS for now as it's unused. Initialize trace & intMask before using them. Mark local set_h8300h function static.
2021-05-08sim: touch modules targetMike Frysinger2-0/+5
If there are no updates to the file, touch the result so we don't keep trying to regenerate it.
2021-05-08sim: cgen: tweak trace formatMike Frysinger2-1/+5
Fixes build warnings when the address size isn't an integer.
2021-05-08sim: cgen: namespace mode_names a bitMike Frysinger3-3/+11
These are exported in the library linkage, so add a cgen_ prefix.
2021-05-08sim: cgen: tweak cgen_rtx_error to fix warningsMike Frysinger3-1/+8
The function was missing a prototype, and passing a constant string as the format string instead of going through a %s format.
2021-05-08sim: cgen: tweak initializers to avoid warningsMike Frysinger2-6/+10
Use {} instead of {0} to avoid warnings: common/cgen-utils.c:59:1: warning: missing braces around initializer [-Wmissing-braces] 59 | { | ^ 60 | { 61 | VIRTUAL_INSN_X_INVALID, "--invalid--", NULL, 0, { V, { 0 } } | {{}} Generated code should be the same.
2021-05-08sim: add html & pdf stubsMike Frysinger2-0/+13
We stub out the info targets already since we don't provide any.
2021-05-08sim: use htab_eq_stringTom Tromey2-9/+6
This changes the sim to use htab_eq_string from libiberty. sim/common/ChangeLog 2021-05-08 Tom Tromey <tom@tromey.com> * sim-options.c (compare_strings): Remove. (dup_arg_p): Use htab_eq_string.
2021-05-07sim: m68hc11: fix up cycle buffer printingMike Frysinger2-5/+8
Make sure the local static buffer is large enough, and simplify the sprintf for merging the fields all into one. This fixes compiler warnings from buf possibly being overflowed.
2021-05-07sim: Add bfd include path for common testsuite toolsDimitar Dimitrov4-2/+12
On a host without installed libbfd, this patch fixes the following "make check-sim" errors for both pru cross target, and native x86_64: In file included from ../../../binutils/sim/common/sim-basics.h:131, from testsuite/common/bits32m0.c:13:../../../binutils/sim/../include/gdb/callback.h:55:10: fatal error: bfd.h: No such file or directory 55 | #include "bfd.h" | ^~~~~~~ Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2021-05-07sim: m32c: clean up various warningsMike Frysinger5-21/+41
A random grab bag of minor fixes to enable -Werror for this port. Check the return values of read & write calls and issue warnings when they fail. Fixup funky pointer math as the compiler doesn't like ++ on void*. Handle short reads with fread().
2021-05-07sim: m32c: fix warnings about mixing code & declsMike Frysinger3-1/+31
Add scope braces to a bunch of the generated sections to avoid compiler warnings about mixing code & variable declarations.
2021-05-07sim: m32c: switch from custom fgets to getlineMike Frysinger5-105/+17
No need to implement this ourselves when POSIX has a nice API.
2021-05-06sim: m68hc11: fix up last warningsMike Frysinger4-105/+113
Change the printf formats a little to fix the last build warnings in here, and then turn on -Werror by default for the arch port.
2021-05-06sim: m68hc11: warn when emul_write failsMike Frysinger2-2/+10
Not sure what we should do here when this fails, so just emit a warning for now to satisfy unused result compiler warnings. We can see if any users actually notice here.
2021-05-06sim: h8300 special case testYoshinori Sato4-2/+37
In "mov. [bwl] reg, @ -reg", added a special case test using the same register.
2021-05-05sim: m32c/rl78/rx: fix command parsingMike Frysinger6-80/+59
Use buildargv to avoid writing to const memory and freeing invalid pointers, and to avoid doing any string parsing ourselves.
2021-05-04sim: rl78: clean up various warningsMike Frysinger9-17/+34
A random grab bag of minor fixes to enable -Werror for this port. Fix local prototypes for a bunch of functions (e.g. adding static). Add missing includes for missing prototypes. Move local variable decls from the middle of functions to the top of the scope. Fix a logic error when processing commands where p was reassigned to cmd and then has its leading whitespace scanned a 2nd time. Handle short reads with fread().
2021-05-04sim: m68hc11: tweak types to fix warningsMike Frysinger3-2/+7
The hw attach API wants unsigned addresses. The write API wants signed chars.
2021-05-04sim: mips: include stdlib.h for memory prototypesMike Frysinger2-0/+5
This file uses free() and friends, so include it to fix missing prototype warnings.
2021-05-04sim: mips: always enable device modelsMike Frysinger3-18/+8
There's no need to restrict these to only specific targets as the user can select them at runtime if they want them. Always build them so we can improve build coverage too.
2021-05-04sim: mips: delete unused constant variablesMike Frysinger4-29/+10
Since these never change, inline and delete them.
2021-05-04sim: mcore: fix build time warningsMike Frysinger4-3/+11
Once we fix a minor const warning we can enable -Werror in here.
2021-05-04sim: remove sys/times.h in most placesMike Frysinger6-3/+12
The v850 port used this, and then it got copied to other ports even though it wasn't needed. Clean it up to avoid portability issues on platforms not providing this (e.g. mingw64 for Windows).
2021-05-04sim: mips: fix qh_acc tableMike Frysinger2-1/+5
The AccAddLQH func was unused, and looking at this table, it looks like it's due to a typo.
2021-05-04sim: hw: localize init callbackMike Frysinger4-14/+13
Now that we don't need to hardcode the module init list in a single place, move the hw init logic out to the sim-hw file.
2021-05-04sim: microblaze: enable some basic trace pointsMike Frysinger3-0/+9
This isn't super complete, but it's useful enough as-is.
2021-05-04sim: microblaze: hook up libgloss syscallsMike Frysinger6-4/+54
When in the virtual environment, have brki 8 trigger libgloss syscalls like other ports. This also matches the ABI that Linux uses for its syscalls (ignoring the syscall table differences).
2021-05-04Add missing stdlib.h includes to simTom Tromey10-0/+26
This updates the various "mloop.in" files to emit an include of stdlib.h, to avoid warnings about 'abort' being undeclared. One such warning now remains, in mn10300.igen. I don't know offhand the best way to fix this one. 2021-05-04 Tom Tromey <tromey@adacore.com> * mloop.in: Include <stdlib.h>. sim/iq2000/ChangeLog 2021-05-04 Tom Tromey <tromey@adacore.com> * mloop.in: Include <stdlib.h>. sim/lm32/ChangeLog 2021-05-04 Tom Tromey <tromey@adacore.com> * mloop.in: Include <stdlib.h>. sim/m32r/ChangeLog 2021-05-04 Tom Tromey <tromey@adacore.com> * mloop.in: Include <stdlib.h>. sim/or1k/ChangeLog 2021-05-04 Tom Tromey <tromey@adacore.com> * mloop.in: Include <stdlib.h>.
2021-05-04Fix igen buildTom Tromey3-0/+8
The igen build fails for me like: gcc -g -O2 -c ../../binutils-gdb/sim/igen/igen.c -o igen/igen.o In file included from ../../binutils-gdb/sim/igen/igen.c:26: ../../binutils-gdb/sim/igen/lf.h:22:10: fatal error: ansidecl.h: No such file or directory This patch fixes the problem by arranging for igen to find the libiberty includes. This seems slightly hacky to me, because libiberty is not a "build" library, so it can't be linked against. However, since igen currently only includes the header, it seems relatively safe. 2021-05-04 Tom Tromey <tromey@adacore.com> * Makefile.in: Rebuild. * Makefile.am (AM_CPPFLAGS): New variable.
2021-05-04Add config.h to generated_files for simTom Tromey2-0/+5
I noticed that config.h isn't in 'generated_files' in the sim subdirectories. This causes it to sometimes be rebuilt too late. 2021-05-04 Tom Tromey <tromey@adacore.com> * Make-common.in (generated_files): Add config.h.
2021-05-04sim: add support for build-time ar & ranlibMike Frysinger68-66/+476
This is needed when building for a target whose ar & ranlib are incompatible with the current build system. For example, building for Windows on a Linux system. Then manually import the automake rule for libigen.a, but tweak the tool variables to use the FOR_BUILD variants.
2021-05-04sim: clean up bfd_vma printingMike Frysinger18-42/+79
A lot of this code predates the bfd_vma format define, so we have a random mix of casts to known types so we can printf the value. Use the BFD_VMA_FMT that now exists to simplify and reliability output across different build configs.
2021-05-03sim: add ATTRIBUTE_PRINTF / ATTRIBUTE_NULL_PRINTF where necessarySimon Marchi17-21/+50
I finally got the all-targets sim building with Clang, these are all the instances where an ATTRIBUTE_PRINTF or ATTRIBUTE_NULL_PRINTF attribute needed to be added to avoid errors like: /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-profile.c:464:19: error: format string is not a string literal [-Werror,-Wformat-nonliteral] vfprintf (fp, fmt, ap); ^~~ There are more fixes needed to get everything building, but adding these attributes is trivial enough, so I send them all in a single patch. Adding the format attributes introduces some format string errors when building with GCC (because now format strings are checked), so corresponding changes are needed to avoid breaking the build. Other than simple format string specified changes, there is this one: /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c: In function 'hw_event_queue_schedule': /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c:95:15: error: too many arguments for format [-Werror=format-extra-args] 95 | NULL, dummy); | ^~~~~ We can fix it and avoid using a dummy variable by simply calling hw_event_queue_schedule_tracef instead of hw_event_queue_schedule_vtracef. sim/arm/ChangeLog: * armdefs.h (ARMul_ConsolePrint): Use format attribute. * wrapper.c (op_printf): Likewise. sim/bfin/ChangeLog: * interp.c (sim_open): Adjust format string specifier. sim/common/ChangeLog: * hw-events.h (hw_event_queue_schedule_tracef): Use format attribute. (hw_event_queue_schedule_vtracef): Likewise. * hw-tree.h (hw_tree_vparse): Likewise. * sim-profile.c (profile_vprintf): Likewise. * sim-trace.c (dis_printf): Likewise. * sim-trace.h (trace_printf): Likewise. (trace_vprintf): Likewise. * sim-utils.h (sim_do_commandf): Likewise. * hw-events.c (hw_event_queue_schedule): Use hw_event_queue_schedule_tracef. sim/rx/ChangeLog: * trace.c (op_printf): Likewise. sim/v850/ChangeLog: * interp.c (sim_open): Adjust format string specifier. Change-Id: I1445115ce57db15bb8e35dca93014555e7555794
2021-05-02sim: add default cases to two switches in sim-options.cSimon Marchi2-0/+7
This is the next compilation error I hit when I build all targets with Clang: /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-options.c:234:12: error: no case matching constant switch condition '0' [-Werror] switch (WITH_ENVIRONMENT) ^~~~~~~~~~~~~~~~ ./config.h:215:26: note: expanded from macro 'WITH_ENVIRONMENT' #define WITH_ENVIRONMENT ALL_ENVIRONMENT ^~~~~~~~~~~~~~~ /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-options.c:276:15: error: no case matching constant switch condition '0' [-Werror] switch (WITH_ALIGNMENT) ^~~~~~~~~~~~~~ /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-config.h:220:24: note: expanded from macro 'WITH_ALIGNMENT' #define WITH_ALIGNMENT 0 ^ This is a little bit special because these are switches on compile-time value. But regardless, the idea is that we logically can't reach the switches if WITH_ENVIRONMENT == 0 or WITH_ALIGNMENT == 0, so the code is correct. In addition to getting rid of the compiler warning, adding default cases to these switches ensure that if we do get in an unexpected situation, it is caught. In GDB, I'd use gdb_assert_not_reached, I don't know if there is something similar in sim so I went with abort. sim/common/ChangeLog: * sim-options.c (standard_option_handler): Add default cases to switches. Change-Id: Ie237d67a201caa6b72de0d17cc815193417156b6
2021-05-02sim: replace custom attributes with ansidecl.hMike Frysinger20-63/+79
A lot of this code predates the common attributes. We had already started migrating over piece by piece, so just do a pass across all the attributes and replace most of them.
2021-05-01sim: bfin: move option inits to respective modulesMike Frysinger4-13/+30
Now that modules can self declare their own init funcs, change the mmu and mach logic to use it. We don't need to export the option symbols or specifically call this logic from the sim_open function anymore.
2021-05-01sim: options: fix --help outputMike Frysinger2-0/+5
The hash table rewrite broke --help output due to subtle behavior: calling dup_arg_p(NULL) will create & clear the table, not just create it. The --help output relies on this to clear the table before it shows things.
2021-05-01sim: dv-sockser: localize init callbackMike Frysinger4-12/+12
Now that we don't need to hardcode the module init list in a single place, move the dv-sockser logic to the place to the one file.
2021-05-01sim: mips: mark local func staticMike Frysinger2-1/+5
2021-05-01sim: add framework for declaring init callbacks locallyMike Frysinger4-16/+74
To facilitate decentralized module initialization/registration with an eye towards multi-target support, add a framework to detect init calls declared in the source and automatically call them. This is akin to gdb's _initialize_xxx framework for letting modules autodiscover.
2021-05-01sim: nrun: add local strsignal prototypeMike Frysinger97-62/+386
While libiberty provides a definition for this for systems that lack the function (e.g. Windows), it doesn't provide a prototype. So add our own local copy in the one file that uses the func.
2021-05-01sim: rx: cast bfd_vma when printingMike Frysinger2-1/+5
A bit of a hack, but it's what we've been doing so far when printing bfd_vma's since bfd doesn't provide PRI helper types for us to use.
2021-05-01sim: riscv: fix building on 32-bit hosts w/out int128Mike Frysinger2-1/+5
Check for __SIZEOF_INT128__ before trying to use the builtin type. This fixes building on some 32-bit systems like x86.
2021-05-01sim: aarch64: use PRIx64 for formatting 64-bit typesMike Frysinger2-5/+12
We can't assume that %lx is big enough for 64-bit types as it isn't on most 32-bit builds. Use the standard format define for this instead.
2021-05-01sim: aarch64: fix 64-bit immediate shiftsMike Frysinger2-2/+6
Trying to shift immediates 63 bits fails on 32-bit systems since UL is only 32-bits, not 64-bits. Switch to ULL to guarantee at least 64-bits here.
2021-05-01sim: arm: move build logic to source filesMike Frysinger3-9/+25
This simplifies the build logic a bit by just having source file inputs. It also simplifies code that assumes there's a source file for each object.
2021-05-01sim: callback: inline wrap helperMike Frysinger2-25/+66
This is annoying as it requires inlining boiler plate, but we don't have much choice: the wrap helper assumes the return value is always an int, but that's already not the case with some of the callbacks which use long. GCC has extensions to define macros-as-functions, but we can't assume GCC.
2021-04-26sim: riscv: switch MIN/MAX to common min/maxMike Frysinger2-7/+9
The common sim-basics.h defines min/max already, so use them.
2021-04-26sim: nltvals: unify common syscall tablesMike Frysinger29-508/+117
Since libgloss provides a default syscall table for arches, use that to provide the default syscall table for ports. Only the exceptions need to be enumerated now with the common logic as the default.