Age | Commit message (Collapse) | Author | Files | Lines |
|
PTR will soon disappear from ansidecl.h. Remove uses in sim. Where
a PTR cast is used in assignment or function args to a void* I've
simply removed the unnecessary (in C) cast rather than replacing with
(void *).
|
|
Change-Id: Ifd574e38524dd4f1cf0fc003e0c5c7499abc84a0
|
|
Drop the sim-specific unsignedXX types and move to the standard uintXX_t
types that C11 provides.
|
|
These are almost entirely unused. For the very few places using them,
replace with explicit signed types. This matches what was done in the
common sim code.
|
|
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.
|
|
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.
|
|
|
|
Drop our compat code and assume environ exists to simplify.
We did this for all other targets already, but ppc was missed.
|
|
The project has been using GPL v3 for a while now in the source files,
and the arm & ppc ports have carried a copy of the COPYING file. Lets
move those up to the top sim dir like other projects to make it clear.
Also drop the ppc/COPYING.LIB as it's not really referenced by any
source as everything is GPL v3.
|
|
We will never bother building w/out a ../common/ sim directory,
so drop ancient logic supporting that method.
|
|
We don't need to build this anymore ourselves since the common build
includes it and produces the same object code. We also need to pull
in the split constant modules after the refactoring and pulling them
out of nltvals.def & targ-map.o. This doesn't matter for the sim
directly, but does for gdb and other users of libsim.
We also delete some conditional source tree logic since we already
require this be the "new" combined tree with a ../common/ dir. This
has been the case for decades at this point.
|
|
The time delta is a 64-bit value too.
|
|
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.
|
|
There's no need to define these ourselves anymore, so switch to the
stdint.h types. This will be important when we start using PRI*
defines with printf formats.
|
|
Make sure we consume & ignore \r bytes in inputs in case the file
encodings are from a non-LF systems (e.g. Windows).
|
|
|
|
The ppc codebase is unique and doesn't leverage common/, so have to
add silent rules to it specifically.
|
|
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
|
|
To fix this error (seen on cygwin):
/../../sim/ppc/../common ../../../sim/ppc/hw_memory.c
In file included from ../../gnulib/import/stdlib.h:100,
from ../../../sim/ppc/hw_memory.c:28:
../../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
663 | #error "Please include config.h first."
| ^~~~~
../../gnulib/import/unistd.h:665:24: error: expected ';' before 'extern'
665 | _GL_INLINE_HEADER_BEGIN
| ^
| ;
../../gnulib/import/unistd.h:2806:22: error: expected ';' before 'extern'
2806 | _GL_INLINE_HEADER_END
| ^
| ;
|
|
Not all systems have easy access to hard links or symlinks, so add
fallback logic to the run->psim build code to handle those.
Bug: https://sourceware.org/PR18864
|
|
Only the ppc arch supports this kind of source file override logic.
All the others expose knobs via configure flags, and for some of
these, the ppc code does as well. For others, it doesn't make sense
to ever change them. Since it's unlikely anyone is using this, drop
it all to simplify the code (and to get us a little closer to the
common sim code).
|
|
All other sim arches are using this now, so finish up the logic in
the ppc arch to enable gnulib usage here too.
|
|
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.
|
|
Now that the ppc code has been cleaned up enough to use the same set
of warning flags as the common code, delete the ppc-specific configure
logic so we can leverage what the common code already defined for us.
|
|
When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into:
...
src/sim/ppc/hw_memory.c: In function 'hw_memory_init_address':
src/sim/ppc/hw_memory.c:204:7: error: pointer targets in passing argument 4 \
of 'device_find_integer_array_property' differ in signedness \
[-Werror=pointer-sign]
&new_chunk->size);
^
...
Fix these by adding an explicit pointer cast. It's a bit ugly to use APIs
based on signed integers to read out unsigned values, but in practice, this
is par for the course in the ppc code.
We already use signed APIs and assign the result to unsigned values a lot:
see how device_find_integer_property returns a signed integer (cell), but
then assign it to unsigned types. The array APIs are not used that often
which is why we don't see many warnings, and we disable warnings when we
assign signed integers to unsigned integers in general.
The dtc/libfdt project (which is the standard in other projects) processes
the fdt blob as a series of bytes without any type information. Typing is
left to the caller. They have core APIs that read/write bytes, and a few
helper functions to cast/convert those bytes to the right value (e.g. u32).
In this ppc sim code, the core APIs use signed integers, and the callers
convert to unsigned, usually implicitly.
We could add some core APIs to the ppc sim that deal with raw bytes and then
add some helpers to convert to the right type, but that seems like a lot of
lifting for what boils down to a cast, and is effectively equivalent to all
the implicit assignments we use elsewhere. Long term, a lot of the ppc code
should either get converted to existing sim common code, or we should stand
up proper APIs in the common code first, or use standard libraries to do all
the processing (e.g. libfdt). Either way, this device.c code would all get
deleted, and callers (like these hw_*.c files) would get converted. Which
is also why we go with a cast rather new (but largely unused) APIs.
|
|
This aligns with common code which already uses this flag. We have
to add another local prototype to fix the failure, and add another
local decl for the SIM_DESC type. Unwinding these will require a
lot more work & conversions in the process, so going with the decl
for now unblocks the warning unification.
|
|
This copies logic used in the common sim warning configure code to fix
build errors for mingw targets. Turning format warnings on triggers
a failure in the debug.c file, so apply a minor fix at the same time.
|
|
This file is compiled for the --host & --build system which leads to
including the configure generated config.h in both environments.
This obviously doesn't work when the two targets don't look alike at
all and can cause build failures here (e.g. a mingw host & a linux
build). Since we don't actually need any config settings in this
very simple file, drop the includes entirely.
|
|
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 are copied from sim/common/Make-common.in.
On ppc the build fails without at least the 'info' target, e.g.:
Making info in ppc
make[4]: Entering directory '/<<BUILDDIR>>/gdb-10.2.2974.g5b45e89f56d+21.10.20210510155809/build/default/sim/ppc'
make[4]: *** No rule to make target 'info'. Stop.
|
|
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.
|
|
Copy most of the common build warning logic over from the common
code to help keep code behavior a bit consistent, and turn them
on by default. We disable a few flags for now until we can clean
the code up.
|
|
This code hits some format-zero-length warnings, so hack the code
like we did in the common layers.
|
|
This will allow us to build the common code with the same inline
settings as the arch subdirs, and only do the test once.
|
|
Use the same basic names as the common sim inline logic so we can
merge the two. We don't do that here, just prepare for it.
The common code seems to be based on the ppc version but with slightly
different names as it was cleaned up & generalized. I *think* these
concepts are the same, so binding them together is OK, but maybe I'm
misreading them. If so, can always tweak them later.
REVEAL_MODULE -> H_REVEALS_MODULE
INLINE_MODULE -> C_REVEALS_MODULE
|
|
Move these options up to the common dir so we only test & export
them once across all ports.
|
|
Move these options up to the common dir so we only test & export
them once across all ports.
|
|
Move these options up to the common dir so we only test & export
them once across all ports.
|
|
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.
|
|
As we merge settings from subdirs into the common configure, we
sometimes need to keep the settings working in both dirs. Create
a makefile fragment to pass them down so we don't have to run the
checks twice. For now, the file is empty, but we'll start moving
logic in shortly.
|
|
The sim-basics.h is too big and includes too many things. This leads
to some arch's sim-main.h having circular loop issues with defs, and
makes it hard to separate out common objects from arch-specific defs.
By splitting up sim-basics.h and killing off sim-main.h, it'll make
it easier to separate out the two.
|
|
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.
|
|
This define is used for a particular target and depends on the
simulated CPU hardware. It has no relation to the host CPU that
the sim is running on. So rename the common "PAGE_SIZE" here to
better reflect its usage and avoid conflicts with system headers.
|
|
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.
|
|
The common sim code already sets this up for us, so no need to
duplicate the logic.
|
|
Rather than re-invent endian defines, as well as maintain our own list
of OS & arch-specific includes, punt all that logic in favor of the bfd
ones already set up and maintained elsewhere. We already rely on the
bfd library, so leveraging the endian aspect should be fine.
This was done for all the other ports years ago, so catch ppc up.
|
|
The common ansidecl.h provides fallbacks for these so we don't need to.
|