binutils-gdb.git
22 months ago[gdb/testsuite] Fix gdb.reverse/step-indirect-call-thunk.exp with -fcf-protection
Tom de Vries [Fri, 30 Dec 2022 15:48:07 +0000 (16:48 +0100)]
[gdb/testsuite] Fix gdb.reverse/step-indirect-call-thunk.exp with -fcf-protection

On Ubuntu 22.04.1 x86_64, I run into:
...
gdb.reverse/step-indirect-call-thunk.c: In function 'inc':^M
gdb.reverse/step-indirect-call-thunk.c:22:1: error: '-mindirect-branch' and \
  '-fcf-protection' are not compatible^M
   22 | {                /* inc.1 */^M
      | ^^M
...

Fix this by forcing -fcf-protection=none, if supported.

Tested on x86_64-linux.

22 months ago[gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with -fcf-protection
Tom de Vries [Fri, 30 Dec 2022 13:00:39 +0000 (14:00 +0100)]
[gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with -fcf-protection

On Ubuntu 22.04.1 x86_64, I run into:
...
(gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: not in inline 1
next^M
51        if (t != NULL^M
(gdb) FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
...

This is due to -fcf-protection, which adds the endbr64 at the start of get_alias_set:
...
0000000000001180 <_Z13get_alias_setP4tree>:
    1180:       f3 0f 1e fa             endbr64
    1184:       48 85 ff                test   %rdi,%rdi
...
so the extra insn gets an is-stmt line number entry:
...
INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
  ...
11     50     0x0000000000001180 Y
12     50     0x0000000000001180
13     51     0x0000000000001184 Y
14     54     0x0000000000001184
...
and when stepping into get_alias_set we step to line 50:
...
(gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: in main
step^M
get_alias_set (t=t@entry=0x555555558018 <xx>) at step-and-next-inline.cc:50^M
50      {^M
...

In contrast, with -fcf-protection=none, we get:
...
0000000000001170 <_Z13get_alias_setP4tree>:
    1170:       48 85 ff                test   %rdi,%rdi
...
and:
...
INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
  ...
11     50     0x0000000000001170 Y
12     51     0x0000000000001170 Y
13     54     0x0000000000001170
...
so when stepping into get_alias_set we step to line 51:
...
(gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: in main
step^M
get_alias_set (t=t@entry=0x555555558018 <xx>) at step-and-next-inline.cc:51^M
51        if (t != NULL^M
...

Fix this by rewriting the gdb_test issuing the step command to check which
line the step lands on, and issuing an extra next if needed.

Tested on x86_64-linux, both with and without -fcf-protection=none.

PR testsuite/29920
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29920

22 months ago[gdb/symtab] Make comp_unit_head.length private
Tom de Vries [Fri, 30 Dec 2022 12:55:22 +0000 (13:55 +0100)]
[gdb/symtab] Make comp_unit_head.length private

Make comp_unit_head.length private, to enforce using accessor functions.

Replace accessor function get_length with get_length_with_initial and
get_length_without_initial, to make it explicit which variant we're using.

Tested on x86_64-linux.

PR symtab/29343
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29343

22 months agoPR29948, heap-buffer-overflow in display_debug_lines_decoded
Alan Modra [Fri, 30 Dec 2022 01:11:16 +0000 (11:41 +1030)]
PR29948, heap-buffer-overflow in display_debug_lines_decoded

This fixes a couple of places in display_debug_lines_decoded that were
off by one in checking DWARF5 .debug_line directory indices.  It also
displays the DWARF5 entry 0 for the program current directory rather
than "." as is done for pre-DWARF5.  I decided against displaying
DW_AT_comp_dir for pre-DWARF5 since I figure it is better for readelf
to minimally interpret debug info.

binutils/
PR 29948
* dwarf.c (display_debug_lines_decoded): Display the given
directory entry 0 for DWARF5.  Properly check directory index
against number of entries in the table.  Revert to using
unsigned int for n_directories and associated variables.
Correct warning messages.
gas/
* testsuite/gas/elf/dwarf-5-loc0.d: Update.

22 months agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Dec 2022 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

22 months agoRISC-V: Simplify riscv_csr_address logic on state enable extensions
Tsukasa OI [Tue, 27 Dec 2022 03:31:19 +0000 (03:31 +0000)]
RISC-V: Simplify riscv_csr_address logic on state enable extensions

This commit makes CSR class handling for 'Smstateen' and 'Ssstateen'
extensions simpler using fall-throughs (as used in CSR_CLASS_I{,_32}).

gas/ChangeLog:

* config/tc-riscv.c (riscv_csr_address): Simplify the logic for
'Smstateen' and 'Ssstateen' extensions.

22 months agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Dec 2022 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

22 months agoUse $decimal in timestamp.exp
Tom Tromey [Wed, 28 Dec 2022 17:07:45 +0000 (10:07 -0700)]
Use $decimal in timestamp.exp

This patch fixes a review comment by Tom de Vries.  He pointed out
that the new timestamp.exp should use the $decimal convenience regexp.

22 months agoFix "set debug timestamp"
Tom Tromey [Tue, 27 Dec 2022 23:34:44 +0000 (16:34 -0700)]
Fix "set debug timestamp"

PR cli/29945 points out that "set debug timestamp 1" stopped working
-- this is a regression due to commit b8043d27 ("Remove a ui-related
memory leak").

This patch fixes the bug and adds a regression test.

I think this should probably be backported to the gdb 13 branch.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29945

22 months agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Dec 2022 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

23 months agox86-64: Allocate input section memory if needed
H.J. Lu [Tue, 27 Dec 2022 19:41:11 +0000 (11:41 -0800)]
x86-64: Allocate input section memory if needed

When --no-keep-memory is used, the input section memory may not be cached.
Allocate input section memory for -z pack-relative-relocs if needed.

bfd/

PR ld/29939
* elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Allocate
input section memory if needed.

ld/

PR ld/29939
* testsuite/ld-elf/dt-relr-2i.d: New test.

23 months agoRISC-V: Fix T-Head Fmv vendor extension encoding
Christoph Müllner [Fri, 16 Dec 2022 18:44:07 +0000 (19:44 +0100)]
RISC-V: Fix T-Head Fmv vendor extension encoding

A recent change in the XTheadFmv spec fixed an encoding bug in the
document. This patch changes the code to follow this bugfix.

Spec patch can be found here:
  https://github.com/T-head-Semi/thead-extension-spec/pull/11

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
23 months agoHandle SIGSEGV in gdb selftests
Tom Tromey [Thu, 15 Dec 2022 21:12:05 +0000 (14:12 -0700)]
Handle SIGSEGV in gdb selftests

The gdb.gdb self-tests were timing out for me, which turned out to be
PR testsuite/29325.  Looking into it, the problem is that the version
of the Boehm GC that is used by Guile on my machine causes a SEGV
during stack probing.  This unexpected stop confuses the tests and
causes repeated timeouts.

This patch adapts the two failing tests.  This makes them work for me,
and reduces the running time of gdb.gdb from 20 minutes to about 11
seconds.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29325

23 months agosim: build: clean up unused codegen logic
Mike Frysinger [Sun, 25 Dec 2022 18:46:30 +0000 (13:46 -0500)]
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.

23 months agosim: mips: hoist "multi" igen rules up to common builds
Mike Frysinger [Sun, 25 Dec 2022 08:13:24 +0000 (03:13 -0500)]
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.

23 months agosim: mips: hoist "m16" igen rules up to common builds
Mike Frysinger [Sun, 25 Dec 2022 07:50:07 +0000 (02:50 -0500)]
sim: mips: hoist "m16" igen rules up to common builds

23 months agosim: mips: hoist "single" igen rules up to common builds
Mike Frysinger [Sun, 25 Dec 2022 07:48:36 +0000 (02:48 -0500)]
sim: mips: hoist "single" igen rules up to common builds

23 months agosim: mips: rename "igen" generation mode to "single"
Mike Frysinger [Sun, 25 Dec 2022 07:37:10 +0000 (02:37 -0500)]
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.

23 months agosim: mips: hoist itable igen rules up to common builds
Mike Frysinger [Sun, 25 Dec 2022 07:25:47 +0000 (02:25 -0500)]
sim: mips: hoist itable igen rules up to common builds

Since this rule is pretty simple, hoist it up to the common build.

23 months agosim: mips: unify itable generation (a bit)
Mike Frysinger [Sun, 25 Dec 2022 06:48:01 +0000 (01:48 -0500)]
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.

23 months agosim: mips: rename multi_flags to igen_itable_flags
Mike Frysinger [Sun, 25 Dec 2022 06:44:27 +0000 (01:44 -0500)]
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.

23 months agosim: mips: drop unused micromips igen logic
Mike Frysinger [Sun, 25 Dec 2022 06:23:21 +0000 (01:23 -0500)]
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.

23 months agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Dec 2022 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in

23 months agoAdd initializers to comp_unit_head
Tom Tromey [Sat, 16 Jul 2022 01:05:29 +0000 (19:05 -0600)]
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

23 months agobfd/dwarf2.c: allow use of DWARF5 directory entry 0
Alan Modra [Fri, 23 Dec 2022 12:52:32 +0000 (23:22 +1030)]
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.

23 months agoAdd support for x86_64-*-gnu-* targets to build x86_64 gnumach/hurd
Flavio Cruz [Mon, 26 Dec 2022 01:20:58 +0000 (20:20 -0500)]
Add support for x86_64-*-gnu-* targets to build x86_64 gnumach/hurd

23 months agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Dec 2022 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in

23 months agosim: build: drop support for subdir distclean
Mike Frysinger [Sun, 25 Dec 2022 19:23:24 +0000 (14:23 -0500)]
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.

23 months agosim: mips: move distclean settings to common build
Mike Frysinger [Sun, 25 Dec 2022 08:23:06 +0000 (03:23 -0500)]
sim: mips: move distclean settings to common build

This was missed when mips/configure was merged into the top-level.

23 months agolibsframe: write out SFrame FRE start address correctly
Indu Bhagat [Sun, 25 Dec 2022 08:06:22 +0000 (00:06 -0800)]
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.

23 months agosim: smp: plumb igen flag down to all users
Mike Frysinger [Sun, 25 Dec 2022 06:05:09 +0000 (01:05 -0500)]
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.

23 months agosim: smp: make option available again
Mike Frysinger [Sun, 25 Dec 2022 04:28:19 +0000 (23:28 -0500)]
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.

23 months agosim: cpu: change default init to handle all cpus
Mike Frysinger [Sun, 25 Dec 2022 05:53:25 +0000 (00:53 -0500)]
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.

23 months agosim: msp430: add basic SMP cpu init
Mike Frysinger [Sun, 25 Dec 2022 05:49:11 +0000 (00:49 -0500)]
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.

23 months agosim: m32r: fix iterator typo when setting up cpus
Mike Frysinger [Sun, 25 Dec 2022 05:48:30 +0000 (00:48 -0500)]
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.

23 months agosim: v850: fix SMP compile
Mike Frysinger [Sun, 25 Dec 2022 05:32:49 +0000 (00:32 -0500)]
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.

23 months agosim: or1k: fix iterator typo when setting up cpus
Mike Frysinger [Sun, 25 Dec 2022 05:31:19 +0000 (00:31 -0500)]
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.

23 months agosim: mn10300: fix SMP compile
Mike Frysinger [Sun, 25 Dec 2022 05:28:55 +0000 (00:28 -0500)]
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.

23 months agosim: cpu: fix SMP msg prefix helper
Mike Frysinger [Sun, 25 Dec 2022 04:43:18 +0000 (23:43 -0500)]
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.

23 months agosim: mips: clean up a bit after mips/configure removal
Mike Frysinger [Sun, 25 Dec 2022 02:29:55 +0000 (21:29 -0500)]
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.

23 months agosim: mips: move igen settings to top-level configure
Mike Frysinger [Sun, 25 Dec 2022 02:28:03 +0000 (21:28 -0500)]
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.

23 months agosim: mips: namespace igen configure vars
Mike Frysinger [Sun, 25 Dec 2022 00:38:44 +0000 (19:38 -0500)]
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.

23 months agosim: mips: add igen recursive dep
Mike Frysinger [Sun, 25 Dec 2022 02:25:50 +0000 (21:25 -0500)]
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.

23 months agosim: mips: drop unused ENGINE_ISSUE_POSTFIX_HOOK
Mike Frysinger [Sun, 25 Dec 2022 02:04:09 +0000 (21:04 -0500)]
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.

23 months agosim: igen: drop move-if-changed usage
Mike Frysinger [Sat, 24 Dec 2022 20:10:01 +0000 (15:10 -0500)]
sim: igen: drop move-if-changed usage

Now that igen itself has this logic, drop these custom build rules
to greatly simplify.

23 months agosim: igen: support in-place updates ourself
Mike Frysinger [Sat, 24 Dec 2022 20:02:00 +0000 (15:02 -0500)]
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.

23 months agosim: igen: constify itable data structures
Mike Frysinger [Sat, 24 Dec 2022 06:20:14 +0000 (01:20 -0500)]
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.

23 months agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Dec 2022 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

23 months agogdb/testsuite: fix buffer overflow in gdb.base/signed-builtin-types.exp
Andrew Burgess [Tue, 20 Dec 2022 12:51:50 +0000 (12:51 +0000)]
gdb/testsuite: fix buffer overflow in gdb.base/signed-builtin-types.exp

In commit:

  commit 9f50fe0835850645bd8ea9bb1efe1fe6c48dfb12
  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.

23 months agosim: or1k: move arch-specific settings to internal header
Mike Frysinger [Sat, 24 Dec 2022 01:51:39 +0000 (20:51 -0500)]
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.

23 months agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Dec 2022 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

23 months agoUse bool for dwarf2_has_info
Tom Tromey [Wed, 21 Dec 2022 21:35:01 +0000 (14:35 -0700)]
Use bool for dwarf2_has_info

This changes dwarf2_has_info to return bool.

23 months agolibsframe: testsuite: fix memory leaks in testcases
Indu Bhagat [Fri, 23 Dec 2022 21:04:19 +0000 (13:04 -0800)]
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.

23 months agolibsframe: fix a memory leak in sframe_decode
Indu Bhagat [Fri, 23 Dec 2022 21:04:06 +0000 (13:04 -0800)]
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.

23 months agogdb/testsuite: remove MPFR detection in gdb.base/float128.exp
Simon Marchi [Thu, 22 Dec 2022 15:10:24 +0000 (10:10 -0500)]
gdb/testsuite: remove MPFR detection in gdb.base/float128.exp

I see this fail since commit 991180627851 ("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>
23 months agosim: m32r: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 05:49:09 +0000 (00:49 -0500)]
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.

23 months agosim: bfin: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 05:10:35 +0000 (00:10 -0500)]
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.

23 months agosim: m68hc11: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 05:07:47 +0000 (00:07 -0500)]
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.

23 months agosim: sh: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 05:01:43 +0000 (00:01 -0500)]
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.

23 months agosim: mcore: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 05:00:07 +0000 (00:00 -0500)]
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.

23 months agosim: h8300: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 04:56:19 +0000 (23:56 -0500)]
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.

23 months agosim: pru: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 04:52:24 +0000 (23:52 -0500)]
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.

23 months agosim: mn10300: standardize the arch-specific settings a little
Mike Frysinger [Fri, 23 Dec 2022 04:47:50 +0000 (23:47 -0500)]
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.

23 months agosim: microblaze: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 04:29:21 +0000 (23:29 -0500)]
sim: microblaze: 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.

23 months agosim: example-synacor: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 04:15:39 +0000 (23:15 -0500)]
sim: example-synacor: 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.

23 months agosim: moxie: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 04:13:54 +0000 (23:13 -0500)]
sim: moxie: 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.

23 months agosim: riscv: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 04:10:38 +0000 (23:10 -0500)]
sim: riscv: 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.

