Commit Graph

112628 Commits

Author SHA1 Message Date
Mike Frysinger
b19d96d139 sim: build: clean up unused codegen logic
Now that all igen ports are in the top-level makefile, we don't need
this logic in any subdirs anymore, so clean it up.
2022-12-27 00:31:34 -05:00
Mike Frysinger
f12c3c632e sim: mips: hoist "multi" igen rules up to common builds
Since these are the last mips igen rules, we can clean up a number of
bits in the local Makefile.in.
2022-12-27 00:31:34 -05:00
Mike Frysinger
f6d58d4012 sim: mips: hoist "m16" igen rules up to common builds 2022-12-27 00:31:34 -05:00
Mike Frysinger
3a31051b3a sim: mips: hoist "single" igen rules up to common builds 2022-12-27 00:31:34 -05:00
Mike Frysinger
07f60ed831 sim: mips: rename "igen" generation mode to "single"
The naming in here has grown organically and is confusing to follow.
Originally there was only one set of rules for generating code from
the igen sources, so calling it "tmp-igen" and such made sense.  But
when other multigen modes were added ("m16" & "multi") which also
used igen, it's not clear what's common igen and what's specific to
this generation  mode.  So rename the set of rules from "igen" to
"single" so it's easier to follow.
2022-12-27 00:31:34 -05:00
Mike Frysinger
49d3ce6c2e sim: mips: hoist itable igen rules up to common builds
Since this rule is pretty simple, hoist it up to the common build.
2022-12-27 00:31:33 -05:00
Mike Frysinger
67c952d109 sim: mips: unify itable generation (a bit)
The m16 & multi targets generate itable once even when all the other
modules are generated multiple times.  The default igen target will
generate itable with everything else out of convenience.  This means
flags are passed which don't affect the generated itable there.

We can unify the itable generation by making sure the right -F/-M
filter variables are passed down.  Since there's already a dedicated
rule & variable in the multi build mode, generalize that and switch
the m16 & igen builds over too.

I spent a lot of time staring at this code, building for diff mips
targets, and exploring all the shell code paths.  I think this is
safe, but only time (and users) will really tell.
2022-12-27 00:31:33 -05:00
Mike Frysinger
4c45662c0f sim: mips: rename multi_flags to igen_itable_flags
This variable is only used to generate the itable files.  In preparation
for merging the itable logic among all ports, rename "multi_flags" to a
more appropriate "igen_itable_flags" variable.  There should be no real
chagnes here otherwise.
2022-12-27 00:31:33 -05:00
Mike Frysinger
556ca380d7 sim: mips: drop unused micromips igen logic
This code appears to be unused since it was first merged.  When
micromips was enabled, it was via the "MULTI" config, not the
"MICROMIPS" config, and the multi configs have sep vars.  Since
nothing sets SIM_MIPS_GEN=MICROMIPS in the config, all of this
should be unreachable, so punt it to simplify.  Further, the
SIM_MIPS_MICROMIPS16_FLAGS & SIM_MIPS_MICROMIPS_FLAGS settings
rely on sim_mips_micromips{,16}_{filter,machine} variables that
are never set in the configure script.
2022-12-27 00:31:33 -05:00
GDB Administrator
f754cabb05 Automatic date update in version.in 2022-12-27 00:00:11 +00:00
Tom Tromey
4d78ce7723 Add initializers to comp_unit_head
PR symtab/29343 points out that it would be beneficial if
comp_unit_head had a constructor and used initializers.  This patch
implements this.  I'm unsure if this is sufficient to close the bug,
but at least it's a step.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29343
2022-12-26 11:01:10 -07:00
Alan Modra
639601f90d bfd/dwarf2.c: allow use of DWARF5 directory entry 0
I think the test for table->files[file].dir being non-zero is wrong
for DWARF5 where index zero is allowed and is the current directory of
the compilation.  Most times this will be covered by the use of
table->comp_dir (from DW_AT_comp_dir) in concat_filename but the point
of putting the current dir in .debug_line was so the section could
stand alone without .debug_info.

