aboutsummaryrefslogtreecommitdiff
path: root/sim/igen
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess36-36/+36
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-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-08sim: igen: fix format-zero-length warningsMike Frysinger1-3/+7
Fix warnings from calling printf functions with "" which normally is useless.
2024-01-08sim: warnings: fix unused variable warningsMike Frysinger2-6/+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-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-01sim: igen: extend error to take argumentsMike Frysinger1-2/+2
The ppc igen error helper allows arbitrary printf calls, so extend the common one to do the same.
2024-01-01sim: igen: minor constify logicMike Frysinger1-2/+2
Copy some improvements from the ppc igen code.
2024-01-01sim: igen: remove libigen.a when cleaningMike Frysinger1-2/+2
2023-12-14sim: igen: do not reindent literal semantics outputMike Frysinger1-2/+9
When generating semantics.c from .igen source files, indenting the code makes it more readable, but confuses compiler diagnostics. The latter is a bit more important than the former, so bias towards that. For example, with an introduced error, we can see w/gcc-13: (before this change) CC mn10300/semantics.o ../../../sim/mn10300/am33-2.igen: In function ‘semantic_dcpf_D1a’: ../../../sim/mn10300/am33-2.igen:11:5: error: ‘srcreg’ undeclared (first use in this function) 11 | srcreg = translate_rreg (SD_, RN2); | ^~~~~~ (with this change) CC mn10300/semantics.o ../../../sim/mn10300/am33-2.igen: In function ‘semantic_dcpf_D1a’: ../../../sim/mn10300/am33-2.igen:11:3: error: ‘srcreg’ undeclared (first use in this function) 11 | srcreg = translate_rreg (SD_, RN2); | ^~~~~~
2023-01-15sim: igen: simplify build logic a littleMike Frysinger1-1/+1
Now that all ports (that use igen) build in the top-level and depend on igen, we can move the conditional logic out of configure. We also switch from noinst_LIBRARIES to EXTRA_LIBRARIES so that the library is only built when needed (i.e. the igen tool is used).
2023-01-14sim: igen: simplify build depMike Frysinger1-4/+0
Now that all ports (other than ppc) build in the top-level, we don't need to mark the igen tool as a recursive dep. Each port depends on the tool if it actually uses it, and ppc doesn't use it at all.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker36-36/+36
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.
2022-12-25sim: smp: plumb igen flag down to all usersMike Frysinger1-1/+1
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.
2022-12-24sim: igen: support in-place updates ourselfMike Frysinger1-7/+72
Every file that igen outputs is then processed with the move-if-changed shell script. This creates a lot of boilerplate in the build and not an insignificant amount of build-time overhead. Move the simple "is the file changed" logic into igen itself.
2022-12-24sim: igen: constify itable data structuresMike Frysinger1-16/+18
These are const data arrays of strings and numbers. We don't want or need them to be writable, so mark them all const.
2022-11-11sim: igen: cleanup archaic pointer-to-long printf castsMike Frysinger4-53/+49
Use proper %p to printf a pointer instead of casting it to long and using 0x%lx. It's cleaner, more correct, and doesn't break on LLP64.
2022-11-11sim: igen: fix hang when decoding boolean rule constantsMike Frysinger1-0/+2
The parser for boolean rules fails to skip over the , separator in the options which makes it hang forever. No dc files in the tree use boolean rules atm which is why no one noticed.
2022-11-11sim: igen: mark error func as noreturn since it exitsMike Frysinger1-1/+1
2022-11-11sim: igen: mark output funcs with printf attributeMike Frysinger2-7/+4
... and fix the legitimate bug that it catches.
2022-11-11sim: igen: constify various func argumentsMike Frysinger31-265/+380
2022-11-10sim: igen: add missing newline to various error messagesMike Frysinger5-6/+6
The error() function expects a trailing newline in its message. Most callers do this already, so adding it to the few that don't.
2022-10-29sim, sim/{m32c,ppc,rl78}: Use getopt_longTsukasa OI1-2/+4
Because of a Libiberty hack, getopt on GNU libc (2.25 or earlier) is currently unusable on sim, causing a regression on CentOS 7. This is caused as follows: 1. If HAVE_DECL_GETOPT is defined (getopt declaration with known prototype is detected while configuration), a declaration of getopt in "include/getopt.h" is suppressed. The author started to define HAVE_DECL_GETOPT in sim with the commit 340aa4f6872c ("sim: Check known getopt definition existence"). 2. GNU libc (2.25 or earlier)'s <unistd.h> includes <getopt.h> with a special purpose macro defined to declare only getopt function but due to include path (not tested while configuration), it causes <unistd.h> to include Libiberty's "include/getopt.h". 3. If both 1. and 2. are satisfied, despite that <unistd.h> tries to declare getopt by including <getopt.h>, "include/getopt.h" does not do so, causing getopt function undeclared. Getting rid of "include/getopt.h" (e.g. renaming this header file) is the best solution to avoid hacking but as a short-term solution, this commit replaces getopt with getopt_long under sim/.
2022-01-06sim: igen: migrate to standard uintXX_t typesMike Frysinger6-27/+9
Move off the custom local 64-bit types and to the standard uintXX_t types that C11 provides.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker36-36/+36
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-12-09sim: use ## for automake commentsMike Frysinger1-22/+22
The ## marker tells automake to not include the comment in its generated output, so use that in most places where the comment only makes sense in the inputs.
2021-11-02sim: hoist mn10300 & v850 igen rules up to common buildsMike Frysinger1-3/+8
These rules don't depend on the target compiler settings, so hoist the build logic up to the common builds for better parallelization. We leave the mips rules in place as they depend on complicated arch-specific configure logic that needs to be untangled first.
2021-10-31sim: igen: tighten up build outputMike Frysinger1-0/+2
Add a new stamp helper for quiet builds, and don't dump the command line options when it runs. That isn't standard tool behavior, and doesn't really seem necessary in any way.
2021-08-17sim: rename ChangeLog files to ChangeLog-2021Mike Frysinger1-0/+0
Now that ChangeLog entries are no longer used for sim patches, this commit renames all relevant sim ChangeLog to ChangeLog-2021, similar to what we would do in the context of the "Start of New Year" procedure. The purpose of this change is to avoid people merging ChangeLog entries by mistake when applying existing commits that they are currently working on. Also throw in a .gitignore entry to keep people from adding new ChangeLog files anywhere in the sim tree.
2021-06-09sim: cleanup obsolete NULL fallbackMike Frysinger5-17/+7
We require C11 which defines NULL, so drop the inconsistent set of fallback defines in the codebase.
2021-06-05sim: common: start dedicated local.mkMike Frysinger2-1/+6
This provides a space to generate things that we only need to build once per-arch. Some day that will be all of common/, but for now, we move the version.c management in.
2021-05-04sim: add support for build-time ar & ranlibMike Frysinger2-0/+10
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-02sim: replace custom attributes with ansidecl.hMike Frysinger2-2/+7
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-04-02sim: igen: merge build into top levelMike Frysinger6-5446/+94
This simplifies the build a bit (especially for deps in port subdirs), and avoids recursive make. This in turn speeds up the build, and sets us up for multi-target.
2021-04-02sim: unify toolchain settingsMike Frysinger4-242/+1425
The toplevel, common, and igen dirs all have their own code for setting up toolchain settings. Unify all of that in a new macro.
2021-03-13sim: rename BUILD_LDFLAGS to LDFLAGS_FOR_BUILDMike Frysinger4-2/+17
The rest of the binutils tree renamed this variable many years ago.
2021-03-13sim: introduce {COMPILE,LINK}_FOR_BUILDMike Frysinger2-9/+19
These use the same pattern as seen in the opcodes/ dir and in automake in general (ish). This helps simplify the boilerplate for building and linking build-time code, and fixes some inconsistency in flag usage. For rules that were compiling+linking in a single step, split them into separate steps so we can apply the correct set of options. This matches automake behavior too.
2021-03-08sim: delete unused BUILD_LIBS settingMike Frysinger2-6/+11
This hasn't been initialized anywhere for years. It used to be for passing in the path to libiberty, but that stopped happening long ago. Delete it to simplify the build logic.
2021-03-07sim: igen: update options APIMike Frysinger4-3/+9
This local macro doesn't take any args, so adjust the API to match. No one really noticed as this is behind code that is not normally built, only when a dev specifically tries to compile it.
2021-03-07sim: switch top level to automakeMike Frysinger2-0/+5
This doesn't gain us much by itself, but it sets us up for using more features as we try to unify ports and avoid recursive make.
2021-02-28sim: igen: drop config.h & header checkingMike Frysinger12-1125/+58
While the configure script was checking for a bunch of headers, only one of them was conditionally included in the source (unistd.h). The rest were always included. Based on those usage this whole time, we can reasonably assume that the build also has unistd.h. All the other files including config.h never actually used any defines from the header.
2021-02-28sim: igen: delete more unused toolchain settingsMike Frysinger4-122/+7
This package doesn't build any archives or install programs.
2021-02-28sim: igen: delete unused FOR_BUILD varsMike Frysinger4-24/+7
2021-02-21sim: common: split up acinclude.m4 into individual m4 filesMike Frysinger3-16/+7
This file is quite large and is getting unmanageable. Split it apart to follow aclocal best practices by putting one-macro-per-file. There shouldn't be any real functional changes here as can be seen in the configure script regens.
2021-02-13sim: switch to AC_CONFIG_MACRO_DIRSMike Frysinger3-1813/+20
Rather than hand maintain m4 includes in various autotool files, use AC_CONFIG_MACRO_DIRS to declare the relevant search paths. This simplifies the code, makes it more robust, and cleans out unused logic from configure.
2021-02-06sim: add ChangeLog entries for last commitsMike Frysinger1-0/+7
2021-02-06sim: igen: drop libiberty linkageMike Frysinger3-10/+1
This dir doesn't use anything from libiberty, so drop the linkage.
2021-02-06sim: drop use of bfd/configure.hostMike Frysinger3-4/+5
These settings might have made sense in darker compiler times, but I think they're largely obsolete now. Looking through the values that get used in HDEFINES, it's quite limited, and configure itself should handle them. If we still need something, we can leverage standard autoconf macros instead, after we get a clear user report. TDEFINES was never set anywhere and was always empty, so prune that.
2021-01-11sim: clean up C11 header includesMike Frysinger8-39/+15
Since we require C11 now, we can assume many headers exist, and clean up all of the conditional includes. It's not like any of this code actually accounted for the headers not existing, just whether we could include them. The strings.h cleanup is a little nuanced: it isn't in C11, but every use of it in the codebase will include strings.h only if string.h doesn't exist. Since we now assume the C11 string.h exists, we'll never include strings.h, so we can delete it.
2021-01-09sim: clean up stale AC_PREREQ refsMike Frysinger1-12/+1
This was purged from the tree when we upgraded to autoconf-2.69, but a few references in the sim tree were missed.
2021-01-09sim: enable -Werror by default for some archesMike Frysinger2-5/+7
We've had this off for a long time because the sim code was way too full of warnings for it to be feasible. However, I've cleaned things up significantly from when this was first merged, and we can start to turn this around. Change the macro to enable -Werror by default, and allow ports to opt out. New ports will get it automatically (and we can push back on them if they try to turn it off). Also turn it off for the few ports that still hit warnings for me. All the rest will get the new default, and we'll wait for feedback if/when new issues come up.