We can also move the machs.h include out since the model logic was all
generalized from compile-time to runtime last year.

23 months agosim: v850: standardize the arch-specific settings a little
Mike Frysinger [Fri, 23 Dec 2022 03:57:57 +0000 (22:57 -0500)]
sim: v850: standardize the arch-specific settings a little

Rename v850_sim.h to v850-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.

23 months agosim: msp430: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 03:47:10 +0000 (22:47 -0500)]
sim: msp430: 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 msp430-sim.h include and move it to
the few files that actually need it.

While we're here, drop redundant includes from sim-main.h:
* sim-config.h & sim-types.h included by sim-basics.h already
* sim-engine.h included by sim-base.h already
And move sim-options.h to the one file that needs it.

23 months agosim: ft32: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 03:42:02 +0000 (22:42 -0500)]
sim: ft32: 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 ft32-sim.h include and move it to
the few files that actually need it.

23 months agosim: d10v: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 03:39:55 +0000 (22:39 -0500)]
sim: d10v: 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 d10v_sim.h include and move it to
the few files that actually need it.

Also rename the file to standardize it a bit better with other ports.

23 months agosim: cr16: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 03:35:11 +0000 (22:35 -0500)]
sim: cr16: 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 cr16_sim.h include and move it to
the few files that actually need it.

