]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
35 min agogdb/testsuite: adjust add-inferior test for native-extended-gdbserver board master
Simon Marchi [Thu, 6 Nov 2025 21:13:07 +0000 (16:13 -0500)] 
gdb/testsuite: adjust add-inferior test for native-extended-gdbserver board

I see this failure:

    $ make check TESTS="gdb.base/with.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"
    FAIL: gdb.base/with.exp: per-inferior parameters: add-inferior

The add-inferior command produces more output than expected when using
the native-extended-gdbserver board, because it is already connected to
a remote target:

    (gdb) add-inferior
    [New inferior 2]
    Added inferior 2 on connection 1 (extended-remote localhost:2348)

Fix that by accepting output after "Added inferior 2", as is done
elsewhere in the testsuite already (e.g. gdb.btrace/multi-inferior.exp).

Change-Id: I047a3be5249dd803839b213dd2f1646736fc8289

5 hours agogas: Default to -mrelax-relocations=no on Solaris/x86 [PR19520]
Rainer Orth [Thu, 6 Nov 2025 16:18:16 +0000 (17:18 +0100)] 
gas: Default to -mrelax-relocations=no on Solaris/x86 [PR19520]

I recently noticed a complex case statement in gas/configure.ac controlling
the setting of ac_default_x86_relax_relocations on Solaris/x86.  Since it
included all versions of Solaris, it could be massively simplified.

Looking closer however, I found that it was introduced in

commit 0cb4071ef9e10f703220f5e731141bf438aca16e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Feb 3 08:25:15 2016 -0800

    Add -mrelax-relocations= to x86 assembler

based on PR gas/19520.  This PR reported that the new R_386_GOT32X
etc. relocations weren't supported on older versions of Solaris,
breaking gcc bootstrap.  In response, they were disabled on all Solaris
versions except Solaris 12, where they had been implemented in the
native toolchain based on my findings.

However, Solaris 12 has been rechristened to 11.4 before release,
effectively disabling DEFAULT_GENERATE_X86_RELAX_RELOCATIONS on all
versions of Solaris/x86.

Since Solaris 11.4 cannot be distinguished from earlier versions in
cross configurations, this patch fixes this by removing
--enable-x86-relax-relocations completely, instead disabling
DEFAULT_GENERATE_X86_RELAX_RELOCATIONS in tc-i386.c on Solaris.  It also
adds testcases to verify the -mrelax-relocations default.

Tested on {i386,amd64}-pc-solaris2.11 and {i686,x86_64}-pc-linux-gnu.

2025-10-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gas:
PR gas/19520
* configure.ac (ac_default_x86_relax_relocations): Remove.
<i386-*-solaris2* | x86_64-*-solaris2>: Likewise.
* configure: Regenerate.
* config.in: Regenerate.
* config/tc-i386.c (DEFAULT_GENERATE_X86_RELAX_RELOCATIONS): Define.
* doc/c-i386.texi (i386-Options, -mrelax-relocations): Remove
--enable-x86-relax-relocations reference.
* testsuite/gas/i386/gotx.s: New source.
* testsuite/gas/i386/gotx-default.d: New test.
* testsuite/gas/i386/no-gotx-default.d: Likewise.
* testsuite/gas/i386/i386.exp: Run them.

6 hours agoFix build after command_classes change
Tom Tromey [Thu, 6 Nov 2025 15:33:08 +0000 (08:33 -0700)] 
Fix build after command_classes change

Commit 7028626eff3 (gdb: make command classes be bitmaps) broke the
build, causing the compiler to issue an error message about the global
scm-cmd.c:command_classes being redefined as a different type.
Renaming the global fix the problem.

11 hours agogdb/python: fix gdb.Block repr output
Andrew Burgess [Tue, 4 Nov 2025 09:59:09 +0000 (09:59 +0000)] 
gdb/python: fix gdb.Block repr output

I noticed that when printing a gdb.Block object in Python, I would
occasionally get corrupted, nonsensical output, like this:

  <gdb.Block <anonymous> {intintyinty_1inty_3inty_5... (-5 more symbols)}>

The symbol list is missing commas, it should be:

  int, inty, inty_1, inty_3, inty_5, ...

And the '-5 more symbols' is clearly not right.

The problem is in python/py-block.c, we use this line to calculate the
number of symbols in a block:

  const int len = mdict_size (block->multidict ());

Then we loop over the symbols in the block like this:

  for (struct symbol *symbol : block_iterator_range (block))
    ...

The problem here is that 'block_iterator_range (block)' can loop over
more symbols than just those within 'block'.  For global and static
blocks, block_iterator_range() takes into account included CUs; and so
can step through multiple global or static blocks.  See
block_iterator_step and find_iterator_compunit_symtab in block.c for
more details.

In contrast, 'mdict_size (block->multidict ())' only counts the
symbols contained within 'block' itself.

I could fix this by either fixing LEN, or by only iterating over the
symbols within 'block'.

I assume that printing a gdb.Block object is used mostly for debug
purposes; the output isn't really user friendly, so I cannot imagine a
user script that is relying on printing a gdb.Block as a way to inform
the user about blocks in their program.  As such, I think it makes
more sense if the symbols listed are restricted to those strictly held
within the block.

And so, instead of block_iterator_range, I've switched to iterating
over the multidict symbols.  Now the calculated LEN will match the
number of symbols being printed, which fixes the output seen above.
However, as we're now only printing symbols that are within the block
being examined, the output above becomes:

  <gdb.Block <anonymous> {}>

All the symbols that GDB previously tried to print, are coming from an
included CU.

For testing, I've made use of an existing DWARF test that tests
DW_AT_import.  In the wild I saw this in an inferior that used
multiple shared libraries that has their debug information stored in a
separate debug file, and then parts of that debug information was
combined into a third separate file using the DWZ tool.  I made a few
attempts to craft a simpler reproducer, but failed.  In the end it was
easier to just use a DWARF assembler test to reproduce the issue.

I have added some more typedef symbols into the DWARF test, I don't
believe that this will impact the existing test, but makes the
corrupted output more obvious.

Approved-By: Tom Tromey <tom@tromey.com>
12 hours ago[gdb/testsuite] Fix DUPLICATE in callfuncs.exp
Tom de Vries [Thu, 6 Nov 2025 09:39:33 +0000 (10:39 +0100)] 
[gdb/testsuite] Fix DUPLICATE in callfuncs.exp

With test-case gdb.base/callfuncs.exp I get:
...
UNTESTED: gdb.base/callfuncs.exp: failed to prepare
  ...
UNTESTED: gdb.base/callfuncs.exp: failed to prepare
DUPLICATE: gdb.base/callfuncs.exp: failed to prepare
...

Fix this by moving a with_test_prefix up one level.

Tested on x86_64-linux.

20 hours agoRISC-V: Fix missing instruction classes in error messages
Jerry Zhang Jian [Wed, 5 Nov 2025 02:18:20 +0000 (10:18 +0800)] 
RISC-V: Fix missing instruction classes in error messages

Add 6 missing instruction class cases to riscv_multi_subset_supports_ext()
to provide proper extension names in error messages instead of producing
"internal: unreachable INSN_CLASS_*" errors.

These instruction classes exist in riscv_multi_subset_supports() but were
missing from riscv_multi_subset_supports_ext(), causing the assembler to
produce internal errors when instructions are used without the required
-march specification.

Missing classes added:
- INSN_CLASS_ZABHA_AND_ZACAS (zabha and zacas)
- INSN_CLASS_XVENTANACONDOPS (xventanacondops)
- INSN_CLASS_XSFVCP (xsfvcp)
- INSN_CLASS_XSFVQMACCQOQ (xsfvqmaccqoq)
- INSN_CLASS_XSFVQMACCDOD (xsfvqmaccdod)
- INSN_CLASS_XSFVFNRCLIPXFQF (xsfvfnrclipxfqf)

