aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2024-01-29Update version number to 2.42binutils-2_42Nick Clifton1-2/+2
2024-01-12sim: Fix compile errorsDimitar Dimitrov3-12/+12
The following change broke simulator testsuite with host GCC 13: commit 435ad222b3de93fa647fba7221eece36b1b395eb sim: warnings: compile build tools with -Werror too Host GCC13 complains about missing function prototypes: binutils/sim/testsuite/common/bits-gen.c:26:1: error: no previous prototype for ‘gen_struct’ [-Werror=missing-prototypes] 26 | gen_struct (void) | ^~~~~~~~~~ Fix by making the functions static, which instructs the compiler that there is no need for a prototype. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess671-673/+673
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2024-01-11sim: ppc: return register error when unhandledMike Frysinger1-4/+2
We don't want to fallthru and use cooked_buf when we haven't initialized it to anything. Returning 0 indicates the register wasn't recognized.
2024-01-10sim: m32r: enable warnings in traps.cMike Frysinger2-4/+0
File should be clean now!
2024-01-10sim: m32r: fixup some of the int<->pointer castsMike Frysinger4-31/+94
The m32r trap code was written for a 32-bit Linux host (and really, one whose Linux ABI matched pretty exactly). This has lead to conversions between integers and pointers which breaks down hard on 64-bit hosts. Clean up some of the functions where possible to avoid unnecessary conversions, use uintptr_t to cast 32-bit target pointers to host pointers in some places, and just stub out a few functions that can't easily be salvaged currently when sizeof(void*) is not 32-bits. This is a bit ugly, but lets us enable warnings for the whole file.
2024-01-10sim: m32r: fix missing break statementMike Frysinger1-0/+1
The ftime syscall should not fallthrough to the sync syscall. Clearly the code was missing a break statement.
2024-01-10sim: m32r: migrate ftime() to clock_gettime()Mike Frysinger1-5/+8
The ftime() function has been deprecated since POSIX-1-2004, and removed in POSIX.1-2008. It's also been deprecated/removed in glibc since 2.33. POSIX has always said the function is not portable, and its return value, timezone, and dstflag fields are unspecified. Even if Linux/glibc & m32r had defined behavior, those aren't the host for the sim runtime. So let's stop using the function and switch to clock_gettime. gnulib already has detection support for it, and it's been around since at least POSIX-1-2004.
2024-01-10sim: m32r: cleanup unused variablesMike Frysinger1-3/+1
We've been building this file with -Wno-error, so clean up unused variable warnings.
2024-01-10sim: igen: add printf attributes to the prototypes tooMike Frysinger1-4/+4
While gcc propagates the printf attribute via the typedef, clang doesn't seem to, so add it to the prototypes themselves too. We still keep it on the prototype for cases where it's used as a variable.
2024-01-10gdbsupport: tighten up libiberty code a bit with dnlMike Frysinger1-4/+1
No functional change here, just touch up generated output slightly. Approved-By: Tom Tromey <tom@tromey.com>
2024-01-10sim: build: switch to gdbsupport/libiberty.m4Mike Frysinger5-13/+411
Leverage this common logic to find all the libiberty settings rather than duplicate it ourselves.
2024-01-10sim: ppc: rework defines.h to handle HAVE symbols defined to 0Mike Frysinger2-2/+2
The HAVE_DECL_xxx defines are always defined to 0 or 1. The current defines.h logic assumes every HAVE_xxx symbol is only defined iff it's defined to 1 which causes this to break. Tweak the sed logic to only match defines of 1.
2024-01-08sim: warnings: compile build tools with -Werror tooMike Frysinger4-5/+100
Add support for compiling build tools with various -Werror settings. Since the tools don't compile cleanly with the same set of flags as the rest of the sim code, we need to maintain & test a separate list. Only bother when not cross-compiling so we don't have to test all the flags against the build compiler. This should be good enough for our actual development flows.
2024-01-08sim: igen: fix format-zero-length warningsMike Frysinger1-3/+7
Fix warnings from calling printf functions with "" which normally is useless.
2024-01-08sim: m68hc11: gencode: add printf markingsMike Frysinger1-0/+2
2024-01-08sim: m32c: fix declaration-after-statement warningsMike Frysinger1-2/+3
2024-01-08sim: warnings: fix unused variable warningsMike Frysinger3-76/+7
Leave the igen code in place as it's meant to be used with newer (to-be-written) code ported from the ppc version. The sh code isn't really necessary as the opcodes enums have been maintained independently from here, and the lists are out-of-sync already.
2024-01-08sim: warnings: mark local funcs/vars as staticMike Frysinger2-49/+35
These are only used in the respective files, so mark them as static. This fixes missing prototype warnings at build time.
2024-01-08sim: build: clean more generated outputsMike Frysinger10-125/+147
2024-01-08sim: mips: drop old clean workaroundMike Frysinger2-4/+1
This logic dates back to the original import, and seems to be for handling systems where `rm -f` (i.e. no files) would error out. None of that is relevant for us with current automake, so drop it.
2024-01-08sim: ppc: workaround uninitialized variable compiler warningsMike Frysinger1-2/+2
Some compilers don't understand the semctl API and think it's an input argument even when it's used as an output, and then complains that it is being used uninitialized. Zero it out explicitly to workaround it. This adds some runtime overhead, but should be fairly minor as it's a small stack buffer, and shouldn't be that relevant relative to all the other logic in these functions.
2024-01-08sim: warnings: enable -Wshift-negative-valueMike Frysinger2-0/+2
Now that all the relevant sources are fixed, enable the warning.
2024-01-08sim: sh: avoid left shifting negative valuesMike Frysinger1-2/+2
We just want to create a bitmask here, so cast the mask to unsigned to avoid left shifting a negative value which is undefined behavior.
2024-01-08sim: bfin: avoid left shifting negative valuesMike Frysinger1-2/+2
We just want to create a bitmask here, so cast the mask to unsigned to avoid left shifting a negative value which is undefined behavior.
2024-01-08sim: cgen: rework DI macros to avoid signed left shiftsMike Frysinger1-3/+3
The cgen code uses DI as int64_t and UDI as uint64_t. The DI macros are used to construct 64-bit values from 32-bit values (for the low and high parts). The MAKEDI macro casts the high 32-bit value to a signed 32-bit value before shifting. If this created a negative value, this would be undefined behavior according to the C standard. All we care about is shifting the 32-bits as they are to the high 32-bits, not caring about sign extension (since there's nothing left to shift into), and the low 32-bits being empty. This is what we get from shifting an unsigned value, so cast it to unsigned 32-bit to avoid undefined behavior. While we're here, change the SETLODI macro to truncate the lower value to 32-bits before we set it. If it was passing in a 64-bit value, those high bits would get included too, and that's not what we want. Similarly, tweak the SETHIDI macro to cast the value to an unsigned 64-bit instead of a signed 64-bit. If the value was only 32-bits, the behavior would be the same. If it happened to be signed 64-bit, it would trigger the undefined behavior too.
2024-01-06sim: warnings: enable -Wshadow=localMike Frysinger2-1/+2
This brings us in sync with current set of gdb warnings (for C).
2024-01-06sim: cris: change temp var name slightly to avoid shadowingMike Frysinger2-48/+48
Rename the temp var to avoid shadowing another one: .../sim/cris/semcrisv10f-switch.c:11032:22: error: declaration of ‘tmp_tmpb’ shadows a previous local [-Werror=shadow=compatible-local] 11032 | tmp_tmpb = ({ SI tmp_tmpb; | ^~~~~~~~ .../sim/cris/semcrisv10f-switch.c:11031:24: note: shadowed declaration is here 11031 | tmp_tmpres = ({ SI tmp_tmpb; | ^~~~~~~~
2024-01-06sim: cris: add error fallbacks when decoding condition & swap codesMike Frysinger2-0/+24
The condition & swap code decoder only checks known bits and sets based on that. If the variable is out of range, it ends up returning uninitialized data. Turn that case into a hard error. This fixes build warnings like: sim/cris/semcrisv10f-switch.c:13115:11: error: variable 'tmp_condres' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
2024-01-03sim: ppc: unify igen filter modulesMike Frysinger11-190/+67
The common igen code was forked from the ppc long ago. The filter module is still pretty similar in API, so we can unfork them with a little bit of effort. The filter.c module is still here because of the unique it_is API. The common igen code doesn't seem to have an equiv API as this only operates on two strings and not an actual filter object, and it's easy enough to leave behind to unfork the rest.
2024-01-03sim: ppc: unify igen line number output modulesMike Frysinger13-670/+154
The common igen code was forked from the ppc long ago. The lf module is still pretty similar in API, so we can unfork them with a little bit of effort. Some of the generated ppc code is now slightly different, but that's because of fixes the common igen code has gained, but not the ppc igen code (e.g. fixing of #line numbers). The ppc code retains lf_print__c_code because the common igen code rewrote the logic to a new table.c API. Let's delay that in the ppc code to at least unfork all this code.
2024-01-03sim: igen: clean up headers a bitMike Frysinger17-8/+73
Add standard multiple inclusion protection, and add a few missing local includes when one header uses another. This isn't complete, but fixes some short comings seen when merging the ppc igen.
2024-01-03sim: ppc: switch to common endian codeMike Frysinger5-440/+0
The common sim-endian is a forked & updated version of the ppc code. Fortunately, they didn't diverge from the basic APIs, so they are still compatible, which means we can just delete the ppc version now that the build env is merged at the top-level.
2024-01-03sim: common: include sim-types.h in the endian header directlyMike Frysinger1-0/+2
This is a bit redundant for most ports as they go through sim-basics.h which always includes sim-types.h before including sim-endian.h, but in order to unify ppc's sim-endian code, we need this include here. Plus, it's the directly we generally want to go to get away from one header that defines all APIs and causes hard to untangle dependencies.
2024-01-03sim: ppc: rename local ALU SIGNED64 macrosMike Frysinger1-6/+6
The common/ code has macros with the same name but different behavior: it's for declaring integer constants as 64-bit, not for casting them. Rename ppc's local variant since it's only used in this file in order to avoid conflicts.
2024-01-03sim: ppc: sync WITH_TARGET_{ADDRESS,CELL}_BITSIZE with common/Mike Frysinger1-0/+8
This will make it easier to share common/ code that rely on these additional defines.
2024-01-03sim: cr16: cleanup unused variable compiler warningsMike Frysinger1-5/+3
2024-01-03sim: configure: switch to m4_mapMike Frysinger2-91/+63
Minor reduction in boilerplate here. No real functional changes.
2024-01-03sim: drop support for recursive makes entirelyMike Frysinger4-112/+4
Now that all ports have been merged to the top-level, we no longer need this framework to pass settings down to sub-makefiles. Delete it all.
2024-01-03sim: ppc: hoist compilation up to top-levelMike Frysinger5-602/+16
This removes all recursive makes from the ppc port.
2024-01-03sim: drop support for automatic subdir recursionMike Frysinger4-131/+44
No port relies on this anymore, so we can scrub it all.
2024-01-03sim: ppc: move libsim.a creation to top-levelMike Frysinger5-35/+141
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. It adds some overhead, so it's not great, but it shouldn't be a big deal. This will go away once compilation is hoisted up.
2024-01-03sim: ppc: move main.o compilation to top-levelMike Frysinger3-22/+33
2024-01-02sim: ppc: hoist pk.h creation to top-levelMike Frysinger4-35/+50
2024-01-02sim: ppc: hoist hw.[ch] creation to top-levelMike Frysinger3-47/+85
2024-01-02sim: ppc: hoist igen execution to top-levelMike Frysinger4-88/+153
Invoke ppc's igen from the top-level like we do for all other ports.
2024-01-02sim: ppc: merge configure logic into top-levelMike Frysinger7-3418/+457
Now that the ppc configure script is just namespaced options, we can move it to ppc/acinclude.m4 and include it directly in the top-level configure script and kill off the last subdir configure script.
2024-01-02sim: ppc: scope configure options to --enable-sim-ppc-xxxMike Frysinger3-395/+398
To prepare for moving these into the top-level configure, namespace then with the port name like we do with all other ports.
2024-01-02sim: ppc: standardize configure option processingMike Frysinger2-248/+161
Switch from ad-hoc $silent checks & echo calls to standard AC_MSG_CHECKING & AC_MSG_RESULT calls. Also delete pointless variable setting after calling AC_MSG_ERROR.
2024-01-02sim: ppc: switch to AS_HELP_STRING for automatic formattingMike Frysinger2-36/+51