Also rename the file to standardize it a bit better with other ports.

23 months agosim: arm: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 03:28:06 +0000 (22:28 -0500)]
sim: arm: 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.

The BIT override would be better in the place where it's redefined, so
move it to armdefs.h instead.

23 months agosim: aarch64: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 03:20:08 +0000 (22:20 -0500)]
sim: aarch64: 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.

While we're here, drop redundant includes from sim-main.h:
* sim-types.h is included by sim-base.h already
* sim-base.h is included twice
* sim-io.h is included by sim-base.h already

23 months agosim: avr: move arch-specific settings to internal header
Mike Frysinger [Fri, 23 Dec 2022 03:12:20 +0000 (22:12 -0500)]
sim: avr: 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.

23 months agoFix illegal memory access parsing corrupt DWARF information.
Nick Clifton [Fri, 23 Dec 2022 13:02:04 +0000 (13:02 +0000)]
Fix illegal memory access parsing corrupt DWARF information.

PR 29936
* dwarf2.c (concat_filename): Fix check for a directory index off
the end of the directory table.

23 months agoFix MinGW build using mingw.org's MinGW
Eli Zaretskii [Thu, 22 Dec 2022 10:42:24 +0000 (12:42 +0200)]
Fix MinGW build using mingw.org's MinGW

