]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
6 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.

6 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.

6 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

7 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

7 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>
7 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.

7 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.

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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)
8 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.

8 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.

8 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.

8 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.

8 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>
8 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>
8 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>
8 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.

8 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.

8 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.

8 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.

8 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>
8 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

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

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

9 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

10 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)
10 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.

10 days agoEmit language and encoding names from dwarf-to-dwarf-assembler
Tom Tromey [Wed, 22 Oct 2025 14:04:12 +0000 (08:04 -0600)] 
Emit language and encoding names from dwarf-to-dwarf-assembler

This changes dwarf-to-dwarf-assembler to emit DW_LANG_* and DW_ATE_*
names when decoding the appropriate attributes.  This makes the output
a little more readable and a little closer to something we'd check in.

Approved-By: Andrew Burgess <aburgess@redhat.com>
10 days agoUpdate "usage" line in dwarf-to-dwarf-assembler
Tom Tromey [Wed, 22 Oct 2025 13:37:01 +0000 (07:37 -0600)] 
Update "usage" line in dwarf-to-dwarf-assembler

This changes the "usage" text in dwarf-to-dwarf-assembler to be a bit
more GNU-like.  It also fixes the name used in the message.

Approved-By: Andrew Burgess <aburgess@redhat.com>
10 days agoFix formatting of attributes in dwarf-to-dwarf-assembler output
Tom Tromey [Wed, 22 Oct 2025 13:33:35 +0000 (07:33 -0600)] 
Fix formatting of attributes in dwarf-to-dwarf-assembler output

This updates dwarf-to-dwarf-assembler.py to reflect the changes made
to how attributes are parsed; see commit c44edec047d (Make location
expressions be code in DWARF assembler).

Approved-By: Andrew Burgess <aburgess@redhat.com>
10 days agogdb: assign a valid section in convert_address_location_to_sals
Sébastien Darche [Thu, 16 Oct 2025 21:01:10 +0000 (17:01 -0400)] 
gdb: assign a valid section in convert_address_location_to_sals

The convert_address_location_to_sals function builds a symtab_and_line
from an explicit pc. Unless overlay debugging is enabled, the sal does not
contain a valid section (as find_pc_overlay will simply return nullptr).

While it is usually not a problem (as the sal users often recompute the
proper section, when needed), it may lead to the proper gdbarch not
being assigned when setting a breakpoint.

In code_breakpoint::add_location, gdb attempts to retrieve the gdbarch
through get_sal_arch by checking for the section or the symtab. However,
neither are currently set by cinvert_address_location_to_sals if the
debug symbols cannot be found. We then fall back to the current
architecture, which may cause errors in heterogeneous programs
(in ROCm, a breakpoint was not being hit since GDB was setting an
x86 int3 instruction instead of the architecture-appropriate s_trap 1).

This is a rework of a patch that was approved, but never merged
upstream (https://inbox.sourceware.org/gdb-patches/20241108195257.485488-2-lancelot.six@amd.com/).
The original change proposed to set the objfile field in the sal, and
check this field in get_sal_arch() if neither the section, nor the
symtab is defined. This patch makes GDB compute the section from the pc
instead of checking from the objfile in get_sal_arch, in accordance with
the rule of trying to set the section when creating the sal implemented
in this patch series. The test cases from the original patch are
included in this new one.

This should have minimal impact on other parts of GDB as users of this
section field would either (1) recompute it the same way (2) not use it
at all. In the case of overlay debugging, then the preceding call to
find_pc_overlay would likely assign a section.

Co-Authored-By: Lancelot SIX <lancelot.six@amd.com>
Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I23cef6ad5a66f696536c7c49c885a074bfea9b23

10 days agogdb: pass minsym section to find_function_start_sal, when possible
Sébastien Darche [Fri, 3 Oct 2025 13:18:30 +0000 (09:18 -0400)] 
gdb: pass minsym section to find_function_start_sal, when possible

We may rely on a minimal symbol to place a breakpoint on a function,
for instance when debug infos are unavailable. The minsym_found
function attempts to convert that minsym to a sal using either
find_function_start_sal or filling a sal manually from the minimal
symbol. This patch implements the decision to make it the responsibility
of the sal creation site to properly fill out the section field when
that is possible.

The function address may be updated when dealing with ifuncs, which
means the section from the minsym may be completely different from the
actual function address's section. A preceding change (6f7ad238 : gdb:
ensure bp_location::section is set correct to avoid an assert) has
proposed recomputing the section by calling find_pc_overlay. However,
this ends up setting the section to NULL in most cases. While the
section is often recomputed later on, I think it might be more
appropriate to set it once and for all when creating the sal.