Before this fix:
  Error: internal: unreachable INSN_CLASS_*
  Error: unrecognized opcode `amocas.b a0,a1,(a2)'

After this fix:
  Error: unrecognized opcode `amocas.b a0,a1,(a2)', extension `zabha' and `zacas' required

bfd/
    * elfxx-riscv.c (riscv_multi_subset_supports_ext): Add 6
    missing instruction class cases.

Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
21 hours agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Nov 2025 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

24 hours agogdb: add "essential" command class
Guinevere Larsen [Fri, 19 Sep 2025 11:44:35 +0000 (08:44 -0300)] 
gdb: add "essential" command class

Currently, there is no way for a new user to have an idea of common
useful commands  and behaviors from the GDB interface itself, without
checking the example session in the documentation.  This command class
aims to close that gap by providing a set of quickstart commands that
allows for any simple debug session to happen without anything too
egregious missing.

The set of commands was chosen somewhat arbitrarily, based on what I
used or missed the most.  The one overarching important thing, however,
is that the list is kept short, so as to not overwhelm new users.  This
is confirmed by the newly introduced selftest, essential_command_count,
which ensures there are 20 or fewer essential commands.

Here's the reasoning for some of the choices:
* The command "start" was picked over "run" because combining it with
"continue" achieves the same effect, and I prefer it over needing to set
a breakpoint on main to stop at the start of the inferior.
* The command "ptype" is chosen because I believe it is important to
provide a way for the user to check a variable's type from inside GDB,
and ptype is a more complete command than the alternative, "whatis".

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
24 hours agogdb: make command classes be bitmaps
Guinevere Larsen [Thu, 18 Sep 2025 19:09:59 +0000 (16:09 -0300)] 
gdb: make command classes be bitmaps

This commit makes it so GDB's command classes can be represented with a
single bit, allowing for a command to have multiple classes.  This is
primarily done as preparation for the next patch, but it can provide
value on its own as some commands could be described as belonging to
multiple classes, such as "record" being obscure and related to running
the inferior.

Approved-By: Tom Tromey <tom@tromey.com>
26 hours agobinutils/MAINTAINERS: list new gprofng maintainers
Jose E. Marchesi [Wed, 5 Nov 2025 19:32:18 +0000 (20:32 +0100)] 
binutils/MAINTAINERS: list new gprofng maintainers

As agreed with Nick I will be co-maintaining gprofng moving forward
along with Claudiu.  Update the MAINTAINERS file accordingly.

26 hours agogdb/testsuite: remove unused "variable" statement
Simon Marchi [Tue, 4 Nov 2025 15:51:44 +0000 (10:51 -0500)] 
gdb/testsuite: remove unused "variable" statement

Change-Id: I2e26a9953324c752edd01b37db6b176fd0ee9187

26 hours agoLD/doc: Add missing `--push-state' option markup
Maciej W. Rozycki [Wed, 5 Nov 2025 19:02:55 +0000 (19:02 +0000)] 
LD/doc: Add missing `--push-state' option markup

There is a missing option markup for a `--push-state' reference in the
description of the `--pop-state' option, fix it.

26 hours agoBFD: Remove unused file position member of `struct orl'
Maciej W. Rozycki [Wed, 5 Nov 2025 19:02:55 +0000 (19:02 +0000)] 
BFD: Remove unused file position member of `struct orl'

The `pos' member of `struct orl' has never been used.  Remove it along
with the enclosing union so as not to propagate clutter with a later
change, which adds that union as a distinct type.  No functional change.

30 hours ago[gdb/testsuite] Yet another attempt to fix gdb.threads/thread-specific-bp.exp
Tom de Vries [Wed, 5 Nov 2025 15:16:01 +0000 (16:16 +0100)] 
[gdb/testsuite] Yet another attempt to fix gdb.threads/thread-specific-bp.exp

When running test-case gdb.threads/thread-specific-bp.exp using taskset to
select an Efficient-core in a loop, it fails 19 out of 100 runs.

For example, like this:
...
(gdb) continue -a^M
Continuing.^M
^M
Thread 1 "thread-specific" hit Breakpoint 4, end () at thread-specific-bp.c:29^M
29      }^M
(gdb) FAIL: $exp: non_stop=on: continue to end
[Thread 0x7ffff7cbe6c0 (LWP 2348848) exited]^M
Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M
...

The way we're trying to match this gdb output is:
...
    gdb_test_multiple "$cmd" "continue to end" {
-re "$\r\n${gdb_prompt} .*${msg_re}\r\n" {
    pass $gdb_test_name
}
-re "\r\n${msg_re}\r\n.*$gdb_prompt " {
    pass $gdb_test_name
  }
     }
...

The problem is that the two -re clauses above do not match the output ending
in a prompt, so the default fail in gdb_test_multiple triggers.

Fix this by splitting this up in two gdb_test_multiple calls:
- the first matches a prompt (with or without preceding $msg_re), making sure
  that the default fail doesn't trigger, and
- the second matches $msg_re, if that was not already matched by the first call.

Using this approach, the test-case passes 100 out of 100 runs.

Tested on x86_64-linux, also with make-check-all.sh.

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

30 hours ago[gdb/testsuite] Remove gdb.dwarf2/dw2-ranges.exp
Tom de Vries [Wed, 5 Nov 2025 15:07:54 +0000 (16:07 +0100)] 
[gdb/testsuite] Remove gdb.dwarf2/dw2-ranges.exp

On openSUSE Leap 15.6 x86_64 with test-case gdb.dwarf2/dw2-ranges.exp I ran
into:
...
(gdb) file dw2-ranges^M
Reading symbols from dw2-ranges...^M
warning: stabs debug information is not supported.^M
(gdb)
...

The test-case checks a combination of dwarf and stabs.

Now that stabs is no longer supported, checking the combination is no longer possible.

Fix this by removing the test-case.

38 hours agoinclude: sframe: fix minor typos in sframe_decode
Indu Bhagat [Wed, 5 Nov 2025 07:28:43 +0000 (23:28 -0800)] 
include: sframe: fix minor typos in sframe_decode

Change argument names (in declaration) to SF_BUF and SF_SIZE (instead of
the current CF_BUF and CF_SIZE respectively).

include/
        * sframe-api.h (sframe_decode): Fix typos.  Use same name as
used for the definition.

38 hours agogas: sframe: fix PR gas/33277
Indu Bhagat [Wed, 5 Nov 2025 06:59:11 +0000 (22:59 -0800)] 
gas: sframe: fix PR gas/33277

In SFrame stack trace format, the representation of stack offsets allows
for either 1-byte, 2-byte or 4-byte integers.

Add new internal function sframe_fre_stack_offset_bound_p () which
checks if the given offset is within bounds (at most as a 4-byte
integer).  Use this to check if CFA offset is within bounds, if not skip
emitting the FDE, and warn the user.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
PR gas/33277
        * gen-sframe.c (sframe_fre_stack_offset_bound_p): New
definition.
        (sframe_xlate_do_def_cfa): Check bounds of offset.
        (sframe_xlate_do_def_cfa_offset): Likewise.

gas/testsuite/
PR gas/33277
        * gas/cfi-sframe/cfi-sframe.exp: Add new test.
        * gas/cfi-sframe/cfi-sframe-x86_64-empty-pr33277.d: Likewise.
        * gas/cfi-sframe/cfi-sframe-x86_64-empty-pr33277.s: Likewise.

45 hours agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Nov 2025 00:00:38 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 days agohppa64: Fix some issues handling dynamic relocaltions
John David Anglin [Tue, 4 Nov 2025 21:00:04 +0000 (16:00 -0500)] 
hppa64: Fix some issues handling dynamic relocaltions

This change fixes the allocation logic in allocate_dynrel_entries and
elf64_hppa_finalize_dynreloc.  It also fixes addend calculation for
segment based relocations.

Some applications now link successfully on HP-UX but there are still
issues with external weak symbols.  This breaks linking with libgcc.
It looks like we need support for .rela.data.rel.ro, ...

2025-11-04  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* elf64-hppa.c (allocate_dynrel_entries): Correct hh->want_opd
if condition.
(elf64_hppa_finalize_dynreloc): Likewise.  Use symbol address
instead of OPD address.  Include sec->output_offset in value2
calculation.
(elf64_hppa_finalize_opd): Likewise.
(elf64_hppa_finalize_dlt): Likewise.
(elf_hppa_final_link_relocate): Fix symbol address calculation.

2 days agogdb: change blockvector_contains_pc to be a method
Jan Vrany [Tue, 4 Nov 2025 11:18:12 +0000 (11:18 +0000)] 
gdb: change blockvector_contains_pc to be a method

This changes blockvector_contains_pc() to be a method contains()
of struct blockvector.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 days agogdb: change find_block_in_blockvector to be a method
Jan Vrany [Tue, 4 Nov 2025 11:18:12 +0000 (11:18 +0000)] 
gdb: change find_block_in_blockvector to be a method

This changes find_block_in_blockvector() to be a method lookup()
of struct blockvector.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 days agos390: Emit relocation for 32-bit immediate operand
Jens Remus [Tue, 4 Nov 2025 10:51:07 +0000 (11:51 +0100)] 
s390: Emit relocation for 32-bit immediate operand

IBM Z instruction format RIL-a has a 32-bit immediate operand in
instruction bits 16 to 47.  Enable the assembler to emit a 32-bit
direct or PC-relative relocation when processing a fixup, similar
as it is already done for 16-bit immediate operands in bits 16-31.

This enables to assemble the following:

lgfi %r1,symbol # R_390_32
lgfi %r1,symbol-. # R_390_PC32

Furthermore it brings GNU assembler on par with LLVM assembler in
that regard.

gas/
* config/tc-s390.c (md_apply_fix): Emit 32-bit direct or
PC-relative relocation for 32-bit immediate operand in
instruction bits 16-47.

gas/testsuite/
* gas/s390/zarch-reloc.d: Add tests for relocation of RIL-a
32-bit immediate operand.
* gas/s390/zarch-reloc.s: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2 days agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Nov 2025 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 days agogdb: introduce blockvector_up
Simon Marchi [Mon, 3 Nov 2025 17:45:10 +0000 (12:45 -0500)] 
gdb: introduce blockvector_up

Change-Id: Id43c5982969f85b5931ba8a32d208a7326ed3492
Approved-By: Tom Tromey <tom@tromey.com>
3 days agogdb: fix a typo in a comment in gdbtypes.h
Tankut Baris Aktemur [Mon, 3 Nov 2025 15:07:52 +0000 (16:07 +0100)] 
gdb: fix a typo in a comment in gdbtypes.h

Fix the typo "can server" to "can serve".

Also re-align the comment to make `void (*) ()` not break.

3 days agoClean up "return -1" in gdb.rust
Tom Tromey [Thu, 30 Oct 2025 15:20:25 +0000 (09:20 -0600)] 
Clean up "return -1" in gdb.rust

This changes gdb.rust tests to use plain "return" rather than
"return -1".  In these spots, the "-1" has no meaning.