This allows to build GDB even though the default value of
_WIN32_WINNT is lower than the one needed to expose some
new APIs used here, and leave the test for their actual
support to run time.
* gdb/nat/windows-nat.c (EXTENDED_STARTUPINFO_PRESENT): Define if
not defined.
(create_process_wrapper): Use 'gdb_lpproc_thread_attribute_list'
instead of 'PPROC_THREAD_ATTRIBUTE_LIST' (which might not be defined
at compile time).  This fixes compilation error using mingw.org's
MinGW.

23 months agold: Write linker symbols in PDB
Mark Harmstone [Fri, 9 Dec 2022 01:52:40 +0000 (01:52 +0000)]
ld: Write linker symbols in PDB

23 months agold: Copy other symbols into PDB file
Mark Harmstone [Fri, 9 Dec 2022 01:52:39 +0000 (01:52 +0000)]
ld: Copy other symbols into PDB file

23 months agold: Write globals stream in PDB
Mark Harmstone [Fri, 9 Dec 2022 01:52:38 +0000 (01:52 +0000)]
ld: Write globals stream in PDB

23 months agold: Parse LF_UDT_SRC_LINE records when creating PDB file
Mark Harmstone [Fri, 9 Dec 2022 01:52:37 +0000 (01:52 +0000)]
ld: Parse LF_UDT_SRC_LINE records when creating PDB file

