Commit Graph

97 Commits

Author SHA1 Message Date
Mike Frysinger
047fa8cc1c sim: sh: fix nested braces in struct init
The op struct includes an array of strings, but doesn't use braces
around that array when initializing.  This causes a ton of warnings
when using -Wmissing-braces.  Add them to fix.

The code this tool generates is the same before & after.
2024-01-23 03:15:02 -05:00
Andrew Burgess
1d506c26d9 Update copyright year range in header of all files managed by GDB
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-12 15:49:57 +00:00
Mike Frysinger
08a7937f3a sim: m32r: fixup some of the int<->pointer casts
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-10 22:37:03 -05:00
Mike Frysinger
72d711c155 sim: build: switch to gdbsupport/libiberty.m4
Leverage this common logic to find all the libiberty settings rather
than duplicate it ourselves.
2024-01-10 19:53:10 -05:00
Mike Frysinger
435ad222b3 sim: warnings: compile build tools with -Werror too
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-08 21:36:44 -05:00
Mike Frysinger
9f17cdda31 sim: warnings: enable -Wshift-negative-value
Now that all the relevant sources are fixed, enable the warning.
2024-01-08 20:02:44 -05:00
Mike Frysinger
f6c714d65b sim: warnings: enable -Wshadow=local
This brings us in sync with current set of gdb warnings (for C).
2024-01-06 23:30:43 -05:00
Mike Frysinger
6bf212a8ac sim: ppc: move termios probes to top-level
This is the last compile-time logic in the ppc subdir.
2024-01-02 00:34:15 -05:00
Mike Frysinger
d43207b057 sim: ppc: move struct statfs to top-level 2024-01-02 00:31:40 -05:00
Mike Frysinger
568432432a sim: ppc: move long long test to top-level
While the sim code doesn't utilize HAVE_LONG_LONG itself, other code
(like libiberty) seem to, so check for it in the top-level for all
ports to leverage.
2024-01-02 00:31:08 -05:00
Mike Frysinger
d472066471 sim: ppc: hoist sysv tests to top-level
Now that the sysv tests turn into config.h defines and everything
checks that, we can move the tests to the top-level and out of the
ppc subdir.
2024-01-02 00:29:29 -05:00
Mike Frysinger
58d38850b6 sim: warnings: enable -Wunused-variable 2024-01-01 10:51:50 -05:00
Mike Frysinger
4da6be3f1a sim: warnings: rework individual flag disable into dedicated vars
The -Wshadow=local is too new for some compilers, so move it to a var
that we test at configure time.
2023-12-23 01:21:23 -05:00
Mike Frysinger
3744b73e3b sim: warnings: enable -Wreturn-type
Older versions of gcc support this warning flag.  We're already clean.
2023-12-21 20:59:16 -05:00
Mike Frysinger
fa113bd940 sim: warnings: fix -Wreturn-mismatch typo 2023-12-21 20:58:51 -05:00
Mike Frysinger
3a4ee62868 sim: warnings: enable -Wimplicit-fallthrough=5
It caught some legitimate bugs, so clearly it's helpful.
2023-12-21 01:59:23 -05:00
Mike Frysinger
d137b254d9 sim: signal: mark signal callback funcs as noreturn since they don't return
All funcs already call other funcs that don't return.  The mips port is
the only exception because its generic exception handler can return in
the case of normal exceptions.  So while the exceptions its signal handler
triggers doesn't return, we can't express that conditional logic.  So add
some useless abort calls to make the compiler happy.
2023-12-21 01:59:22 -05:00
Mike Frysinger
95cd009f5d sim: warnings: enable -Wduplicated-cond 2023-12-21 00:02:20 -05:00
Mike Frysinger
2757c1c65f sim: warnings: add more flags
We already build cleanly with these.
2023-12-17 00:15:49 -05:00
Mike Frysinger
00383ba6b4 sim: warnings: enable -Wunused-but-set-variable 2023-12-15 21:14:13 -05:00
Mike Frysinger
a729245526 sim: warnings: disable -Wenum-conversion fow now [PR sim/29752]
The cgen code mixes virtual insn enums with insn enums, and there isn't
an obvious (to me) way to unravel this atm, so disable the warning.

sim/lm32/decode.c:45:5: error:
	implicit conversion from enumeration type 'CGEN_INSN_VIRTUAL_TYPE'
	to different enumeration type 'CGEN_INSN_TYPE' (aka 'enum cgen_insn_type')
	[-Werror,-Wenum-conversion]
   45 |   { VIRTUAL_INSN_X_INVALID, LM32BF_INSN_X_INVALID, LM32BF_SFMT_EMPTY },
      |   ~ ^~~~~~~~~~~~~~~~~~~~~~

