aboutsummaryrefslogtreecommitdiff
path: root/sim/m4
AgeCommit message (Collapse)AuthorFilesLines
2023-01-16sim: assume sys/stat.h always exists (via gnulib)Mike Frysinger1-4/+1
We have many uses of sys/stat.h that are unprotected by HAVE_SYS_STAT_H, so this is more formalizing the reality that we require this header. Since we switched to gnulib, it guarantees that a sys/stat.h exists for us to include, so we're doubly OK.
2023-01-16sim: formally assume unistd.h always exists (via gnulib)Mike Frysinger1-1/+2
We have many uses of unistd.h that are unprotected by HAVE_UNISTD_H, so this is more formalizing the reality that we require this header. Since we switched to gnulib, it guarantees that a unistd.h exists for us to include, so we're doubly OK.
2023-01-16sim: build: stop probing system extensions (ourselves)Mike Frysinger1-1/+0
This logic was added in order to expose the strsignal prototype for nrun.c. Since then, we've migrated to gnulib as our portability layer, and it takes care of probing system extensions for us, so there's no need to duplicate the work.
2023-01-05sim: Move getopt checking inside SIM_AC_PLATFORMTsukasa OI1-0/+14
This commit moves getopt declaration checker originally in sim/ configure.ac; added in commit 340aa4f6872c ("sim: Check known getopt definition existence") to sim/m4/sim_ac_platform.m4 (inside the SIM_AC_PLATFORM macro). It also regenerates configuration files using the maintainer mode.
2023-01-01sim: drop mention of & support for subdir configureMike Frysinger2-57/+0
Now that no ports use these common configure APIs, delete the logic and remove it from the documentation.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker21-21/+21
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/+2
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-25sim: smp: make option available againMike Frysinger1-6/+12
At some point we want this to work, but it's not easy to test if the configure option isn't available. Restore it, but keep the default off.
2022-11-10sim: restore lstat & mkdir func checksMike Frysinger1-0/+2
When merging ppc configure checks into the top-level, these 2 funcs were accidentally dropped (probably due to incorrect resolution of conflicts). Restore them since the ppc code utilizes them both.
2022-11-05sim: fix readline linkageMike Frysinger1-1/+1
Now that we link programs in the top dir instead of the arch subdir, update the readline library path to be relative to the top dir.
2022-11-05sim: adjust sim_hw options styleMike Frysinger1-2/+4
We use uppercase for other variables, and are already turning it to uppercase in the arch-subdir.mk, so convert it in the configure step.
2022-11-04sim: don't hardcode -ldl for SDL supportMike Frysinger1-4/+8
Since we use AC_SEARCH_LIBS to find dlopen, we don't need to hardcode -ldl when using SDL ourselves.
2022-11-04sim: build: change AC_CHECK_LIB to AC_SEARCH_LIBSMike Frysinger1-5/+5
With more C libraries moving functions entirely into the main -lc, change the AC_CHECK_LIB calls to AC_SEARCH_LIBS so we look in there first and avoid extra linkage when possible.
2022-11-04sim: build: switch to bfd & opcodes libtool linker scriptsMike Frysinger1-15/+1
Now that we use libtool to link, we don't need to duplicate all the libs that bfd itself uses. This simplifies the configure & Makefile.
2022-11-02sim: split CPPFLAGS between build & hostMike Frysinger1-0/+3
In order to merge more common/ files into the top-level, we need to add more host flags to CPPFLAGS, and that conflicts with our current use with build-time tools. So split them apart like we do with all other build flags to avoid the issue.
2022-09-27sim: Link ZSTD_LIBSFangrui Song1-0/+1
This fixes linker errors in a `../../configure --enable-targets --enable-sim; make all-gdb` build.
2022-02-21sim: gdbinit: hoist setup to common codeMike Frysinger1-7/+0
This was left in subdirs because of the dynamic cgen usage. However, we can move this breakpoint call to runtime and let gdb detect whether the symbol exists.
2022-02-14sim: Fix use of out-of-tree assembler and linker when testingHans-Peter Nilsson1-7/+14
With commit 7a259895bb2d "sim: testsuite: expand arch specific toolchain settings", trying to use out-of-tree ld and as at test-time broke for the "primary target", like when testing a release-tarball. Subsequent to that commit, all assembler tests without in-tree-built tools FAIL, getting errors when trying to call $(abs_builddir)/../gas/as-new. But, that isn't the actual culprint; it's actually it's its immediate predecessor, commit 8996c21067373 "sim: testsuite: setup per-port toolchain settings for multitarget build", which hardcodes in-tree-paths to those tools instead of considering e.g. $(<X>_FOR_TARGET), the preferred overridable variable for single-target builds, as set up by the toplevel Makefile. This commit calls GCC_TARGET_TOOL (a deceptive name; gcc-specific features aren't used) from toplev/config/acx.m4, somewhat like calls in toplev/configure.ac but without the NCN_STRICT_CHECK_TARGET_TOOLS step, for each X to find a value for $(<X>_FOR_TARGET). N.B.: in-tree tools still override any ${target}-${tool} found in $PATH, i.e. only previously broken builds are affected. The variables $(<X>_FOR_TARGET) are usually overridden by the toplevel Makefile to the same value or better, but has to be set here too, as automake "wants" Makefiles to be self-contained (you get an error pointing out that the variable may be empty). If it hadn't been for that, SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET would not be needed. This detail should only (positively) affect users invoking "make check" in sim/ instead of "make check-sim" (or "make check") at the toplevel. Now the output from "configure" matches the target tools actually used by sim at test-time, for the "primary target". Using $(CC) for "example-" targets CC_FOR_TARGET is not changed, as that appears to be a deliberate special-case. Note that all tools still have to be installed and present in $PATH at configure-time to be properly used at test-time. sim: * m4/sim_ac_toolchain.m4 (SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET): New defun. (SIM_TOOLCHAIN_VARS): Call it using AC_REQUIRE, and use variables AS_FOR_TARGET, LD_FOR_TARGET and CC_FOR_TARGET instead of hard-coded values. * Makefile.in, configure: Regenerate.
2022-01-01sim: tweak copyright lines for gnulib update-copyrightMike Frysinger21-21/+21
The regex it uses does not like so many leading spaces which causes it to think the files lack copyright. Trim them down so the script can find & update them accordingly.
2021-11-28sim: testsuite: setup per-port toolchain settings for multitarget buildMike Frysinger1-0/+25
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-09-13sim: bfin: add support for SDL2Mike Frysinger1-5/+14
This probably should have been ported long ago, but better late than never. We keep support for both versions for now since both projects tend to have long lifetimes. Maybe consider dropping SDL1 in another ten years.
2021-09-09sim: dv-sockser: enable for mingw targets tooMike Frysinger1-10/+5
We have enough functionality from gnulib now to build sockser on all platforms. Non-blocking I/O is supported when F_GETFL/F_SETFL are unavailable, but we can address that in a follow up commit. This mirrors what is done in other places in the sim already.
2021-07-01sim: unify reserved instruction bits settingsMike Frysinger2-11/+13
Move these options up to the common dir so we only test & export them once across all ports. The setting only affects igen based ports, and they were turning this on by default, so keep the default in place.
2021-06-30sim: unify scache settingsMike Frysinger2-15/+10
The cgen scache module is enabled by every cgen port, and with the same default value of 16k (which matches the common default value). Let's pull this option out of the individual ports (via CPPFLAGS) and into the common code (via config.h). The object itself is compiled only for cgen ports atm, so that part doesn't change. The scache code is initialized dynamically via the modules.c logic. That's why the profile code needs an additional CGEN_ARCH check. This will allow us to collapse arch configure files more. Merging the source files will require more future work, but integrating the cgen & non-cgen worlds itself will take a lot.
2021-06-30sim: move default model to the runtime sim stateMike Frysinger2-32/+0
This kills off another compile-time option by moving the setting to the individual arch runtimes. This will allow dynamic selection by the arch when doing a single build with multiple arches. The sim_model_init rework is a little funky. In the past it was disabled entirely if no default model was set. We maintain the spirit of the logic by gating the fallback logic on whether the port has defined any models.
2021-06-29sim: use -Wunused-but-set-parameterMike Frysinger1-6/+10
The code is already clean, so sync this over from gdb warning.m4. Also shuffle the order of the flags a bit to match the current gdb warning.m4 code.
2021-06-29sim: use -Wno-error=maybe-uninitializedMike Frysinger1-0/+3
We have some code tripping this warning, but it depends on the gcc version & optimization levels. We've added some hints to the code so some versions of gcc work better, but still not all. Let's just disable the warning like gdb does.
2021-06-27sim: erc32: merge with common configure scriptMike Frysinger1-0/+28
Move the unique library tests to the common code so we can delete the erc32 configure logic entirely.
2021-06-27sim: bfin: move pkg-config & SDL checks to common codeMike Frysinger2-0/+10
This reduces the unique logic in bfin/configure to make it easier to (eventually) unify it entirely.
2021-06-22sim: drop configure scripts for simple portsMike Frysinger1-0/+6
These ports only use the pieces that have been unified, so we can merge them into the common configure script and get rid of their unique one entirely. We still compile & link separate run programs, and have dedicated subdir Makefiles, but the configure script portion is merged.
2021-06-21sim: unify hardware settingsMike Frysinger2-12/+1
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-21sim: hw: rework configure option & device selectionMike Frysinger2-38/+22
The sim-hardware configure option allows builders to select a set of device models to enable. But this seems like unnecessary overkill: the existence of individual device models doesn't affect performance at all as they are only enabled at runtime if the config uses them, and individually these are all <5KB a piece. Stripping off a total of ~50KB from a ~1MB binary doesn't seem useful, and it's extremely unlikely anyone will ever bother. So let's simplify the configure/make logic by turning sim-hardware into a boolean option like many of the other sim options. Any ports that have unique device models will declare them in their Makefile instead of at configure time. This will allow us to (eventually) unify the setting into the common dir.
2021-06-20sim: delete SIM_AC_COMMON macroMike Frysinger1-24/+0
Now that we've moved all content out to the common file, this is empty and can be deleted it entirely.
2021-06-20sim: unify general maintainer settingsMike Frysinger1-3/+0
Move these options up to the common dir so we only test & export them once across all ports. This takes a page from the cgen maint logic to make $(MAINT) work for non-automake Makefiles which will allow us to merge it together.
2021-06-20sim: move sim-inline to the common codeMike Frysinger2-7/+6
This will allow us to build the common code with the same inline settings as the arch subdirs, and only do the test once.
2021-06-19sim: unify dtc tool checksMike Frysinger1-0/+2
Only one arch uses this currently, but others could too. By moving it up to the common checks, it'll also let us simplify the moxie code significantly.
2021-06-19sim: unify gettext/intl probing logicMike Frysinger2-5/+5
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify toolchain dependency logicMike Frysinger1-6/+0
The common dir is already probing this info since it's using automake, so pass it down to the subdirs so they don't have to probe it at all.
2021-06-19sim: unify toolchain probing logicMike Frysinger1-2/+2
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify bfd library dependency testing logicMike Frysinger2-10/+10
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify various library testing logicMike Frysinger3-8/+6
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-18sim: unify -Werror build settingsMike Frysinger1-1/+0
Move these options up to the common dir so we only test & export them once across all ports. It also enables -Werror usage on the common files we've been pulling out of arch subdirs.
2021-06-18sim: move -Werror disabling to MakefileMike Frysinger1-8/+5
For the ports that still don't build with -Werror, rather than disable the flag at configure time, do it at make time. This will allow us to unify these tests in the common sim configure script.
2021-06-17sim: overhaul & unify endian settings managementMike Frysinger2-45/+12
The m4 macro has 2 args: the "wire" settings (which represents the hardwired port behavior), and the default settings (which are used if nothing else is specified). If none are specified, the arch is expected to support both, and the value will be probed based on the user runtime options or the input program. Only two arches today set the default value (bpf & mips). We can probably let this go as it only shows up in one scenario: the sim is invoked, but with no inputs, and no user endian selection. This means bpf will not behave like the other arches: an error is shown and forces the user to make a choice. If an input program is used though, we'll still switch the default to that. This allows us to remove the WITH_DEFAULT_TARGET_BYTE_ORDER setting. For the ports that set a "wire" endian, move it to the runtime init of the respective sim_open calls. This allows us to change the WITH_TARGET_BYTE_ORDER to purely a user-selected configure setting if they want to force a specific endianness. With all the endian logic moved to runtime selection, we can move the configure call up to the common dir so we only process it once across all ports. The ppc arch was picking the wire endian based on the target used, but since we weren't doing that for other biendian arches, we can let this go too. We'll rely on the input selecting the endian, or make the user decide.
2021-06-16sim: drop obsolete AC_EXEEXT callMike Frysinger1-3/+0
The current autoconf 2.69 defines this to nothing because the logic in AC_PROG_CC takes care of it all the time now. Delete the call.
2021-06-16sim: drop arch-specific config.hMike Frysinger1-1/+0
All of the settings in here are handled by the common top-level config.h, so drop the individual arch-config.h files entirely. This will also help guarantee that we don't add any new arch specific defines that would affect common code which will help with the effort of unifying them.
2021-06-15sim: move dv-sockser define to CPPFLAGSMike Frysinger1-2/+1
This is the only define left in m4/ that is not in the common config.h, so move it to sim_hw_cflags so we can drop the arch-specific config.h.
2021-06-12sim: assume sys/select.h always existsMike Frysinger1-1/+0
Now that gnulib provides this, assume it exists.
2021-06-12sim: overhaul alignment settings managementMike Frysinger1-43/+10
Currently, the sim-config module will abort if alignment settings haven't been specified by the port's configure.ac. This is a bit weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's optional to use. Thus everyone invokes it. There are 4 alignment settings, but really only 2 matters: strict and nonstrict. The "mixed" setting is just the default ("unset"), and "forced" isn't used directly by anyone (it's available as a runtime option for some ports). The m4 macro has 2 args: the "wire" settings (which represents the hardwired port behavior), and the default settings (which are used if nothing else is specified). If none are specified, then the build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't called). If default settings are provided, then that is used, but we allow the user to override at runtime. Otherwise, the "wire" settings are used and user runtime options to change are ignored. Most ports specify a default, or set the "wire" to nonstrict. A few set "wire" to strict, but it's not clear that's necessary as it doesn't make the code behavior, by default, any different. It might make things a little faster, but we should provide the user the choice of the compromises to make: force a specific mode at compile time for faster runtime, or allow the choice at runtime. More likely it seems like an oversight when these ports were initially created, and/or copied & pasted from existing ports. With all that backstory, let's get to what this commit does. First kill off the idea of a compile-time default alignment and set it to nonstrict in the common code. For any ports that want strict alignment by default, that code is moved to sim_open while initializing the sim. That means WITH_DEFAULT_ALIGNMENT can be completely removed. Moving the default alignment to the runtime also allows removal of setting the "wire" settings at configure time. Which allows removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving that call to common code. The macro logic can be reworked to not pass WITH_ALIGNMENT as -D CPPFLAG and instead move it to config.h. All of these taken together mean we can hoist the macro up to the top level and share it among all sims so behavior is consistent among all the ports.
2021-06-12sim: unify bug & package settingsMike Frysinger1-12/+0
Move these options up to the common dir so we only test & export them once across all ports. The AC_INIT macro does a lot of the heavy lifting already which allows further simplification.