Approved-by: Kevin Buettner <kevinb@redhat.com>
3 days agoRemove call to abort in the DGB debug format printing code, thus allowing the display...
Nick Clifton [Mon, 3 Nov 2025 11:49:02 +0000 (11:49 +0000)] 
Remove call to abort in the DGB debug format printing code, thus allowing the display of a fuzzed input file to complete without triggering an abort.

PR 33448

3 days agoSync top-level with GCC
Sam James [Mon, 3 Nov 2025 09:53:04 +0000 (09:53 +0000)] 
Sync top-level with GCC

This just brings in the following two changes:

commit 04df8fa9e73e612f978fff35a97841703b872f6c
Author:     Thomas Schwinge <tschwinge@baylibre.com>
AuthorDate: Tue Oct 21 09:46:32 2025 +0200
Commit:     Thomas Schwinge <tschwinge@baylibre.com>
CommitDate: Fri Oct 24 12:40:22 2025 +0200

    Simplify 'Makefile' dependencies for libatomic [PR81358]

    ...

commit e63cf4b130b86dd7dde1bf499d3d40faca10ea2e
Author:     Prathamesh Kulkarni <prathameshk@nvidia.com>
AuthorDate: Thu Oct 9 07:07:24 2025 +0000
Commit:     Prathamesh Kulkarni <prathameshk@nvidia.com>
CommitDate: Thu Oct 9 07:26:51 2025 +0000

    PR81358: Enable automatic linking of libatomic.

    ...

ChangeLog:

* Makefile.def: Sync with GCC.
* configure.ac: Ditto.
* configure: Regenerate.

3 days agolibsframe: use sframe_decoder_get_funcdesc_v2 in dumper
Indu Bhagat [Mon, 3 Nov 2025 07:42:32 +0000 (23:42 -0800)] 
libsframe: use sframe_decoder_get_funcdesc_v2 in dumper

Not strictly necessary for correctness.  But using '_v2' named APIs is
more appropriate.

libsframe/

        * sframe-dump.c (dump_sframe_func_with_fres):

3 days agogas: sframe: improve code comments around SFRAME_FRE_BASE_REG_INVAL
Indu Bhagat [Mon, 3 Nov 2025 07:41:04 +0000 (23:41 -0800)] 
gas: sframe: improve code comments around SFRAME_FRE_BASE_REG_INVAL

Rename it to SFRAME_FRE_REG_INVALID.

gas/
        * gen-sframe.c (sframe_row_entry_new): Adjust code comments a
bit.
        * gen-sframe.h (SFRAME_FRE_BASE_REG_INVAL): Rename from..
        (SFRAME_FRE_REG_INVALID): ..to this.

3 days agoelf: Don't set its DT_VERSYM entry for unversioned symbol
H.J. Lu [Wed, 29 Oct 2025 01:49:57 +0000 (09:49 +0800)] 
elf: Don't set its DT_VERSYM entry for unversioned symbol

1. Referenced symbol without '@' has no version.
2. Defined symbol without the .symver directive has no version if there
is no linker version script.

Symbol without version shouldn't have the base version in its DT_VERSYM
entry.  Instead, its DT_VERSYM entry should be all zero to indicate that
the symbol doesn't have a version.

NB: Symbol with the base version has a '@' suffix, like "foo@", defined
with

.symver hide_original_foo, foo@

bfd/

PR ld/33577
* elflink.c (elf_link_output_extsym): Don't set its DT_VERSYM
entry for the symbol without version.

ld/

PR ld/33577
* ld-elfvers/vers16.dsym: Remove the "Base" version on symbols
without version.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 days agobtrace: stopped_by_*() consider the selected thread
Markus Metzger [Fri, 25 Oct 2024 14:15:59 +0000 (14:15 +0000)] 
btrace: stopped_by_*() consider the selected thread

In stopped_by_sw_breakpoint() and stopped_by_hw_breakpoint(), we check
whether any thread is replaying.  This is unnecessary as it only matters
if inferior_ptid is replaying.

Narrow the check to inferior_ptid.

3 days agobtrace: remove update_thread_list() and thread_alive()
Markus Metzger [Fri, 25 Oct 2024 14:07:51 +0000 (14:07 +0000)] 
btrace: remove update_thread_list() and thread_alive()

The record btrace target does not create or destroy threads.  There is no
reason to override the update_thread_list() and thread_alive() target
methods.

3 days agobtrace, infrun: replay scheduler locking only depends on to-be-resumed thread
Markus Metzger [Fri, 25 Oct 2024 13:53:04 +0000 (13:53 +0000)] 
btrace, infrun: replay scheduler locking only depends on to-be-resumed thread

Similar to the parent commit, simplify schedlock_applies() by only
checking the argument thread.

When resuming that thread, GDB will automatically stop replaying its
inferior.  The replay state of other inferiors is not considered by
user_visible_resume_ptid(), so let's not consider them in
schedlock_applies(), either.

Approved-By: Tom Tromey <tom@tromey.com>
3 days agobtrace, infrun: simplify scheduler-locking replay
Markus Metzger [Fri, 25 Oct 2024 07:17:05 +0000 (07:17 +0000)] 
btrace, infrun: simplify scheduler-locking replay

When scheduler-locking is set to replay and we're resuming a thread at the
end of its execution history, we check whether anything is replaying in
user_visible_resume_ptid() only to check again in clear_proceed_status()
before we stop replaying the current process.

What really matters is whether the selected thread is replaying or will
start replaying.

Simplify this by removing redundant checks.

Also avoid a redundant pass over all threads to check whether anything is
replaying before stopping replaying.  Make record_stop_replaying() handle
the case when we're not replaying gracefully.

Approved-By: Tom Tromey <tom@tromey.com>
3 days agogdb, remote: adjust debug printing
Markus Metzger [Mon, 24 Jun 2024 08:21:17 +0000 (08:21 +0000)] 
gdb, remote: adjust debug printing

remote::wait () may get called rather frequently, polluting the logging
output with tons of

    [remote] wait: enter
    [remote] wait: exit

messages.

Similarly, remote_target::remote_notif_remove_queued_reply () will print
the debug message even if nothing was actually removed.  Change that to
only print a debug message if a stop reply was removed.

Approved-By: Tom Tromey <tom@tromey.com>
3 days agogdb, btrace: set wait status to ignore if nothing is moving
Markus Metzger [Wed, 21 Feb 2024 17:06:41 +0000 (17:06 +0000)] 
gdb, btrace: set wait status to ignore if nothing is moving

When record_btrace::wait() is called and no threads are moving, we set the
wait status to no_resumed.  Change that to ignore.

This helps with enabling per-inferior run-control for the record btrace
target as it avoids breaking out of do_target_wait() too early with
no_resumed when there would have been an event on another thread.

3 days agogdb, btrace: simplify gdb.btrace/multi-inferior.exp
Markus Metzger [Thu, 22 Feb 2024 10:32:11 +0000 (10:32 +0000)] 
gdb, btrace: simplify gdb.btrace/multi-inferior.exp

We don't really need three inferiors to test multi-inferior recording.
We don't really need to check info record before starting recording.
If we were recording, there would be output, causing a fail.

This just complicates the test when there is something to debug.

3 days agobtrace: clear thread stopped state when stopping replaying
Markus Metzger [Tue, 12 Aug 2025 12:33:48 +0000 (12:33 +0000)] 
btrace: clear thread stopped state when stopping replaying

When we stop replaying a thread, it moves to the end of its execution
history.  It retains its state from when it was replaying, though, so a
subsequent 'info program' command would show wrong information.

Clear all execution state used by the 'info program' command.

3 days agobtrace: do not allow moving running threads with 'record goto'
Markus Metzger [Wed, 13 Aug 2025 14:38:10 +0000 (14:38 +0000)] 
btrace: do not allow moving running threads with 'record goto'

With asynchronous commands, a thread can be replaying in the background
while it is being moved using the 'record goto' command in the foreground.

Do not allow that.

3 days agobtrace: do not stop replaying or recording while a thread is running
Markus Metzger [Wed, 13 Aug 2025 14:25:27 +0000 (14:25 +0000)] 
btrace: do not stop replaying or recording while a thread is running

With asynchronous stepping commands, one may start replaying a thread in
the background and then stop recording its inferior in the foreground.

This causes the execution history to be cleared and the record target to
be unpushed while the thread is using said execution history.

I fail to see a use-case for this, so rather than trying to make this
work, I prevent such a scenario by not allowing replaying or recording to
be stopped while a thread is running.

We could do this only when a thread is running in replay mode and preserve
the existing behavior of being able to stop recording while threads are
running in recording mode.  It seems more consistent to not allow this for
both replaying and recording threads, though.

3 days agobtrace: update record_btrace_stop_replaying_at_end
Markus Metzger [Mon, 11 Aug 2025 14:17:17 +0000 (14:17 +0000)] 
btrace: update record_btrace_stop_replaying_at_end

In record_btrace_stop_replaying_at_end, we know that we are at the end of
the execution history, so PC must match the current PC if we're not
replaying.

We're not changing any other registers during btrace replay, so we should
be fine leaving the regcache.

But we need to reinit the frame cache, since current frames used the
btrace unwinder.

The main motivation for this, however, is that future patches extend stop
replaying in ways that is not relevant to stop replaying at the end.

3 days agogdb, record: notify frame change on 'record stop' when selected thread moves
Markus Metzger [Fri, 9 May 2025 10:33:44 +0000 (10:33 +0000)] 
gdb, record: notify frame change on 'record stop' when selected thread moves