Also, there is no need to check for table->dirs non-NULL, the
table->num_dirs test is sufficient.

	* dwarf2.c (concat_filename): Correct and simplify tests of
	directory index.
2022-12-26 22:50:50 +10:30
Flavio Cruz
aac7ae599a Add support for x86_64-*-gnu-* targets to build x86_64 gnumach/hurd 2022-12-26 22:50:24 +10:30
GDB Administrator
13cca0074b Automatic date update in version.in 2022-12-26 00:00:11 +00:00
Mike Frysinger
2a005e97c9 sim: build: drop support for subdir distclean
All ports that need to clean things up at distclean time have moved
to the top-level build, so we can drop support for this hook.
2022-12-25 14:24:05 -05:00
Mike Frysinger
edda128da7 sim: mips: move distclean settings to common build
This was missed when mips/configure was merged into the top-level.
2022-12-25 10:05:39 -05:00
Indu Bhagat
68bb0d2765 libsframe: write out SFrame FRE start address correctly
The following test was failing on ppc64 and s390x:
  "FAIL: encode-1: Encode buffer match"

The offending stub was how we memcpy the FRE start address to the buffer
(on-disk format).  When the host is big-endian, the address of the
source buffer for the memcpy needs to point to the uint8_t/uint16_t sized
value of the FRE start addr, not uint32_t sized value; we intend to copy
out only the fre_start_addr_sz number of bytes.

ChangeLog:

	* libsframe/sframe.c (sframe_encoder_write_fre_start_addr): New
	function.
	(sframe_encoder_write_fre): Use it instead of memcpy.