The parent commit ensures that find_function_start_sal will return a
symtab_and_line with a section if possible. minsym_found can pass the
section if it can be trusted later on - it is in fact necessary to
ensure we get the proper pc/section with overlays. When dealing with
an ifunc that was resolved, then the section has to be recomputed
since the ifunc implementation may be in another section, or objfile.
This is now done in find_sal_for_pc_sect.

This change restores the section argument in
find_function_start_sal that was removed in a previous commit (6b0581fc
: gdb/symtab: remove section parameter from find_function_start_sal),
as it avoids an unnecessary lookup later in find_sal_for_pc_sect. The
function now sends the minsym's section if it corresponds to the actual
function, and not an ifunc.

This commit fixes a failure on gdb.rocm/displaced-stepping.exp. A new
test case is also provided to check that a breakpoint on a kernel is hit
without debug infos.

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I7a502dc4565911cec92618f34be3d4bcbf8560c5

10 days agogdb: make find_sal_for_pc_sect attempt to fill sal section
Sébastien Darche [Fri, 3 Oct 2025 12:47:55 +0000 (08:47 -0400)] 
gdb: make find_sal_for_pc_sect attempt to fill sal section

The find_sal_for_pc_section function inconsistently fills the section
field from its output symtab_and_line, depending on whether a symtab is
present or not. In the case that we cannot find a symtab for the pc and
section, the function would construct a sal with a pc but no section,
even though it could be either forwarded from the arguments, or
computed from the pc.

With the proposed changes, the function attempts to set the section in
all code paths and performs a section lookup when it is not provided as
an argument. This change is part of a patch series to fix
inconsistencies in symtab_and_line constructions, making it the
responsibility of the sal creator to fill out the section field (when
possible).

This section may be passed from a minsym in an unmapped overlay section.
Leaving the section field empty would mean in most cases losing some
important context (e.g. which overlay section this pc corresponds to).

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I818a08c4f61803b6d2cadd32ec106fe416af4c66

10 days agogdb: lookup minsym using section in find_sal_for_pc_sect
Sébastien Darche [Mon, 20 Oct 2025 19:07:33 +0000 (15:07 -0400)] 
gdb: lookup minsym using section in find_sal_for_pc_sect

The find_sal_for_pc_sect function attempts to find the line that is
closest to a pc+section in the available symbols. One of the first thing
the function does is search for a bound minimal symbol corresponding to
that pc. In its original version, the lookup is performed by
lookup_minimal_symbol_by_pc, discarding the section. This is misleading
and may cause issues with overlay debugging if a second minsym with the
same pc (but a different section) can be found -- although this is only
in theory after inspecting the code, as I have no way to test this on a
system supporting overlays.

This should have no observable effects for the end user. One slight
benefit is that we can avoid a section lookup inside
lookup_minimal_symbol_by_pc_section if the caller does provide a
section.

Since the section is already passed as an argument to the function, the
proposed change forwards this section to the minsym lookup section.

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I86a16bf397ea7167d3e9c7db79b8d7901fad1a97

10 days agoPowerPC: Support for Load/Store VSX Vector Paired Byte*32 Indexed (RFC02678)
Abhay Kandpal [Tue, 28 Oct 2025 12:33:01 +0000 (07:33 -0500)] 
PowerPC: Support for Load/Store VSX Vector Paired Byte*32 Indexed (RFC02678)

opcodes/
* ppc-opc.c (powerpc_opcodes): Add lxvpb32x, stxvpb32x.

gas/
* testsuite/gas/ppc/future.s: New test.
* testsuite/gas/ppc/future.d: Likewise.

10 days agoaarch64: gas: Allow movprfx with fmmla and bfscale [PR gas/33562]
Alfie Richards [Thu, 23 Oct 2025 09:45:22 +0000 (09:45 +0000)] 
aarch64: gas: Allow movprfx with fmmla and bfscale [PR gas/33562]