As a side effect of the 'record stop' command, threads may move to the end
of their execution history if they had been replaying.

When using CLI or TUI, there is no indication of that move for the
selected thread.

Notify about the frame change for the selected thread.  This makes CLI
print the selected frame and TUI update their view.

Add a note to the MI record-stopped event.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
3 days agogdb, btrace: fix pr19340
Markus Metzger [Tue, 20 Feb 2024 11:45:39 +0000 (11:45 +0000)] 
gdb, btrace: fix pr19340

GDB fails with an assertion when stopping recording on a replaying thread
and then resuming that thread.  Stopping recording left the thread
replaying but the record target is gone.

Stop replaying all threads in the selected inferior before stopping recording.

I had to change the stepping test slightly to account for different
compilers generating slightly different debug information, so when
stepping the 'return 0' after 'record stop' I would end up in a different
location depending on which compiler I used.  The test still covers all
stepping commands.

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

Approved-By: Andrew Burgess <aburgess@redhat.com>
3 days agoctf-archive sanity checks
Alan Modra [Mon, 3 Nov 2025 02:31:42 +0000 (13:01 +1030)] 
ctf-archive sanity checks

Existing code checks that the first uint64_t ctfa_magic field is
available before reading but neglects to check that the last uint64_t
ctfa_ctfs is available before reading it in ctf_arc_bufpreamble.
ctf_arc_bufopen sets up a pointer to the struct ctf_archive in
ctf_new_archive_internal.  Extend the check to cover the entire struct.

PR 33548
PR 33549
* ctf-archive.c (ctf_arc_bufpreamble, ctf_arc_bufopen): Check
that buffer contains at least an entire struct ctf_archive
when accessing such a struct.

3 days agoregen some configure files
Alan Modra [Mon, 3 Nov 2025 01:21:24 +0000 (11:51 +1030)] 
regen some configure files

commit 87b6078fc212 had some stale files

3 days agotidy m4 plugin config support
Alan Modra [Mon, 3 Nov 2025 00:29:50 +0000 (10:59 +1030)] 
tidy m4 plugin config support

In CLANG_PLUGIN_FILE it is possible for plugin_file to be non-NULL
when LLVMgold.so does not exist.

configure output is messy, with results not printed against their
  "checking.." line, eg.
checking for clang... (cached) yes
checking for clang plugin file... checking for x86_64-pc-linux-gnu-ar... (cached) ar --plugin /usr/lib/llvm-20/lib/clang/20/../../LLVMgold.so
/usr/lib/llvm-20/lib/clang/20/../../LLVMgold.so

This patch fixes those problems, and a similar interposition of other
configure output between AC_MSG_CHECKING and AC_MSG_RESULT in
gcc-plugin.m4.  It also tidies some of the message text, and makes
similar code in gcc-plugin.m4 and clang-plugin.m4 a little more
consistent.

config/
* clang-plugin.m4 (CLANG_PLUGIN_FILE): Don't place checks for
tools (llvm-config, ar) inside AC_MSG_CHECKING..AC_MSG_RESULT
for clang plugin file.  Clear plugin_file before loop exit.
(CLANG_PLUGIN_FILE_FOR_TARGET): Similarly.
* gcc-plugin.m4 (GCC_PLUGIN_OPTION): Similarly.
(GCC_PLUGIN_OPTION_FOR_TARGET): Correct AC_MSG_CHECKING.  Tidy
return code.
binutils/
* testsuite/lib/binutils-common.exp <llvm_plug_opt>: Set for
non-native.
* configure: Regenerate.
/
* configure: Regenerate.
bfd/
* configure: Regenerate.
gas/
* configure: Regenerate.
gdb/
* configure: Regenerate.
gprof/
* configure: Regenerate.
gprofng/
* configure: Regenerate.
* libcollector/configure: Regenerate.
ld/
* configure: Regenerate.
libbacktrace/
* configure: Regenerate.
libctf/
* configure: Regenerate.
libiberty/
* configure: Regenerate.
libsframe/
* configure: Regenerate.
opcodes/
* configure: Regenerate.
sim/
* configure: Regenerate.
zlib/
* configure: Regenerate.

3 days agoPR 33455 SEGV in vfinfo at ldmisc.c:527
Alan Modra [Sun, 2 Nov 2025 22:33:37 +0000 (09:03 +1030)] 
PR 33455 SEGV in vfinfo at ldmisc.c:527

A reloc howto set up with EMPTY_HOWTO has a NULL name.  More than one
place emitting diagnostics assumes a reloc howto won't have a NULL
name.

PR 33455
* coffcode.h (coff_slurp_reloc_table): Don't allow a howto with
a NULL name.

3 days agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Nov 2025 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 days agohppa64: Implement segment based relocations for local symbols
John David Anglin [Sun, 2 Nov 2025 21:04:55 +0000 (16:04 -0500)] 
hppa64: Implement segment based relocations for local symbols

There is progress in implementing 64-bit shared library support.

Fixes link error compiling vdso64.so.  HP-UX dynamic linker no longer
complains that libgcc_s.4 linked with GNU ld is an invalid shared library.

Relocations are now generated for all slots in .rela.data, .rela.dlt
and .rela.opd.  Relocation counts for libgcc_s.4 linked using GNU and
HP ld are the same except .rela.plt.  That may be okay as GNU ld directs
pc-relative calls to stubs.

Glibc's ld.so.new appears to link okay.  However, libgcc_s.4 linked with
GNU ld is still broken on HP-UX.

There are six unexpected fails in the testsuite and three unexpected
passes.  There's at least one fail due to name munging in the .dynsym
table.

2025-11-02  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* elf64-hppa.c (struct elf64_hppa_link_hash_entry): Remove
sym_ind and owner fields.  Rename hash entries for __text_seg
and __data_seg.  Adjust all users.
(global_sym_index): Remove.
(hppa64_elf_local_refcounts): Assert size is not 0.
(elf64_hppa_check_relocs): Drop NEED_PLT from R_PARISC_FPTR64
relocation.  Don't stash abfd and r_symndx in hh->owner and
hh->sym_indx.  Add global symbols with hh->eh.dynindx equal
-1 to dynamic table.  Don't record section symbols to the
local dynamic symbol table.
(allocate_global_data_dlt): Don't add symbol to local dynamic
symbol table.
(allocate_global_data_opd): Likewise.
(elf64_hppa_late_size_sections): Rework code to add __text_seg
and __data_seg symbols to the dynamic table.
(elf64_hppa_finalize_dlt): Revise to use __text_seg and
__data_seg symbols.
(elf64_hppa_finalize_dynreloc): Likewise.
(elf_hppa_final_link_relocate): When generating a shared
library, ignore relocs in debugging sections.  Revise
relocations needing DLT and OPD dynamic relocations to output
dynamic relocatios for local symbols.  Move code to initialize
segment base values back to SEGREL case.

4 days agogdb: add a constructor for symtab
Andrew Burgess [Fri, 31 Oct 2025 10:19:41 +0000 (10:19 +0000)] 
gdb: add a constructor for symtab

Convert symtab to use obstack_new, and have a real constructor.  The
filename, filename_for_id and m_compunit, members should really not
change once the symtab has been created, so make these members private
(m_compunit was already private) and set them just once from the
constructor.  The set_compunit function has been deleted, and new
getter functions for filename and filename_for_id have been added.

The language is also set at construction time, but can be updated
later, so set the language in the constructor, but retain
symtab::set_language for when the language needs to be updated.

Prior to this patch the symtab was allocated with OBSTACK_ZALLOC which
would zero out the symtab object.  With the call to objstack_new
fields in the symtab would no longer be initialised, so I've added
default member initialisation for everything not set in the
constructor.

The interesting changes are in symtab.h, and symfile.c.  Everything
else is just updating to handle symfile::filename and
symfile::filename_for_id becoming methods.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
4 days agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Nov 2025 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 days agolibsframe: use sf_fde_tbl data structure internally for the decoder
Indu Bhagat [Sat, 1 Nov 2025 08:46:42 +0000 (01:46 -0700)] 
libsframe: use sf_fde_tbl data structure internally for the decoder

Instead of the current sframe_func_desc_entry (on-disk format
representation) data structure.

The decoder context in libsframe, so far, has been internally directly
tied to the sframe_func_desc_entry (on-disk format representation) data
structure.  While this allows libsframe to avoid some operations, this
is not desirable anymore as the format evolves: we will need to support
reading in of older version(s) of SFrame FDE, as well as a newer on-disk
representations for SFrame FDE.

Use sf_fde_tbl internally in the decoder context.  Note that libsframe
already does _not_ use sframe_func_desc_entry in any external-facing,
user-visible APIs.

Note that this commit is simply preparatory in nature.  At the moment,
the 'sf_fde_tbl' internally uses the sframe_func_desc_entry (on-disk
format representation).  When need arises (as SFrame FDE evolves), we
may change sf_fde_tbl to use an alternative (but still libsframe
internal) definition of SFrame FDE.

lisbframe/
        * sframe-impl.h (sf_fde_tbl, sf_fre_tbl): Move definition before use.
Use sf_fde_tbl instead of sframe_func_desc_entry in struct
        sframe_decoder_ctx.
        * sframe.c (sframe_fde_tbl_alloc): New internal definition.
        (sframe_fde_tbl_init): Likewise.
        (sframe_decoder_get_funcdesc_at_index): Adjust for sf_fde_tbl
