]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
5 hours agogdb/record-full: fix some -Wpessimizing-move errors master
Simon Marchi [Mon, 6 Jul 2026 14:38:46 +0000 (14:38 +0000)] 
gdb/record-full: fix some -Wpessimizing-move errors

Compiling record-full.c with clang shows:

    /home/smarchi/src/binutils-gdb/gdb/record-full.c:2386:14: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
     2386 |         rec.entry = std::move (record_full_reg_entry::from_bfd
          |                     ^
    /home/smarchi/src/binutils-gdb/gdb/record-full.c:2386:14: note: remove std::move call here
     2386 |         rec.entry = std::move (record_full_reg_entry::from_bfd
          |                     ^~~~~~~~~~~
     2387 |                                 (cbfd, osec, bfd_offset));
          |                                                         ~
    /home/smarchi/src/binutils-gdb/gdb/record-full.c:2393:14: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
     2393 |         rec.entry = std::move (record_full_mem_entry::from_bfd
          |                     ^
    /home/smarchi/src/binutils-gdb/gdb/record-full.c:2393:14: note: remove std::move call here
     2393 |         rec.entry = std::move (record_full_mem_entry::from_bfd
          |                     ^~~~~~~~~~~
     2394 |                                 (cbfd, osec, bfd_offset));
          |                                                         ~

It's indeed not recommended to std::move the return value of a
function.  Remove the std::moves.

Change-Id: I80d947aa3d917fe3fcaaad0c3e329cb1de48a8ee

5 hours agos390: Deprecate s390 32-bit target "s390-*"
Jens Remus [Mon, 6 Jul 2026 14:34:26 +0000 (16:34 +0200)] 
s390: Deprecate s390 32-bit target "s390-*"

The s390 32-bit target (s390-*) is deprecated and planned for removal
in a future release, along with the elf32-s390 target format.  Emit an
error for this target during configure, which can be overridden using
option --enable-obsolete.

Linux Kernel 6.19 removed s390 32-bit compatibility support. [1]
Glibc 2.43 [2] and GCC 16.1 (compiler option -m31) [3] deprecated
s390 32-bit with the intent to remove it in a future release.

The s390 64-bit target (s390x-*) remains supported.

[1]: Linux kernel 6.19 commit 8e0b986c59c6 ("s390: Remove compat support"),
     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e0b986c59c6
[2]: Glibc 2.43 commit 638d437dbf9c ("Deprecate s390-linux-gnu (31bit)"),
     https://sourceware.org/git/glibc.git?a=commitdiff;h=638d437dbf9c
[3]: GCC 16 commit 5886bb453a6a ("s390: Deprecate -m31"),
     https://gcc.gnu.org/git/gcc.git?h=5886bb453a6a

bfd/
* config.bfd: Require --enable-obsolete to build s390 32-bit
target "s390-*".

binutils/
* NEWS: Deprecate s390 32-bit target "s390-*".

gdb/
* NEWS: Deprecate s390 32-bit target "s390-*".

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
5 hours agos390: Add store CPU counter multiple instruction
Jens Remus [Mon, 6 Jul 2026 14:11:50 +0000 (16:11 +0200)] 
s390: Add store CPU counter multiple instruction

IBM z13 introduced the "store CPU counter multiple" (stcctm) instruction
with the Store-CPU-Counter-Multiple Facility, which is part of the
CPU-Measurement Facilities (CPUMF) [1].

While at it add a comment to the s390 opcode table for the existing
CPUMF instructions.

[1]: The Load-Program-Parameter and the CPU-Measurement Facilities,
     SA23-2260-08,
     https://www.ibm.com/docs/en/module_1678991624569/pdf/SA23-2260-08.pdf

opcodes/
* s390-opc.txt (stcctm): Add store CPU counter multiple
instruction.  Add comment on CPUMF instructions.

gas/testsuite/
* gas/s390/zarch-z13.d (stcctm): Add test for store CPU counter
multiple instruction.
* gas/s390/zarch-z13.s (stcctm): Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
8 hours agoaarch64: Fix assembler internal error for %dtprel relocations
Srinath Parvathaneni [Mon, 6 Jul 2026 11:41:08 +0000 (11:41 +0000)] 
aarch64: Fix assembler internal error for %dtprel relocations

The current implementation creates the DTPREL fixup before reserving
the storage for the corresponding ".xword". GCC's "%dtprel" support
for TLS DWARF debug information exposed this during an AArch64 bootstrap,
where the libsanitizer/tsan DWARF layout places the DTPREL fixup at a
frag boundary. Reserving the storage before creating the fixup avoids
this corner case.

gas/
PR binutils/34357
* config/tc-aarch64.c (s_aarch64_cons) : Fix the storage order for
DTPREL.

8 hours agogdb, amd-dbgapi-target: split wave_coordinates::to_string
Tankut Baris Aktemur [Mon, 6 Jul 2026 10:33:04 +0000 (05:33 -0500)] 
gdb, amd-dbgapi-target: split wave_coordinates::to_string

wave_coordinates::to_string() produces a string in the following format:

  AMDGPU Wave a:q:d:w (x,y,z)/i

Split the method into smaller pieces:

  a:q:d:w   : hierarchy_str
  (x,y,z)   : workgroup_coord_str
  (x,y,z)/i : dispatch_pos_str

This is a refactoring to allow reusing pieces and also to let the code
document itself better.  Currently the reuse opportunity exists in the
downstream debugger.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
Approved-by: Lancelot Six <lancelot.six@amd.com> (amdgpu)
9 hours agogdb, amd-dbgapi-target: use pulongest more
Tankut Baris Aktemur [Mon, 6 Jul 2026 10:33:04 +0000 (05:33 -0500)] 
gdb, amd-dbgapi-target: use pulongest more

The group id coordinates and the wave number in workgroup that are
being formatted to a string in wave_coordinates::to_string are
uint32_t.  Use pulongest to print them.

Approved-by: Lancelot Six <lancelot.six@amd.com> (amdgpu)
25 hours agoLoongArch: Fix relaxation alignment with ld -r (PR 33236)
mengqinggang [Fri, 22 May 2026 01:38:49 +0000 (09:38 +0800)] 
LoongArch: Fix relaxation alignment with ld -r (PR 33236)

LoongArch has the same issue as RISC-V for PR 33236 [1].

Section alignment can't be adjusted for objects generated by ld -r.
If previous sections are relaxed, the subsequent section maybe misaligned.

To fix this, add an align section and an align relocation before each
section when ld -r. And change the section alignment to 4 to disable
the default section start address calculation.

ld.lld has fixed this issue in the following two patches [2] [3].

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=33236
[2] https://github.com/llvm/llvm-project/pull/151639
[3] https://github.com/llvm/llvm-project/pull/198147

25 hours agoLoongArch: Fix linker relaxation alignment
mengqinggang [Tue, 16 Jun 2026 11:10:26 +0000 (19:10 +0800)] 
LoongArch: Fix linker relaxation alignment

When linking multiple objects, relaxation can cause alignment issues.
Input section's output_offset is updated in relaxation without considering
alignment. Update section output_offset by align_opwer.

19 hours agoAutomatic date update in version.in
GDB Administrator [Mon, 6 Jul 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

28 hours agogas: add --reloc-section-sym={all,internal,none} option for ELF
Fangrui Song [Sun, 8 Feb 2026 19:56:49 +0000 (11:56 -0800)] 
gas: add --reloc-section-sym={all,internal,none} option for ELF

When generating relocations for non-ifunc local symbols that satisfies
several conditions, GAS converts them to reference the section symbol
(STT_SECTION) instead, folding the original symbol's offset into the
addend.  This allows the original local symbol to be omitted from
.symtab, but the STT_SECTION symbol itself must be present, so the
conversion saves .symtab entries only when a section has more than one
local symbol referenced by relocations.

Add --reloc-section-sym to control this conversion:

- all (default): convert all eligible local symbols
- internal: only convert compiler-generated locals (.L prefix)
- none: never convert; keep all symbols as-is in relocations

This is useful for debugging and for tools that benefit from preserved
symbol names.

PR gas/33885

43 hours agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Jul 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 days agopr34322: assertion failure in get_or_create_member_type
Alan Modra [Sat, 4 Jul 2026 10:27:43 +0000 (19:57 +0930)] 
pr34322: assertion failure in get_or_create_member_type

I thought about warning "DW_TAG_member without struct/union parent"
here but decided that doesn't help much as the warning is disconnected
from output.  As it is the --map-global-vars code silently ignores
unexpected attributes that might be found in fuzzed files.  I'm fine
with that too.

PR 34322
* dwarf.c (get_or_create_member_type): Return NULL on NULL parent.
(insert_element_in_list): Ignore DW_TAG_member without struct
or union parent.

2 days agoAVR: Adhere to GNU coding style
Georg-Johann Lay [Fri, 3 Jul 2026 20:01:09 +0000 (22:01 +0200)] 
AVR: Adhere to GNU coding style

This patch fixes some style nits:

- Fix indentations
- Using TABs for indentation
- Breaking long lines
- Remove ; after the closing } of a code block

bfd/
* cpu-avr.c: Adhere to GNU coding style.
* elf32-avr.c: Same.
* elf32-avr.h: Same.

gas/
* config/tc-avr.c: Adhere to GNU coding style.

opcodes/
* avr-dis.c: Adhere to GNU coding style.

include/
* opcode/avr.h: Adhere to GNU coding style.

2 days agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Jul 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 days agoPR 34275 double free in ctf_link_deduplicating_per_cu
xuqing yang [Wed, 10 Jun 2026 14:12:05 +0000 (14:12 +0000)] 
PR 34275 double free in ctf_link_deduplicating_per_cu

* ctf-link.c (ctf_link_deduplicating_per_cu): Don't call
ctf_next_destroy twice on error path.

3 days agogdb/record: add support for BMI2 instructions
Guinevere Larsen [Tue, 16 Jun 2026 19:03:43 +0000 (16:03 -0300)] 
gdb/record: add support for BMI2 instructions

This commit adds support for recording all instructions in the Bit
Manipulation Instruction set 2, for x86 cpus. The specific instructions
are:

* mulx
* pdep
* pext
* rorx
* sarx
* sh[r|l]x
* bzhi

And adds them to the AVX test, for the same reason as the previous
commit.

Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: Add support for recording BMI1 instructions
Guinevere Larsen [Wed, 3 Jun 2026 11:58:10 +0000 (08:58 -0300)] 
gdb/record: Add support for recording BMI1 instructions

This commit adds support for recording all instructions of the Bit
Manipulation Instruction set 1, for x86 cpus. The specific instructions
are:

* andn
* bls[i|r|msk]
* bextr
* [l|t]zcnt

Also add them to the avx test. While BMI is a different set of
instructions, there are no currently existing CPUs that have access to
AVX2 and don't have access to BMI1 and BMI2, so it seems like a
reasonable idea to keep them together, as the avx test already requires
AVX2.

Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agoreadelf: Update dynamic tag processing and validate section info
H.J. Lu [Wed, 1 Jul 2026 02:15:30 +0000 (10:15 +0800)] 
readelf: Update dynamic tag processing and validate section info

Count DT_RELR relocations using dynamic tags when section header isn't
used.  Ignore section sh_offset and sh_size if they are larger than file
size.

One side effect is that we now display

readelf: Warning: Ignore the out of range sh_offset value of 2199023261148 for section 17
readelf: Warning: Ignore the out of range sh_size value of 13 for section 17 with sh_offset value of 2199023261148
...
  [17] .fini             PROGBITS        00000000000015dc 000000 000000 00  AX  0   0  4
...

instead of

...
  [17] .fini             PROGBITS        00000000000015dc 200000015dc 00000d 00  AX  0   0  4
...

and segfault.

binutils/

PR binutils/34326
PR binutils/34339
* readelf.c (update_all_relocations): Skip if nentries == 0.
(validate_section_info): New.
(get_32bit_section_headers): Call validate_section_info.
(get_64bit_section_headers): Likewise.
(process_relocs): Call count_relr_relocations for relocations
from dynamic tags.  Skip if values in DT_RELENT/DT_RELAENT
are larger than values in DT_RELSZ/DT_RELASZ.
(process_got_section_contents): Skip if all_relocations_count
== 0.

ld/
PR binutils/34339
* testsuite/ld-x86-64/binutils.exp: Run PR binutils/34339 tests.
* testsuite/ld-x86-64/got-2.s: New file.
* testsuite/ld-x86-64/libgot-2.rd: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 days agogdb/record: rename record_full_list to record_full_log
Guinevere Larsen [Fri, 15 May 2026 14:57:04 +0000 (11:57 -0300)] 
gdb/record: rename record_full_list to record_full_log

Now that we no longer use a linked list to manage the history, the name
"record_full_list" is no longer meaningful. This commit changes the name
to record_full_log since it is the execution log. I decided to not say
"record_full_execution_log" to avoid overly long lines when accessing
it.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: Define new version of the record-save section
Guinevere Larsen [Wed, 15 Apr 2026 13:17:29 +0000 (10:17 -0300)] 
gdb/record: Define new version of the record-save section

With the changes to the internal representation of the history, we can
no longer support the previous record save format. This commit makes it
official, documenting the new format and changing the magic number.

Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: extract the PC to record_full_instruction
Guinevere Larsen [Mon, 1 Jun 2026 19:54:09 +0000 (16:54 -0300)] 
gdb/record: extract the PC to record_full_instruction

This commit makes it so the PC is not saved as part of the
record_full_instruction effects, but rather gets a special location.
That is because a couple of commands would really benefit from it being
easy to find the PC (especially ones from record-btrace that's haven't
been implemented to record-full yet, such as the ones in PR
record/18059), while also possibly allowing for one fewer resizing of
the effect vector (and saving an entire byte in the process).

This commit also refactored record_full_read_entry_from_bfd and
record_full_write_entry_to_bfd, to make them methods of
record_full_reg_entry and record_full_mem_entry, and also creates
similar methods for record_full_entry and record_full_instruction.
These could be turned into constructors in a future step of
c++ification, but it felt like too much change for a single commit.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: make record_full_history more c++-like
Guinevere Larsen [Mon, 1 Jun 2026 19:42:41 +0000 (16:42 -0300)] 
gdb/record: make record_full_history more c++-like

This commit moves the function record_full_exec_insn to be a method of
the record_full_instruction class.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: c++ify internal structures of record-full.c
Guinevere Larsen [Tue, 7 Apr 2026 13:55:13 +0000 (10:55 -0300)] 
gdb/record: c++ify internal structures of record-full.c

This commit adds a constructor, destructor, and some methods to the
structures record_full_entry, record_full_reg_entry and
record_full_mem_entry. This is a move to disentangle the internal
representation of the data and how record-full manipulates it for
replaying.

Along with this change, record_full_entry is changed to use an
std::variant, since it was basically doing that already, but now we have
the stdlibc++ error checking to make sure we're only accessing elements
we're allowed to.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: remove record_full_insn_num
Guinevere Larsen [Wed, 8 Apr 2026 19:25:00 +0000 (16:25 -0300)] 
gdb/record: remove record_full_insn_num

Now that record_full_list uses a deque, we don't need a variable to
track the amount of items recorded, so it is just dropped.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: factor out reading and writing the execution log to corefile
Guinevere Larsen [Fri, 29 May 2026 16:42:40 +0000 (13:42 -0300)] 
gdb/record: factor out reading and writing the execution log to corefile

Before this commit, the functions to read and write the execution log to
a corefile would would have a large section dedicated to handling a
single entry from the log.  This commit factors out those large sections
into their own functions, record_full_read_entry_from_bfd and
record_full_write_entry_to_bfd, respectively.

There should be no functional changes after this commit.

Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb/record: Refactor record history
Guinevere Larsen [Thu, 28 May 2026 18:36:33 +0000 (15:36 -0300)] 
gdb/record: Refactor record history

This is the first step in a large refactor in how GDB keeps execution
history.  Rather than using a linked list where multiple entries can
describe a single instruction, the history will now be stored in an
std::deque, each instruction being one entry in the deque.

The choice was initially to use an std::vector, but it would become
unwieldy because it needs all the memory to be consecutive, which is
hard for 200 thousand entries. Deque was picked because it was a nice
midpoint between vector (maximum cache cohesion) and linked list
(maximum ease of finding space to store more).

Each instruction in memory will be now one record_full_instruction
entry, which for this commit just contains a vector of
record_full_entry for the effects of the instruction, and the data that
was stored in the record_full_end entry (that is, the instruction number
and the signal, if any).

This change introduced a minimal performance improvement (what's
important is that it isn't a degradation) and a  reduction in the total
memory footprint of roughly 20% if the entire history is used.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
3 days agogdb, amd-dbgapi-target: use pulongest to print id handles
Tankut Baris Aktemur [Fri, 3 Jul 2026 12:32:10 +0000 (07:32 -0500)] 
gdb, amd-dbgapi-target: use pulongest to print id handles

In amd-dbgapi-target, there are a number of cases where identifier
handles that are obtained from dbgapi are being printed.  Those
handles are defined to have type uint64_t.  Use pulongest when
printing them for improved portability.

In one case, `ptid.tid ()` was being printed for the wave id.  Change
this to use `wave_id.handle` for consistency with the other cases.

Approved-by: Lancelot Six <lancelot.six@amd.com> (amdgpu)
3 days agogdb/testsuite: fix gdb.rocm/interrupt-twice
Lancelot SIX [Wed, 1 Jul 2026 16:09:25 +0000 (17:09 +0100)] 
gdb/testsuite: fix gdb.rocm/interrupt-twice

Since 246aecb1cd1 "gdb/testsuite: make gdb_breakpoint, runto and
runto_main use parse_args", gdb_breakpoint arguments changed.  The
gdb.rocm/interrupt-twice.exp testcase was not updated to call
gdb_breakpoint with correct arguments.  This due to the new test being
reviewed before the gdb_breakpoint landed, but it being pushed after.

This patch fixes this issue.

Change-Id: I0204e2c3cc9b704c79ce01386134e13b018593b8
Reviewed-By: Tankut Baris Aktemur <TankutBaris.Aktemur@amd.com>
3 days agox86/gas: add missing RegBND to debugging code
Jan Beulich [Fri, 3 Jul 2026 09:19:00 +0000 (11:19 +0200)] 
x86/gas: add missing RegBND to debugging code

This must have been overlooked when MPX support was added.

3 days agogdb: replace alloca with gdb::unique_xmalloc_ptr in remote-fileio.c
Luis Machado [Wed, 1 Jul 2026 19:01:56 +0000 (14:01 -0500)] 
gdb: replace alloca with gdb::unique_xmalloc_ptr in remote-fileio.c

remote_fileio_extract_ptr_w_len parsed a debuggee controlled 64 bit
length, narrowed it to int with no bounds check, and the value flowed
directly into alloca() across RSP File I/O handlers (Fopen, Frename,
Funlink, Fstat, Fsystem).  A malicious inferior or remote stub could
send a crafted packet with a large path length, displacing the stack
pointer by up to 2 GiB and potentially crashing the debugger.

remote_fileio_extract_ptr_w_len now rejects negative lengths, lengths
that would overflow the int result (greater than INT_MAX), and zero.
An allow_zero_length flag lets the Fsystem handler opt in to the zero
length sentinel that signals a NULL cmdline query.  All other handlers
use the default and are protected without any per call checks.  Oversized
names are rejected naturally by the underlying syscall with ENAMETOOLONG.
All alloca(length) calls have been replaced with
gdb::unique_xmalloc_ptr<char>, so an oversized but positive length now
fails as a graceful heap allocation error rather than corrupting the
stack.

Add a selftest that exercises various problematic cases.

Signed-off-by: Luis Machado <luis.machado@amd.com>
Approved-By: Pedro Alves <pedro@palves.net>
3 days agogdb/testsuite: deduplicate --offload-arch targets in hcc_amdgpu_targets
Luis Machado [Mon, 29 Jun 2026 13:56:13 +0000 (08:56 -0500)] 
gdb/testsuite: deduplicate --offload-arch targets in hcc_amdgpu_targets

On systems with multiple identical GPUs, find_amdgpu_devices returns one
entry per device, causing hcc_amdgpu_targets to emit redundant
--offload-arch flags when compiling HIP test programs (e.g. eight
--offload-arch=gfx942 flags on an 8-GPU MI300 system).

Deduplicate the target list in hcc_amdgpu_targets, preserving order, so
each unique architecture appears exactly once regardless of how many
physical devices share it.  The same deduplication is applied when the
list comes from the HCC_AMDGPU_TARGET environment variable.  An array
is used for the seen-set to give O(1) membership tests.

Add gdb.rocm/hcc-amdgpu-targets.exp to unit-test the deduplication
logic across both the env-var and device-enumeration code paths, without
requiring a GPU.

Approved-by: Lancelot Six <lancelot.six@amd.com>
3 days agoPR 34342 SIGSEGV libctf/ctf-types.c:1603
Alan Modra [Fri, 3 Jul 2026 00:10:01 +0000 (09:40 +0930)] 
PR 34342 SIGSEGV libctf/ctf-types.c:1603

* ctf-open.c (init_static_types_internal): Sanity check variable
length record bytes against type section length.
(upgrade_types_v1): Likewise.  Don't check unused "size" here.

3 days agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Jul 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 days agoHandle -1 in ptid_t::parse
Tom Tromey [Thu, 2 Jul 2026 18:12:49 +0000 (12:12 -0600)] 
Handle -1 in ptid_t::parse

ptid_t::parse fails to correctly handle the -1 return from
hex_or_minus_one in the 'p' case.  As Mark Wielaard pointed out, it
does this check:

      if (hex != ((unsigned_lwp_type) lwp))

However on 32-bit, this means that it will mishandle (ULONGEST) -1.

This patch fixes the problem by adding a check for the -1 case.

I built a -m32 gdb and verified this fix; I'm checking it in.

4 days agoobjdump: Fix private header ('-p') import table output for pe-aarch64
Jon Turney [Fri, 19 Jun 2026 12:47:03 +0000 (13:47 +0100)] 
objdump: Fix private header ('-p') import table output for pe-aarch64

The private header ('-p') import table output for pe-aarch64 (and
probably all other 64-bit arches apart from x86_64) is truncated after the
first import.

The distinction between the conditional branches here should be between
PE32 (32-bit) and PE32+ (somewhat confusingly, the 64-bit version of the
PE format).

PE file format specification [1] states under "Import Lookup Table":

"An import lookup table is an array of 32-bit numbers for PE32 or an
array of 64-bit numbers for PE32+."

[1] https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#import-lookup-table

2026-06-19  Jon Turney  <jon.turney@dronecode.org.uk>

* peXXigen.c (pe_print_idata): Fix conditional.

4 days agobfd/readelf: Add core file support for FEAT_S1POE
Srinath Parvathaneni [Thu, 2 Jul 2026 13:57:25 +0000 (13:57 +0000)] 
bfd/readelf: Add core file support for FEAT_S1POE

Add support for `NT_ARM_POE` dumps/reads for core files.

4 days agoaarch64: Adjust architecture version for mpamv2 tests
Richard Earnshaw [Thu, 2 Jul 2026 12:51:03 +0000 (13:51 +0100)] 
aarch64: Adjust architecture version for mpamv2 tests

Armv9.3a now permits mpamv2, so lower the version needed for the tests.

4 days agoFix ptid_t selftest crash
Tom Tromey [Thu, 2 Jul 2026 12:51:36 +0000 (06:51 -0600)] 
Fix ptid_t selftest crash

Sam James pointed out that my recent patch to add ptid_t::parse caused
a selftest crash.

At first I couldn't see why this did not crash for me, but then I
realized that ptid_t::parse didn't unconditionally initialize '*obuf'.
Initializing it to nullptr made this crash reliably.

The underlying bug is that some code paths in ptid_t::parse don't set
obuf on return.  This patch fixes the bug by passing 'obuf' down to
hex_or_minus_one.

Since this is straightforward and fixes a new crash, I'm checking it
in.

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

4 days agoNEWS: Update for withdrawal of the MPAMv2_VID feature.
Richard Earnshaw [Mon, 29 Jun 2026 16:07:01 +0000 (17:07 +0100)] 
NEWS: Update for withdrawal of the MPAMv2_VID feature.

4 days agoaarch64: Remove +mpamv2 feature option
Richard Earnshaw [Mon, 29 Jun 2026 15:46:27 +0000 (16:46 +0100)] 
aarch64: Remove +mpamv2 feature option

The remaining mpamv2 details only use system registers; so by our
conventions we do not use a feature option to enable them.  Remove the
now redundant +mpamv2 architecture option and adjust the tests
accordingly.

4 days agoRevert "aarch64: Add FEAT_MPAMv2_VID system registers"
Richard Earnshaw [Mon, 29 Jun 2026 15:36:22 +0000 (16:36 +0100)] 
Revert "aarch64: Add FEAT_MPAMv2_VID system registers"

This reverts commit 5fc6b09c078532fa4206a350e34d82488b80a5fb.

4 days agoRevert "aarch64: Add support for MLBI system instructions"
Richard Earnshaw [Mon, 29 Jun 2026 15:35:01 +0000 (16:35 +0100)] 
Revert "aarch64: Add support for MLBI system instructions"

This reverts commit d8e004f124877849c654c0f24c2960970dbc1ee8.

4 days agoaarch64: remove MLBI from sys-rt-alias test.
Richard Earnshaw [Mon, 29 Jun 2026 16:03:49 +0000 (17:03 +0100)] 
aarch64: remove MLBI from sys-rt-alias test.

4 days agoaarch64: warn if the TME feature is used during assembly.
Richard Earnshaw [Thu, 25 Jun 2026 13:09:28 +0000 (14:09 +0100)] 
aarch64: warn if the TME feature is used during assembly.

Arm has obsoleted the unimplemented TME feature.  Warn if instructions
from this feature are encountered.

Also tweak warn_unpredictable_ldst to use const more often, since the
arguments are the same as for the new warn_deprecated function.

4 days agoaarch64: Remove a stray comment from opcode/aarch64.h
Richard Earnshaw [Thu, 25 Jun 2026 10:32:23 +0000 (11:32 +0100)] 
aarch64: Remove a stray comment from opcode/aarch64.h

When flag bit 28 was removed in an earlier patch, the comment describing
it was left behind.  This just cleans that up.

4 days agold/testsuite: add support for remote testing in ld-cdtest
Clément Chigot [Fri, 20 Feb 2026 14:43:03 +0000 (15:43 +0100)] 
ld/testsuite: add support for remote testing in ld-cdtest

This converts the existing to code to use "remote_load" allowing
execution on both native and remote targets.

The "diff" between the output and the expected result has been
transformed to the usual regexp_diff. The previous could have been
transformed into `remote_exec build diff` but tends to be fickled with
new lines.

4 days agoRe: x86: Disable AMX-TF32 by default
Alan Modra [Thu, 2 Jul 2026 04:10:36 +0000 (13:40 +0930)] 
Re: x86: Disable AMX-TF32 by default

Regenerate opcodes/i386-init.h, which was listed in the changelog but
not committed.

4 days agoPR 34327 More out of bounds accesses in reloc special functions
Alan Modra [Thu, 2 Jul 2026 01:34:13 +0000 (11:04 +0930)] 
PR 34327 More out of bounds accesses in reloc special functions

I don't claim to have caught all places where reloc special functions
don't sanity check input, but this should be most of them.  Hopefully
this does not expose odd reloc howto entries like the mmix one in the
previous patch.

* coff-arm.c (aoutarm_fix_pcrel_26): Sanity check reloc offset.
Remove some unnecessary casts.
(coff_thumb_pcrel_common): Likewise.
* coff-mips.c (mips_generic_reloc): Remove unnecessary casts.
(mips_refhi_reloc): Likewise.
(mips_gprel_reloc): Likewise.  Use bfd_reloc_offset_in_range.
* cpu-ns32k.c (do_ns32k_reloc): Likewise.
* elf32-m68hc1x.c (m68hc11_elf_special_reloc): Likewise.  Don't
abort, return notsupported instead.
* elf32-pj.c (pj_elf_reloc): Sanity check reloc offset.
* elf32-pru.c (pru_elf32_do_s10_pcrel_relocate): Update reloc
offset sanity check.
(pru_elf32_do_ldi32_relocate): Likewise.
* elf32-s390.c (s390_elf_ldisp_reloc): Use bfd_reloc_offset_in_range.
Remove unnecessary casts.
* elf32-score7.c (score_elf_got_lo16_reloc): Remove redundant old
reloc offset sanity check.
* elf32-sh.c (sh_elf_reloc): Use bfd_reloc_offset_in_range.
* elf32-v850.c (v850_elf_reloc): Likewise.

4 days agoPR 34327 Out of bounds accesses in reloc special functions.
Alan Modra [Thu, 2 Jul 2026 01:18:34 +0000 (10:48 +0930)] 
PR 34327 Out of bounds accesses in reloc special functions.

As per the PR, s12z lacked any reloc offset sanity checking, the
others all just checked that the offset started within the section
rather than checking the field was contained in the section.

Using the proper check for mmix exposed a problem in the howto table,
present since the initial mmix commit.  The R_MMIX_BASE_PLUS_OFFSET
field is actually two bytes, located at the reloc address.  Making it
an eight byte field is just wrong, as doing that indicates the field
is at the reloc address plus six bytes for a big-endian target.
Presumably this was done for overlow reporting, which is properly done
by appropriately setting complain_on_overflow.

* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): Use
bfd_reloc_offset_in_range
* elf32-s12z.c (opru18_reloc): Likewise.
* elf32-spu.c (spu_elf_rel9): Likewise.
* elf32-xstormy16.c (xstormy16_elf_24_reloc): Likewise.
* elf32-visium.c (visium_elf_howto_parity_reloc): Likewise.
Remove unnecessary casts too.
* elf64-s390.c (s390_elf_ldisp_reloc): Likewise.
* elfxx-sparc.c (init_insn_reloc): Likewise.
* elf64-mmix.c (mmix_elf_reloc): Likewise.  Remove unnecessary
variable too.
(elf_mmix_howto_table[R_MMIX_BASE_PLUS_OFFSET]): Correct size,
bitsize and complain_on_overflow.

4 days agoPR 34165 aarch64 assertion fail and segv
Alan Modra [Wed, 1 Jul 2026 01:28:53 +0000 (10:58 +0930)] 
PR 34165 aarch64 assertion fail and segv

* elfnn-aarch64.c (dtpoff_base, tpoff_base): Don't assert that
tls_sec is non-NULL, return zero instead.

4 days agox86: Disable AMX-TF32 by default
Haochen Jiang [Tue, 30 Jun 2026 07:58:35 +0000 (15:58 +0800)] 
x86: Disable AMX-TF32 by default

AMX-TF32 got depublished in ISE062. Just like AMX-TRANSPOSE, we
will keep the AMX-TF32 support for now in case there are x86 vendors
want to utilize the feature. AMX-TF32 will not show up on any
Intel/AMD hardware. Also in foreseeable future, no hardware will
support AMX-TF32, we will disable it by default. For testcases,
we will simply add .arch .amx_tf32 to keep the original test
intuition.

gas/ChangeLog:

        * testsuite/gas/i386/x86-64-amx-tf32.s: Add .amx_tf32.
        * testsuite/gas/i386/x86-64-amx-tf32-inval.s: Ditto.
        * testsuite/gas/i386/x86-64-amx-transpose.s: Ditto.
        * testsuite/gas/i386/x86-64-amx-transpose-inval.s: Ditto.
        * testsuite/gas/i386/x86-64-amx-tf32-inval.l: Adjust line
number.
        * testsuite/gas/i386/x86-64-amx-transpose-inval.l: Ditto.

opcodes/ChangeLog:

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

4 days agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Jul 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 days agoreadelf: Avoid may be used uninitialized warning from GCC 14
H.J. Lu [Wed, 1 Jul 2026 23:02:48 +0000 (07:02 +0800)] 
readelf: Avoid may be used uninitialized warning from GCC 14

GCC 14 fails to recognize that rel_entsz and entsz_name are unused when
process_relocs returns early for error:

.../binutils/readelf.c:10127:18: error: â€˜rel_entsz’ may be used uninitialized [-Werror=maybe-uninitialized]
10127 |               if (rel_entsz == 0)
      |                  ^
...
.../binutils/readelf.c:10129:19: error: â€˜entsz_name’ may be used uninitialized [-Werror=maybe-uninitialized]
10129 |                   printf (_("<missing or corrupt dynamic tag: %s>\n"),
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10130 |                           entsz_name);

Clear them before returning error.  Also replace reltype_unknown with
default since GCC 14 fails to see that reltype_unknown is the only
unhandled value for relocation_type enum.

PR binutils/34324
* readelf.c (process_relocs): Clear rel_entsz and entsz_name
before returning error on missing DT_REL and DT_RELA dynamic
tags.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 days agoreadelf: Check missing DT_REL and DT_RELA dynamic tags
H.J. Lu [Tue, 30 Jun 2026 23:31:42 +0000 (07:31 +0800)] 
readelf: Check missing DT_REL and DT_RELA dynamic tags

PR binutils/34324
* readelf.c (process_relocs): Return error on missing DT_REL and
DT_RELA dynamic tags.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 days agoDo not write negative PID or TID in remote protocol
Tom Tromey [Wed, 11 Mar 2026 20:17:50 +0000 (14:17 -0600)] 
Do not write negative PID or TID in remote protocol

Currently both gdb and gdbserver can write a negative number for the
PID or TID.  However, the only negative value that really makes sense
is the special case of "-1" -- in other cases if the PID or TID has
the high bit set, it should still be written as a positive number.

This patch attempts to fix the bug.

v2 of this patch combines the implementations and moves them to
gdbsupport.  I tried making these standalone functions in rsp-low.cc,
but that runs afoul of libipa.  So, I made them methods of ptid_t.

The new unit tests pointed out that round-tripping a sign-extended
number didn't really work, because the checks were done via ULONGEST.
It's kind of unfortunate that the PID and LWP are host-dependent
types.  This should probably be fixed, but I haven't done so here.
Meanwhile I changed the checks to use the corresponding unsigned type.

v1 is here

    https://inbox.sourceware.org/gdb-patches/20260311202152.2704410-1-tromey@adacore.com/

Regression tested on x86-64 Fedora 43.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25111
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33979
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33983

5 days agolibiberty d_compact_number signed integer overflow
Alan Modra [Wed, 1 Jul 2026 01:27:51 +0000 (10:57 +0930)] 
libiberty d_compact_number signed integer overflow

https://lists.gnu.org/archive/html/bug-binutils/2026-06/msg00189.html
Fix this by doing the addition in unsigned arithmetic.

5 days agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Jul 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 days agold/testsuite: Add comprehensive PE COFF weak external tests
Peter Damianov [Tue, 23 Jun 2026 21:38:07 +0000 (17:38 -0400)] 
ld/testsuite: Add comprehensive PE COFF weak external tests

Add tests covering the full matrix of weak/strong symbol interactions
for PE COFF weak externals, based on testcases by Martin Storsjo.
The archive test covers PE weak externals whose public name is backed
by a real fallback definition, and ensures weak declarations with the
null fallback are not advertised as archive providers.

ld/testsuite/

* ld-pe/pe-compile.exp (weak_ext_test): New proc.  Compiles
source files, links via gcc, and runs natively if possible.
(weak_ext_archive_test): New proc.
Add tests: normal, weak-undef, weak-defined,
weak-decl-weak-def, strong-undef-weak-def-archive, weak-use,
weak-override, weak-duplicate, weak-def-override, weak-def-use.
* ld-pe/weak-ext-main.c: New file.
* ld-pe/weak-ext-main-weak.c: New file.
* ld-pe/weak-ext-main-weak-def.c: New file.
* ld-pe/weak-ext-add2.c: New file.
* ld-pe/weak-ext-add1-weak-chained.c: New file.
* ld-pe/weak-ext-dummy.c: New file.
* ld-pe/weak-ext-expected1.c: New file.
* ld-pe/weak-ext-expected3.c: New file.
* ld-pe/weak-ext-expected5.c: New file.
* ld-pe/weak-ext-expected3-add1-weak.c: New file.

5 days agobfd: Handle PE weak externals with real fallbacks in archives
Peter Damianov [Tue, 23 Jun 2026 21:38:06 +0000 (17:38 -0400)] 
bfd: Handle PE weak externals with real fallbacks in archives

PE weak externals are canonicalized as undefined BFD symbols, even
when their auxiliary entry names a real fallback definition in the same
object.  Archive map generation therefore skipped the public weak name,
so a strong undefined reference to that name could not extract the
archive member.

Include such PE weak externals in the archive map, but only when the
fallback is a real definition rather than the absolute-zero null symbol
used for weak declarations with no fallback.  Also avoid extracting an
archive member again during repeated archive searches once the weak
external resolves through a defined fallback.

Fixes: https://gcc.gnu.org/PR124263
bfd/

* archive.c: Include coff-bfd.h.
(_bfd_compute_and_push_armap): Include PE weak externals in
the archive map when their fallback is a real definition.
* coff-bfd.c (bfd_coff_pe_weak_external_has_real_fallback): New
function.
* coff-bfd.h (bfd_coff_pe_weak_external_has_real_fallback):
Declare.
* cofflink.c (coff_link_hash_pe_weak_external_has_real_fallback):
New function.
(coff_link_check_archive_element): Avoid extracting an archive
member again for a PE weak external whose real fallback is
already defined.

5 days agoPE-COFF: Prefer weak external with defined fallback over null fallback
Peter Damianov [Tue, 23 Jun 2026 21:38:05 +0000 (17:38 -0400)] 
PE-COFF: Prefer weak external with defined fallback over null fallback

When two PE COFF weak externals for the same symbol are linked (both
C_NT_WEAK with aux records), the generic linker takes no action on the
second one (NOACT: weak undef meets existing weak undef).  This means
the first file's fallback alias always wins regardless of whether it
points to a real definition or to NULL.

This causes a problem when a weak declaration (fallback = NULL,
i.e. "resolve to NULL if nothing provides it") is linked before a
weak definition (fallback = actual function body).  The symbol resolves
to address 0 at runtime, causing a crash when called.

Fix this by comparing the fallback targets when two weak externals
meet: if the incoming weak external's fallback resolves to a defined
symbol and the existing one does not (or points to NULL),
update the aux record to use the better fallback.

This matches the behavior of lld after:
  https://github.com/llvm/llvm-project/commit/7ca5698b4c3698d06065e0941df7f23d72913d23

bfd/
* cofflink.c (coff_link_add_symbols): When two PE COFF weak
externals meet, prefer the one whose fallback alias resolves
to a defined symbol.

5 days agoPE-COFF: Fix weak external symbol resolution when strong undef is seen first
Peter Damianov [Tue, 23 Jun 2026 21:38:04 +0000 (17:38 -0400)] 
PE-COFF: Fix weak external symbol resolution when strong undef is seen first

When linking PE-COFF objects, a weak external symbol (C_NT_WEAK with an
aux record specifying a fallback alias) may fail to resolve if a strong
undefined reference to the same symbol is encountered before the weak
definition.  This causes "undefined reference" errors for symbols like
operator new or personality routines that GCC emits as weak externals
with a fallback to a default implementation.

There are two problems:

1. In coff_link_add_symbols, when the generic linker resolves a weak
   undefined against an existing strong undefined (NOACT in the action
   table), the COFF-specific symbol_class and aux record were not stored
   because the existing hash entry already had non-null class/type from
   the first (strong) object file.

2. In _bfd_coff_generic_relocate_section, the weak alias fallback only
   triggered for bfd_link_hash_undefweak symbols.  When a strong undef
   is seen first, the hash type stays bfd_link_hash_undefined (the
   generic linker does not downgrade it), so the fallback was skipped.

Fix by extending the condition in coff_link_add_symbols to also update
symbol_class and aux when the incoming symbol is a PE weak external
with aux and the existing hash is still undefined.  Also extend the
relocation handler to resolve the weak alias fallback for
bfd_link_hash_undefined symbols that carry C_NT_WEAK class and have
an aux record.

bfd/
        * cofflink.c (coff_link_add_symbols): Also store symbol_class
        and aux record when a PE weak external with aux meets an
        existing undefined hash entry.
        (_bfd_coff_generic_relocate_section): Also resolve weak alias
        fallback for undefined symbols with C_NT_WEAK class and aux.

6 days agoRISC-V: Fix zvdota altfmt disassemble format issue
Jiawei [Tue, 30 Jun 2026 16:24:20 +0000 (00:24 +0800)] 
RISC-V: Fix zvdota altfmt disassemble format issue

Fix-up vtype altfmt disassembly extension check.

Only print the altfmt vtype names when the object advertises one of the
extensions that defines that encoding, or when disassembling with all
extensions enabled.

Validated with:
  make check RUNTEST=... RUNTESTFLAGS="riscv.exp"

Result:
  PASS: gas/riscv/vector-insns
  PASS: gas/riscv/zvdota
  # of expected passes: 360

gas/ChangeLog:

* testsuite/gas/riscv/zvdota.d: Fix format.

opcodes/ChangeLog:

* riscv-dis.c (riscv_vtype_altfmt_supported): Add ext check.
(print_insn_args): Use altfmt check.

6 days agoRISC-V: Add Zvbdota extension support
Jiawei [Tue, 30 Jun 2026 13:55:11 +0000 (07:55 -0600)] 
RISC-V: Add Zvbdota extension support

This patch supports the RISC-V Zvbdota family of batched dot-product
extensions [1].

Compared to the non-batched Zvdota family, Zvbdota computes up to eight
dot products at a time.  These instructions use an EMUL=8 `vs2` vector
register group and a scaled-by-8 `ci` immediate encoded in `vs2[2:0]`.
This patch adds assembler/disassembler support for those additional
operand constraints.

The Zvbdota extension family includes the following extensions:

* Zvqwbdota8i: batched dot product of 8-bit integers with 32-bit
  accumulation.
* Zvqwbdota16i: batched dot product of 16-bit integers with 64-bit
  accumulation.
* Zvfwbdota16bf: batched dot product of bfloat16 floating-point numbers
  with 32-bit accumulation.
* Zvfqwbdota8f: batched dot product of 8-bit floating-point numbers with
  32-bit accumulation.
* Zvfbdota32f: batched dot product of 32-bit single-precision
  floating-point numbers with 32-bit accumulation.

[1] https://github.com/riscv/riscv-isa-manual/blob/zvbdot/src/zvdota.adoc

bfd/ChangeLog:

* elfxx-riscv.c (riscv_implicit_subsets): New implies.
(riscv_supported_std_z_ext): New extensions.
(riscv_multi_subset_supports): Ditto.
(riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

* NEWS: Add zvqwbdota8i, zvqwbdota16i, zvfwbdota16bf,
zvfqwbdota8f and zvfbdota32f extensions.
* config/tc-riscv.c (validate_riscv_insn): Add Zvbdota operand
type 'q' and 'r' bits validation.
(riscv_vtype_altfmt_supported): Add Zvbdota extensions.
(my_getVsetvliExpression): Update altfmt error message.
(riscv_ip): Add 'q' operand for VS2 EMUL=8 alignment check
and 'r' operand for ci immediate.
* testsuite/gas/riscv/march-help.l: Ditto.
* testsuite/gas/riscv/zvbdota.d: New test.
* testsuite/gas/riscv/zvbdota.s: Ditto.
* testsuite/gas/riscv/zvbdota-operands-fail.d: Ditto.
* testsuite/gas/riscv/zvbdota-operands-fail.l: Ditto.
* testsuite/gas/riscv/zvbdota-operands-fail.s: Ditto.
* testsuite/gas/riscv/zvbdota-zvqwbdota16i.d: Ditto.
* testsuite/gas/riscv/zvbdota-zvqwbdota16i.s: Ditto.

include/ChangeLog:

* opcode/riscv-opc.h (MATCH_VQWBDOTAU_VV, MASK_VQWBDOTAU_VV):
New encoding.
(MATCH_VQWBDOTAS_VV, MASK_VQWBDOTAS_VV): Ditto.
(MATCH_VFWBDOTA_VV, MASK_VFWBDOTA_VV): Ditto.
(MATCH_VFQWBDOTA_VV, MASK_VFQWBDOTA_VV): Ditto.
(MATCH_VFQWBDOTA_ALT_VV, MASK_VFQWBDOTA_ALT_VV): Ditto.
(MATCH_VFBDOTA_VV, MASK_VFBDOTA_VV): Ditto.
(DECLARE_INSN): New declarations.
* opcode/riscv.h (enum riscv_insn_class): New extension classes.

opcodes/ChangeLog:

* riscv-dis.c (print_insn_args): Add 'q' and 'r' operand types
for Zvbdota.
* riscv-opc.c (riscv_opcodes): New instructions.

6 days agoRISC-V: Add Zvdota extension classes
Jiawei [Tue, 30 Jun 2026 13:54:21 +0000 (07:54 -0600)] 
RISC-V: Add Zvdota extension classes

Zvfqwdota8f: dot product of 8-bit floating-point numbers with 32-bit accumulation.

Zvdota also uses the vtype alternative format bit, altfmt, which is bit 8 of the vtype CSR. This patch adds symbolic e8alt and e16alt vsew constants for vsetvli/vsetivli so that assembly code can select the alternative element formats required by these dot-product instructions.

[1] https://github.com/riscv/riscv-isa-manual/blob/zvbdot/src/zvdota.adoc

bfd/ChangeLog:

* elfxx-riscv.c (riscv_implicit_subsets): New implies.
(riscv_supported_std_z_ext): New extensions.
(riscv_multi_subset_supports): Ditto.
(riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

* NEWS: Add zvqwdota8i, zvqwdota16i, zvfwdota16bf and
zvfqwdota8f extensions.
* config/tc-riscv.c (riscv_vsew_altfmt): New vsew altfmt
constants array for e8alt and e16alt.
(riscv_vtype_altfmt_supported): New function.
(my_getVsetvliExpression): Ditto.
* testsuite/gas/riscv/march-help.l: New test.
* testsuite/gas/riscv/vector-vtype-altfmt.d: Ditto.
* testsuite/gas/riscv/vector-vtype-altfmt.s: Ditto.
* testsuite/gas/riscv/zvdota.d: Ditto.
* testsuite/gas/riscv/zvdota.s: Ditto.

include/ChangeLog:

* opcode/riscv-opc.h (MATCH_VQWDOTAU_VV, MASK_VQWDOTAU_VV): New encoding.
(MATCH_VQWDOTAS_VV, MASK_VQWDOTAS_VV): Ditto.
(MATCH_VFWDOTA_VV, MASK_VFWDOTA_VV): Ditto.
(MATCH_VFQWDOTA_VV, MASK_VFQWDOTA_VV): Ditto.
(MATCH_VFQWDOTA_ALT_VV, MASK_VFQWDOTA_ALT_VV): Ditto.
(DECLARE_INSN): New declarations.
* opcode/riscv.h (OP_MASK_VTYPE_ALTFMT, OP_SH_VTYPE_ALTFMT): New vtype altfmt.
(enum riscv_insn_class): New extension classes.

opcodes/ChangeLog:

* riscv-dis.c (print_insn_args): Add altfmt support.
* riscv-opc.c (riscv_opcodes): New instructions.

6 days agoreadelf: Also set do_got_section_contents to false
H.J. Lu [Mon, 29 Jun 2026 22:37:05 +0000 (06:37 +0800)] 
readelf: Also set do_got_section_contents to false

Also set do_got_section_contents to false if section headers are failed
to load.

PR binutils/34323
* readelf.c (process_object): Also set do_got_section_contents.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 days agold testsuite alpha_ld_flags
Alan Modra [Tue, 30 Jun 2026 02:56:46 +0000 (12:26 +0930)] 
ld testsuite alpha_ld_flags

This is how alpha can use -Ttext-segment on just those tests that need
it.  And since the way run_dump_test uses $opts(ld) allows tcl procs to
be embedded, there is no need to specially expand [big_or_little_endian].

binutils/
* testsuite/lib/binutils-common.exp (run_dump_test <opts(ld)>): No
need to handle big_or_little_endian specially.
ld/
* testsuite/ld-elf/elf.exp (alpha_ld_flags): New proc.
(LDFLAGS): Don't set -Ttext-segment for alpha globally.
* testsuite/ld-elf/compress1a.d: Add alpha_ld_flags.
* testsuite/ld-elf/compressed1a.d: Likewise.
* testsuite/ld-elf/eh5.d: Likewise.

6 days agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Jun 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 days agoelf: Set image base address to the maximum page size
H.J. Lu [Thu, 28 May 2026 02:47:37 +0000 (10:47 +0800)] 
elf: Set image base address to the maximum page size

When generating Position Dependent Executable for ELF with the maximum
page size set on command-line, set the default image base address to the
maximum page size to avoid segfault if it is lower than the maximum page
size and issue an warning if the image base address set on command-line
is lower than the maximum page size.

PR ld/34184
* ldexp.c (fold_binary): Set the default image base address to
the maximum page size for ELF PDE output if it is lower than
the maximum page size set on command-line and issue an warning
if the image base address set on command-line is lower than the
maximum page size.
* testsuite/ld-elf/elf.exp: Add ld/34184 tests for PDE, PIE
static PDE and static PIE.
* testsuite/ld-elf/pr34184.c: New file.
* testsuite/ld-elf/textaddr3.d: Change -Ttext-segment address
to 0x200100 so that it > the maximum page size.
* testsuite/ld-elf/textaddr5.d: Likewise.
* testsuite/ld-elf/textaddr8.d: New test.
* testsuite/ld-elf/textaddr9.d: Likewise.
* testsuite/ld-elf/textaddr10.d: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
7 days agoPE/COFF: auto-promote oversized objects to bigobj
Oleg Tolmatcev [Mon, 29 Jun 2026 13:48:11 +0000 (15:48 +0200)] 
PE/COFF: auto-promote oversized objects to bigobj

PE/COFF object files use 16-bit section numbers in normal symbols.
When an object grows past that limit, current BFD already rejects it with
a "too many sections" / "file too big" error.

BFD already has PE bigobj targets for the backends that support them, but
oversized PE/COFF output still requires selecting bigobj explicitly.

Teach coff_compute_section_file_positions to switch PE/COFF output to the
corresponding bigobj target when the normal section-number limit is
exceeded. This preserves the existing hard error for targets without
bigobj support, but lets supported PE targets transparently emit a valid
bigobj object instead of requiring manual selection.

bfd/
* coffcode.h (coff_compute_section_file_positions): Auto-promote
oversized PE/COFF objects to the bigobj target.

gas/
* testsuite/gas/pe/big-obj-auto.d: New test.
* testsuite/gas/pe/big-obj-auto.s: New test.
* testsuite/gas/pe/pe.exp: Run big-obj-auto.

Signed-off-by: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
7 days agobfd: Always use CP_ACP=1 on Solaris [PR11280]
Rainer Orth [Mon, 29 Jun 2026 11:25:38 +0000 (13:25 +0200)] 
bfd: Always use CP_ACP=1 on Solaris [PR11280]

bfd/configure.host defines CP_ACP=1 on Solaris 11 as a workaround for
the lack the MS-ANSI codepage in Solaris libc iconv(3C).  However, the
issue isn't restricted to some OpenSolaris build as the comment
suggests, but present on Solaris in general as can be seen in the iconv -l
output:

On both Solaris 10 and 11.4, one gets

CP1252 (1252, ANSI-1252, WINDOWS-1252),

unlike GNU iconv which lists

CP1252 MS-ANSI WINDOWS-1252

Therefore, this patch applies the patch on all Solaris versions.

Tested on {amd64,i386}-pc-solaris2.11 and sparc{v9,}-sun-solaris2.11.

2026-06-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

bfd:
PR binutils/11280
* configure.host (HDEFINES): Always define CP_ACP=1 on Solaris.

7 days agoRemove 32-bit-only Solaris configurations
Rainer Orth [Mon, 29 Jun 2026 11:23:15 +0000 (13:23 +0200)] 
Remove 32-bit-only Solaris configurations

After the removal of all Solaris configurations but Solaris 10/11
(*-*-solaris2.1[01]), the 32-bit-only configurations can no longer be
matched.  This patch removes them.

Tested on {amd64,i386}-pc-solaris2.11 and sparc{v9,}-sun-solaris2.11.

2026-06-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

bfd:
* config.bfd <i[3-7]86-*-solaris*>: Remove.
<sparc*-*-solaris*>: Likewise.

ld:
* configure.tgt <i[3-7]86-*-solaris*>: Remove.
<sparc*-*-solaris*>: Likewise.

7 days agoRISC-V: Fix build with clang and gcc prior to gcc11
Mark Zhuang [Tue, 23 Jun 2026 13:35:08 +0000 (21:35 +0800)] 
RISC-V: Fix build with clang and gcc prior to gcc11

A label followed by a declaration is a C23 extension.
Add braces to fix it.

7 days agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Jun 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 days agold-elf/linux-x86.exp: Remove $options in readelf log
H.J. Lu [Sun, 28 Jun 2026 22:49:53 +0000 (06:49 +0800)] 
ld-elf/linux-x86.exp: Remove $options in readelf log

Remove $options in readelf log since it isn't passed to readelf.

* testsuite/ld-elf/linux-x86.exp (elfedit_test): Remove $options
in readelf log.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
8 days agoAVR: PR13129 - Overhaul c-avr.texi and document gs().
Georg-Johann Lay [Sun, 28 Jun 2026 16:05:18 +0000 (18:05 +0200)] 
AVR: PR13129 - Overhaul c-avr.texi and document gs().

This patch adds documentation for gs() to the GAS manual
and overhauls gas/doc/c-avr.texi as a whole.

PR gas/13129
gas/
* doc/c-avr.texi: Overhaul and add gs() documentation.

8 days agoelf32_arm_copy_special_section_fields wild read
Alan Modra [Sun, 28 Jun 2026 12:43:09 +0000 (22:13 +0930)] 
elf32_arm_copy_special_section_fields wild read

This function has a number of loops with a controlling expression of
(i-- > 0) with tests in the loop to break out on finding something.
If that something is not found, the value of i is -1u on loop exit.
Code following the loop expects the "not found" value of i to be 0.
This can lead to an attempted access of oheaders[-1u].

oheaders is elf_elfsections(obfd), the ELF section header table.  We
are not interested here in anything at index zero of the array, so the
proper loop control is --i > 0, or equivalently, --i != 0.

* elf32-arm.c (elf32_arm_copy_special_section_fields): Correct
loop controlling expressions.

8 days agoasan: index out of bounds in print_insn_tic6x
Alan Modra [Sun, 28 Jun 2026 05:37:05 +0000 (15:07 +0930)] 
asan: index out of bounds in print_insn_tic6x

header.word_compact is a seven element array.  If fp_offset has values
of 29 to 31 then word_compact[7] is read to set num_bits which is then
never used since the function returns before its first use.

* tic6x-dis.c (print_insn_tic6x): Delay setting num_bits until
invalid fp_offset values are handled.

8 days agoaarch64: segv on aarch64_stub_erratum_843419_veneer
Alan Modra [Thu, 25 Jun 2026 13:13:05 +0000 (22:43 +0930)] 
aarch64: segv on aarch64_stub_erratum_843419_veneer

With a patch I've had in my tree for a while that makes use of the
stub bfd for linker generated sections, I saw segfaults in the
testsuite linking ld-aarch64/erratum843419-adr and
ld-aarch64/erratum843419-far-adr.  Without my changes (that result in
stub_file->the_bfd->sections non-NULL), elf64_aarch64_build_stubs is
not called.  See aarch64elf.em finish function.  However, I believe it
is possible to hit the segfault with a testcase that generates other
stub types besides the aarch64_stub_erratum_843419_veneer.

The segfault occurs on the aarch64_build_one_stub assert that
stub_sec->output_section != NULL.  That happens because
_bfd_aarch64_add_stub_entry_after creates a stub_entry with stub_sec
NULL when fix_erratum_843419 is ERRAT_ADR.  Clearly we shouldn't be
doing anything in aarch64_build_one_stub when stub_sec is NULL, and
inspecting aarch64_size_one_stub reveals that these stubs are not
sized.

I found the test in aarch64_size_one_stub to exclude these stubs a
little obscure, needing to verify the possible values of
htab->fix_erratum_843419 to convince myself it was correct.  (It is.)
So I changed the test in both places to stub_entry->stub_sec being
non-NULL.   Which is how _bfd_aarch64_erratum_843419_branch_to_stub
distinguishes the variants of the stub.

* elfnn-aarch64.c (aarch64_build_one_stub): Don't segfault on
NULL stub_sec.
(aarch64_size_one_stub): Use the same condition here for
aarch64_stub_erratum_843419_veneer.

8 days agoasan: buffer overflow in elf32_dlx_relocate26
Alan Modra [Sat, 27 Jun 2026 23:41:46 +0000 (09:11 +0930)] 
asan: buffer overflow in elf32_dlx_relocate26

* elf32-dlx.c (elf32_dlx_relocate26): Sanity check reloc offset.
(elf32_dlx_relocate16): Likewise.
(_bfd_dlx_elf_hi16_reloc): Likewise, and remove ineffective
existing check.

8 days agoasan: use of uninitialised value in s_ifeqs
Alan Modra [Sat, 27 Jun 2026 04:28:46 +0000 (13:58 +0930)] 
asan: use of uninitialised value in s_ifeqs

demand_copy_string returns NULL when a double-quoted string is not
found, and calls ignore_rest_of_line.  demand_copy_C_string can also
return NULL when finding an embedded \0, but doesn't call
ignore_rest_of_line for this condition.  This makes it difficult to
handle errors.

I believe ignore_rest_of_line should only be called at the level of
functions handling an entire line.  It will typically appear then only
in functions that call demand_empty_rest_of_line.  So this patch
removes the ignore_rest_of_file call in demand_copy_string, moving it
to callers of these functions.  Missing error handling is added in the
second part of the changelog below.

* read.c (demand_copy_string): Don't call ignore_rest_of_file.
(demand_copy_C_string): Don't zero length on error.
(s_file, s_incbin, s_include): Call ignore_rest_of_file on
demand_copy_string error.
(s_errwarn, s_print): Call ignore_rest_of_file on
demand_copy_C_string error.
(s_linefile): Move ignore_rest_of_line call for negative linenum
earlier and similarly for missing file, reducing block
indentation.
* config/tc-tic54x.c (tic54x_mlib): Call ignore_rest_of_line
after demand_copy_C_string error.
* dwarf2dbg.c (dwarf2_directive_filename): Likewise.
* stabs.c (s_stab_generic, s_xstab): Likewise.

* cond.c (s_ifeqs): Handle NULL return from demand_copy_C_string.
* config/tc-ia64.c (dot_pred_rel): Likewise.
* config/tc-ppc.c (ppc_rename, ppc_stabx, ppc_biei, ppc_bc): Likewise.
* config/tc-tic54x.c (tic54x_asg, tic54x_sect, tic54x_include),
(tic54x_message, tic54x_sblock, subsym_get_arg): Likewise.
* ecoff.c (ecoff_directive_file): Likewise.
* config/tc-alpha.c (s_alpha_file): Handle NULL return from
demand_copy_string.
* config/tc-ppc.c (ppc_file): Likewise.

8 days agoasan: buffer overflow in m32r_elf_generic_reloc
Alan Modra [Sat, 27 Jun 2026 04:26:11 +0000 (13:56 +0930)] 
asan: buffer overflow in m32r_elf_generic_reloc

The existing sanity check didn't take into account the size of the
reloc field.  So a field that started before the end of section, but
extended past it, accessed past the end of the contents buffer.

* elf32-m32r.c (m32r_elf_generic_reloc): Properly check reloc
offset.
(m32r_elf_do_10_pcrel_reloc): Likewise.

8 days agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Jun 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 days agogdbserver/linux-low: carry over stop_expected flag after exec (avoid spurious SIGSTOPs)
Simon Marchi [Fri, 26 Jun 2026 14:32:28 +0000 (10:32 -0400)] 
gdbserver/linux-low: carry over stop_expected flag after exec (avoid spurious SIGSTOPs)

Running test gdb.base/vfork-follow-parent.exp on the native-gdbserver
board is flaky.  This test has GDB debugging a vfork parent and child.
When resuming the child, we expect it to run through an exec, and then
exit, like so:

    continue
    Continuing.
    [New inferior 2 (process 3286309)]
    process 3286309 is executing new program: /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/vforked-prog
    [Inferior 2 (process 3286309) exited normally]
    (gdb) PASS: gdb.base/vfork-follow-parent.exp: exec_file=vfork-follow-parent-exec: target-non-stop=off: non-stop=off: resolution_method=schedule-multiple: continue to end of inferior 2

Instead, we sometimes see it reporting a spurious SIGSTOP:

    continue
    Continuing.
    [New inferior 2 (process 3281383)]
    process 3281383 is executing new program: /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/vforked-prog

    Thread 2.1 "vforked-prog" received signal SIGSTOP, Stopped (signal).
    Cannot remove breakpoints because program is no longer writable.
    Further execution is probably impossible.
    0x00007ffff7fe0300 in ?? () from /lib64/ld-linux-x86-64.so.2
    (gdb) FAIL: gdb.base/vfork-follow-parent.exp: exec_file=vfork-follow-parent-exec: target-non-stop=off: non-stop=off: resolution_method=schedule-multiple: continue to end of inferior 2

Note that this case uses "target-non-stop=off", meaning that when one
thread reports a stop, GDBserver attempts to stop the other threads
itself before reporting the stop to GDB.  The bug is related to
GDBserver's bookkeeping of the threads.

When running the test 100 times, it failed 6 times.  Using taskset to
pin the process subtree to a single CPU seemed to make it more likely
to fail: on 100 runs, it failed 30 times.

The cause
=========

The steps occurring in the "pass" case are:

 1. Process P (Parent) is blocked inside the vfork system call, waiting
    for process C (Child) to exec or exit.
 2. Process C is currently stopped at its first instruction (right out
    of vfork).
 3. We resume process C (the "continue" seen in the logs above).
 4. Process C calls exec, as a result the kernel produces two events to
    be consumed by the tracer (GDBserver):

     - For P, a vfork done event (PTRACE_EVENT_VFORK_DONE)
     - For C, an exec event (PTRACE_EVENT_EXEC)

 5. Let's suppose here that waitpid happens to return the
    PTRACE_EVENT_EXEC for C first.
 6. Upon receiving the event, GDBserver calls stop_all_lwps, which sends
    a SIGSTOP to P, and sets `lwp->stop_expected` for P.
 7. GDBserver waits for P to stop, waitpid returns the
    PTRACE_EVENT_VFORK_DONE event.  GDBserver stashes it in
    lwp->status_pending.  The SIGSTOP for P is still pending at the
    kernel level.
 8. When we resume C, everything is fine, it runs until exit.
 9. When we resume P, GDBserver receives the SIGSTOP event for P, but
    suppresses it because `lwp->stop_expected` is set for P.

Now, for the failing case, imagine that at step 5 the kernel decided to
return the PTRACE_EVENT_VFORK_DONE event for P first.  The following
steps would play out like this:

 6. Upon receiving the event, GDBserver calls stop_all_lwps, which sends
    a SIGSTOP to C, and sets `lwp->stop_expected` for C.
 7. GDBserver waits for C to stop, waitpid returns the PTRACE_EVENT_EXEC
    event.
 8. In the handling of PTRACE_EVENT_EXEC (in
    linux_process_target::handle_extended_wait), GDBserver deletes the
    process and its threads (the mourn call), and creates a brand new
    process and lwp_info for C.  Note that this loses the previously set
    `lwp->stop_expected`.  The SIGSTOP for C is still pending at the
    kernel level.
 9. When we resume C, GDBserver receives the SIGSTOP event for C, and
    because `lwp->stop_expected` is not set, GDBserver doesn't recognize
    it as its own, and the stop is presented to the user.

The fix
=======

The (simplest) fix is to transfer the `lwp->stop_expected` from the old
lwp_info to the new one.  When doing so, when we resume C and GDBserver
receives the SIGSTOP event for C, it recognizes it as its own and
suppresses it.

Some care is needed in case process C is multi-threaded and the exec is
done by a non-leader thread.  When a non-leader thread execs, the kernel
scraps all other threads and renumbers this one to the tgid, so that it
becomes the new leader.  The PTRACE_EVENT_EXEC event is reported using
that new renumbered id.  But if a SIGSTOP was pending for the non-leader
exec'ing thread when the exec happened, it will still be pending
post-exec for that thread under its new post-exec leader identity.

Here is a hypothetical but more concrete scenario:

 - There are two threads, 100.100 (the leader) and 100.101.
 - Thread 100.101 is stopped at the entry of the execve system call (so
   the effects of execve haven't occurred yet) when GDBserver sends it a
   SIGSTOP and sets `lwp->stop_expected`.  The SIGSTOP becomes pending
   in the kernel.
 - When 100.101 is resumed, the exec occurs, the kernel deletes thread
   100.100 and renumbers 100.101 to 100.100.  The latter still has the
   SIGSTOP pending.
 - GDBserver receives a PTRACE_EVENT_EXEC event for thread 100.100.
 - Upon resumption, GDBserver then receives an event for the SIGSTOP,
   for thread 100.100.

All this to say that when transferring the `lwp->stop_expected` flag
from the old lwp_info to the new, we must take care to read the exec'ing
thread's flag.  If we use the id reported for the PTRACE_EVENT_EXEC to
look up an lwp_info, then we'll get the leader's lwp_info, which may not
have `lwp->stop_expected` set.  Instead, we must get the exec'ing
thread's original id using PTRACE_GETEVENTMSG, and use that to source
the right lwp_info to transfer the `lwp->stop_expected` flag.

There is a comment about using PTRACE_GETEVENTMSG with PTRACE_EVENT_EXEC
in gdb/linux-nat.c:

    ...
    tid to the tgid, and the previous leader vanishes.  Since
    Linux 3.0, the former thread ID can be retrieved with
    PTRACE_GETEVENTMSG, but since we support older kernels, don't
    bother with it, and just walk the LWP list.  Even with
    ...

Linux 3.0 was released in 2011, so I think it's fine to use that.

With the fix, I don't get any failures after 100 test runs (even with
taskset).

Kernel behavior experiments
===========================

The fix relies on assumptions about how the kernel orders ptrace events
and handles pending signals across exec.  I experimented with these
using standalone ptrace programs (mostly written by my buddy Claude).
The programs would drive a thread of the tracee to the execve syscall
entry, deliver a SIGSTOP to a thread, resume things and then look at
what events would come out of waitpid.  Here are the scenarios I tried:

  - Single-threaded: a tracee stopped at execve syscall entry is sent a
    SIGSTOP, then allowed to exec.  The kernel reports PTRACE_EVENT_EXEC first,
    then the SIGSTOP.

  - Multi-threaded, non-leader exec: a non-leader thread stopped at
    execve syscall entry is sent a SIGSTOP, then allowed to exec.  The
    kernel reports PTRACE_EVENT_EXEC, then the SIGSTOP, both under the
    leader id (the exec'ing non-leader got renumbered).

  - Multi-threaded, leader has a pending SIGSTOP while a non-leader
    execs: the leader is sent a SIGSTOP, which stays pending, then we
    let the non-leader thread exec (giving it a few seconds to be sure).
    The kernel reports PTRACE_EVENT_EXEC under the leader id (the
    exec'ing non-leader got renumbered) and the SIGSTOP has vanished.

What about GDB
==============

I tried to check if the same bug could happen with GDB's linux-nat
target, and if the same fix was needed.  linux-nat takes a different
approach when handling PTRACE_EVENT_EXEC.  It wipes all lwp_infos except
the leader:

      for (lwp_info &other_lp : all_lwps_safe ())
if (&other_lp != lp && other_lp.ptid.pid () == lp->ptid.pid ())
  exit_lwp (&other_lp);

Here, LP is an lwp_info obtained using the event ptid of the
PTRACE_EVENT_EXEC, therefore the leader's lwp_info (even if the exec was
done by a non-leader).

If the exec is done by the leader, as is the case with
gdb.base/vfork-follow-parent.exp, we are ok.  Because GDB doesn't delete
and re-create the lwp_info, the equivalent of GDBserver's
`lwp_info::stop_expected`, `lwp_info::signalled`, survives the exec.

If the exec is done by a non-leader, then we could be in trouble.  If
the leader's signalled flag is not set, but the exec'ing non-leader's
flag is set, then we'll lose it.  I suppose we could fix GDB to use
PTRACE_GETEVENTMSG to get the exec'ing thread former id, look up the
lwp_info for that id, and preserve that lwp_info.

Change-Id: Iaebd1d2cf813dcad35d7d8639bbaed80d40b7d1e
Approved-By: Pedro Alves <pedro@palves.net>
9 days agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Jun 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

10 days agoDisable gdb.ada/dgopt.exp with gnat-llvm
Tom Tromey [Fri, 26 Jun 2026 13:00:47 +0000 (07:00 -0600)] 
Disable gdb.ada/dgopt.exp with gnat-llvm

gdb.ada/dgopt.exp fails with gnat-llvm.

Looking into it, it turns out that this test case relies on a bug in
GNAT.  In particular, despite the use of -gnatDG, GNAT will still put
a reference to "x.adb" into both the DWARF .debug_info and into the
line table.  The test relies on this, because the original problem
being fixed here is that, when the test was written, there was a bug
causing these references to be dropped when writing .debug_names.

gnat-llvm does not have this same bug -- it only emits references to
x.adb.dg.

This patch disables this test for gnat-llvm.  There's not really a
good way to tell that gnatmake is llvm-based, so while I've added a
new caching proc for this, it is just a proxy for an existing proc.

Since this only affects gnat-llvm, and was discussed internally, I am
going to check it in.

10 days agoPrinting of Fortran arrays with dynamic elements
Tom Tromey [Fri, 19 Jun 2026 21:23:47 +0000 (15:23 -0600)] 
Printing of Fortran arrays with dynamic elements

This bug points out a case where a Fortran array has dynamic elements,
and each element must have its dynamic type resolved separately.

I took the test case directly from the bug, figuring it was ok as the
author is at AMD and has some tags in the repository already.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34276
Reviewed-By: Tom de Vries <tdevries@suse.de>
10 days agoHandle nested Ada functions with gnat-llvm
Tom Tromey [Tue, 7 Apr 2026 17:38:48 +0000 (11:38 -0600)] 
Handle nested Ada functions with gnat-llvm

In Ada, a nested function can refer to variables in lexically
enclosing outer scopes.  Ordinarily this is implemented in DWARF using
DW_AT_static_link, so that the correct outer function invocation can
be found from the nested function.

However, LLVM does not implement the DWARF DW_AT_static_link feature,
so this approach isn't possible.

gnat-llvm, though, implements "unnesting" manually, passing an
activation record parameter to nested functions.  This activation
record can be used to find the correct outer frame.

This patch adds a new language method to enable this.  A new test case
is included; this test will fail if the static link or some similar
feature is not implemented (i.e., a naive unwind looking for the next
instance of the outer function will fail).

Reviewed-By: Tom de Vries <tdevries@suse.de>
10 days agoRemove ARI
Tom Tromey [Thu, 18 Jun 2026 16:00:20 +0000 (10:00 -0600)] 
Remove ARI

I was reminded that while we turned off ARI reports a little while
ago, we never did remove ARI from gdb itself.  This patch does so.

ARI was an attempt at enforcing some gdb coding standards.  However,
it seemed to get in the way more than it helped.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33842
Reviewed-By: Tom de Vries <tdevries@suse.de>
10 days agogdb: Fix build for aarch64-windows
Hannes Domani [Tue, 23 Jun 2026 16:28:09 +0000 (18:28 +0200)] 
gdb: Fix build for aarch64-windows

When reload_context was removed from windows_thread_info, it
was missed at one point in aarch64-windows-nat.c:

../../gdb/aarch64-windows-nat.c:260:20: error: no member named 'reload_context' in 'windows_nat::windows_thread_info'
  260 |   gdb_assert (!th->reload_context);
      |                ~~  ^

This removes it.

Approved-By: Tom Tromey <tom@tromey.com>
10 days agogdb+gdbserver: Fix build for aarch64-windows
Hannes Domani [Tue, 23 Jun 2026 16:25:09 +0000 (18:25 +0200)] 
gdb+gdbserver: Fix build for aarch64-windows

Some time ago siginfo_re was made per-thread state, but
not every use location was adjusted, giving this error:

../../gdb/aarch64-windows-nat.c:139:31: error: no member named 'siginfo_er' in 'aarch64_windows_per_inferior'
  139 |   if (aarch64_windows_process.siginfo_er.ExceptionCode != EXCEPTION_BREAKPOINT
      |       ~~~~~~~~~~~~~~~~~~~~~~~ ^

Fix by looking up the exception-record of the current thread.

Approved-By: Tom Tromey <tom@tromey.com>
10 days agoRISC-V: Minor fix the gas march-help.l testcase
Nelson Chu [Fri, 26 Jun 2026 05:01:20 +0000 (13:01 +0800)] 
RISC-V: Minor fix the gas march-help.l testcase

10 days agoMAINTAINERS: Update my email address
Nelson Chu [Fri, 26 Jun 2026 04:56:33 +0000 (12:56 +0800)] 
MAINTAINERS: Update my email address

10 days agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Jun 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 days agogdb: fix indentation in dwarf2/expr.c
Simon Marchi [Thu, 25 Jun 2026 16:42:13 +0000 (12:42 -0400)] 
gdb: fix indentation in dwarf2/expr.c

Fix some mis-indented lines, pointed out in a review.

Change-Id: I523f461881dab4b23e59efa76914b1d5ce8cc817

11 days agowindows gdb: Fix -target-attach result
Claudiu Zissulescu [Fri, 12 Jun 2026 09:25:40 +0000 (04:25 -0500)] 
windows gdb: Fix -target-attach result

This patch fixes a Windows issue with "-target-attach <pid>", where
"running" is emitted instead of "done". The "done" message should be
synchronous for "-target-attach", but "mi_proceeded" variable is
incorrectly set to "1" when clear_proceed_status(0, true) is
called. As a result, "mi_interp::on_about_to_proceed" sets mi_proceed
to 1, and later "mi_interp::on_resume" emits "running" instead of
"done".

Remove redundant clear_proceed_status(0) call (the notify argument is
set to true by default). The init_wait_for_inferior(), which runs on
the very next line, already calls clear_proceed_status (0, false). A
new test is added too.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@amd.com>
Approved-By: Pedro Alves <pedro@palves.net>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 days agoAVR: Fix GNU coding style.
Georg-Johann Lay [Thu, 25 Jun 2026 11:23:19 +0000 (13:23 +0200)] 
AVR: Fix GNU coding style.

This patch uses TABs for indentation in all places instead of blanks.

gas/
* config/tc-avr.c: Fix indentations to follow GNU style.
* config/tc-avr.h: Same.

11 days agogas/ELF: Allow local symbol with non-protected visibility
H.J. Lu [Wed, 24 Jun 2026 00:09:56 +0000 (08:09 +0800)] 
gas/ELF: Allow local symbol with non-protected visibility

In the source code extracted from glibc:

extern void _dl_sysinfo_int80 (void)
  __attribute__ ((visibility ("hidden")));

asm (".text\n\t"
     ".type _dl_sysinfo_int80,@function\n"
     "_dl_sysinfo_int80:\n\t"
     "int $0x80;\n\t"
     "ret");

uintptr_t
foo ()
{
  return (uintptr_t) _dl_sysinfo_int80;
}

_dl_sysinfo_int80 is a local function, but it is defined in an asm
statement.  Since it is referenced in C, it is declared as hidden,
which leads to an assembler warning:

Warning: local symbol `_dl_sysinfo_int80' has non-default visibility

Symbol binding and visiblity are orthogonal.  One is for link-editing,
the other for runtime linking.  In principle, all combinations are "okay"
(if questionable), and have obvious implementations.  But it's only that
specific combination STB_LOCAL+STV_PROTECTED that is explicitely made
ill-formed in the spec (despite it being also obviously implementable).
Warning on that combination can be done on the grounds of following the
spec.  But no other combination is so spelled out, so there's no basis
for trying to disallow them.

Partially revert:

commit c4150acbda1b3ce0602f79cbb7700b39e577be7e
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri May 8 11:45:04 2026 +0200

    gas/ELF: warn upon non-default visibility of local symbols

and update elf_adjust_symtab to only warn local symbol with protected
visibility.

binutils/

PR gas/34312
* testsuite/binutils-all/localize-hidden-1.l: Adjusted.
* testsuite/binutils-all/nm-ver.s: Revert commit c4150acbda1.

gas/

PR gas/34312
* config/obj-elf.c (elf_adjust_symtab): Allow local symbol with
non-protected visibility.
* testsuite/gas/elf/visibility.l: Adjusted.
* testsuite/gas/i386/tlsnopic.s: Revert commit c4150acbda1.

ld/

PR gas/34312
* testsuite/ld-aarch64/ifunc-21.s: Revert commit c4150acbda1.
* testsuite/ld-aarch64/ifunc-21.s: Likewise.
* testsuite/ld-tic6x/shlib-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-1.s: Likewise.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.dd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.dd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.dd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.dd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
11 days agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Jun 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

12 days agoRISC-V: Add support for Smpmpmt v0.6 extension
Jerry Zhang Jian [Wed, 24 Jun 2026 14:49:11 +0000 (08:49 -0600)] 
RISC-V: Add support for Smpmpmt v0.6 extension

This implements the Smpmpmt (PMP-based Memory Types) extension,
version 1.0[1].

The Smpmpmt extension provides a mechanism to control memory
attributes at the granularity of PMP regions, analogous to Svpbmt
but associated with PMP registers rather than page-table entries.

The extension is currently in frozen state[2].

[1] https://github.com/riscv/riscv-isa-manual/blob/smpmpmt/src/smpmpmt.adoc
[2] https://riscv.atlassian.net/browse/RVS-2948

[JL] Since this patch was originally posted, the spec has moved to v1.0.  I've
adjusted the patch & ChangeLog accordingly.

bfd/ChangeLog:

* elfxx-riscv.c: Add Smpmpmt v1.6 extension.

gas/ChangeLog:

* NEWS: Updated.
* testsuite/gas/riscv/march-help.l: Ditto.

Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
12 days agogdbsupport: Remove some use after move instances
Guinevere Larsen [Tue, 23 Jun 2026 20:15:36 +0000 (17:15 -0300)] 
gdbsupport: Remove some use after move instances

We ran the Coverity static analysis tool on GDB and it pointed out some
instances of "use after move" in GDB. The instances that could be easily
removed are related to move constructors for exceptions, that were using
the parameter's reason in an assert, when they could instead just use
their own internal "reason" member. One such example is the following:

Error: USE_AFTER_MOVE (CWE-457):
gdb-17.1/gdbsupport/common-exceptions.h:281:7: move: "ex" is moved (indicated by "std::move(ex)").
gdb-17.1/gdbsupport/common-exceptions.h:283:5: use_after_move: "ex" is used after it has been already moved.
 #  281|       : gdb_exception (std::move (ex))
 #  282|     {
 #  283|->     gdb_assert (ex.reason == RETURN_ERROR);
 #  284|     }
 #  285|   };

This patch fixes that small oversight.

Approved-By: Simon Marchi <simon.marchi@efficios.com>