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.
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.
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.
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)
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)
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].
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.
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.
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.
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.
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
...
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.
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.
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>
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.
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.
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>
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.
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)
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>
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>
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.
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+."
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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>
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.
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).
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);
| ~~ ^
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.
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>
_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.
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.
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>