usage.
        (sframe_decoder_get_secrel_func_start_addr): Likewise.
        (sframe_fre_check_range_p): Likewise.
        (sframe_decode): Likewise.
        (sframe_get_funcdesc_with_addr_internal): Likewise.

5 days agolibsframe: make flip_header version aware
Indu Bhagat [Sat, 1 Nov 2025 08:42:02 +0000 (01:42 -0700)] 
libsframe: make flip_header version aware

Future versions of the format may have alternative representation of an
FDE.  As the format evolves, endian flipping of the SFrame header may
need to be version aware.

flip_header () now takes the SFrame version as argument and also returns
SFRAME_ERR in case of error.  Currently the SFrame version as argument
remains unused.

SFrame encoder, at the momemnt, writes the SFrame data in the most recent
format version by default.

libsframe/
        * sframe.c (flip_header): Make version aware.
        (sframe_decode): Adjust usage of flip_header.
        (sframe_encoder_write): Likewise.

5 days agolibsframe: make flip_fde version aware
Indu Bhagat [Sat, 1 Nov 2025 08:35:34 +0000 (01:35 -0700)] 
libsframe: make flip_fde version aware

Future versions of the format may have a different representation of an
SFrame FDE.  As the format evolves, endian flipping will need to be version
aware.

Refactor flip_fde a bit by carving out an internal sframe_decode_fde API
which can read information from an on-disk SFrame FDE.

libsframe/
        * sframe.c (flip_fde): Make version aware.
        (sframe_decode_fde): New internal definition.
        (flip_sframe): Use the new definitions.

5 days agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Nov 2025 00:00:12 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 days agoAutomatic date update in version.in
GDB Administrator [Fri, 31 Oct 2025 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 days agolto: Set plugin_format to bfd_plugin_no only if known_used is set
H.J. Lu [Tue, 28 Oct 2025 12:21:19 +0000 (20:21 +0800)] 
lto: Set plugin_format to bfd_plugin_no only if known_used is set

commit b21318bd2c29fcca8f99c1de7facdaa5cb2e66e2
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu May 11 14:31:09 2023 +0000

    Add LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [GCC PR109128]

added the LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook for offload
support.  Since the V2 linker plugin hook doesn't claim the offload IR if
known_used is unset, set input plugin_format to bfd_plugin_no only if
known_used is set or the V2 linker plugin hook is unused.

PR ld/33584
* plugin.c (plugin_object_p): Set plugin_format to bfd_plugin_no
only if known_used is set or the V2 linker plugin hook is unused.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 days agotic4x_scan: match printable arch string
Alan Modra [Thu, 30 Oct 2025 23:08:00 +0000 (09:38 +1030)] 
tic4x_scan: match printable arch string

Fix odd behaviour of objcopy -I -B on tic4x, where the tms320c4x
string reported by objcopy --info isn't a valid arch string.

* cpu-tic4x.c (tic4x_scan): Match arch string reported by
objcopy --info.

6 days agoPass -B to objcopy binary symbol test
Alan Modra [Thu, 30 Oct 2025 22:57:46 +0000 (09:27 +1030)] 
Pass -B to objcopy binary symbol test

objcopy -I binary -O some_coff_target does not currently work without
choosing a valid arch with -B.  This used to be the case for ELF
targets too, until commit 6765ee1825d9.

* testsuite/binutils-all/objcopy.exp (binary_symbol): Pass
-B arch to objcopy.  Choose different output object files for
the two tests.

7 days agohppa64: Use address of __text_seg symbol in elf64_hppa_finalize_opd
John David Anglin [Thu, 30 Oct 2025 20:40:06 +0000 (16:40 -0400)] 
hppa64: Use address of __text_seg symbol in elf64_hppa_finalize_opd

2025-10-30  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* elf64-hppa.c (elf64_hppa_finalize_opd): Use address of
__text_seg symbol instead of hppa_info->text_segment_base.

7 days agohppa64: Use address of __text_seg symbol insted of hppa_info->text_segment_base
John David Anglin [Thu, 30 Oct 2025 20:29:55 +0000 (16:29 -0400)] 
hppa64: Use address of __text_seg symbol insted of hppa_info->text_segment_base

2025-10-30  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* elf64-hppa.c (elf_hppa_final_link_relocate): Use address of
__text_seg symbol insted of hppa_info->text_segment_base.

7 days agohppa64: Add code to intialize __data_seg section symbol
John David Anglin [Thu, 30 Oct 2025 20:15:31 +0000 (16:15 -0400)] 
hppa64: Add code to intialize __data_seg section symbol

2025-10-30  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* elf64-hppa.c (struct elf64_hppa_link_hash_table): Add
data_segment field.
(allocate_global_data_opd): Move code to initialize text
segment section symbol to elf64_hppa_late_size_sections.
(elf64_hppa_late_size_sections): Add code to setup
__data_seg section symbol.

7 days agogdbsupport: bump unordered_dense to 4.8.0
Simon Marchi [Mon, 27 Oct 2025 19:25:51 +0000 (15:25 -0400)] 
gdbsupport: bump unordered_dense to 4.8.0

We don't need anything in this release, but I think it doesn't hurt to
just stay up to date.  The new version has a new include file, stl.h.
To keep things clean and separated, move the imported files to a new
sub-directory.  This requires a small change in
gdb/check-include-guards.py, to be able to ignore the whole new
directory.

Change-Id: Ic8c5d0dd5ea8b6691c99975d6ca78f637175ef42
Approved-By: Tom Tromey <tom@tromey.com>
7 days agopre-commit: use ^ anchors in `files`
Simon Marchi [Wed, 29 Oct 2025 17:49:28 +0000 (13:49 -0400)] 
pre-commit: use ^ anchors in `files`

Some `files` regexes use a ^ anchor, some don't.  I think it's good to
be explicit about it (and consistent), so use it everywhere.

Change-Id: I14eb2082a1c0ff6bc219e202fb16c3f12001fd73
Approved-By: Tom Tromey <tom@tromey.com>
7 days agopre-commit: run flake8 on all .py(.in)? files under gdb
Simon Marchi [Wed, 29 Oct 2025 17:49:27 +0000 (13:49 -0400)] 
pre-commit: run flake8 on all .py(.in)? files under gdb

This covers Python files under gdb/contrib and gdb/testsuite, which are
now flake8-clean.

Change-Id: If587964d0735f6f585c72d18df40439424215644
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/contrib/dwarf-to-dwarf-assembler.py: remove unused imports
Simon Marchi [Wed, 29 Oct 2025 17:49:26 +0000 (13:49 -0400)] 
gdb/contrib/dwarf-to-dwarf-assembler.py: remove unused imports

Remove imports reported as unused by flake8.

Change-Id: I1a1e5edab6ecd6ee774cb4bd20bf22b8952898aa
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: avoid assigning lambdas in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:25 +0000 (13:49 -0400)] 
gdb/testsuite: avoid assigning lambdas in Python files

Fix flake8 warnings like this one:

    gdb/testsuite/gdb.perf/template-breakpoints.py:35:13: E731 do not assign a lambda expression, use a def

I chose to inline the lambdas in the expressions, since they are simple
enough and only used once each.

Change-Id: I46fac428a95da38f5a6a87e101be4da9fa4acc31
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: rename ambiguous variable in py-command-breakpoint.py
Simon Marchi [Wed, 29 Oct 2025 17:49:24 +0000 (13:49 -0400)] 
gdb/testsuite: rename ambiguous variable in py-command-breakpoint.py

Fix this flake8 warning:

    gdb/testsuite/gdb.python/py-commands-breakpoint.py:37:13: E741 ambiguous variable name 'l'

This one is a bit subjective, but renaming the variable is easy enough
and the simplest way to get rid of the warning.

Change-Id: I9b1ffd898e27a9d0e172f29715aff3ff3cc785b9
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: use "not in" in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:23 +0000 (13:49 -0400)] 
gdb/testsuite: use "not in" in Python files

Fix flake8 warnings like this one:

    gdb/testsuite/gdb.python/py-send-packet.py:68:12: E713 test for membership should be 'not in'

Change-Id: I2b4cc1eeb63ee2fceb8c4264e7d6ce2d22824688
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: address "unused not at top of file" warnings in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:22 +0000 (13:49 -0400)] 
gdb/testsuite: address "unused not at top of file" warnings in Python files

Address flake8 warnings like this one:

    gdb/testsuite/gdb.python/py-typeprint.py:60:1: E402 module level import not at top of file

Change-Id: I6ab7880ec5b55b6a5c85cb01d0f85172d44b4ee1
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: remove unused but set variables in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:21 +0000 (13:49 -0400)] 
gdb/testsuite: remove unused but set variables in Python files

Fix flake8 errors like this one:

    gdb/testsuite/gdb.python/py-unwind-inline.py:61:17: F841 local variable 'v' is assigned to but never used

For this one, there is a slight possibility that removing a variable
changes some behavior, and perhaps renders some test uneffective (where
the test would no longer exercises what it meant to).  Removing a
variable means that the object it pointed to likely gets de-allocated
earlier (its tp_dealloc method gets called).  So if the intent of the
variable was to ensure the variable outlives the statements that come
after, then this change would be wrong.  But I didn't see any evidence
of that being the intent in all the occurences.

Change-Id: Ic57bc68ad225a43ae6771c47b7f443956e8029a6
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: avoid bare except in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:20 +0000 (13:49 -0400)] 
gdb/testsuite: avoid bare except in Python files