2022-12-25 00:08:27 -08: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
883be19774 sim: cpu: change default init to handle all cpus
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.
2022-12-25 02:10:46 -05:00
Mike Frysinger
fc9b044582 sim: msp430: add basic SMP cpu init
There's no need to assert there's only 1 CPU when setting them all
up here is trivial.
2022-12-25 02:10:46 -05:00
Mike Frysinger
21a0fa89d2 sim: m32r: fix iterator typo when setting up cpus
This code loops over available cpus with "c", but then looks up the
cpu with "i".  Fix the typo so the code works correctly with smp.
2022-12-25 02:10:46 -05:00
Mike Frysinger
8290c8b5dd sim: v850: fix SMP compile
The igen tool sets up the SD & CPU defines for code fragments to use,
but v850 was expecting "sd".  Change all the igen related code to use
SD so it actually compiles, and fix a few places to use "CPU" instead
of hardcoding cpu0.
2022-12-25 02:10:22 -05:00
Mike Frysinger
46ebce9b9c sim: or1k: fix iterator typo when setting up cpus
This code loops over available cpus with "c", but then looks up the
cpu with "i".  Fix the typo so the code works correctly with smp.
2022-12-25 02:09:18 -05:00
Mike Frysinger
70b920ed09 sim: mn10300: fix SMP compile
The igen tool sets up the SD define for code fragments to use, but
mn10300 was expecting "sd".  Change all the igen related code to use
SD so it actually compiles.
2022-12-25 02:09:18 -05:00
Mike Frysinger
fb74976044 sim: cpu: fix SMP msg prefix helper
This code fails to compile when SMP is enabled due to some obvious
errors.  Fix those and change the logic to avoid CPP to prevent any
future rot from creeping back in.
2022-12-25 02:09:17 -05:00
Mike Frysinger
23ddbd2f2b sim: mips: clean up a bit after mips/configure removal
Now that there is no subdir configure script, we can clean up some
logic that was spread between the files.
2022-12-24 22:13:56 -05:00
Mike Frysinger
abc494c65d sim: mips: move igen settings to top-level configure
This is the last bit of logic that exists in the mips configure
script, so move it to the top-level configure to kill it off.
We still have to move the Makefile.in igen logic to local.mk,
but this is a required first step for that.
2022-12-24 22:13:13 -05:00
Mike Frysinger
fec5386aef sim: mips: namespace igen configure vars
To prepare moving this logic to the top-level configure, the vars
need to be namespaced.  Do that here to make it easier to review.
Basically sim_xxx -> SIM_MIPS_XXX when a var is exported from the
configure script to the Makefile, and sim_xxx -> sim_mips_xxx when
the var is internal in the configure script.
2022-12-24 21:41:22 -05:00
Mike Frysinger
a449d2c294 sim: mips: add igen recursive dep
Make sure the igen tool exists before trying to compile the mips
subdir.  This happens to work when mips has a subconfigure, but
hits a race condition when that is removed.
2022-12-24 21:39:09 -05:00
Mike Frysinger
d093438bdc sim: mips: drop unused ENGINE_ISSUE_POSTFIX_HOOK
Nothing defines this, and it isn't called in all the engine runtimes,
so drop it entirely to avoid confusion.
2022-12-24 21:37:59 -05:00
Mike Frysinger
3bef0f032c sim: igen: drop move-if-changed usage
Now that igen itself has this logic, drop these custom build rules
to greatly simplify.
2022-12-24 21:35:54 -05:00
Mike Frysinger
a5f08108c1 sim: igen: support in-place updates ourself
Every file that igen outputs is then processed with the move-if-changed
shell script.  This creates a lot of boilerplate in the build and not an
insignificant amount of build-time overhead.  Move the simple "is the file
changed" logic into igen itself.
2022-12-24 21:33:24 -05:00
Mike Frysinger
5d3539bd6b sim: igen: constify itable data structures
These are const data arrays of strings and numbers.  We don't want
or need them to be writable, so mark them all const.
2022-12-24 21:30:33 -05:00
GDB Administrator
bba234157f Automatic date update in version.in 2022-12-25 00:00:08 +00:00
Andrew Burgess
3a98808c16 gdb/testsuite: fix buffer overflow in gdb.base/signed-builtin-types.exp
In commit:

  commit 9f50fe0835
  Date:   Wed Dec 7 15:55:25 2022 +0000

      gdb/testsuite: new test for recent dwarf reader issue

A new test (gdb.base/signed-builtin-types.exp) was added that made use
of 'info sources' to figure out if the debug information for a
particular object file had been fully expanded or not.  Unfortunately
some lines of the 'info sources' output can be very long, this was
observed on some systems where the debug information for the
dynamic-linker was installed, in this case, the list of source files
associated with the dynamic linker was so long it would cause expect's
internal buffer to overflow.

This commit switches from using 'info sources' to 'maint print
objfile', the output from the latter command is more compact, but
also, can be restricted to a single named object file.

With this change in place I am no longer seeing buffer overflow errors
from expect when running gdb.base/signed-builtin-types.exp.
2022-12-24 16:02:47 +00:00
Mike Frysinger
f5e82fac07 sim: or1k: move arch-specific settings to internal header
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 the existing or1k-sim.h.
Unfortunately, we can't yet drop the or1k-sim.h include from sim-main.h
as many of the generated CGEN files refer only to sim-main.h.  We'll
have to improve the CGEN interface before we can make more progress,
but this is at least a minor improvement.
2022-12-23 20:55:55 -05:00
GDB Administrator
095f84c7e3 Automatic date update in version.in 2022-12-24 00:00:07 +00:00
Tom Tromey
32e62cbcc1 Use bool for dwarf2_has_info
This changes dwarf2_has_info to return bool.
2022-12-23 14:14:18 -07:00
Indu Bhagat
28f1a767db libsframe: testsuite: fix memory leaks in testcases
ChangeLog:

	* libsframe/testsuite/libsframe.decode/be-flipping.c: Free
	SFrame buffer.
	* libsframe/testsuite/libsframe.decode/frecnt-1.c: Likewise.
	* libsframe/testsuite/libsframe.decode/frecnt-2.c: Likewise.