Bug: https://sourceware.org/PR29752
2023-12-07 06:00:25 -07:00
Mike Frysinger
708aee5ec6 sim: support dlopen in -lc
Stop assuming that dlopen is only available via -ldl.  Newer versions
of glibc have merged it into -lc which broke this configure test.
2023-12-06 20:56:29 -07:00
Mike Frysinger
b0c06375e1 sim: warnings: add more flags
Sync with the list of flags from gdbsupport, and add a few more of
our own to catch recent issues.  Comment out the C++-specific flags
as we don't build with C++.
2023-12-06 20:11:05 -07:00
Mike Frysinger
3c7666dca5 sim: warnings: sync some build logic from gdbsupport
This fixes testing of -Wno flags, and adds some more portable ones.
2023-12-05 23:12:16 -07:00
Mike Frysinger
ab18008ed1 sim: warnings: enable only for development builds
Reuse the bfd/development.sh script like most other project to
determine whether the current source tree is a dev build (e.g.
git) or a release build, and disable the warnings for releases.
2023-12-04 23:45:27 -05:00
Alan Modra
e7ad52cde6 sim --enable-cgen-maint
I had reason yesterday to want to regenerate configury files which I
do with --enable-maintainer-mode, and added --enable-cgen-maint
accidentally.  The first problem I hit is that sim looks for cgen in a
different directory by default than opcodes, and I had my source
layout set up for opcodes rather than sim.  Fix that by making both
use ../cgen first, then ../../cgen relative to sim/ and opcodes/.  The
next problem was that various sim local.mk files expected generated
sources in the build dir rather than the source dir.  Fix that by
adding $(srcdir) to paths.  Finally, the generated iq2000 files had a
compile error, fixed by the cpu/iq2000.cpu patch.

cpu/
	* iq2000.cpu (syscall): Add pc arg.
opcodes/
	* configure.ac (cgendir): Default to ../../cgen, but use ../cgen
	if found there.
	* configure: Regenerate.
sim/m4/
	* sim_ac_option_cgen_maint.m4 (cgendir): Look in ../cgen too.
sim/
	* cris/local.mk: Add $(srcdir) to paths for regenerated source.
	* frv/local.mk: Likewise.
	* iq2000/local.mk: Likewise.
	* lm32/local.mk: Likewise.
	* m32r/local.mk: Likewise.
	* or1k/local.mk: Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2023-08-19 12:41:32 +09:30
Mike Frysinger
da8c966399 sim: assume sys/stat.h always exists (via gnulib)
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-16 04:42:47 -05:00
Mike Frysinger
4cd7de783b sim: formally assume unistd.h always exists (via gnulib)
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-16 04:35:48 -05:00
Mike Frysinger
e9bf6a4a20 sim: build: stop probing system extensions (ourselves)
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-16 04:22:10 -05:00
Tsukasa OI
9f046489d0 sim: Move getopt checking inside SIM_AC_PLATFORM
This commit moves getopt declaration checker originally in sim/
configure.ac; added in commit 340aa4f687 ("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-05 03:31:42 +00:00
Mike Frysinger
508de64120 sim: drop mention of & support for subdir configure
Now that no ports use these common configure APIs, delete the logic
and remove it from the documentation.
2023-01-01 17:35:16 -05:00
Joel Brobecker
213516ef31 Update copyright year range in header of all files managed by GDB
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.
2023-01-01 17:01:16 +04:00
Mike Frysinger
111b1cf97e sim: smp: plumb igen flag down to all users
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-25 02:13:32 -05:00
Mike Frysinger
20b579bac5 sim: smp: make option available again
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-12-25 02:13:30 -05:00
Mike Frysinger
959550953e sim: restore lstat & mkdir func checks
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-10 00:19:45 +07:00
Mike Frysinger
5a9886170b sim: fix readline linkage
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-05 21:21:31 +07:00
Mike Frysinger
682a2a82e4 sim: adjust sim_hw options style
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-05 10:23:28 +07:00
Mike Frysinger
c55c1f6e9d sim: don't hardcode -ldl for SDL support
Since we use AC_SEARCH_LIBS to find dlopen, we don't need to hardcode
-ldl when using SDL ourselves.
2022-11-04 13:50:37 +07:00
Mike Frysinger
051081585e sim: build: change AC_CHECK_LIB to AC_SEARCH_LIBS
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-04 07:42:31 +07:00
Mike Frysinger
89cf99a910 sim: build: switch to bfd & opcodes libtool linker scripts
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-04 07:42:31 +07:00
Mike Frysinger
fde7c6bf64 sim: split CPPFLAGS between build & host
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-11-02 20:59:14 +05:45
Fangrui Song
382fa97ce0 sim: Link ZSTD_LIBS
This fixes linker errors in a `../../configure --enable-targets
--enable-sim; make all-gdb` build.
2022-09-27 11:42:32 -07:00
Mike Frysinger
216722984f sim: gdbinit: hoist setup to common code
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-21 13:57:33 -05:00
Hans-Peter Nilsson
dc4e1fde36 sim: Fix use of out-of-tree assembler and linker when testing
With commit 7a259895bb "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 8996c21067
"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-02-14 23:51:07 +01:00
Mike Frysinger
efd811591c sim: tweak copyright lines for gnulib update-copyright
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.
2022-01-01 13:14:01 -05:00
Mike Frysinger
8996c21067 sim: testsuite: setup per-port toolchain settings for multitarget build
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-11-28 21:55:15 -05:00
Mike Frysinger
f050cfdd82 sim: bfin: add support for SDL2
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-13 22:45:19 -04:00
Mike Frysinger
03de8f26e8 sim: dv-sockser: enable for mingw targets too
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-09-09 01:32:16 -04:00
Mike Frysinger
7eb1f99ada sim: unify reserved instruction bits settings
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-07-01 20:53:00 -04:00
Mike Frysinger
b79efe264f sim: unify scache settings
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-30 13:33:18 -04:00