Age | Commit message (Collapse) | Author | Files | Lines |
|
Drop the sim-specific unsignedXX types and move to the standard uintXX_t
types that C11 provides.
|
|
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 header shuffling in here broke the workaround for gnulib defining
"open". Move it back before the sim-specific includes to fix. This
is because the callback struct in the headers has an "open" member and
this file tries to call that.
|
|
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.
|
|
Avoid implicit include deps with this to help untangle sim headers
so we can get rid of arch-specific sim-main.h.
|
|
Avoid implicit include deps with this to help untangle sim headers
so we can get rid of arch-specific sim-main.h.
|
|
Avoid implicit include deps with this to help untangle sim headers
so we can get rid of arch-specific sim-main.h.
|
|
We're including system headers after local headers in a bunch of
places, but this leads to conflicts when our local headers happen
to define symbols that show up in the system headers.
Use the more standard order of:
* config.h (via defs.h)
* system headers
* local library headers (e.g. bfd & libiberty)
* sim specific headers
|
|
Some of the core sim headers rely on the SIM_AC_OPTION_BITSIZE macro
which can change the size of core types. Since these haven't been
unified across ports, add checks to make sure they aren't accidentally
included when building for all ports. This caught the sim-load file
using poisoned headers that it didn't actually need.
|
|
Now that we've unified all the syscall tables, this file does not rely
on any port-specific settings, so move it up to building as part of the
common step so we only do it once in a multibuild.
|
|
Now that all ports have switched to target-newlib-* files, there's
no need for these files & generating things at build time. So punt
the logic and make target-newlib-syscall a hard requirement.
|
|
Like we just did for pulling out the errno map, pull out the syscall
maps into a dedicated common file. Most newlib ports are using the
same syscall map, but not all, which means we have to do a bit more
work to migrate.
This commit adds the maps and switches the ports using the common
default syscall table over to it. Ports using unique syscall tables
are still using the old targ-map.c logic.
Switching common ports over is easy by checking NL_TARGET, but the
ppc code needs a bit more cleanup here hence its larger diff.
|
|
This port was dropped from gdb/bfd/sim years ago, so stop including
its syscall constants too.
|
|
|
|
Instead of always using target_alias as a prefix on the name, use
program_transform_name instead so that the library is scoped in the
same way as the run program.
|
|
Support the same syntax as other common utilities where env vars can
be specified before the program to be run without an explicit option.
This behavior can be suppressed by using the -- marker.
|
|
Provide explicit control over the program's environment with the
basic set/unset/clear options. These are a bit clunky to use,
but they're functional.
The env set operation is split out into a separate function as it'll
be used in the next commit.
With these in place, we can adjust the custom cris testsuite to use
the now standard options and not its one-off hack.
|
|
Now that the callback framework supports argv & envp, we can move
the Blackfin implementation of these syscalls to the common code.
|
|
Now that we have access to the argv & envp strings, finish implementing
these syscalls. Delete unused variables, fix tbuf by incrementing the
pointer instead of setting to the length, and make sure we don't write
more data than the bufsize says is available.
|
|
Pass the existing strings data to the callbacks so that common
libgloss syscalls can be implemented (which we'll do shortly).
|
|
We've been passing the environment strings to sim_create_inferior,
but most ports don't do anything with them. A few will use ad-hoc
logic to stuff the stack for user-mode programs, but that's it.
Let's formalize this across the board by storing the strings in the
normal sim state. This will allow (in future commits) supporting
more functionality in the run interface, and to unify some of the
libgloss syscalls.
|
|
The new argv processing code assumed that we were always passed a
command line. If we weren't, make sure we don't crash before we
get a chance to output an error message about incorrect usage.
|
|
We default argv[0] to the program we run which is a standard *NIX
convention, but sometimes we want to be able to control the argv[0]
setting independently (especially for programs that inspect argv[0]
to change their behavior or output). Add an option to control it.
|
|
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.
|
|
Outputting an extra space broke a cris test. Change the workaround
to use %s with an empty string to avoid the compiler warning but not
output an extra space.
|
|
These are marked inline, so building w/gcc at higher optimization
levels will automatically discard them. But building with -O0 will
trigger unused function warnings, so fix that.
The common before/after cover functions in the common mloop generator
are not used by all architecture ports. Doesn't seem to be a hard
requirement, so marking them optional (i.e. unused) is fine.
The cris execute function is conditionally used depending on the
fast-build mode settings, so mark it unused too.
|
|
These rules don't depend on the target compiler settings, so hoist
the build logic up to the common builds for better parallelization.
We have to extend the genmloop.sh logic a bit to allow outputting
to a subdir since it always assumed cwd was the right place.
We leave the cgen maintainer rules in the subdirs for now as they
aren't normally run, and they rely on cgen logic that has not yet
been generalized.
|
|
The custom echo was off by one space relative to all the others.
|
|
Don't blindly cast every possible type to (long). Change to the right
printf format specifier whether it be a 64-bit type or a pointer.
|
|
This is used in a few places where it's not needed. Drop the include
to avoid the build-time generated header file as we move to drop it.
|
|
Now that the use of TARGET_xxx defines have been removed, we can move
this to the common logic so we only build it once for multi-targets.
|
|
Like we just did for pulling out the errno & signal maps, pull out the
open flag map into a dedicated common file. All newlib ports are using
the same map which makes it easy.
|
|
Code should not be using these directly, instead they should be
resolving these dynamically via the open_map. Rework the common
callback code that was using the defines to use symbolic names
instead, and localize some of the defines in the ARM code (since
it's a bit unclear how many different APIs it supports currently),
then remove the defines out of the header so no new code can rely on
them.
|
|
Like we just did for pulling out the errno map, pull out the signal
map into a dedicated common file. All newlib ports are using the
same signal map which makes it easy.
|
|
The current system maintains a list of target errno constants in the
nltvals.def file, then runs a build-time tool to turn that into a C
file. This list of errno values is the same for all arches, so we
don't need the arch-specific flexibility. Further, these are only
for newlib/libgloss environments, which makes it confusing to support
other userland runtimes (like Linux). Let's simplify to make this
easier to understand & build. We don't namespace the variables yet,
but sets up the framework for it.
Create a new target-newlib-errno.c template file. The template file
is hand written, but the inline map is still automatically generated.
This allows us to move it to the common set of objects so it's only
built once in a multi-target build.
Now we can remove the output from the gentmap build-time tool since
it's checked into the tree.
Then we stop including the errno lists in nltvals.def since nothing
uses it.
|
|
This provides a minor speedup when cleaning in a multi-target build.
|
|
Update the makefile & configure related rules to use the silent
build helpers.
|
|
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.
|
|
Add a new ECHO_STAMP helper and convert existing stamp code over
to it. This is mostly common rules and cgen mloop rules.
|
|
We pretty much never care about these stamp touches, so silence them.
Also switch to using $@ when it makes sense.
|
|
Use the srcroot path and make them all silent.
|
|
...by reordering includes.
1. sim-utils.c
sim/mips/sim-main.h defines UserMode, while there is a struct in winnt.h
which has UserMode as a member. So if sim-main.h is included before winnt.h,
compilation fails.
2. ppc
registers.h defines CR, which is used as a member in winnt.h.
winsock2.h is included by sys/time.h, so sys/time.h has to be included
before registers.h.
Bug: https://sourceware.org/PR28476
|
|
It can be difficult to guess the exact bfd name, so add an option to
list all the targets that the current build supports. This aligns with
other simulator options like --info-architecture.
|
|
We map target signals to host signals so we can propagate signals
between the host & simulated worlds. That means we need to know
the symbolic names & values of all signals that might be sent.
The tools that generate that list use signal.h and include all
symbols that start with "SIG" so as to automatically include any
new symbols that the C library might add. Unfortunately, this
also picks up "SIGSTKSZ" which is not actually a signal itself,
but a signal related setting -- it's the size of the stack when
a signal is handled.
By itself this doesn't super matter as we will never see a signal
with that same value (since the range of valid signals tend to be
way less than 1024, and the size of the default signal stack will
never be that small). But with recent glibc changes that make this
into a dynamic value instead of a compile-time constant, some users
see build failures when building the sim.
As suggested by Adam Sampson, update our scripts to ignore this
symbol to simplify everything and avoid the build failure.
Bug: https://sourceware.org/PR28302
|
|
When I first wrote this, I was thinking we'd scan all source files
that existed and generate a complete init list. That means for any
particular build, we'd probably have a few functions that didn't
exist, so weak attributes was necessary. What I ended up scanning
though was only the source files that went into a particular build.
There was another concern too: a source file might be included, but
the build settings would cause all of its contents to be skipped
(via CPP defines). So scanning via naive grep would pick up names
not actually available. A check of the source tree shows that we
never do this, and it's pretty easy to institute a policy that we
don't start (by at the very least including a stub init func).
The use of weak symbols ends up causing a problem in practice: for
a few modules (like profiling), nothing else pulls it in, so the
linker omits it entirely, which leads to the profiling module never
being available. So drop the weak markings since we know all these
funcs will be available.
|
|
It's unclear why -H was picked over the more standard -h, but since
-h is still not used, just change -H to -h to match pretty much every
other tool in the sourceware tree.
|
|
Many GNU tools accept -EB/-EL as short options for selecting big &
little endian modes. While the sim has an -E option, it requires
spelling out "big" and "little". Adding support for -EB & -EL is
thus quite trivial, so lets round it out to be less annoying.
|
|
We use these older names inconsistently in the sim codebase, and time
has moved on long ago, so drop support for these non-standard names.
POSIX provides O_NONBLOCK for us, so use it everywhere.
|
|
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.
|
|
The cgen framework provides a "VOID" type for code to use, but this
defines ends up conflicting with the standard Windows VOID define.
Since they actually define to the same thing ("void"), undef it here
to fix the Windows build.
We might want to reconsider the need for "VOID" in cgen, but that
will take larger discussion & coordination with the cgen project.
|