These instructions were previously incorrectly marked as not accepting
movprfx.  Fix this and add tests.

PR gas/33562

opcodes:
* aarch64-tbl.h: Update widening fmmmla and bfscale instructions.
gas:
* testsuite/gas/aarch64/f8f16mm_sve2-bad.l: Update test with movprfx.
* testsuite/gas/aarch64/f8f16mm_sve2.d: Ditto.
* testsuite/gas/aarch64/f8f16mm_sve2.s: Ditto.
* testsuite/gas/aarch64/f8f32mm_sve2-bad.l: Ditto.
* testsuite/gas/aarch64/f8f32mm_sve2.d: Ditto.
* testsuite/gas/aarch64/f8f32mm_sve2.s: Ditto.
* testsuite/gas/aarch64/sve-f16f32mm-bad.l: Ditto.
* testsuite/gas/aarch64/sve-f16f32mm.d: Ditto.
* testsuite/gas/aarch64/sve-f16f32mm.s: Ditto.
* testsuite/gas/aarch64/sve-bfscale-sve2.s: Ditto.
* testsuite/gas/aarch64/sve-bfscale-sve2.d: Ditto.

Approved-By: Alice Carlotti <alice.carlotti@arm.com>
10 days agoAutomatic date update in version.in
GDB Administrator [Tue, 28 Oct 2025 00:01:01 +0000 (00:01 +0000)] 
Automatic date update in version.in

10 days agohppa64: Remove code to generate dot symbols for EPLT relocations
John David Anglin [Mon, 27 Oct 2025 21:42:42 +0000 (17:42 -0400)] 
hppa64: Remove code to generate dot symbols for EPLT relocations

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

bfd/ChangeLog:

* elf64-hppa.c (USE_DOT_ELPT_PREFIX): Delete define.
(allocate_global_data_opd): Remove dot code.
(elf64_hppa_finalize_opd): Likewise.  Update comments.

10 days agohppa64: Handle R_PARISC_EPLT relocations for local symbols
John David Anglin [Mon, 27 Oct 2025 20:13:37 +0000 (16:13 -0400)] 
hppa64: Handle R_PARISC_EPLT relocations for local symbols

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

bfd/ChangeLog:

* elf64-hppa.c (elf_hppa_final_link_relocate): Handle
R_PARISC_EPLT relocations for local symbols.

11 days agogdb/dwarf: make some fields of dwarf2_per_cu private
Simon Marchi [Mon, 27 Oct 2025 19:12:24 +0000 (15:12 -0400)] 
gdb/dwarf: make some fields of dwarf2_per_cu private

The comments on these fields mention that they should be private, but we
can't.  I think this comes from the time where dwarf2_per_cu was and had
to remain POD.  I don't think it's relevant anymore, there are other
private fields anyway.  Make them private.

Change-Id: I1915ea531f42d685f68ff547833816906f79cd58
Approved-By: Tom Tromey <tom@tromey.com>
11 days agogdbsupport: bump unordered_dense library to 4.6.0
Simon Marchi [Wed, 8 Oct 2025 16:10:37 +0000 (12:10 -0400)] 
gdbsupport: bump unordered_dense library to 4.6.0

This version brings a fix made by Pedro [1] to fix compilation on some
Windows systems.

[1] https://github.com/martinus/unordered_dense/pull/132

Change-Id: I5cedec0e644074e2274346ecc1c73e5be00f84b0
Approved-By: Tom Tromey <tom@tromey.com>
11 days agoAdd more details to the linker documentation for the --hash-size and --max-cache...
Nick Clifton [Mon, 27 Oct 2025 15:21:04 +0000 (15:21 +0000)] 
Add more details to the linker documentation for the --hash-size and --max-cache-size options

11 days agogdb/help: Update help message for target record-core
Guinevere Larsen [Fri, 24 Oct 2025 11:43:46 +0000 (08:43 -0300)] 
gdb/help: Update help message for target record-core

Before this commit, the help message for target record-core is the same
as the help message for target record-full, which is the following:
    Log program while executing and replay execution from log.