23 months agold: Write types into IPI stream of PDB
Mark Harmstone [Fri, 9 Dec 2022 01:52:36 +0000 (01:52 +0000)]
ld: Write types into IPI stream of PDB

23 months agold: Write types into TPI stream of PDB
Mark Harmstone [Fri, 9 Dec 2022 01:52:35 +0000 (01:52 +0000)]
ld: Write types into TPI stream of PDB

23 months agold: Write DEBUG_S_LINES entries in PDB file
Mark Harmstone [Fri, 9 Dec 2022 01:52:34 +0000 (01:52 +0000)]
ld: Write DEBUG_S_LINES entries in PDB file

23 months agold: Fix segfault in populate_publics_stream
Mark Harmstone [Fri, 9 Dec 2022 01:52:33 +0000 (01:52 +0000)]
ld: Fix segfault in populate_publics_stream

23 months agold: Write DEBUG_S_FILECHKSMS entries in PDBs
Mark Harmstone [Fri, 9 Dec 2022 01:52:32 +0000 (01:52 +0000)]
ld: Write DEBUG_S_FILECHKSMS entries in PDBs

23 months agold: Generate PDB string table
Mark Harmstone [Fri, 9 Dec 2022 01:52:31 +0000 (01:52 +0000)]
ld: Generate PDB string table

23 months agopdb build fixes
Alan Modra [Thu, 22 Dec 2022 01:19:09 +0000 (11:49 +1030)]
pdb build fixes

Enable compilation of ld/pdb.c just for x86, as is done for bfd/pdb.c.
This reduces the size of ld and is necessary with the following
patches that call a COFF-only bfd function from ld/pdb.c.  Without it
we'd break every non-COFF target build.

23 months agosim: lm32/m32r: drop redundant opcode/cgen.h include
Mike Frysinger [Fri, 23 Dec 2022 05:37:32 +0000 (00:37 -0500)]
sim: lm32/m32r: drop redundant opcode/cgen.h include