2022-12-23 13:04:19 -08:00
Indu Bhagat
995bc59782 libsframe: fix a memory leak in sframe_decode
sframe_decode () needs to malloc a temporary buffer of the same size as
the input buffer (containing the SFrame section bytes) when endian
flipping is needed.  The decoder keeps the endian flipped contents in
this buffer for its usage.  This code is necessary when the target
endianneess is not the same as host endianness.

The malloc'd buffer needs to be kept track of, so that it can freed up in
sframe_decoder_free () later.

ChangeLog:

	* libsframe/sframe-impl.h (struct sframe_decoder_ctx): Add new
	member to keep track of the internally malloc'd buffer.
	* libsframe/sframe.c (sframe_decoder_free): Free it up.
	(sframe_decode): Update the reference to the buffer.
2022-12-23 13:04:06 -08:00
Simon Marchi
c9397e5758 gdb/testsuite: remove MPFR detection in gdb.base/float128.exp
I see this fail since commit 9911806278 ("Use toplevel configure for
GMP and MPFR for gdb"):

    FAIL: gdb.base/float128.exp: show configuration

The test fails to find --with-mpfr or --without-mpfr in the "show
configuration" output.  Since MPFR has become mandatory, we can just
remove that check and simplify the test to assume MPFR support is there.

Change-Id: I4f3458470db0029705b390dfefed3a66dfc0633a
Approved-By: Tom de Vries <tdevries@suse.de>
2022-12-23 11:17:39 -05:00
Mike Frysinger
f51d9c6a77 sim: m32r: move arch-specific settings to internal header
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 the existing m32r-sim.h.
Unfortunately, we can't yet drop the m32r-sim.h include from sim-main.h
as many of the generated CGEN files refer only to sim-main.h.  We'll
have to improve the CGEN interface before we can make more progress,
but this is at least a minor improvement.
2022-12-23 08:32:59 -05:00
Mike Frysinger
218366690f sim: bfin: move arch-specific settings to internal header
There's no need for these settings to be in sim-main.h which is shared
with common/ sim code, so drop the bfin.h include and move the remaining
bfin-specific settings into it.
2022-12-23 08:32:58 -05:00
Mike Frysinger
600ddfd55a sim: m68hc11: move arch-specific settings to internal header
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.
2022-12-23 08:32:58 -05:00
Mike Frysinger
12d563bbf7 sim: sh: move arch-specific settings to internal header
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.
2022-12-23 08:32:58 -05:00
Mike Frysinger
7e9c749ccc sim: mcore: move arch-specific settings to internal header
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.
2022-12-23 08:32:58 -05:00
Mike Frysinger
758f5a9875 sim: h8300: move arch-specific settings to internal header
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.
2022-12-23 08:32:58 -05:00
Mike Frysinger
2a91447ab8 sim: pru: move arch-specific settings to internal header
There's no need for these settings to be in sim-main.h which is shared
with common/ sim code, so drop the pru.h include and move the remaining
pru-specific settings into it.
2022-12-23 08:32:58 -05:00
Mike Frysinger
627bdb6394 sim: mn10300: standardize the arch-specific settings a little
Rename mn10300_sim.h to mn10300-sim.h to match other ports, and move most
of the arch-specific content out of sim-main.h to it.  This isn't a big
win though as we still have to include the header in sim-main.h due to the
igen interface: it hardcodes including sim-main.h in its files.  So until
we can fix that, we have to keep bleeding these settings into the common
codes.

Also take the opportunity to purge a lot of unused headers from these.
The local modules should already include the right headers, so there's
no need to force everyone to pull them in.  A lot of this is a hold over
from the pre-igen days of this port.
2022-12-23 08:32:58 -05:00