Fix flake8 warnings like this:

    gdb/testsuite/gdb.python/py-unwind-inline.py:62:9: E722 do not use bare 'except'

Change-Id: I9736c948bc84fefcb7db2a6ac7322cbbfe39da94
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: use "is" to check against None
Simon Marchi [Wed, 29 Oct 2025 17:49:19 +0000 (13:49 -0400)] 
gdb/testsuite: use "is" to check against None

Fix flake8 warnings like:

    gdb/testsuite/gdb.base/pc-not-saved.py:55:18: E711 comparison to None should be 'if cond is None:'

Change-Id: Icb8bbe3ea444125c9d7ae63b7c1461045782b4b2
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: use "is" for type comparison in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:18 +0000 (13:49 -0400)] 
gdb/testsuite: use "is" for type comparison in Python files

Fix flake8 warnings like:

    gdb/testsuite/gdb.python/py-unwind.py:253:20: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

Change-Id: I506c0874bba88aa418757d94168992bf4ec677f8
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: remove unused "global" statements in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:17 +0000 (13:49 -0400)] 
gdb/testsuite: remove unused "global" statements in Python files

Fix the flake8 warnings of this type:

  gdb/testsuite/gdb.python/py-disasm.py:855:9: F824 `global current_pc` is unused: name is never assigned in scope

Change-Id: If492c69553cebea932cfb21e6fea26529761254c
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: remove unused imports in Python files
Simon Marchi [Wed, 29 Oct 2025 17:49:16 +0000 (13:49 -0400)] 
gdb/testsuite: remove unused imports in Python files

Remove the imports reported as unused by flake8.

Change-Id: I6e657de3dea8db18a99e711e594cb92f98e1cebb
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/testsuite: remove variable with ambiguous name in gdb.server/fileio-packets.py
Simon Marchi [Wed, 29 Oct 2025 17:49:15 +0000 (13:49 -0400)] 
gdb/testsuite: remove variable with ambiguous name in gdb.server/fileio-packets.py

flake8 complains about:

  gdb/testsuite/gdb.server/fileio-packets.py:67:9: E741 ambiguous variable name 'l'

I think the variable is unnecessary anyway, inline the expression in the
format string.

Change-Id: Ib294f58e663e79e65de058139a770d572bafb282
Approved-By: Tom Tromey <tom@tromey.com>
7 days agogdb/{testsuite,system-gdbinit}: import gdb module in Python scripts
Simon Marchi [Wed, 29 Oct 2025 17:49:14 +0000 (13:49 -0400)] 
gdb/{testsuite,system-gdbinit}: import gdb module in Python scripts

Fix flake8 warnings like:

    gdb/system-gdbinit/wrs-linux.py:21:5: F821 undefined name 'gdb'

These scripts get executed in a context where the gdb module is already
loaded, so this is not strictly necessary.  However, adding these
imports removes a lot of red lines when editing these files in an IDE.
Without them, the code uses this `gdb` thing that appears to be
undefined.  Pylance is able to pull the module definition from typeshed
[1] and provide a good experience with typings.

[1] https://github.com/python/typeshed/tree/main/stubs/gdb/gdb

Change-Id: I09c6ae1866ef66f10d8270457771687343c84e32
Approved-By: Tom Tromey <tom@tromey.com>
7 days agodarwin-nat.c: fix broken build caused by typing issues from 1ad8737b
Can Acar [Wed, 29 Oct 2025 20:02:14 +0000 (13:02 -0700)] 
darwin-nat.c: fix broken build caused by typing issues from 1ad8737b

1ad8737b is gdb: change inf_threads_iterator to yield references

Change-Id: Ic9478f4a292c3309481b16ace24ee23e82bbed4a
Approved-By: Tom Tromey <tom@tromey.com>
7 days agoFix device index in gdb.rocm/addr-bp-gpu-no-deb-info.exp
Luis Machado [Wed, 29 Oct 2025 10:07:08 +0000 (10:07 +0000)] 
Fix device index in gdb.rocm/addr-bp-gpu-no-deb-info.exp

On a system with a single GPU, I spotted this test failing. The environment
variable ROCR_VISIBLE_DEVICES can be a bit misleading, as it actually expects
a list of device id's as opposed to a literal number of devices to make
visible.

This test sets it to 1, which is the second GPU on the system. As a result,
systems with a single GPU will have no visible GPU's and the test will FAIL.

Set ROCR_VISIBLE_DEVICES to 0 to make use of the first GPU on the system.

Approved-By: Lancelot Six <lancelot.six@amd.com> (AMDGPU)
7 days agoMIPS/GAS: Add HI16/LO16 pairing for REL TLS relocs
Maciej W. Rozycki [Thu, 30 Oct 2025 14:24:23 +0000 (14:24 +0000)] 
MIPS/GAS: Add HI16/LO16 pairing for REL TLS relocs