The xxx-desc.h header file already includes this, and it's how the
other cgen ports are getting it, so drop it from these two.

23 months agosim: ppc: drop unused types from sim-main.h
Mike Frysinger [Fri, 23 Dec 2022 05:27:08 +0000 (00:27 -0500)]
sim: ppc: drop unused types from sim-main.h

The common sim headers should define these for us already, so there's
no need for the ppc header to set them up.

23 months agosim: cgen: move symcat.h include to where it's used
Mike Frysinger [Fri, 23 Dec 2022 05:32:29 +0000 (00:32 -0500)]
sim: cgen: move symcat.h include to where it's used

Move this out of the global sim-main.h and to the few files that
actually use functions from it.  Only the cgen ports were pulling
this, so this makes cgen & non-cgen behave more the same.

23 months agosim: cgen: move cgen-types.h include to cgen-defs.h
Mike Frysinger [Fri, 23 Dec 2022 04:21:59 +0000 (23:21 -0500)]
sim: cgen: move cgen-types.h include to cgen-defs.h

The cgen-types.h header sets up types that are needed by cgen-defs.h,
so move the include out of sim-main.h and to that header.  It might
be needed in other specific modules, but for now let's kick it out of
sim-main.h to make some progress.  Things still build with just this.

23 months agoRevert "sim: mn10300: drop unused sim-main.c"
Mike Frysinger [Fri, 23 Dec 2022 05:20:52 +0000 (00:20 -0500)]
Revert "sim: mn10300: drop unused sim-main.c"

This reverts commit 681a422b855e4b20086554b170dae051361f00c7.

I missed that this was included via common/sim-inline.c.  I thought
I had grepped the top of the tree, but I must have only done mn10300.

Add a comment to make it clear where/how this file is used.

23 months agosim: mn10300: drop unused sim-main.c
Mike Frysinger [Fri, 23 Dec 2022 04:38:32 +0000 (23:38 -0500)]
sim: mn10300: drop unused sim-main.c

Nothing compiles or references this, so punt it.

23 months agosim: endian: move bfd.h from header to source
Mike Frysinger [Fri, 23 Dec 2022 03:06:52 +0000 (22:06 -0500)]
sim: endian: move bfd.h from header to source

The bfd APIs are used only by sim-n-endian.h which is only included by
sim-endian.c, so move the bfd.h include there and out of sim-endian.h
which is included by many other modules.

23 months agosim: move bfd.h include out of sim-main.h
Mike Frysinger [Fri, 23 Dec 2022 03:01:19 +0000 (22:01 -0500)]
sim: move bfd.h include out of sim-main.h

Not all arches include this in sim-main.h, and the ones that do don't
actually use bfd defines in the sim-main.h header.  Prune it to make
sim-main.h simpler so we can kill it off entirely in the future.

We add the include to the files that utilize e.g. bfd_vma though.

23 months agosim: mcore: replace custom "word" type with int32_t
Mike Frysinger [Fri, 23 Dec 2022 02:53:51 +0000 (21:53 -0500)]
sim: mcore: replace custom "word" type with int32_t

This is a 32-bit architecture with 32-bit registers, so replace the
custom "word" long int typedef with an explicit int32_t.  This is
a correctness fix since long will be 64-bits on most 64-bit hosts.

23 months agosim: moxie: replace custom "word" type with int32_t
Mike Frysinger [Fri, 23 Dec 2022 02:45:15 +0000 (21:45 -0500)]
sim: moxie: replace custom "word" type with int32_t

This is a 32-bit architecture with 32-bit registers, so replace the
custom "word" int typedef with an explicit int32_t.  Practically
speaking, this produces the same code, but it should hopefully make
it easier to merge common code in the future.

23 months agosim: cr16/d10v/mcore/moxie: clean up unused word & uword types
Mike Frysinger [Fri, 23 Dec 2022 02:36:24 +0000 (21:36 -0500)]
sim: cr16/d10v/mcore/moxie: clean up unused word & uword types

Nothing actually uses these, so punt them.  Some of the ports are
using local "word" types, but we'll clean those up in a follow up.

23 months agosim: mips: trim redundant igen settings
Mike Frysinger [Fri, 23 Dec 2022 02:28:16 +0000 (21:28 -0500)]
sim: mips: trim redundant igen settings

These variables are setting the same value as the defaults.  Trim
this redundant logic to make it easier to see the real differences
so we can try to keep unifying cases.