For one, having the same message is unhelpful, since it doesn't tell
users what the difference between the two is.  But, more importantly,
that message seems to also be incorrect, since attempting to execute the
inferior forward from a restored file past the end of history will crash
GDB, since there isn't an actual live inferior to run.

To fix this, the help text is updated to the following:
    Load a saved execution log, allowing replay of the last instructions
This message doesn't imply that future execution is supported, while it
shows that replaying within recorded instructions *is* supported.

Approved-By: Tom Tromey <tom@tromey.com>
11 days agoAutomatic date update in version.in
GDB Administrator [Mon, 27 Oct 2025 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 days agohppa64: Mostly fix symbol versioning support
John David Anglin [Sun, 26 Oct 2025 22:20:37 +0000 (18:20 -0400)] 
hppa64: Mostly fix symbol versioning support

The dot prefix used for R_PARISC_EPLT relocations causes issues
for symbol version support as no version section is defined for
these symbols.  This causes the linker to exit with an error.

This change modifies the handling of EPLT relocations to use
offsets relative to a __text_seg base symbol.  This symbol is
defined in the same way as the HP linker (a section symbol for
the .dynamic section).

This mostly fixes the symbol versioning support.  There are
still issues caused by the munging of the value and section
of dynamic symbols.  The value modifies the sorting of the
dynamic table by number.  The section changes the type of
text symbols to data symbols.  I don't think the section munging
is actually needed but that's an issue for another patch.

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

bfd/ChangeLog:

* elf64-hppa.c (USE_DOT_ELPT_PREFIX): Define.
(struct elf_link_hash_entry): Add text_segment field.
(allocate_global_data_opd): Compute hppa_info.
Condition old dot prefix code on USE_DOT_ELPT_PREFIX.
Add new code to setup __text_seg hash table entry.
(elf64_hppa_finalize_opd): Check hh.  Rework to output
relocation using __text_seg base.
(elf64_hppa_finish_dynamic_sections): Remove duplicate
comment.
(elf_hppa_final_link_relocate): Move code to initialize
the segment base values forward.

11 days agohppa64: Fix linking of linux kernel
John David Anglin [Sun, 26 Oct 2025 20:34:35 +0000 (16:34 -0400)] 
hppa64: Fix linking of linux kernel

Relocation handling is currently brokern for linker and ld script
symbols.

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

bfd/ChangeLog:

* elf64-hppa.c (elf64_hppa_check_relocs): Don't set hh to
NULL for linker and ld script symbols.

12 days agoAutomatic date update in version.in
GDB Administrator [Sun, 26 Oct 2025 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

13 days agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Oct 2025 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

13 days agoelf: Drop the FIXME comment in set_symbol_value
H.J. Lu [Fri, 24 Oct 2025 21:10:49 +0000 (05:10 +0800)] 
elf: Drop the FIXME comment in set_symbol_value

Since

commit aeaaa9af6359c8e394ce9cf24911fec4f4d23703
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Sep 23 08:52:26 2025 +0800

    elf: Return error on unsorted symbol table if not allowed

returns false when get_link_hash_entry returns NULL, we can drop the FIXME
comment now.

PR ld/33450
* elflink.c (set_symbol_value): Drop the FIXME comment.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
13 days agoBFD: Fix function prototype breakage through stabs.c
Maciej W. Rozycki [Fri, 24 Oct 2025 20:39:46 +0000 (21:39 +0100)] 
BFD: Fix function prototype breakage through stabs.c

Update function prototype templates through stabs.c according to commit
eb92a17c47ea ("bfd: move sec_info from ELF to general section struct"),
which changed the generated prototypes in libbfd.h by hand rather than
by remaking them properly from sources, and causing the build to fail as
soon as libbfd.h has been regenerated.

While at it remove an extraneous character introduced by the same commit
to a comment for a new member of `struct bfd_section'.

2 weeks agogdb/reverse: update error message for "reverse-" commands
Guinevere Larsen [Thu, 23 Oct 2025 18:05:33 +0000 (15:05 -0300)] 
gdb/reverse: update error message for "reverse-" commands

Before this change, when a user tried to use a command that executes the
inferior in reverse, they would get the following error message:
    Target multi-thread does not support this command.

As an end-user with no knowledge of the internals of GDB would have as a
best guess, that reverse execution as a whole would not be supported in
their system (verified by asking a couple new users).

This commit changes the message to avoid the internal terminology, and
to add a hint that the user may need to create a recording somehow to be
able to execute in reverse.

Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agoHandle dynamic DW_AT_bit_size
Tom Tromey [Tue, 14 Oct 2025 19:26:30 +0000 (13:26 -0600)] 
Handle dynamic DW_AT_bit_size

gnat-llvm will sometimes emit a structure that that uses
DW_AT_bit_size with an expression to compute the bit size of a record.
I believe this is a DWARF extension.  This patch implements support
for this in gdb.

Reviewed-By: Keith Seitz <keiths@redhat.com>
2 weeks agogdb: remove TYPE_DATA_LOCATION_ADDR macro
Simon Marchi [Thu, 23 Oct 2025 19:07:01 +0000 (15:07 -0400)] 
gdb: remove TYPE_DATA_LOCATION_ADDR macro

Remove it in favor of using the dynamic_prop::const_val method directly.

Change-Id: I8dea18d7f504d4ec982b6624342f7a301e8fd636
Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agogdb: remove TYPE_DATA_LOCATION_KIND
Simon Marchi [Thu, 23 Oct 2025 19:07:00 +0000 (15:07 -0400)] 
gdb: remove TYPE_DATA_LOCATION_KIND

Remove it in favor of accessing the dynamic_prop::kind method directly.

Change-Id: I8e5da4443b0df558286ce46eba5754c61f1b95db
Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agogdb: remove TYPE_DATA_LOCATION_BATON macro
Simon Marchi [Thu, 23 Oct 2025 19:06:59 +0000 (15:06 -0400)] 
gdb: remove TYPE_DATA_LOCATION_BATON macro

It is unused.

Change-Id: Ide860825d8365cfa2370944725c7c999ec2a1cbd
Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agogdb: remove TYPE_*_PROP macros
Simon Marchi [Thu, 23 Oct 2025 19:06:58 +0000 (15:06 -0400)] 
gdb: remove TYPE_*_PROP macros

Remove the macros in favor of using the dyn_prop member function
directly.

Change-Id: I29758ea408610a2df0a6a226327d1f1af39a178d
Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agogdb: add gdb_rl_tilde_expand util
Simon Marchi [Thu, 23 Oct 2025 16:34:23 +0000 (12:34 -0400)] 
gdb: add gdb_rl_tilde_expand util

Add gdb_rl_tilde_expand, a wrapper around readline's tilde_expand that
returns a gdb::unique_xmalloc_ptr<char>.  Change all callers of
tilde_expand to use gdb_rl_tilde_expand (even the couple of spots that
release it immediatly, for consistency).  This simplifies a few callers.

The name gdb_tilde_expand is already taken by a home-made implementation
in gdbsupport/gdb_tilde_expand.{h.cc}.  I wonder if we could just use
that one instead of readline's tilde_expand, but that's an orthogonal
question.  I don't know how they differ, and I don't want to introduce
behavior changes in this patch.

Change-Id: I6d34eef19f86473226df4ae56d07dc01912e3131
Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agogdb: replace use of alloca with std::string in openp
Simon Marchi [Thu, 23 Oct 2025 22:54:56 +0000 (18:54 -0400)] 
gdb: replace use of alloca with std::string in openp

This makes the code simpler and hopefully safer.

Change-Id: I30c7f0bc0c786621858d3f46d138f3b596dc49f5
Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agold: testsuite: xfail ld-elf/compress1a etc. on Solaris/sparcv9 [PR25802]
Rainer Orth [Fri, 24 Oct 2025 13:57:24 +0000 (15:57 +0200)] 
ld: testsuite: xfail ld-elf/compress1a etc. on Solaris/sparcv9 [PR25802]

A couple of tests FAIL on Solaris/sparcv9:

FAIL: ld-elf/compress1a
FAIL: ld-elf/compressed1a
FAIL: ld-elf/eh5
FAIL: --gc-sections with multiple debug sections for a function section

The symptom is always similar:

compress1.o:(.debug_info+0x10): relocation truncated to fit: R_SPARC_UA32 against `.text'
eh5.o:(.eh_frame+0x3e): relocation truncated to fit: R_SPARC_UA32 against symbol `my_personality_v0' defined in .text section in eh5.o
all-debug-sections.o: in function `debug_info_main':
(.debug_info.text.main+0x4): relocation truncated to fit: R_SPARC_32 against symbol `main' defined in .text.main section in all-debug-sections.o

With the default Solaris/sparcv9 text address of 0x100000000, the
relocations are out of the 32-bit range of R_SPARC_UA32 resp. R_SPARC_32,
so the "relocation truncated to fit" errors are benign.

One could avoid those by linking the affected tests with -Ttext=0x80000000,
matching Solaris /usr/lib/ld/map.below4G, but that doesn't reflect real
usage.  Therefore this patch xfail's those tests.

Tested on sparcv9-sun-solaris2.11, sparc-sun-solaris2.11, and
x86_64-pc-linux-gnu.

2025-07-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

ld:
PR ld/25802
* testsuite/ld-elf/compress1a.d: xfail on sparcv9-*-solaris2*.
* testsuite/ld-elf/compressed1a.d: Likewise.
* testsuite/ld-elf/eh5.d: Likewise.
* testsuite/ld-gc/all-debug-sections.d: Likewise.

2 weeks ago[gdb/testsuite] Remove gdb.base/gdbindex-stabs.exp
Tom de Vries [Fri, 24 Oct 2025 13:40:29 +0000 (15:40 +0200)] 
[gdb/testsuite] Remove gdb.base/gdbindex-stabs.exp

On openSUSE Leap 15.6 x86_64 I ran into:
....
(gdb) file gdbindex-stabs^M
Reading symbols from gdbindex-stabs...^M
warning: stabs debug information is not supported.^M
(gdb) list stabs_function^M
(gdb) FAIL: gdb.base/gdbindex-stabs.exp: list stabs_function
...

Fix this by removing the test-case.

Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agoz80, gas: follow historical assemblers and allow "op A,x" and "op x"
H. Peter Anvin [Fri, 24 Oct 2025 13:12:39 +0000 (15:12 +0200)] 
z80, gas: follow historical assemblers and allow "op A,x" and "op x"

For arithmetic ops, Z80 syntax wants "op A,x" for ADD, ADC and SBC and
"op x" for SUB, AND, OR, XOR, and CP. Many historical assemblers
simply treat them orthogonally; allowing but not requiring the "A,"
operand for any of these operations. This is widely used in legacy
source code, and there is no reason not to.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2 weeks agobfd: section merging for PE/COFF images
Jan Beulich [Fri, 24 Oct 2025 13:12:07 +0000 (15:12 +0200)] 
bfd: section merging for PE/COFF images

Leverage the generalized section merging to enable it also when linking
PE/COFF images (from ELF objects).

Sadly the previous hack in bfd_generic_get_relocated_section_contents()
(from "bfd: generalize _bfd_elf_merge_sections()") is getting yet more
bogus.

2 weeks agobfd: replace _bfd_merge_sections() hook with simple boolean
Jan Beulich [Fri, 24 Oct 2025 13:11:39 +0000 (15:11 +0200)] 
bfd: replace _bfd_merge_sections() hook with simple boolean

There's no need for a hook; what needs doing is uniform, the question is
only whether to perform any merging (i.e. whether other parts of a backend
are capable of dealing with the effects).

Where _bfd_nolink_bfd_merge_sections() was used, false is hardcoded. For
ELF no real target override is permitted; true is hardcoded except for the
cases where bfd_generic_merge_sections() was used as the hook function
before.

2 weeks agobfd: generalize _bfd_elf_merge_sections()
Jan Beulich [Fri, 24 Oct 2025 13:11:11 +0000 (15:11 +0200)] 
bfd: generalize _bfd_elf_merge_sections()

Except for the ELF class check, which isn't needed anymore when the
generic linker knows how to deal with SEC_MERGE sections, there isn't
anything substantially ELF-specific left in the function.

This also eliminates the need for the "remove_hook" callback.

As a result, section merging itself now works for mixed-class ELF input
objects (issues with dropping of symbols and relocations that were there
before for such cases remain present, though), i.e. the PR ld/19013
testcases need adjusting accordingly: Both now expect identical .rodata
contents. While making the change, add another line of expected output,
to properly match after "#...". Else a mismatch on the important line
isn't properly visible in ld.log.

In set_symbol_from_hash() additionally set BSF_GLOBAL when dealing with a
defined symbol. Without that the if() body ahead of the one being added to
default_indirect_link_order() would not be entered once previously
undefined symbols become defined (suggesting that there is a pre-existing
issue there).

2 weeks agobfd: simplify _bfd_{link,write,discard}_section_stabs() interface
Jan Beulich [Fri, 24 Oct 2025 13:10:35 +0000 (15:10 +0200)] 
bfd: simplify _bfd_{link,write,discard}_section_stabs() interface

... as well as that of _bfd_stab_section_offset(): As sec_info is now
hanging off of sec, there's no need for the extra 4th parameter anymore.
Along these line struct struct coff_section_tdata's stab_info member then
isn't needed anymore either.

Furthermore there also hasn't been a good reason to have the caller of
_bfd_link_section_stabs() set sec_info_type.

2 weeks agobfd: simplify _bfd_merged_section_offset() interface
Jan Beulich [Fri, 24 Oct 2025 13:10:09 +0000 (15:10 +0200)] 
bfd: simplify _bfd_merged_section_offset() interface

As sec_info is now hanging off of sec, there's no need for the extra 3rd
parameter anymore; all callers pass as 2nd argument the address of a
section pointer that sec_info can be fetched from.

2 weeks agobfd: simplify _bfd_{add_merge,write_merged}_section() interface
Jan Beulich [Fri, 24 Oct 2025 13:09:39 +0000 (15:09 +0200)] 
bfd: simplify _bfd_{add_merge,write_merged}_section() interface

As sec_info is now hanging off of sec, there's no need for the extra 4th /
3rd parameter anymore. Along these line struct sec_merge_sec_info's
psecinfo member then isn't needed anymore either.

Furthermore there also hasn't been a good reason to have the caller of
_bfd_add_merge_section() set sec_info_type.

2 weeks agobfd: move sec_info from ELF to general section struct
Jan Beulich [Fri, 24 Oct 2025 13:09:11 +0000 (15:09 +0200)] 
bfd: move sec_info from ELF to general section struct

This is in preparation of supporting section merging also when the output
isn't ELF (or not of the same class). Note that it's also more consistent
this way, as the related sec_info_type field also live in the same struct.

2 weeks agobfd: move merge_info from ELF to general link hash table
Jan Beulich [Fri, 24 Oct 2025 13:08:33 +0000 (15:08 +0200)] 
bfd: move merge_info from ELF to general link hash table

This is in prepration of supporting section merging also when the output
isn't ELF (or not of the same class).

2 weeks agoRemove get_context_stack_depth
Tom Tromey [Fri, 24 Oct 2025 00:04:14 +0000 (18:04 -0600)] 
Remove get_context_stack_depth

Nothing calls get_context_stack_depth, so this patch removes it.

I looked at also removing context_stack::depth but apparently this is
used in coffread.c, and I didn't want to figure out how to make it
local to just that code.

I'm checking this in as obvious.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 24 Oct 2025 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 weeks agoUse bool in buildsym
Tom Tromey [Fri, 17 Oct 2025 01:23:21 +0000 (19:23 -0600)] 
Use bool in buildsym

This changes the buildsym code to use bool rather than int, where
appropriate.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agoRemove buildsym_compunit::end_compunit_symtab_with_blockvector
Tom Tromey [Fri, 17 Oct 2025 01:17:14 +0000 (19:17 -0600)] 
Remove buildsym_compunit::end_compunit_symtab_with_blockvector

This patch removes buildsym_compunit::end_compunit_symtab_with_blockvector.
This method is only called in one spot and the two methods can easily
be combined.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agogdb: change find_pcs_for_symtab_line() to return entries instead of PCs
Jan Vrany [Thu, 23 Oct 2025 19:39:44 +0000 (20:39 +0100)] 
gdb: change find_pcs_for_symtab_line() to return entries instead of PCs

This commit changes find_pcs_for_symtab_line() to return complete
linetable entries instead of just PCs.  This is a preparation for adding
more attributes to gdb.LinetableEntry objects.

I also renamed the function to find_linetable_entries_for_symtab_line()
to better reflect what it does.

Approved-By: Tom Tromey <tom@tromey.com>
2 weeks agoRemove iterate_over_symbols_terminated
Tom Tromey [Thu, 23 Oct 2025 18:13:23 +0000 (12:13 -0600)] 
Remove iterate_over_symbols_terminated

iterate_over_symbols_terminated only has a single caller, in
ada-lang.c.  It's simpler to handle this case directly there.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agoFree multidicts from blockvector
Tom Tromey [Fri, 17 Oct 2025 17:23:38 +0000 (11:23 -0600)] 
Free multidicts from blockvector

Currently, nothing in the tree ever calls mdict_free.  However, code
does heap-allocate some multidicts.  A simple way to see this is to
use valgrind, run "gdb -readnow" on the executable created by
gdb.dwarf2/struct-with-sig.exp, and then use "file" to clear the
objfile list.  This yields:

==1522843== 144 (16 direct, 128 indirect) bytes in 1 blocks are definitely lost in loss record 905 of 3,005
==1522843==    at 0x4843866: malloc (vg_replace_malloc.c:446)
==1522843==    by 0x48E397: xmalloc (alloc.c:52)
==1522843==    by 0x59DE66: multidictionary* xnew<multidictionary>() (poison.h:102)
==1522843==    by 0x59CFF4: mdict_create_hashed_expandable(language) (dictionary.c:965)
==1522843==    by 0x50A269: buildsym_compunit::finish_block_internal(symbol*, pending**, pending_block*, dynamic_prop const*, unsigned long, unsigned long, int, int) (buildsym.c:221)
==1522843==    by 0x50AE04: buildsym_compunit::end_compunit_symtab_get_static_block(unsigned long, int, int) (buildsym.c:818)
==1522843==    by 0x50C4CF: buildsym_compunit::end_expandable_symtab(unsigned long) (buildsym.c:1037)
==1522843==    by 0x61DBC6: process_full_type_unit (read.c:4970)

This patch fixes the leaks by calling mdict_free when a blockvector is
destroyed.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agoTwo bug fixes in mdict_free
Tom Tromey [Fri, 17 Oct 2025 17:21:50 +0000 (11:21 -0600)] 
Two bug fixes in mdict_free

A heap-allocated multidictionary should be freed by calling
mdict_free.  However, while this function does free the contents of
the dictionary, it neglects to free the dictionary itself.

There's also a second bug, which is that if a multidictionary is
created with no dictionaries, gdb will crash on the first line of
mdict_free:

  enum dict_type type = mdict->dictionaries[0]->vector->type;

So, this patch also adds the type to struct multidictionary, avoiding
this problem.  Note that this does not increase the structure size on
x86-64, because the new member fits into the padding.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agoRemove Python API checker defines
Tom Tromey [Tue, 21 Oct 2025 16:00:20 +0000 (10:00 -0600)] 
Remove Python API checker defines

The GCC plugin that implements the Python API checker does not appear
to really be maintained.  And, as far as I know, it never really
worked for C++ code anyway.  Considering those factors, and that no
one has tried to run it in years, I think it's time to remove the
macros from the gdb source.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agoRemove Py_TPFLAGS_CHECKTYPES
Tom Tromey [Tue, 21 Oct 2025 16:04:14 +0000 (10:04 -0600)] 
Remove Py_TPFLAGS_CHECKTYPES

According to 'git annotate', the Py_TPFLAGS_CHECKTYPES was added to
python-internal.h way back when gdb was first ported to Python 3.  It
was a compatibility fix for Python 2.

This is not needed any more, because Python 2 is no longer supported.
This patch removes the vestiges.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agogdb: update mdebugread.c to use blockvector::block_less_than
Jan Vrany [Thu, 23 Oct 2025 11:01:34 +0000 (12:01 +0100)] 
gdb: update mdebugread.c to use blockvector::block_less_than

This commit updates mdebugread.c to use common blockvector ordering
predicate. It also changes the code to use std::stable_sort as in
buildsym.c. This is probably not necessary but should not hurt and makes
block sorting code more consistent.

Approved-By: Tom Tromey <tom@tromey.com>