Complementing commit 7ea90d9316d3 ("MIPS: Fix linker for REL TLS
HI16/LO16 relocs") also add pairing for HI16/LO16 REL TLS relocations
in GAS, which is where it needs to be done in the first place and
which is required for later linker operation on the objects produced.

Pairing also corrects in-place addend installation for the high-part
relocations, which used not to happen in the absence of this fix for
ones not already followed by the corresponding low-part relocation.

Add test cases to verify relocation ordering and addend installation.

7 days agoMIPS/GAS: Fix microMIPS TLS reloc classification
Maciej W. Rozycki [Thu, 30 Oct 2025 14:24:23 +0000 (14:24 +0000)] 
MIPS/GAS: Fix microMIPS TLS reloc classification

Fix `micromips_reloc_p' wrongly classifying microMIPS TLS relocations
as non microMIPS relocations.

Owing to where the function is called this issue does not trigger in
reality, but with an upcoming change it would, where suitable tests
will be included.

7 days agoMIPS: Add o32 RELA relocations for VxWorks targets
Maciej W. Rozycki [Thu, 30 Oct 2025 14:24:23 +0000 (14:24 +0000)] 
MIPS: Add o32 RELA relocations for VxWorks targets

MIPS/VxWorks targets have an unusual arrangement in that they use RELA
relocations with the o32 ABI, unlike any other MIPS target.  Due to an
inconsistency in BFD however "hybrid" relocations are produced by GAS,
where despite the relocations being of the RELA type the field to be
relocated also holds an in-place addend to be applied at link time.

For example:

$ cat vxworks-rela.s
.text
foo:
la $2, bar + 0x12345678
$ mips-vxworks-as -o vxworks-rela.o vxworks-rela.s
$ mips-vxworks-objdump -dr vxworks-rela.o

vxworks-rela.o:     file format elf32-bigmips-vxworks

Disassembly of section .text:

00000000 <foo>:
   0: 3c021234  lui v0,0x1234
0: R_MIPS_HI16 bar+0x12345678
   4: 24425678  addiu v0,v0,22136
4: R_MIPS_LO16 bar+0x12345678
$

This is due to the BFD backend being strapped for RELA relocations:

#undef elf_backend_may_use_rel_p
#define elf_backend_may_use_rel_p 0
#undef elf_backend_may_use_rela_p
#define elf_backend_may_use_rela_p 1
#undef elf_backend_default_use_rela_p
#define elf_backend_default_use_rela_p 1

but the howtos in use requesting an in-place addend, e.g.:

  /* High 16 bits of symbol value.  */
  HOWTO (R_MIPS_HI16, /* type */
 16, /* rightshift */
 4, /* size */
 16, /* bitsize */
 false, /* pc_relative */
 0, /* bitpos */
 complain_overflow_dont, /* complain_on_overflow */
 _bfd_mips_elf_hi16_reloc, /* special_function */
 "R_MIPS_HI16", /* name */
 true, /* partial_inplace */
 0x0000ffff, /* src_mask */
 0x0000ffff, /* dst_mask */
 false), /* pcrel_offset */

  /* Low 16 bits of symbol value.  */
  HOWTO (R_MIPS_LO16, /* type */
 0, /* rightshift */
 4, /* size */
 16, /* bitsize */
 false, /* pc_relative */
 0, /* bitpos */
 complain_overflow_dont, /* complain_on_overflow */
 _bfd_mips_elf_lo16_reloc, /* special_function */
 "R_MIPS_LO16", /* name */
 true, /* partial_inplace */
 0x0000ffff, /* src_mask */
 0x0000ffff, /* dst_mask */
 false), /* pcrel_offset */

This arrangement nevertheless happens to produce correct ELF executables
owing to the ELF linker avoiding the use of howtos and doing relocation
calculations using its own knowledge of relocation semantics embedded
directly in `mips_elf_calculate_relocation' code.

Beyond producing questionable link object files it however breaks badly
with the generic linker, such as when output is srec.

Fix the problem by providing a set of o32 RELA howtos and making VxWorks
targets use it.  Complement it with a set of test cases for GAS and LD;
we expect link object files to be essentially the same as n32 ones for
other MIPS targets sans the ABI2 ELF file header flag, and machine code
produced to be the same between SREC and ELF executables.

7 days agoMIPS/LD/testsuite: Run HI16/LO16 tests for VxWorks too
Maciej W. Rozycki [Thu, 30 Oct 2025 14:24:23 +0000 (14:24 +0000)] 
MIPS/LD/testsuite: Run HI16/LO16 tests for VxWorks too

Run ELF linker tests for HI16/LO16 relocations with MIPS/VxWorks targets
as well.  Despite issues only fixed in the next change they produce the
same results as with other MIPS targets, so just use the existing tests
verbatim, however refrain from adding other tests until said issues have
been fixed.

7 days agogdb: LoongArch: Change default char data type to signed
Hui Li [Thu, 30 Oct 2025 02:51:56 +0000 (10:51 +0800)] 
gdb: LoongArch: Change default char data type to signed

According to "Procedure Call Standard for the LoongArch Architecture" [1],
for all base ABI types of LoongArch, the char data type in C is signed by
default, so change the char data type to signed in gdb/loongarch-tdep.c.

Before this patch:

make check-gdb TESTS="gdb.base/sizeof.exp"

=== gdb Summary ===

 # of expected passes 75
 # of unexpected failures 1

make check-gdb TESTS="gdb.base/charset.exp"

=== gdb Summary ===

 # of expected passes 277
 # of unexpected failures 6
 # of unsupported tests 1

After this patch:

make check-gdb TESTS="gdb.base/sizeof.exp"

=== gdb Summary ===

 # of expected passes 76

make check-gdb TESTS="gdb.base/charset.exp"

=== gdb Summary ===

 # of expected passes 283
 # of unsupported tests 1

[1] https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc#appendix-c-data-types-and-machine-data-types

Signed-off-by: Hui Li <lihui@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
7 days agogdb/testsuite: Add LoongArch case in my-syscalls.S
Zewei Yang [Thu, 23 Oct 2025 01:45:49 +0000 (09:45 +0800)] 
gdb/testsuite: Add LoongArch case in my-syscalls.S

When running the following command on LoongArch:

  git clone git://sourceware.org/git/binutils-gdb.git gdb
  mkdir -p build && cd build && ../gdb/configure && make -j"$(nproc)"
  make check-gdb TESTS="gdb.threads/step-over-thread-exit-while-stop-all-threads.exp"

there exists the following error:

  gdb/gdb/testsuite/lib/my-syscalls.S:67:3: error: #error "Unsupported architecture"

this is because there is no SYSCALL macro for LoongArch, just add it.
With this patch, the above test passes on LoongArch.

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
7 days agos390: Do not generate incomplete opcode table
Jens Remus [Thu, 30 Oct 2025 13:39:59 +0000 (14:39 +0100)] 
s390: Do not generate incomplete opcode table

The s390 opcode table s390-opc.tbl is generated from s390-opc.txt
using the s390-mkopc utility using output redirection.  If s390-mkopc
fails with a non-zero return code, e.g. due to a warning or error, an
incomplete opcode table may be generated in the build directory.  A
subsequent invocation of make then assumes that incomplete opcode
table to be up to date.  Depending on the s390-mkopc issue the build
may then proceed without any follow-on warnings or errors, causing
the preceding error or warning to go unnoticed.

Generate the s390 opcode table into an intermediate temporary file
s390-opc.tbl.tmp in the build directory and only move it to the final
target s390-opc.tbl if the generation was successful.

Tested by appending an unsupported inline comment "# TEST" to one of
the instructions defined in s390-opc.txt.

opcodes/
* Makefile.am (s390-opc.tab): Use an intermediate temporary file
to prevent updating of the target on error/warning.
* Makefile.in: Regenerated.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
7 days agoSanity check elf_sym_hashes indexing
Alan Modra [Thu, 30 Oct 2025 05:56:57 +0000 (16:26 +1030)] 
Sanity check elf_sym_hashes indexing

I'm a little surprised we haven't already had fuzzing reports of
indexing off the end of sym_hashes.  The idea here is to preempt such
bugs.  One wrinkle is that ppc64 can't leave a zero symtab_hdr when
setting up sym_hashes for the fake stub bfd.

* elf-bfd.h (struct elf_reloc_cookie): Add "num_sym".
(_bfd_elf_get_link_hash_entry): Update declaration.
* elf-eh-frame.c (find_merged_cie): Sanity check reloc symbol
index.
* elf64-ppc.c (use_global_in_relocs): Fake up symtab_hdr for
stub bfd.
* elflink.c (_bfd_elf_get_link_hash_entry): Add "num_sym"
param.  Check symndx against it.  Update all calls.
(set_symbol_value): Add "num_sym" param and update all calls.
(elf_link_input_bfd): Add "num_syms" var and use for above.
(init_reloc_cookie): Set "cookie->num_syms".
* elf64-x86-64.c (elf_x86_64_scan_relocs): Pass symtab number
of entries to _bfd_elf_get_link_hash_entry.
* elfxx-x86.c (_bfd_x86_elf_check_relocs): Likewise.
(_bfd_x86_elf_link_relax_section): Likewise.

7 days agoDon't read and cache local syms for gc-sections
Alan Modra [Thu, 30 Oct 2025 05:56:50 +0000 (16:26 +1030)] 
Don't read and cache local syms for gc-sections

Most places just need the local sym section, so reading and sometimes
caching the symbols is excessive.  A symbol shndx can be stored in 4
bytes, an elf symbol internal form requires 32 bytes.  When caching
the local symbols we went slightly crazy trying to avoid memory usage,
resulting in the symbols being freed then immediately read again for
the testcase in the PR33530.

To avoid this problem, this patch caches the local symbol section
indices in the bfd rather than in the reloc cookie.  They are not
initialised until there is a need for them, so unlike elf_sym_hashes
for global syms you cannot rely on them being present.

One place that does need local syms is adjust_eh_frame_local_symbols,
but that is called once via bfd_discard_info so there is no problem
simply reading them.  The other place that needs local syms is
ppc64_elf_gc_mark_hook for the old ELFv1 ABI when handling .opd.
bfd_sym_from_r_symndx should be sufficient for function pointer
references to static functions, which is how this code is triggered.

PR 33530
* elf-bfd.h (struct elf_reloc_cookie): Delete "locsyms",
"sym_hashes", "bad_symtab".  Make "locsymcount" and
"extsymoff" unsigned int.
(struct elf_obj_tdata): Add loc_shndx.
(elf_loc_shndx): Define.
(_bfd_get_local_sym_section): Declare.
* elf-eh-frame.c (find_merged_cie): Use
_bfd_get_local_sym_section for local syms.
(adjust_eh_frame_local_symbols): Read local syms if any match
.eh_frame section.  Return them if changed.
(_bfd_elf_discard_section_eh_frame): Adjust.
* elf64-ppc.c (ppc64_elf_gc_mark_hook): Use
_bfd_get_local_sym_section.  Use bfd_sym_from_r_symndx when
reading opd local symbol.
* elflink.c (_bfd_get_local_sym_section): New function.
(_bfd_elf_section_for_symbol): Use it.
(elf_link_add_object_symbols): Remove unnecessary cast on
bfd_zalloc return.
(init_reloc_cookie): Remove "info" and "keep_memory" params.
Adjust all callers.  Don't stash elf_sym_hashes and
elf_bad_symtab to cookie.  Don't read local syms to cookie.
(fini_reloc_cookie): Do nothing.
(_bfd_elf_gc_mark_hook): Use _bfd_get_local_sym_section.
(elf_gc_mark_debug_section): Likewise.
(bfd_elf_reloc_symbol_deleted_p): Likewise.  Update cookie use.

7 days ago_bfd_elf_get_link_hash_entry tidy
Alan Modra [Thu, 30 Oct 2025 05:56:44 +0000 (16:26 +1030)] 
_bfd_elf_get_link_hash_entry tidy

Replace the "Elf_Internal_Shdr *symtab_hdr" parameter with
"unsigned int ext_sym_start", making it a duplicate of the existing
get_link_hash_entry function.

Also remove unnecessary checks from get_ext_sym_hash_from_cookie and
find_merged_cie.  The sym_hashes and symbol index checks in
get_ext_sym_hash_from_cookie are duplicates of those done in
_bfd_elf_get_link_hash_entry, and there is no need to check for a
global symbol before calling _bfd_elf_get_link_hash_entry.  When
bad_symtab, local symbols will have a NULL sym_hashes entry.  Removing
these unnecessary checks gets rid of some cookie->locsyms references.

PR 33530
* elf-bfd.h (_bfd_elf_get_link_hash_entry): Update declaration.
* elflink.c (_bfd_elf_get_link_hash_entry): Rename from
get_link_hash_entry, adjusting all calls and deleting original
function.
(get_ext_sym_hash_from_cookie): Make "symndx" unsigned int.
Remove unnecessary check on sym_hashes, symbol index and
symbol binding.
* elf-eh-frame.c (find_merged_cie): Remove similar unnecessary
checks.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Adjust.
* elfxx-x86.c (_bfd_x86_elf_check_relocs): Adjust.
(_bfd_x86_elf_link_relax_section): Adjust.

7 days agoPass cookie and symndx to gc_mark_hook
Alan Modra [Thu, 30 Oct 2025 05:56:27 +0000 (16:26 +1030)] 
Pass cookie and symndx to gc_mark_hook

Replace the "sym" param with "cookie" and "symndx".  This is in
preparation for the next patch.  Also remove "rel" param since this is
available via "cookie", and is always set from cookie->rel.

PR 33530
* elf-m10300.c (mn10300_elf_gc_mark_hook): Replace "rel" and "sym"
params with "cookie" and "symndx".  Adjust to suit.
* elf32-arm.c (elf32_arm_gc_mark_hook): Likewise.
* elf32-bfin.c (bfin_gc_mark_hook): Likewise.
* elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
* elf32-csky.c (csky_elf_gc_mark_hook): Likewise.
* elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
* elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
* elf32-frv.c (elf32_frv_gc_mark_hook): Likewise.
* elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
* elf32-iq2000.c (iq2000_elf_gc_mark_hook): Likewise.
* elf32-lm32.c (lm32_elf_gc_mark_hook): Likewise.
* elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
* elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
* elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
* elf32-metag.c (elf_metag_gc_mark_hook): Likewise.
* elf32-microblaze.c (microblaze_elf_gc_mark_hook): Likewise.
* elf32-nds32.c (nds32_elf_gc_mark_hook): Likewise.
* elf32-or1k.c (or1k_elf_gc_mark_hook): Likewise.
* elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
* elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
* elf32-score.c (s3_bfd_score_elf_gc_mark_hook): Likewise.
(_bfd_score_elf_gc_mark_hook): Likewise.
* elf32-score7.c (s7_bfd_score_elf_gc_mark_hook): Likewise.
* elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
* elf32-tilepro.c (tilepro_elf_gc_mark_hook): Likewise.
* elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
* elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
* elf32-visium.c (visium_elf_gc_mark_hook): Likewise.
* elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
* elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise.
* elf64-alpha.c (elf64_alpha_gc_mark_hook): Likewise.
* elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
* elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
* elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
* elfnn-loongarch.c (loongarch_elf_gc_mark_hook): Likewise.
* elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise.
* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise.
* elfxx-x86.c (_bfd_x86_elf_gc_mark_hook): Likewise.
* elflink.c (_bfd_elf_gc_mark_hook): Likewise.
(elf_gc_mark_debug_section): Likewise.
(_bfd_elf_gc_mark_rsec): Adjust gc_mark_hook calls.
* elf32-cr16.c (elf32_cr16_gc_mark_hook): Delete.
(elf_backend_gc_mark_hook): Don't define.
* elf32-moxie.c (moxie_elf_gc_mark_hook): Delete.
(elf_backend_gc_mark_hook): Don't define.
* elf-bfd.h (elf_gc_mark_hook_fn, _bfd_elf_gc_mark_hook): Update
declarations.
* elf32-score.h (s7_bfd_score_elf_gc_mark_hook): Likewise.
* elfxx-mips.h (_bfd_mips_elf_gc_mark_hook): Likewise.
* elfxx-sparc.h (_bfd_sparc_elf_gc_mark_hook): Likewise.
* elfxx-tilegx.h (tilegx_elf_gc_mark_hook): Likewise.
* elfxx-x86.h (_bfd_x86_elf_gc_mark_hook): Likewise.

7 days agoobjcopy: add option to specify custom prefix for symbol of binary input
Alon Bar-Lev [Wed, 29 Oct 2025 10:54:40 +0000 (12:54 +0200)] 
objcopy: add option to specify custom prefix for symbol of binary input

When using --input-target=binary, objcopy currently derives symbol names
from a mangled version of the input file name.  This approach can lead to
unpredictable results, as the generated symbols depend on the file path and
working directory.

This patch introduces a new option:

  --binary-symbol-prefix <prefix> Use <prefix> as the base symbol name for
                                    the input file (default: derived from
                                    file name)

It allows specifying an explicit symbol prefix, while preserving the existing
behavior as a fallback.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
7 days agoAutomatic date update in version.in
GDB Administrator [Thu, 30 Oct 2025 00:00:15 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 days agogdb/testsuite: fix git repository check in gdb.src/pre-commit.exp
Andrew Burgess [Fri, 24 Oct 2025 21:14:56 +0000 (22:14 +0100)] 
gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp

In the recently added gdb.src/pre-commit.exp test, we check if the
source directory is a git repository like this:

  if {![file isdirectory $repodir/.git]} {
      unsupported "Not in a git repository"
      return
  }

I make extensive use of git worktrees for development.  In a worktree
.git is a file containing the location of the actual .git directory,
it is not itself a directory.  As such, the above check fails,
claiming my source tree is not a git repository, when in fact, it is.

Fix this by relaxing the check to 'file exists $repodir/.git', which
will cover the directory and file case.

Approved-By: Kevin Buettner <kevinb@redhat.com>
8 days agox86: Disable AMX-TRANSPOSE by default
Haochen Jiang [Fri, 24 Oct 2025 05:49:20 +0000 (13:49 +0800)] 
x86: Disable AMX-TRANSPOSE by default

In Binutils, we choose to keep the AMX-TRANSPOSE support for
now in case there are vendors want to utilize the instructions
although the feature itself is de-published. AMX-TRANSPOSE will
not show up on any Intel/AMD hardware. Also in foreseeable future,
no hardware will support AMX-TRANSPOSE, we will disable it by
default.

gas/ChangeLog:

* testsuite/gas/i386/x86-64-amx-movrs-intel.d:
Move AMX-TRANSPOSE part to AMX-TRANSPOSE test.
* testsuite/gas/i386/x86-64-amx-movrs.d: Ditto.
* testsuite/gas/i386/x86-64-amx-movrs.s: Ditto.
* testsuite/gas/i386/x86-64-amx-tf32-bad.d: Ditto.
* testsuite/gas/i386/x86-64-amx-tf32-bad.s: Ditto.
* testsuite/gas/i386/x86-64-amx-tf32-intel.d: Ditto.
* testsuite/gas/i386/x86-64-amx-tf32-inval.l: Ditto.
* testsuite/gas/i386/x86-64-amx-tf32-inval.s: Ditto.
* testsuite/gas/i386/x86-64-amx-tf32.d: Ditto.
* testsuite/gas/i386/x86-64-amx-tf32.s: Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted-intel.d: Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted-wig.d: Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted.d: Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted.s: Ditto.
* testsuite/gas/i386/x86-64-amx-movrs-inval.l: Move
AMX-TRANSPOSE part to AMX-TRANSPOSE file. Remove
noamx_transpose test.
* testsuite/gas/i386/x86-64-amx-movrs-inval.s: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose-bad.d:
Add AMX-MOVRS and AMX-TF32 related test.
* testsuite/gas/i386/x86-64-amx-transpose-bad.s: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose-intel.d: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose-inval.l: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose-inval.s: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose.d: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose.s: Ditto.
* testsuite/gas/i386/x86-64.exp: Remove AMX-MOVRS invalid test.
* testsuite/gas/i386/x86-64-amx-transpose-apx-intel.d:
New test originally comes from APX_F test.
* testsuite/gas/i386/x86-64-amx-transpose-apx-wig.d: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose-apx.d: Ditto.
* testsuite/gas/i386/x86-64-amx-transpose-apx.s: Ditto.

opcodes/ChangeLog:

* i386-gen.c: Disable AMX-TRANSPOSE by default.
* i386-init.h: Regenerated.

8 days agoRevert "x86/APX: drop AMX-TRANSPOSE promoted insns"
Haochen Jiang [Fri, 24 Oct 2025 02:53:21 +0000 (10:53 +0800)] 
Revert "x86/APX: drop AMX-TRANSPOSE promoted insns"

This reverts commit bafcf0823c1ae4c2201670225c9cf14ccf2abc67.

The patch (the removal) was done on the wrong assumption that
it was only the APX-promoted forms which would be dropped
because the APX spec was updated ahead of ISE and there was no
info that AMX-TRANSPOSE would be de-published at that time.
Given the current situation, since we will choose to disable
AMX-TRANSPOSE but not to remove the support in Binutils, we will
also not remove the APX support.

8 days agoAutomatic date update in version.in
GDB Administrator [Wed, 29 Oct 2025 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 days agogdb/solib-rocm: avoid expensive gdbarch_from_bfd call in rocm_solib_relocate_section_...
Simon Marchi [Mon, 27 Oct 2025 19:41:51 +0000 (15:41 -0400)] 
gdb/solib-rocm: avoid expensive gdbarch_from_bfd call in rocm_solib_relocate_section_addresses

Loading a library containing a lot (> 100k) sections proved very slow
with whenever the support for ROCm was built into gdb.  The culprit is
the gdbarch_from_bfd call in rocm_solib_relocate_section_addresses:

    if (!is_amdgpu_arch (gdbarch_from_bfd (so.abfd.get ())))

This function gets called for every section, and gdbarch_from_bfd is
somewhat slow.  It turns out that we can skip the gdbarch_from_bfd call,
since all is_amdgpu_arch needs is the bfd_architecture value, which we
can directly extract from the `bfd *`, without going through the
gdbarch.

Add an overload of is_amdgpu_arch that takes a `bfd *`, and use it in
rocm_solib_relocate_section_addresses.

Update a call site in rocm_solib_bfd_open to use the new overload as
well.  That call site is not as much in a hot path, but there is no
point in paying the extra cost of looking up the gdbarch there.  I
removed the other assert that checked that gdbarch_from_bfd returned a
non-nullptr value.  If that was the case, something would be very wrong
with ROCgdb, and the problem would manifest very soon after anyway.

Change-Id: I55e9e68af59903b1b9727ff57388f9469d0e0002
Approved-by: Lancelot Six <lancelot.six@amd.com> (AMDGPU)
9 days agoFix typo in break-kernel-no-debug-info.exp
Tom Tromey [Tue, 28 Oct 2025 15:53:17 +0000 (09:53 -0600)] 
Fix typo in break-kernel-no-debug-info.exp

pre-commit / codespell pointed out a typo in
break-kernel-no-debug-info.exp.  This patch fixes it.