Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
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.
|
|
Add explicit arch-specific modules.c rules to keep the build from
generating an incorrect common/modules.c. Otherwise the pattern
rules would cascade such that it'd look for $arch/modules.o which
turned into common/modules.c which triggered the gen rule.
My local testing of this code didn't catch this bug because of how
Automake manages .Po (dependency files) in incremental builds -- it
was adding extra rules that override the pattern rules which caused
the build to generate correct modules.c files. But when building
from a cold cache, the pattern rules would force common/modules.c to
be used leading to crashes at runtime.
|
|
This makes sure the arch-specific modules.c wildcard is matched and
not the common/%.c so that we compile it correctly. It also makes
sure each subdir has depdir logic enabled.
|
|
Now that we build these objects in the top dir & generate modules.c
there, we don't need to generate them all first -- we can let the
normal dependency graph take care of building things in parallel.
|
|
This simplifies the build logic and avoids an Automake bug where the
common_libcommon_a_OBJECTS variable isn't set in the arch libsim.a
DEPENDENCIES for targets that, alphabetically, come before "common".
We aren't affected by that bug with the current code, but as we move
things out of SIM_ALL_RECURSIVE_DEPS and rely on finer dependencies,
we will trip over it.
|
|
These aren't used anymore, so punt them all.
|
|
|
|
|
|
Now that all ports have moved to creating libsim.a in the top-level,
drop all the support code to create it in a subdir.
|
|
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. On my 4 core system, it adds ~100msec to the build per
port, so it's not great, but it shouldn't be a big deal. This will go
away of course once the top-level compiles objects.
|
|
Add rules for tracking generated subdir modules.c files. This doesn't
actually generate the file from the top-level, but allows us to add
rules that need to be ordered wrt it. Once those changes land, we can
rework this to actually generate from the top-level.
This currently builds off of the objects that go into the libsim.a as
we don't build those from the top-level either. Once we migrate that
up, we can switch this to the source files directly. It's a bit hacky
overall, but makes it easier to migrate things in smaller chunks, and
we aren't going to keep this logic long term.
|
|
This should have been part of the previous commit 80636a54bcfa2bca3dc8f
("sim: build: move generated headers to built sources"), but they were
missed because they're .c files effectively treated as .h files.
|
|
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.
|
|
All the runtimes were only initializing a single CPU. When SMP is
enabled, things quickly crash as none of the other CPU structs are
setup. Change the default from 0 to the compile time value.
|
|
There's no need for these settings to be in sim-main.h which is shared
with common/ sim code, so move it all out to a new header which only
this port will include.
|
|
We've been using SIM_ADDR which has always been 32-bit. This means
the upper 32-bit address range in 64-bit sims is inaccessible. Use
64-bit addresses all the time since we want the APIs to be stable
regardless of the active arch backend (which can be 32 or 64-bit).
The length is also 64-bit because it's completely feasible to have
a program that is larger than 4 GiB in size/image/runtime. Forcing
the caller to manually chunk those accesses up into 4 GiB at a time
doesn't seem useful to anyone.
Bug: https://sourceware.org/PR7504
|
|
All ports should be migrated now. Drop the SIM_HAVE_COMMON_SIM_CPU
knob and require it be used everywhere now.
|
|
Currently all ports have to declare sim_cpu themselves in their
sim-main.h and then embed the common sim_cpu_base in it. This
dynamic makes it impossible to share common object code among
multiple ports because the core data structure is always different.
Let's invert this relationship: common code declares sim_cpu, and
the port uses the new arch_data field for its per-cpu state.
This is the first in a series of changes: it adds a define to select
between the old & new layouts, then converts all the ports that don't
need custom state over to the new layout. This includes mn10300 that,
while it defines custom fields in its cpu struct, never uses them.
|
|
These headers define the register numbers for each port to implement
the sim_fetch_register & sim_store_register interfaces. While gdb
uses these, the APIs are part of the sim, not gdb. Move the headers
out of the gdb/ include namespace and into sim/ instead.
|
|
Automake will run each subdir individually before moving on to the next
one. This means that the linking phase, a single threaded process, will
not run in parallel with anything else. When we have to link ~32 ports,
that's 32 link steps that don't take advantage of parallel systems. On
my really old 4-core system, this cuts a multi-target build from ~60 sec
to ~30 sec. We eventually want to move all compile+link steps to this
common dir anyways, so might as well move linking now for a nice speedup.
We use noinst_PROGRAMS instead of bin_PROGRAMS because we're taking care
of the install ourselves rather than letting automake process it.
|
|
These manual settings were necessary when we weren't doing automatic
header dependency tracking. That was changed a while ago, and we use
automake now to do it all for us. As a result, many of these vars
aren't even referenced anymore.
Further, some of the source file generation (e.g. .c files, or igen,
or cgen outputs) were moved to the common automake build, and it takes
care of dependency tracking for us with the object files.
|
|
We have configure tests for this in the top-level configure script
to link this when necessary, so we don't need to explicitly list it
for specific ports.
|
|
When reading/writing arbitrary data to the system's memory, the unsigned
char pointer type doesn't make that much sense. Switch it to void so we
align a bit with standard C library read/write functions, and to avoid
having to sprinkle casts everywhere.
|
|
These functions only read from memory, so mark the pointer as const.
|
|
When reading/writing arbitrary data to the system's memory, the unsigned
char pointer type doesn't make that much sense. Switch it to void so we
align a bit with standard C library read/write functions, and to avoid
having to sprinkle casts everywhere.
|
|
Clang generates a warning if there is a function declaration/definition
with zero arguments. Such declarations/definitions without a prototype (an
argument list) are deprecated forms of indefinite arguments
("-Wdeprecated-non-prototype"). On the default configuration, it causes a
build failure (unless "--disable-werror" is specified).
But there is another issue. This function declaration in sim/sh/interp.c
is completely redundant. This commit just removes that declaration.
|
|
The sh simulator incorrectly uses integer abs instead of the floating
point fabs on some floating point values, fixed in this commit.
|
|
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.
|
|
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.
|
|
Use the new target-newlib-syscall module. This is needed to merge all
the architectures into a single build, and sh has a custom syscall
table for its newlib/libgloss port.
|
|
We use the program argv to both find the program to run (argv[0]) and
to hold the arguments to the program. Most of the time this is fine,
but if we want to let programs specify argv[0] independently (which is
possible in standard *NIX programs), this double duty doesn't work.
So let's split the path to the program to run out into a separate
field by itself. This simplifies the various sim_open funcs too.
By itself, this code is more of a logical cleanup than something that
is super useful. But it will open up customization of argv[0] in a
follow up commit. Split the changes to make it easier to review.
|
|
This code triggers -Werror=switch-bool warnings with <=gcc-5 versions.
Rework it to use if statements instead as it also simplifies a bit.
|
|
In <=gcc-7 versions, -fstrict-overflow is enabled by default, and that
triggers warnings in this code that relies on integer overflows to test
for carries. Change the logic to test against the limit directly.
|
|
On LLP64 targets where sizeof(long) != sizeof(void*), this code fails:
sim/sh/interp.c:704:24: error: cast from pointer to integer of different size -Werror=pointer-to-int-cast]
704 | do { memstalls += ((((long) PC & 3) != 0) ? (n) : ((n) - 1)); } while (0)
| ^
Since this code simply needs to check alignment, cast it using uintptr_t
which is the right type for this.
|
|
Casting 0 to a pointer via (long *) doesn't work on LLP64 targets:
error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
It's also unnecessary here. We can simply pass NULL like every other
bit of code does.
|
|
Some _WIN32 targets provide utime (like mingw), so move the header
include out from _WIN32 and under the specific HAVE_UTIME_H check.
|
|
This isn't needed on any reasonable target nowadays, and no other
source does this, and breaks with some mingw targets, so punt the
extern entirely.
|
|
The code assumes that all _WIN32 targets are the same and can
define isnan to _isnan. For mingw targets, they provide an isnan
define already, so no need for the fallback here.
|
|
With most of the warnings fixed in interp.c, we can enable -Werror
here too now. There are some -Wmaybe-uninitialized warnings still
lurking that look legitimate, but we don't flag those are fatal,
and I don't have the expertise to dive into each opcode to figure
out the right way to clean them up.
|
|
This block of code relies on i to control which bits to test and how
many times to run through the loop, but it never actually initialized
it. There is another chunk of code that handles the pdmsb instruction
that sets i to 16, so use that here too assuming it's correct. The
programming manual suggests this is the right value too, but I am by
no means a SuperH DSP expert. The tests are still passing though ...
|
|
|
|
Add parentheses to a bunch of places where the compiler suggests we
do to avoid confusion to most readers.
|
|
These macro expansions are deliberate in not using the computed value
so that they trigger side-effects (possible invalid memory accesses)
but while otherwise being noops. Add a (void) cast so the compiler
knows these are intentional.
|
|
Now that we require C11, we can leverage anonymous unions & structs
to fix a long standing issue with the SH register layout. The use
of sregs.i for sh-dsp has generated a lot of compiler warnings about
the access being out of bounds -- it only has 7 elements declared,
but code goes beyond that to reach into the fregs that follow. But
now that we have anonymous unions, we can reduce the nested names
and have sregs cover all of these registers.
|
|
These rules don't depend on the target compiler settings, so hoist
the build logic up to the common builds for better parallelization.
|
|
Only one file in here still generates warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.
|
|
Update the gencode rules to use the silent build helpers.
|
|
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.
|
|
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.
|