]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
8 days agoaarch64: s390: x86_64: sframe: adjust flex fde hook implementation
Indu Bhagat [Tue, 20 Jan 2026 18:25:49 +0000 (10:25 -0800)] 
aarch64: s390: x86_64: sframe: adjust flex fde hook implementation

A previous commit added new backend hook sframe_support_flex_fde_p by
defining a new function for each backend that supports SFrame stack
trace format:

  commit 2f9b3987db53d7e0606f89bfe2527dd3d0915568
  [SFrame-V3] gas: sframe: add new backend hook
  sframe_support_flex_fde_p for FLEX FDEs

As pointed out in a review comment, simply providing the definition to
use true/false (as applicable) is sufficient for the purpose, and helps
generate better code.  So do that.
https://inbox.sourceware.org/binutils/80404871-53b4-4f5c-9d86-7a3a4d0a920e@suse.com/

ChangeLog:
* gas/config/tc-aarch64.c (aarch64_support_flex_fde_p): Remove.
* gas/config/tc-aarch64.h (aarch64_support_flex_fde_p): Remove.
(sframe_support_flex_fde_p): Define to false.
* gas/config/tc-i386.c (x86_support_flex_fde_p): Remove.
* gas/config/tc-i386.h (x86_support_flex_fde_p): Remove.
(sframe_support_flex_fde_p): Define to true.
* gas/config/tc-s390.c (s390_support_flex_fde_p): Remove.
* gas/config/tc-s390.h (s390_support_flex_fde_p): Remove.
(sframe_support_flex_fde_p): Define to true.

8 days agoRemove angle brackets from "apropos" text
Tom Tromey [Thu, 8 Jan 2026 15:12:10 +0000 (08:12 -0700)] 
Remove angle brackets from "apropos" text

I didn't notice during review, but the boxing patch introduced this
change:

-       styled_string (command_style.style (), "apropos word"));
+       styled_string (command_style.style (), "apropos <word>"));

GNU doesn't generally use the "<...>" convention, but instead uses
upper case for "metasyntactic variables".  See the GNU coding
standards for this topic.

In this particular spot, though, I think the old form using quotes is
preferable.  This patch reverts this change.

Reviewed-By: Tom de Vries <tdevries@suse.de>
8 days agohppa64: Fallback to .text if .dynamic isn't found
John David Anglin [Wed, 21 Jan 2026 18:48:40 +0000 (13:48 -0500)] 
hppa64: Fallback to .text if .dynamic isn't found

Commit a1c2fa92ac93bf50227941bd82094e6997c5fd56 broke the ld
testcase for .note.GNU-stack wanting to be SHT_NOTE.  Fix this
by falling back to .text if .dynamic isn't available to define
the text segment base.

2026-01-21  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* elf64-hppa.c (elf64_hppa_late_size_sections): Fallback
to .text if .dynamic section isn't found.

8 days ago[gdb] Ignore .sframe section in dtrace_static_probe_ops::get_probes
Tom de Vries [Wed, 21 Jan 2026 15:43:07 +0000 (16:43 +0100)] 
[gdb] Ignore .sframe section in dtrace_static_probe_ops::get_probes

On aarch64-linux (Debian testing), with test-case gdb.base/fission-macro.exp I
run into:
...
(gdb) set complaints 5^M
(gdb) file fission-macro-v4-b32-s0^M
Reading symbols from fission-macro-v4-b32-s0...^M
During symbol reading: \
  skipping section '.sframe' which does not contain valid DOF data.^M
(gdb) FAIL: $exp: lang=c: dwarf_version=4: dwarf_bits=32: strict_dwarf=0: \
  No complaints
...

The problem is that there's an overlap between:
...
./include/elf/common.h:#define SHT_SUNW_dof                 0x6ffffff4
...
and:
...
./include/elf/common.h:#define SHT_GNU_SFRAME      0x6ffffff4
...

So when dtrace_static_probe_ops::get_probes tries reading an SHT_SUNW_dof
section, it fails to read the corresponding magic number and bails with this
complaint:
...
During symbol reading: \
  skipping section '.sframe' which does not contain valid DOF data.^M
...

But the section actually being read is not an SHT_SUNW_dof section, but an
SHT_GNU_SFRAME section:
...
[Nr] Name      Type            Address          Off    Size   ES Flg Lk Inf Al
[17] .sframe   GNU_SFRAME      00000000000008f0 0008f0 000035 00   A  0   0  8
...

Fix this by checking for the section name .sframe in
dtrace_static_probe_ops::get_probes.

Tested on aarch64-linux.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33813

8 days agoreadelf: constify read cursor for all object attribute parsing and display helpers
Matthieu Longo [Mon, 19 Jan 2026 16:41:39 +0000 (16:41 +0000)] 
readelf: constify read cursor for all object attribute parsing and display helpers

8 days agoaarch64: fix build issue raised by -Werror=maybe-uninitialized
Matthieu Longo [Wed, 21 Jan 2026 14:43:41 +0000 (14:43 +0000)] 
aarch64: fix build issue raised by -Werror=maybe-uninitialized

8 days agodwarf: constify read_leb128()'s first parameter
Jan Beulich [Wed, 21 Jan 2026 13:45:35 +0000 (14:45 +0100)] 
dwarf: constify read_leb128()'s first parameter

It's not clear why the 2nd one is, but the 1st one isn't.

8 days agoopcodes: Fix BMASKI disassembly for immediate 32 on M*Core
Michal Sobon [Wed, 21 Jan 2026 13:45:05 +0000 (14:45 +0100)] 
opcodes: Fix BMASKI disassembly for immediate 32 on M*Core

The BMASKI instruction has three encoding variants (OMa, OMb, OMc).
The OMa encoding (0x2C00, mask 0xFFF0) specifically represents
BMASKI with immediate 32, encoded as IMM5=0.

Per Motorola M*Core specification: "An IMM5 value of 0 is interpreted
as a value of 32."

Previously, all three variants extracted the immediate the same way,
causing OMa to incorrectly display 0 instead of 32.

Before: 0x2c04 -> bmaski r4, 0
After:  0x2c04 -> bmaski r4, 32

opcodes/
* mcore-dis.c (print_insn_mcore): Handle OMa encoding to display
immediate 32 instead of 0 for BMASKI.

gas/testsuite/
* gas/mcore/allinsn.s: Add test for bmaski with immediate 32.
Replace two clrc padding instructions with one for 4-byte alignment.
Fix missing newline at end of file.
* gas/mcore/allinsn.d: Update expected output.

Signed-off-by: Michal Sobon <msobon@hex-rays.com>
8 days agoaarch64: Add bigobj support to AArch64 COFF
Evgeny Karpov [Wed, 21 Jan 2026 13:44:44 +0000 (14:44 +0100)] 
aarch64: Add bigobj support to AArch64 COFF

During Boost library testing on aarch64-w64-mingw32, it appeared that 2^16
sections are not enough. It can be handled by using the bigobj format to extend
the total amount of sections to 2^32. This patch adds bigobj support to
AArch64 COFF in a similar way to how it is done for x86_64.

Co-authored-by: Martin Vejbora <mvejbora@microsoft.com>
Signed-off-by: Evgeny Karpov <evgeny@kmaps.co>
8 days agold: testcase for .note.GNU-stack wanting to be SHT_NOTE
Jan Beulich [Wed, 21 Jan 2026 13:43:54 +0000 (14:43 +0100)] 
ld: testcase for .note.GNU-stack wanting to be SHT_NOTE

If --noexecstack is removed and instead of empty.s a source file is used
which explicitly creates a @progbits .note.GNU-stack, the test fails (for
the absence of a NOTE segment).

8 days agoamend "ELF: give .note.GNU-stack proper section type"
H.J. Lu [Wed, 21 Jan 2026 13:43:06 +0000 (14:43 +0100)] 
amend "ELF: give .note.GNU-stack proper section type"

PR ld/33780
Correct the section's special_sections[] entry as well, and further
constrain ld's setting of the section type.

8 days agoreadelf: don't (silently) fail on empty SHT_NOTE sections
Jan Beulich [Wed, 21 Jan 2026 13:42:39 +0000 (14:42 +0100)] 
readelf: don't (silently) fail on empty SHT_NOTE sections

Them containing no entries is not an error. Such sections simply have
nothing to dump. (Exiting with non-zero status but no error message isn't
quite appropriate anyway.)

9 days agoaarch64: silence GCS warnings on shared libraries for -z gcs=implicit
Matthieu Longo [Thu, 4 Dec 2025 15:50:30 +0000 (15:50 +0000)] 
aarch64: silence GCS warnings on shared libraries for -z gcs=implicit

Dynamic library incompatibilities should not be reported when no GCS
option is provided (defaults to '-z gcs=implicit') and no explicit
diagnostic is provided via '-z gcs-report-dynamic'.

Binary Linux distributions do not rebuild all packages from scratch
when rolling out a new feature or creating a new release; only
modified packages get rebuilt. In the context of GCS deployment, this
meant that some packages were rebuilt with GCS enabled while their
dependencies were not yet GCS-compatible, resulting in warnings. These
warnings caused build failures for packages that treat linker warnings
as errors. Those errors slowed down the GCS deployment, and Linux
distribution maintainers requested that no GCS option provided should
be equivalent to '-z gcs=implicit -z gcs-report-dynamic=none'.

In contrast, '-z gcs=always' should continue to report such issues by
default. Warnings can still be disabled or promoted to errors by
explicitly setting '-z gcs-report-dynamic' to respectively 'none' or
'error'.

This patch preserves the existing behaviour for '-z gcs=never', changes
the default behaviour of '-z gcs=implicit' or no GCS option, and removed
the inheritance mechanism between '-z gcs-report' and '-z gcs-report-dynamics'.
The expected behaviour with the different possible combinations is as
follows:
* -z gcs=never:
  No diagnostic messages are emitted.
* -z gcs=implicit:
  No diagnostic messages are emitted for input static objects.
  However, if all the input static objects are marked for GCS, the
  output object will also be marked for GCS.
  In this case the output is marked with GCS, '-z gcs-report-dynamic'
  defaults to 'none' and no diagnostics are emitted. Diagnostics can
  be enabled by explicitly providing the option.
* -z gcs=always:
  Warning diagnostics for both static and dynamic input objects are
  enabled by default. The two options are independent of one another,
  and the diagnostic level can be adjusted for each by explicitly
  providing the desired level to '-z gcs-report-dynamic' and '-z
  gcs-report'.

The patch also updates the existing tests, removes redundant test cases,
and adds new tests covering cases with no report option provided, or
report options explicitly set.

9 days agos390 gas cfi-regnames test
Alan Modra [Wed, 21 Jan 2026 11:42:51 +0000 (22:12 +1030)] 
s390 gas cfi-regnames test

Fix failure on 32-bit s390-linux where addresses are shown with eight
fewer leading zeros, and the CIE is smaller.

9 days agosframe: Use UNRESOLVED instead of FAIL
Claudiu Zissulescu [Thu, 15 Jan 2026 13:26:56 +0000 (15:26 +0200)] 
sframe: Use UNRESOLVED instead of FAIL

Fix for PR ld/33784.

The SFrame test for PR ld/33401 is a two-step link test where the
second link depends on the output of the first. In the first step, the
linker process generates R_*_NONE relocs for .sframe section, while
the second link process should pass without any issue.

This patch reworks the PR ld/33401 test by removing the call to
run_cc_link_tests, and use individual command invocation for
compilation, assembling and linking. It introduces the UNRESOLVED
status if the first step contains a linking or assembling error. The
UNTESTED status is emitted if the first stage doesn't produce R_*_NONE
relocs in .sframe section to test the original issue.

ld/

PR ld/33784
* testsuite/ld-sframe/sframe.exp (check_pr33401): Rework the
procedure for UNRESOLVED and UNTESTED cases.
(check_dump): New procedure.
* testsuite/ld-sframe/pr33401.rd: Add extra line at the end of the
file.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agosframe: Add -nostdlib when testing PR 32789
Claudiu Zissulescu [Tue, 20 Jan 2026 14:49:11 +0000 (16:49 +0200)] 
sframe: Add -nostdlib when testing PR 32789

As a result of the mail exchange in
https://sourceware.org/pipermail/binutils/2026-January/147439.html,
the run_cc_link_test procedure may want to link standard libs
too. However, this is not required for running PR 32789 tests. Add
-nostdlib option.

ld/

* testsuite/ld-sframe/sframe.exp: Add nostdlib when testing PR
32789.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agolibsframe misaligned uint32_t
Alan Modra [Mon, 19 Jan 2026 22:13:25 +0000 (08:43 +1030)] 
libsframe misaligned uint32_t

I saw asan complaints about misaligned loads and stores when taking a
quick look at pr33810 before Jens' patch was applied.  They have
disappeared now, but it looks to me like a FRE can start on any
address boundary and there is no padding or suchlike to align the
FRE fields.

* sframe.c (flip_fre_stack_offsets): Let the compiler know
that integers may be misaligned.

9 days agotidy hppa64 XPASSes
Alan Modra [Wed, 21 Jan 2026 04:56:53 +0000 (15:26 +1030)] 
tidy hppa64 XPASSes

Remove a bunch of xfails that now result in XPASS.

9 days agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 days agovms-alpha store immediate repeated
Alan Modra [Tue, 20 Jan 2026 10:07:44 +0000 (20:37 +1030)] 
vms-alpha store immediate repeated

Speed up parsing of fuzzed object with ridiculous repeat counts,
particularly when the object will later fail alpha_vms_object_p for
some reason.

* vms-alpha.c (image_write_section): New function, extracted..
(image_write): ..from here.
(_bfd_vms_slurp_etir <ETIR__C_STO_IMMR>): Optimise sizing.

9 days agogas: sframe: fix inaccurate function-level comment
Indu Bhagat [Tue, 20 Jan 2026 22:07:10 +0000 (14:07 -0800)] 
gas: sframe: fix inaccurate function-level comment

gas/
* gen-sframe.c (sframe_xlate_do_register): Fix code comments.

9 days agogas: sframe: add code comment for rep block size
Indu Bhagat [Tue, 20 Jan 2026 21:45:14 +0000 (13:45 -0800)] 
gas: sframe: add code comment for rep block size

9 days agogdb/dwarf: add unit_lists structure to index writer
Simon Marchi [Sat, 17 Jan 2026 06:02:35 +0000 (01:02 -0500)] 
gdb/dwarf: add unit_lists structure to index writer

I think it makes the code more readable than the pair of vector.  Also,
I'm considering adding a third list (foreigh type units), which will be
easier with the structure.

Change-Id: I38ec4ddf8f786a2ba10c5b371cfe04c2baaa7da9
Approved-By: Tom Tromey <tom@tromey.com>
9 days agogdb/dwarf: rename some abbrev-related things in debug_names writer
Simon Marchi [Sat, 17 Jan 2026 06:02:34 +0000 (01:02 -0500)] 
gdb/dwarf: rename some abbrev-related things in debug_names writer

I think it would be clearer for some of these things to be called
"abbrev", rather than "idx".

Change-Id: Ic128a77dc7ce14a6179c049a2de21f3f9636405d
Approved-By: Tom Tromey <tom@tromey.com>
9 days agogdb/dwarf: add comments to debug_names::build
Simon Marchi [Sat, 17 Jan 2026 06:02:33 +0000 (01:02 -0500)] 
gdb/dwarf: add comments to debug_names::build

These help me follow what is going on, when following with the spec on
the side.

Change-Id: I0da0047eefd233e8f7635118d67622f07c29ce01
Approved-By: Tom Tromey <tom@tromey.com>
9 days agogdb/dwarf: move DWP htab nullptr check to lookup_dwo_unit_in_dwp
Simon Marchi [Sat, 17 Jan 2026 06:02:32 +0000 (01:02 -0500)] 
gdb/dwarf: move DWP htab nullptr check to lookup_dwo_unit_in_dwp

cutu_reader::lookup_dwo_cutu gets hold of the right htab for the kind of
unit to look up (CU or TU), but then just uses the pointer to know if it
should call lookup_dwo_unit_in_dwp or not.  lookup_dwo_unit_in_dwp then
uses the same condition to obtain the correct htab.  I think it would
make more sense to return early from lookup_dwo_unit_in_dwp instead, if
the required htab does not exist.

Change-Id: I6f8f96aba2452f8261b3c60667e72fb21b97c89d
Approved-By: Tom Tromey <tom@tromey.com>
9 days agogdb/dwarf: merge one CU/TU code path
Simon Marchi [Sat, 17 Jan 2026 06:02:31 +0000 (01:02 -0500)] 
gdb/dwarf: merge one CU/TU code path

Simplify the code by merging the paths for CUs and TUs.  It is also not
necessary to check if the maps are empty.

Change-Id: I43e2cf4bb1217a72dda8a03957ed733f87bf57b2
Approved-By: Tom Tromey <tom@tromey.com>
9 days agogdb: fail for 'maint print frame-id LEVEL' of an invalid frame
Andrew Burgess [Tue, 20 Jan 2026 15:08:38 +0000 (15:08 +0000)] 
gdb: fail for 'maint print frame-id LEVEL' of an invalid frame

I noticed that 'maint print frame-id LEVEL' will always print a
frame-id, just not always for LEVEL, for example:

  (gdb) bt
  #0  woof () at stack.c:4
  #1  0x000000000040111f in bar () at stack.c:10
  #2  0x000000000040112f in foo () at stack.c:16
  #3  0x000000000040113f in main () at stack.c:22
  (gdb) maintenance print frame-id 4
  frame-id for frame #3: {stack=0x7fffffffa640,code=0x0000000000401131,!special}
  (gdb)

Notice that the request was for the frame-id of #4, which doesn't
exist, but what I got was the frame-id for #3.

Fix this by adding a check to maintenance_print_frame_id (frame.c), so
the new behaviour is:

  (gdb) maintenance print frame-id 4
  No frame at level 4.
  (gdb)

This matches the behaviour of the 'frame' command:

  (gdb) frame 4
  No frame at level 4.
  (gdb)

I've added a new test to cover this case.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agohppa64: Improve relocation handling for local symbols and add gc_section support
John David Anglin [Tue, 20 Jan 2026 19:27:49 +0000 (14:27 -0500)] 
hppa64: Improve relocation handling for local symbols and add gc_section support

With this patch, gcc-16 can be built and there are significant
improvements in test results.  I spent a lot of time trying to
fix the EH exception support.  While there are still issues with
handling relocations in linkonce sessions, exception handling
mostly works if pc-relative and text relative encoding is used
in .eh_frame.  The main problems are the HP-UX dynamic linker
relocates the text and data segements indpendently, and it does
not support unaligned dynamic relocations.

Due to a configure bug in libstdc++-v3, the lack of gc_section
support caused many test failures, so I added the gc_section
support form elf32-hppa.c.

I also move the HP_LOAD_MAP scratchpad to the end of the .bss
section and fixed a number of issues with the linker scripts.

2026-01-20  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* elf64-hppa.c (elf64_hppa_check_relocs): Drop NEED_PLT
from R_PARISC_LTOFF_FPTR relocations.  Revise R_PARISC_FPTR64
relocation to use maybe_dynamic.  Add support for
R_PARISC_GNU_VTINHERIT and R_PARISC_GNU_VTENTRY relocations.
Add code to handle dynamic relocations of local symbols.
(elf64_hppa_gc_mark_hook): New.
(ensure_undef_dynamic): New.
(allocate_dynrel_entries): Revise checks to determine when
to discard relocs.
(elf64_hppa_late_size_sections): Revise allocation of local
PLT, DLT and OPD entries.
(elf64_hppa_finalize_opd): Remove assert.
(elf64_hppa_finalize_dlt): Change type of dynindx to long.
(elf64_hppa_finalize_dynreloc): Likewise.  Add check for
discarded sections.  Correct handling of  R_PARISC_FPTR64
relocation.  Remove assert.  Add new assert to check that
we don't allocate more relocs in .rela.data than it can
hold.
(elf64_hppa_finish_dynamic_sections): Move allocation for
DT_HP_LOAD_MAP to end of .bss section.  Only allocate on
HP-UX.
(elf_hppa_dlt_dynrel_reloc): Add dynrel_type argument.
Change type of dynindx.  Drop use of value.  Remove assert.
(elf_hppa_opd_dynrel_relocs): Rename to elf_hppa_opd_eplt_reloc.
Drop code to to emit R_PARISC_FPTR64 relocation.
(elf_hppa_opd_fptr_reloc): New.
(elf_hppa_final_link_relocate): Add SYM arguement.  Move
check for SEC_DEBUGGING.  Rework DLT, LTOFF, FPTR and DIR64
relocation handling.
(elf64_hppa_relocate_section): Add asserts to ensure symbol
isn't undefined and input_section hasn't been discarded.
(elf_backend_gc_mark_hook): Define.
(elf_backend_can_gc_sections): Define.

ld/ChangeLog:

* emulparams/elf64hppa.sh (DATA_ADDR): Revise value to match
HP-UX 11 value.
(SHLIB_DATA_ADDR): Likewise.
(NOP): Define.
(OTHER_READONLY_SECTIONS): Add .data.rel, .HP.init, .preinit,
.init and .fini sections to list.
(__SYSTEM_ID_D, __TLS_SIZE_D, __FPU_REVISION, __FPU_MODEL,
__CPU_REVISION, __CPU_KEYBITS_1, __LOAD_INFO, __ARGC, __ARGV,
__ENVP, __libdl_jmp_tbl, __systab): Provide.
(DATA_START_SYMBOLS, OTHER_SYMBOLS, INIT_START): Delete.
(PREINIT_START, PREINIT_END, INIT_START): Define.
emulparams/hppa64linux.sh (NOP): Define.
(DATA_START_SYMBOLS): Delete.
scripttempl/elf64hppa.sc: Delete .init and .fini sections
from script.  Allocate 16 bytes at end of .bss for HP_LOAD_MAP.

9 days agoMove puts_tabular to obj-lang.c
Tom Tromey [Thu, 8 Jan 2026 15:03:33 +0000 (08:03 -0700)] 
Move puts_tabular to obj-lang.c

Only objc-lang.c uses puts_tabular.  This patch moves the function
there and makes it 'static'.  It is also updated not to depend on the
global (but private to utils.c) chars_printed, and not to call
begin_line.

Reviewed-By: Keith Seitz <keiths@redhat.com>
9 days agoUse n_spaces in puts_tabular
Tom Tromey [Thu, 8 Jan 2026 14:58:58 +0000 (07:58 -0700)] 
Use n_spaces in puts_tabular

This changes puts_tabular to use n_spaces rather than alloca.

Reviewed-By: Keith Seitz <keiths@redhat.com>
9 days agoRemove right justification from puts_tabular
Tom Tromey [Thu, 8 Jan 2026 14:52:34 +0000 (07:52 -0700)] 
Remove right justification from puts_tabular

No caller of puts_tabular uses the right-justified feature, so remove
it.

Reviewed-By: Keith Seitz <keiths@redhat.com>
9 days agoConstify puts_tabular
Tom Tromey [Thu, 8 Jan 2026 14:51:46 +0000 (07:51 -0700)] 
Constify puts_tabular

This changes puts_tabular to accept a 'const char *'.

Reviewed-By: Keith Seitz <keiths@redhat.com>
9 days agoChange is_import_fixup_symbol to return bool
Tom Tromey [Fri, 16 Jan 2026 18:28:30 +0000 (11:28 -0700)] 
Change is_import_fixup_symbol to return bool

This changes the is_import_fixup_symbol in coffread.c to return bool
rather than int.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoRemove all globals from coffread.c
Tom Tromey [Fri, 16 Jan 2026 18:27:46 +0000 (11:27 -0700)] 
Remove all globals from coffread.c

This patch changes coffread.c to add a reader object type.  All
globals are moved into this type, and the majority of functions in
coffread.c are changed to be methods.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoRemove coff_symfile_init
Tom Tromey [Fri, 16 Jan 2026 18:19:31 +0000 (11:19 -0700)] 
Remove coff_symfile_init

coff_symfile_init is an empty function, and rather than give it a
name, just use a lambda in coff_sym_fns.

I've occasionally considered adding a do_nothing template function for
all our empty function needs, but still haven't bothered.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoUse coffread_objfile throughout coffread.c
Tom Tromey [Fri, 16 Jan 2026 18:18:20 +0000 (11:18 -0700)] 
Use coffread_objfile throughout coffread.c

coffread.c:coff_symtab_read sets a global objfile while working.  It
seemed nicer to me to hoist this so that it is set by the main entry
point, and then used throughout the file.

Normally I wouldn't encourage the use of globals, but shortly we'll be
replacing these with an object.

Note that while coff_symtab_read cleared coffread_objfile when it was
finished, I haven't preserved this in the new patch.  First, this
should have been done with a scoped_restore.  Second, this is the only
global to get this treatment.  Third, it's not necessary at all.  And,
finally, this will be moot anyway when the globals are removed.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoUse symfile_bfd in more places
Tom Tromey [Fri, 16 Jan 2026 18:14:15 +0000 (11:14 -0700)] 
Use symfile_bfd in more places

Since coffread.c is setting symfile_bfd, it might as well use it
everywhere.  This changes all other BFD references in coffread.c to
use the global.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoRemove redundant nlist_bfd_global
Tom Tromey [Fri, 16 Jan 2026 18:08:58 +0000 (11:08 -0700)] 
Remove redundant nlist_bfd_global

coffread.c has two BFD globals: nlist_bfd_global and symfile_bfd.
There's no need for both, and since symfile_bfd is set early (in
coff_symfile_read, the entry point), this removes nlist_bfd_global and
replaces all the uses.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoChange coffread.c:pe_file to bool
Tom Tromey [Fri, 16 Jan 2026 18:07:05 +0000 (11:07 -0700)] 
Change coffread.c:pe_file to bool

This changes coffread.c:pe_file to use bool.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoFix indentation in coffread.c
Tom Tromey [Fri, 16 Jan 2026 18:03:54 +0000 (11:03 -0700)] 
Fix indentation in coffread.c

A couple of spots in coffread.c were indented incorrectly.  This also
fixes the placement of a comment in coff_symbol.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoClean up a comment in coffread.c
Tom Tromey [Fri, 16 Jan 2026 18:01:23 +0000 (11:01 -0700)] 
Clean up a comment in coffread.c

This comment in coffread.c refers to some things that are no longer
used.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoConstify coffread.c:getsymname
Tom Tromey [Fri, 16 Jan 2026 17:59:08 +0000 (10:59 -0700)] 
Constify coffread.c:getsymname

I noticed that the symbol name in coffread.c can be const.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
9 days agoBFD: Remove extraneous BFD struct member setup from `bfd_make_readable'
Maciej W. Rozycki [Tue, 20 Jan 2026 15:29:15 +0000 (15:29 +0000)] 
BFD: Remove extraneous BFD struct member setup from `bfd_make_readable'

Complementing commit 3097045a18a8 ("ld plugin bfd_make_readable leak")
remove assignments to BFD struct members from `bfd_make_readable' that
now duplicate ones unconditionally made by `_bfd_free_cached_info'
called earlier on.

9 days agoBFD: Remove null pointer checks for `bfd_hash_table_free' calls
Maciej W. Rozycki [Tue, 20 Jan 2026 15:29:15 +0000 (15:29 +0000)] 
BFD: Remove null pointer checks for `bfd_hash_table_free' calls

Given that as from commit 90e5645309be ("libiberty: Make `objalloc_free'
`free'-like WRT null pointer") `bfd_hash_table_free' now returns with no
action taken when called for a hash table with no allocation present,
remove null pointer checks guarding invocations.

10 days agos390: gas: Remove support for register names "ap" and "cc" in CFI directives
Jens Remus [Tue, 20 Jan 2026 09:33:56 +0000 (10:33 +0100)] 
s390: gas: Remove support for register names "ap" and "cc" in CFI directives

The assembler erroneously converted the special register names "ap" and
"cc" to the DWARF register numbers 32 and 33 respectively, which are
actually assigned to the control registers c0 and c1 according to both
the s390 32-bit (s390) ELF ABI [1] and s390 64-bit (s390x) ELF ABI [2].

Register numbers 32 and 33 are used internally by GCC as "argument
pointer" (ap) and "condition code" (cc).  Very early GCC versions leaked
this out into DWARF.  However, those GCC-internal special register names
should never be actually used in CFI, especially given their resulting
DWARF register numbers have a different meaning in DWARF (CFI).

[1]: s390 ELF ABI, section "DWARF definition",
     https://refspecs.linuxbase.org/ELF/zSeries/lzsabi0_s390.html
[2]: s390x ELF ABI, subsection "DWARF Register Numbers",
     https://github.com/IBM/s390x-abi/releases

gas/
* config/tc-s390.c (tc_s390_regname_to_dw2regnum): Remove
support for register names "ap" and "cc" in CFI directives.

Suggested-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
10 days agos390: gas: Support access register names in CFI directives
Jens Remus [Tue, 20 Jan 2026 09:33:56 +0000 (10:33 +0100)] 
s390: gas: Support access register names in CFI directives

Convert access register (AR) names a0-a15 to DWARF register numbers when
used in CFI directives.  Convert an access register number (0..15) to
its corresponding DWARF register number (48..63) as specified in the
s390 64-bit (s390x) ELF ABI [1] by adding 48.

[1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases

gas/
* config/tc-s390.c (tc_s390_regname_to_dw2regnum): Convert
access register names (a0..a15) to DWARF register numbers.

gas/testsuite/
* gas/s390/cfi-regnames.d: Add test for AR names in in CFI
directives.
* gas/s390/cfi-regnames.s: Likewise.
* gas/s390/cfi-regnames-err.l: Likewise.
* gas/s390/cfi-regnames-err.s: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
10 days agos390: gas: Support vector register names in CFI directives
Jens Remus [Tue, 20 Jan 2026 09:33:56 +0000 (10:33 +0100)] 
s390: gas: Support vector register names in CFI directives

Convert vector register names v0-v31 to DWARF register numbers when used
in CFI directives.  Convert a vector register number (0..31) to its
respective DWARF register number (16..31, 68..83) as specified in the
s390 64-bit (s390x) ELF ABI [1] as follows:
Right rotate the least significant three bits and add 16 for register
numbers 0..15 or 68 for register numbers 16..31.

Add a test case for the use of vector register (VR) names in CFI
directives.

[1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases

gas/
* config/tc-s390.c (tc_s390_regname_to_dw2regnum): Convert
vector register names (v0..v31) to DWARF register numbers.

gas/testsuite/
* gas/s390/cfi-regnames.d: Add test for VR names in in CFI
directives.
* gas/s390/cfi-regnames.s: Likewise.
* gas/s390/cfi-regnames-err.l: Likewise.
* gas/s390/cfi-regnames-err.s: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
10 days agos390: gas: Fix conversion of FP register names to DWARF register numbers
Jens Remus [Tue, 20 Jan 2026 09:33:55 +0000 (10:33 +0100)] 
s390: gas: Fix conversion of FP register names to DWARF register numbers

The assembler supports register names in CFI directives.  For floating-
point (FP) registers f0..f15 the register numbers 0..15 are erroneously
converted to DWARF register numbers 16..31 by adding 16.  This is wrong
as the s390 64-bit (s390x) ELF ABI [1] specifies the DWARF register
numbers for the FP registers as follows:

  DWARF               BINARY    BINARY DWARF
  REGISTER  REGISTER  REGISTER  REGISTER
  NUMBER    NAME      NUMBER    NUMBER
  16        f0        0b0000 -> 0b10000
  17        f2        0b0010 -> 0b10001
  18        f4        0b0100 -> 0b10010
  19        f6        0b0110 -> 0b10011
  20        f1        0b0001 -> 0b10100
  21        f3        0b0011 -> 0b10101
  22        f5        0b0101 -> 0b10110
  23        f7        0b0111 -> 0b10111
  24        f8        0b1000 -> 0b11000
  25        f10       0b1010 -> 0b11001
  26        f12       0b1100 -> 0b11010
  27        f14       0b1110 -> 0b11011
  28        f9        0b1001 -> 0b11100
  29        f11       0b1011 -> 0b11101
  30        f13       0b1101 -> 0b11110
  31        f15       0b1111 -> 0b11111

Convert a FP register number (0..15) to its respective DWARF register
number (16..31) as follows:
Right rotate the least significant three bits and add 16.

Add a test case for the use of general register (GR; r0..r15) and
floating-point register (FPR; f0..f15) names in CFI directives.

[1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases

gas/
* config/tc-s390.c (tc_s390_regname_to_dw2regnum): Fix
conversion of FP register names to DWARF register numbers.

gas/testsuite/
* gas/s390/s390.exp (cfi-regnames, cfi-regnames-err): Run new
tests.
* gas/s390/cfi-regnames.d: New test for GR and FPR names in CFI
directives.
* gas/s390/cfi-regnames.s: Likewise.
* gas/s390/cfi-regnames-err.l: Likewise.
* gas/s390/cfi-regnames-err.s: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
10 days agolibsframe: use proper FRE type when flipping SFrame V3 FREs
Jens Remus [Tue, 20 Jan 2026 09:22:52 +0000 (10:22 +0100)] 
libsframe: use proper FRE type when flipping SFrame V3 FREs

flip_sframe_fdes_with_fres_v3 was erroneously using a fixed FRE type
of 0 (= SFRAME_FRE_TYPE_ADDR1) when endianness byte-flipping the FREs,
regardless of the actual FRE type (i.e. ADDR1, ADDR2, or ADDR4).  This
only affected cross builds, where the .sframe section data may needed
to be endianness byte-flipped (e.g. binutils cross-built for s390
64-bit (s390x) on x86-64).

As a consequence objdump/readelf with option --sframe could fail to dump
e.g. s390 64-bit (s390x) .sframe section data on x86-64 with the
following error message:

  Error: SFrame decode failure: Buffer does not contain SFrame data.

The linker ld-sframe test "PR ld/33401 (Step 1: Create relocatable
object and check R_*_NONE)" cross-build for s390 64-bit (s390x) on
x86-64 could fail with ld error message:

  error in tmpdir/StatePlaying.o(.sframe); no .sframe will be created

The linker ld-sframe test "PR ld/33401 (Step 1: Create relocatable
object and check R_*_NONE)" cros-build for s390 64-bit (s390x) on
x86-64 could fail with BDF assertion:

  BFD (GNU Binutils) ... assertion fail .../bfd/elf-sframe.c:153

Add a common cfi-sframe assembler test, that forces a FDE type of
SFRAME_FRE_TYPE_ADDR2.  When the test is run cross-build it may
exercise the SFrame FDE and FDE endianness byte flipping.

libsframe/
PR ld/33810
* sframe.c (sframe_decode_fde_attr_v3): Decode and return FRE
type from FDE attributes.
(flip_sframe_fdes_with_fres_v3): Use proper FRE type from
FDE attributes when flipping FREs.

gas/testsuite/
PR ld/33810
* gas/cfi-sframe/cfi-sframe.exp (cfi-sframe-common-pr33810): Run
new test.
* gas/cfi-sframe/cfi-sframe-common-pr33810.d: New test.
* gas/cfi-sframe/cfi-sframe-common-pr33810.s: Likewise.

Bug: https://sourceware.org/pr33810
Fixes: 8ab6e4c72ab6 ("[SFrame-V3] include: gas: libsframe: split FDE into idx and attr")
Reported-by: Alan Modra <amodra@gmail.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
10 days ago[gdb] Add regression test for PR symtab/33777
Tom de Vries [Tue, 20 Jan 2026 08:06:20 +0000 (09:06 +0100)] 
[gdb] Add regression test for PR symtab/33777

PR symtab/33777 reports a problem where toplevel DIEs of partial units are
read many times.

The problem manifest as a timeout when building gdb with -O0 and Asan, and
running test-case gdb.base/tls-dlobj.exp with glibc debuginfo installed.

Reproduce the problem in a simpler and quicker way, without relying on glibc
debuginfo:
- build an executable with 100 partial units
- run info line "$file:$line" a 100 times
- add a line to "maint print statistics" that tells us how many time a
  toplevel DIE is read.

Without the fix we have:
...
   Number of read units: 1
   Number of unread units: 108
   Number of read top-level DIEs: 10118
...
and with the fix we have:
...
   Number of read units: 1
   Number of unread units: 108
   Number of read top-level DIEs: 218
...

Detect the problem by asserting:
...
gdb_assert { $top_level_die <= 3 * ( $read_cu + $unread_cu ) }
...

The factor 3 is used because for some target boards $top_level_die is slightly
more than 2 * ( $read_cu + $unread_cu ).

Tested on x86_64-linux.

10 days agoRemove "value chain" from symbol
Tom Tromey [Sun, 18 Jan 2026 19:03:47 +0000 (12:03 -0700)] 
Remove "value chain" from symbol

The "value chain" code in struct symbol is no longer used and so it
can be removed.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 days agoInline add_symbol_to_list
Tom Tromey [Sun, 18 Jan 2026 18:22:45 +0000 (11:22 -0700)] 
Inline add_symbol_to_list

add_symbol_to_list is just a simple wrapper for push_back, so we might
as well inline it.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 days agoRemove "alias" hack from add_symbol_to_list
Tom Tromey [Sun, 18 Jan 2026 17:42:34 +0000 (10:42 -0700)] 
Remove "alias" hack from add_symbol_to_list

add_symbol_to_list has this code:

  /* If this is an alias for another symbol, don't add it.  */
  if (symbol->linkage_name () && symbol->linkage_name ()[0] == '#')
    return;

This appears to be an old stabs hack.  In the stabs removal patch
(commit eaea19f98d8) we see:

-  /* '#' is a GNU C extension to allow one symbol to refer to another
-     related symbol.
-
-     Generally this is used so that an alias can refer to its main
-     symbol.  */

This is a classic example of an old style problem that gdb had:
sometimes hacks were added to the gdb core to work around problems in
symbol readers -- IMO this kind of thing should have always been
handled by the stabs reader itself, not add_symbol_to_list.

Anyway, this is obsolete now and this patch removes it.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 days agoRemove buildsym_compunit::free_pending
Tom Tromey [Sun, 18 Jan 2026 17:37:46 +0000 (10:37 -0700)] 
Remove buildsym_compunit::free_pending

buildsym_compunit::free_pending is only called from a single spot in
buildsym.c, so let's inline it and remove the method.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 days agoRemove buildsym_compunit::release_macros
Tom Tromey [Sun, 18 Jan 2026 17:36:52 +0000 (10:36 -0700)] 
Remove buildsym_compunit::release_macros

buildsym_compunit::release_macros is only called from a single spot in
buildsym.c, so let's inline it and remove the method.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 days agoRemove unused methods from buildsym_compunit
Tom Tromey [Sun, 18 Jan 2026 17:26:02 +0000 (10:26 -0700)] 
Remove unused methods from buildsym_compunit

A few methods of buildsym_compunit are now unused and can be removed.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 days agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

10 days ago[gdb/symtab] Handle zero opcode_base in line number program header
Tom de Vries [Mon, 19 Jan 2026 18:14:11 +0000 (19:14 +0100)] 
[gdb/symtab] Handle zero opcode_base in line number program header

I build gdb with TSAN, and with test-case gdb.dwarf2/malformed-line-header.exp
ran into a heap-use-after-free:
...
(gdb) info line 1
==================
WARNING: ThreadSanitizer: heap-use-after-free (pid=897504)
  Write of size 1 at 0x72040000d000 by main thread:
    #0 dwarf_decode_line_header() gdb/dwarf2/line-header.c:356 (gdb+0xa0618c)
  ...

  Previous write of size 8 at 0x72040000d000 by main thread:
    #0 operator delete[](void*) <null> (libtsan.so.2+0xa6128)
    #1 std::enable_if<std::is_convertible<unsigned char (*) [], unsigned char (*) []>::value, void>::type std::default_delete<unsigned char []>::operator()<unsigned char>(unsigned char*) const /usr/include/c++/15/bits/unique_ptr.h:134 (gdb+0xa08479)
    #2 std::unique_ptr<unsigned char [], std::default_delete<unsigned char []> >::~unique_ptr() /usr/include/c++/15/bits/unique_ptr.h:685 (gdb+0xa07324)
    #3 line_header::~line_header() gdb/dwarf2/line-header.h:86 (gdb+0xa0914a)
    #4 std::default_delete<line_header>::operator()(line_header*) const /usr/include/c++/15/bits/unique_ptr.h:93 (gdb+0xa091a4)
    #5 std::unique_ptr<line_header, std::default_delete<line_header> >::~unique_ptr() /usr/include/c++/15/bits/unique_ptr.h:399 (gdb+0xa07f18)
    #6 dw2_get_file_names_reader gdb/dwarf2/read.c:1839 (gdb+0xa648ee)
 ...

  Location is heap block of size 0 at 0x72040000d000 allocated by main thread:
    #0 operator new[](unsigned long) <null> (libtsan.so.2+0xa6b01)
    #1 dwarf_decode_line_header() gdb/dwarf2/line-header.c:354 (gdb+0xa06159)
...

This is caused by allocating a zero-sized array (lh->opcode_base == 0), and
writing to it:
...
  lh->standard_opcode_lengths.reset (new unsigned char[lh->opcode_base]);

  lh->standard_opcode_lengths[0] = 1;  /* This should never be used anyway.  */
...

Fix this by skipping this code if lh->opcode_base == 0.

Tested on x86_64-linux.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 days agogdb/dwarf: remove unused includes from read-gdb-index.c
Simon Marchi [Thu, 15 Jan 2026 20:45:12 +0000 (15:45 -0500)] 
gdb/dwarf: remove unused includes from read-gdb-index.c

There are reported as unused by clangd.

Change-Id: I0e08e5d0eb5eab0fe67099c8fb1f47c827bdea3d

10 days agoRelease the data on the matching_objstack once it is no longer needed.
Nick Clifton [Mon, 19 Jan 2026 15:53:12 +0000 (15:53 +0000)] 
Release the data on the matching_objstack once it is no longer needed.

10 days agobfd: move elf_new_obj_attr to the BFD public API
Matthieu Longo [Fri, 28 Nov 2025 17:26:34 +0000 (17:26 +0000)] 
bfd: move elf_new_obj_attr to the BFD public API

11 days agox86: restrict recently added ifunc gas tests
Jan Beulich [Mon, 19 Jan 2026 09:42:47 +0000 (10:42 +0100)] 
x86: restrict recently added ifunc gas tests

These will fail on Solaris and other non-GNU targets.

11 days agoPPC: permit %dm0 as insn operand
Jan Beulich [Mon, 19 Jan 2026 09:42:25 +0000 (10:42 +0100)] 
PPC: permit %dm0 as insn operand

When the DM registers were added, sorting of the table was broken. With
the present arrangement, this leads to (only) %dm0 not being found by the
binary search that both use sites of the table entertain.

11 days agogdb/testsuite: fix FAILs in fileio.exp
Jan Vrany [Mon, 19 Jan 2026 08:58:41 +0000 (08:58 +0000)] 
gdb/testsuite: fix FAILs in fileio.exp

I'm experiencing intermittent FAILs in fileio.exp when running on (my)
CI:

    FAIL: gdb.base/fileio.exp: Open a file
    FAIL: gdb.base/fileio.exp: Creating already existing file returns EEXIST
    FAIL: gdb.base/fileio.exp: Open for write but no write permission returns EACCES
    FAIL: gdb.base/fileio.exp: Writing to a file
    ...

The problem turned out to be the way the OUTDIR gets defined in fileio.c.
The path is passed down "naked" and turned into string by STRINGIFY macro.

However, if the path happens to contain name of unrelated pre-existing
C macro, this macro gets expanded during the "stringification", resulting
in (likely) different path than used in fileio.exp and therefore causing
failures.

For example, if the GDB is compiled and tested in directory

    /var/lib/jenkins/workspace/binutils-gdb/build/x86_64-linux-gnu

then fileio.c is compiled with

   -DOUTDIR_=/var/lib/jenkins/workspace/binutils-gdb/build/x86_64-linux-gnu/gdb/testsuite/outputs/gdb.base/fileio

But because there's also C macro named "linux" defined to 1, the resulting
OUTDIR is actually:

   /var/lib/jenkins/workspace/binutils-gdb/build/x86_64-1-gnu/gdb/testsuite/outputs/gdb.base/fileio

This commit fixes this by defining the OUTDIR as string literal in first
place (similarly to how it was done prior commit cc91060) and updating
quote_for_host to handle strings that themselves contains quote (").

Tested on x86_64-linux by running all tests using quote_for_host with
both target board unix and host/target board local-remote-host-native.

Approved-By: Tom Tromey <tom@tromey.com>
11 days agoasan: vms-alpha buffer overflow
Alan Modra [Mon, 19 Jan 2026 04:22:24 +0000 (14:52 +1030)] 
asan: vms-alpha buffer overflow

* vms-alpha.c (_bfd_vms_slurp_etir): Sanity check ETIR__C_STO_IMM
size.  Use unsigned "size" to better catch ETIR__C_STO_IMMR errors.
Make cmd_length unsigned too, and avoid pointer overflow in
existing sanity check.

11 days agoasan: coff-alpha use of uninitialised value
Alan Modra [Mon, 19 Jan 2026 04:15:26 +0000 (14:45 +1030)] 
asan: coff-alpha use of uninitialised value

I think this is a false positive as the "use" is reported at a
_bfd_link_reloc_status_error call, and the value passed is not used
except when bfd_reloc_dangerous.  Avoid the warning anyway.

* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Avoid false positive warning.

11 days agoMIPS/opcodes: Fix floor/round exclusions for R5900
David Guillen Fandos [Mon, 19 Jan 2026 00:17:35 +0000 (00:17 +0000)] 
MIPS/opcodes: Fix floor/round exclusions for R5900

MIPS R5900 does not feature ceil/floor/round instructions, but only
ceil is correctly excluded at the moment.  Correct the other two.

Signed-off-by: David Guillen Fandos <david@davidgf.net>
11 days agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 days agoRemove extraneous semicolon from inferior.h
Tom Tromey [Sat, 3 Jan 2026 13:23:43 +0000 (06:23 -0700)] 
Remove extraneous semicolon from inferior.h

I noticed an extra ";" in inferior.h, this removes it.

11 days agoFix multiple-successive-infcall.exp with gdbserver
Tom Tromey [Sun, 18 Jan 2026 02:28:13 +0000 (19:28 -0700)] 
Fix multiple-successive-infcall.exp with gdbserver

PR gdb/33791 points out that my recent change to emit the thread ID in
the thread notification message broke multiple-successive-infcall.exp
when run with gdbserver.  This patch fixes the oversight.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33791
Approved-By: Simon Marchi <simon.marchi@efficios.com>
12 days agogdb/
Eli Zaretskii [Sun, 18 Jan 2026 09:30:06 +0000 (11:30 +0200)] 
gdb/

   PR gdb/33761
   * gdb/ui-style.c (colorsupport) [__MINGW32__]: MS-Windows always
   supports at least 8 colors, even if the "Co" capability is not in
   the terminfo DB.  This fixes "set style FOO foreground COLOR"
   commands in the Windows native build of GDB.

12 days agoPR 33801 strip doesn't remove .gnu.lto_.opts
Alan Modra [Sat, 17 Jan 2026 08:13:06 +0000 (18:43 +1030)] 
PR 33801 strip doesn't remove .gnu.lto_.opts

OK, so people want to be able to partly destroy gcc slim LTO object
files.  I don't see why not, despite HJ's policy-setting slim lto
strip -R tests.  I also don't see why it matters that objcopy/strip
won't similarly break LLVM objects (pr33271).

So out goes the slim lto strip -R tests, and the strip-debug test
expecting slim lto files won't be modified in any way.  strip-debug
now removes a FILE symbol, which isn't unreasonable.

PR 33801
PR 33271
PR 33246
binutils/
* objcopy.c (copy_archive, copy_file): Do not special case
gcc LTO IR files.
ld/
* testsuite/ld-plugin/lto-binutils.exp: Remove slim lto strip -R
tests.
(run_pr33246_test): Don't compare slim object files after
strip-debug.
* testsuite/ld-plugin/strip-1a-s-all.nd: Delete.

12 days agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

12 days agogas: Update PR gas/33744 tests
H.J. Lu [Sat, 17 Jan 2026 00:48:59 +0000 (08:48 +0800)] 
gas: Update PR gas/33744 tests

Since .set directive doesn't work on alpha and hpux has a non-standard
common directive, skip the relevant tests on alpha and hpux.  Also allow
2, 4, 8 byte section alignment for 1-byte section since some targets
have a minimum section alignment.

PR gas/33744
* testsuite/gas/elf/sh-link-abs-1.d: Skip alpha and allow 1, 2,
4, 8 byte section alignment.
* testsuite/gas/elf/sh-link-abs-2.d: Likewise.
* testsuite/gas/elf/sh-link-abs-3-32.d: Likewise.
* testsuite/gas/elf/sh-link-abs-3-64.d: Likewise.
* testsuite/gas/elf/sh-link-abs-4-32.d: Likewise
* testsuite/gas/elf/sh-link-abs-4-64.d: Likewise
* testsuite/gas/elf/sh-link-common-1.d: Skip hpux and allow 1,
2, 4, 8 byte section alignment.
* testsuite/gas/elf/sh-link-common-2.d: Likewise
* testsuite/gas/elf/sh-link-common-3-32.d: Likewise
* testsuite/gas/elf/sh-link-common-3-64.d: Likewise
* testsuite/gas/elf/sh-link-common-4-32.d: Likewise
* testsuite/gas/elf/sh-link-common-4-64.d: Likewise

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
12 days agogdb/i386: remove i386_dbx_reg_to_regnum
Simon Marchi [Sat, 17 Jan 2026 03:44:56 +0000 (22:44 -0500)] 
gdb/i386: remove i386_dbx_reg_to_regnum

Following the removal of gdbarch_sdb_reg_to_regnum,
i386_dbx_reg_to_regnum is only used by i386_svr4_dwarf_reg_to_regnum to
handle SSE and MMX registers.  Remove it and inline the relevant bits in
i386_svr4_dwarf_reg_to_regnum.

Change-Id: Id74fad6ef6798c4cd061905f1c01eadd90e0a118
Approved-By: Andrew Burgess <aburgess@redhat.com>
12 days agogdb: remove gdbarch_sdb_reg_to_regnum
Simon Marchi [Sat, 17 Jan 2026 03:44:55 +0000 (22:44 -0500)] 
gdb: remove gdbarch_sdb_reg_to_regnum

Following the removal of the COFF debug info support,
gdbarch_sdb_reg_to_regnum is no longer used, remove it.

Change-Id: I2cb43465f1fdf74863edfa4dd00fd5f28a5a26bd
Approved-By: Andrew Burgess <aburgess@redhat.com>
12 days agogdb: remove stale comments about COFF / stabs
Simon Marchi [Sat, 17 Jan 2026 03:48:15 +0000 (22:48 -0500)] 
gdb: remove stale comments about COFF / stabs

These comments appear to be stale and no longer relevant.

Change-Id: I3470969b0c0f38d809fe074ffab93ac91202de18
Approved-By: Andrew Burgess <aburgess@redhat.com>
13 days ago[gdb/tdep] Fix gdb.base/siginfo.exp on s390x-linux
Tom de Vries [Sat, 17 Jan 2026 07:44:57 +0000 (08:44 +0100)] 
[gdb/tdep] Fix gdb.base/siginfo.exp on s390x-linux

On s390x-linux (SLES 15 SP5), I'm running into:
...
FAIL: gdb.base/siginfo.exp: backtrace for nexti (pattern 2)
FAIL: gdb.base/siginfo.exp: step out of handler
...

The first FAIL is caused by a failure to unwind:
...
 (gdb) bt^M
 #0  handler (sig=26, info=0x3ffffffe428, context=0x3ffffffe4a8) at \
   gdb.base/siginfo.c:31^M
 Backtrace stopped: Cannot access memory at address 0x1a00000088^M
 (gdb)
...

In contrast, on x86_64-linux I get instead:
...
 (gdb) bt^M
 #0  handler (sig=26, info=0x7fffffffc170, context=0x7fffffffc040) at \
   gdb.base/siginfo.c:31^M
 #1  <signal handler called>^M
 #2  0x0000000000401201 in main () at gdb.base/siginfo.c:67^M
 (gdb)
...

The memory access error is triggered here in s390_sigtramp_frame_unwind_cache:
...
  /* Restore the previous frame's SP.  */
  prev_sp = read_memory_unsigned_integer (
info->saved_regs[S390_SP_REGNUM].addr (),
                        word_size, byte_order);
...
while trying to read an "Old-style RT frame" (for syscall sigreturn).

The problem is that we actually have a "New-style RT frame" (for syscall
rt_sigreturn).

[ See linux kernel source file arch/s390/kernel/signal.c for a detailed
explanation of the two. ]

The choice between the two is made earlier in that same function:
...
  /* New-style RT frame:
retcode + alignment (8 bytes)
siginfo (128 bytes)
ucontext (contains sigregs at offset 5 words).  */
  if (next_ra == next_cfa)
    {
      ...
    }

  /* Old-style RT frame and all non-RT frames:
old signal mask (8 bytes)
pointer to sigregs.  */
  else
...

I'm not sure why the check gives the wrong result, but I noticed that
s390_sigtramp_frame_sniffer is able to distinguish between the two, so fix
this by:
- factoring out new function s390_sigtramp_p out of
  s390_sigtramp_frame_sniffer, and
- using s390_sigtramp_p in s390_sigtramp_frame_unwind_cache to distinguish
  between the "Old-style RT frame" and "New-style RT frame".

This fixes the backtrace.

The second failure is:
...
(gdb) step^M
32      } /* handler */^M
1: x/i $pc^M
=> 0x1000772 <handler+50>:      nopr^M
(gdb) step^M
0x000003fffdffe490 in __kernel_rt_sigreturn ()^M
1: x/i $pc^M
=> 0x3fffdffe490 <__kernel_rt_sigreturn>:       svc     173^M
(gdb) FAIL: gdb.base/siginfo.exp: step out of handler
...

There is some code in process_event_stop_test that is supposed to trigger:
...
  if (ecs->event_thread->control.step_range_end != 1
      && (ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
  || ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
      && get_frame_type (frame) == SIGTRAMP_FRAME)
    {
      infrun_debug_printf ("stepped into signal trampoline");
      /* The inferior, while doing a "step" or "next", has ended up in
 a signal trampoline (either by a signal being delivered or by
 the signal handler returning).  Just single-step until the
 inferior leaves the trampoline (either by calling the handler
 or returning).  */
      keep_going (ecs);
      return;
    }
...
but it doesn't because frame is a NORMAL_FRAME instead of a SIGTRAMP_FRAME.

This is caused by the "dwarf2" unwinder triggering, which has higher priority
than the "s390 linux sigtramp" unwinder:
...
(gdb) maint info frame-unwinders
Name                        Type                      Class     Enabled
dummy                       DUMMY_FRAME               GDB       Y
dwarf2 tailcall             TAILCALL_FRAME            DEBUGINFO Y
inline                      INLINE_FRAME              GDB       Y
jit                         NORMAL_FRAME              EXTENSION Y
python                      NORMAL_FRAME              EXTENSION Y
dwarf2                      NORMAL_FRAME              DEBUGINFO Y
dwarf2 signal               SIGTRAMP_FRAME            DEBUGINFO Y
s390 linux sigtramp         SIGTRAMP_FRAME            ARCH      Y
s390 stub                   NORMAL_FRAME              ARCH      Y
s390 prologue               NORMAL_FRAME              ARCH      Y
...

I found some code in dwarf2_frame_sniffer:
...
  /* On some targets, signal trampolines may have unwind information.
     We need to recognize them so that we set the frame type
     correctly.  */

  if (fde->cie->signal_frame
      || dwarf2_frame_signal_frame_p (get_frame_arch (this_frame),
      this_frame))
    return self->type () == SIGTRAMP_FRAME;
...
and an example implementation i386_linux_dwarf_signal_frame_p, and after
copying this approach, indeed the stepping failure was fixed, but the
backtrace broken again.

Instead, fix this by giving the "s390 linux sigtramp" unwinder a higher
priority:
...
(gdb) maint info frame-unwinders
Name                        Type                      Class     Enabled
dummy                       DUMMY_FRAME               GDB       Y
dwarf2 tailcall             TAILCALL_FRAME            DEBUGINFO Y
inline                      INLINE_FRAME              GDB       Y
jit                         NORMAL_FRAME              EXTENSION Y
python                      NORMAL_FRAME              EXTENSION Y
s390 linux sigtramp         SIGTRAMP_FRAME            ARCH      Y
dwarf2                      NORMAL_FRAME              DEBUGINFO Y
dwarf2 signal               SIGTRAMP_FRAME            DEBUGINFO Y
s390 stub                   NORMAL_FRAME              ARCH      Y
s390 prologue               NORMAL_FRAME              ARCH      Y
...

Also fixes test-case gdb.base/sigaltstack.exp and gdb.base/sigbpt.exp.

Tested on s390x-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
PR tdep/33708
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33708

13 days agofix new arm and aarch64 gas test failures
Alan Modra [Sat, 17 Jan 2026 02:22:08 +0000 (12:52 +1030)] 
fix new arm and aarch64 gas test failures

aarch64-pe  +FAIL: gas/aarch64/fix-adj
arm-pe  +FAIL: MVE vmlas instructions
arm-wince-pe  +FAIL: MVE vmlas instructions

These new tests use ELF directives.

* testsuite/gas/aarch64/fix-adj.d: Only run on ELF targets.
* testsuite/gas/arm/mve-vmlas.d: Likewise.

13 days agold: put wild matching_sections on an obstack
Alan Modra [Fri, 16 Jan 2026 05:49:31 +0000 (16:19 +1030)] 
ld: put wild matching_sections on an obstack

so that the memory can be reclaimed easily when reset_resolved_wilds
throws it all away.

* ldlang.c (matching_obstack): New static var.
(add_matching_section): Rewrite to use matching_obstack.
(lang_init): Init matching_obstack.
(reset_resolved_wilds): Free matching_obstack.

13 days agoMake some ldlang functions inline
Alan Modra [Fri, 16 Jan 2026 05:43:21 +0000 (16:13 +1030)] 
Make some ldlang functions inline

These are small, and making them inline lets me call
lang_statement_append without adding a forward declaration in the
next patch.

* ldlang.c (lang_for_each_statement, lang_list_init),
(lang_statement_append): Move to..
* ldlang.h: ..here making them inline functions.
(bfd_input_just_syms): Group with other inlines.

13 days agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

13 days agoaarch64: Add support for FEAT_MTETC
Richard Ball [Fri, 16 Jan 2026 22:16:40 +0000 (22:16 +0000)] 
aarch64: Add support for FEAT_MTETC

This patch adds two new DC operations:

   *gbva
   *zgbva

13 days agoaarch64: Add FEAT_SCR2 System registers
Richard Ball [Fri, 16 Jan 2026 22:15:35 +0000 (22:15 +0000)] 
aarch64: Add FEAT_SCR2 System registers

This patch adds the system register "SCR2_EL3"
Defined by FEAT_SCR2.

13 days agogdb/hppa: replace bfd_map_over_sections with gdb_bfd_sections
Simon Marchi [Fri, 16 Jan 2026 18:35:58 +0000 (13:35 -0500)] 
gdb/hppa: replace bfd_map_over_sections with gdb_bfd_sections

Replace bfd_map_over_sections with iteration over gdb_bfd_sections.

Change-Id: I92ba6b5ef9e9ab3d2ebe364373aeaf459fd6e34c
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/windows: replace bfd_map_over_sections with gdb_bfd_sections
Simon Marchi [Fri, 16 Jan 2026 18:35:57 +0000 (13:35 -0500)] 
gdb/windows: replace bfd_map_over_sections with gdb_bfd_sections

Replace bfd_map_over_sections with iteration over gdb_bfd_sections.
Change core_process_module_section's signature to take a cpms_data
reference instead of a void pointer.

Change-Id: Ic4f9a12c9c1479799ec87658fd88490106b61836
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/compile: replace bfd_map_over_sections with gdb_bfd_sections
Simon Marchi [Fri, 16 Jan 2026 18:35:56 +0000 (13:35 -0500)] 
gdb/compile: replace bfd_map_over_sections with gdb_bfd_sections

Replace bfd_map_over_sections with iteration over gdb_bfd_sections.
Rename copy_sections to copy_section and change its signature to take
explicit parameters instead of the callback-style void pointer.

Change-Id: I30f1c3c051415722f2220b7fba48103101b640e8
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/mips-sde: replace bfd_map_over_sections with gdb_bfd_sections
Simon Marchi [Fri, 16 Jan 2026 18:35:55 +0000 (13:35 -0500)] 
gdb/mips-sde: replace bfd_map_over_sections with gdb_bfd_sections

Replace bfd_map_over_sections with iteration over gdb_bfd_sections.

Change-Id: If2e1141f2e9345fe50e2a63ce8f8682e82a60f21
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/mips: replace bfd_map_over_sections with gdb_bfd_sections (2)
Simon Marchi [Fri, 16 Jan 2026 18:35:54 +0000 (13:35 -0500)] 
gdb/mips: replace bfd_map_over_sections with gdb_bfd_sections (2)

Replace bfd_map_over_sections with iteration over gdb_bfd_sections.

Change-Id: I34182a67ee52da479c1868a5880709c401cbf34e
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/mips: replace bfd_map_over_sections with gdb_bfd_sections (1)
Simon Marchi [Fri, 16 Jan 2026 18:35:53 +0000 (13:35 -0500)] 
gdb/mips: replace bfd_map_over_sections with gdb_bfd_sections (1)

Replace bfd_map_over_sections with iteration over gdb_bfd_sections.

Change-Id: Ib236b364dc81f43cab8d27271d413eb61d6c703e
Approved-By: Tom Tromey <tom@tromey.com>
13 days ago[gdb] Handle AT_HWCAP3/AT_HWCAP4 in default_print_auxv_entry
Tom de Vries [Fri, 16 Jan 2026 19:14:51 +0000 (20:14 +0100)] 
[gdb] Handle AT_HWCAP3/AT_HWCAP4 in default_print_auxv_entry

On aarch64-linux, I run into:
...
(gdb) info auxv^M
  ...
26   AT_HWCAP2            Extension of AT_HWCAP          0x181^M
29   ???                                                 0x0^M
31   AT_EXECFN            File name of executable        0xffffffffffb9 ...
  ...
28   AT_RSEQ_ALIGN        rseq allocation alignment      32^M
0    AT_NULL              End of vector                  0x0^M
(gdb) WARNING: Unrecognized tag value: 29 ... ??? ... 0x0^M
FAIL: gdb.base/auxv.exp: info auxv on live process
...

Fix this by handling AT_HWCAP3 in default_print_auxv_entry.  Likewise for
AT_HWCAP4.

Tested on aarch64-linux.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32590

13 days ago[include] Add AT_HWCAP3/AT_HWCAP4 in elf/common.h
Tom de Vries [Fri, 16 Jan 2026 19:14:51 +0000 (20:14 +0100)] 
[include] Add AT_HWCAP3/AT_HWCAP4 in elf/common.h

Since glibc 2.39, containing commit 3ab9b88 ("powerpc: Add HWCAP3/HWCAP4 data
to TCB for Power Architecture."), glibc's elf/elf.h contains constants
AT_HWCAP3/AT_HWCAP4.

Add these in elf/common.h.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
13 days agogdb/testsuite: add testcase for .debug_gdb_scripts being compressed
Maximilian Bosch [Wed, 7 Jan 2026 11:56:55 +0000 (12:56 +0100)] 
gdb/testsuite: add testcase for .debug_gdb_scripts being compressed

This is a test-case to make sure that
8eb1701823e46179e3adcb49abf57126b3c49f28
("gdb: fix loading compressed scripts from `.debug_gdb_scripts`-section")
doesn't regress.

The test was mostly implemented by Tom Tromey, with the exception of the
check to make sure that the sections are actually compressed and
corrected compiler flags (-Wl,--compress-debug-sections=zlib-gabi was
missing).

This is an individual patch since the actual fix already landed in the
repository.

Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/buildsym: patch_subfile_names
Simon Marchi [Fri, 9 Jan 2026 21:56:11 +0000 (16:56 -0500)] 
gdb/buildsym: patch_subfile_names

This doesn't seem used anymore.

Change-Id: I39e04f1f05fee3c6f7747923d5c1c2feef1fa315
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/buildsym: remove get_last_source_start_addr/set_last_source_start_addr methods
Simon Marchi [Fri, 9 Jan 2026 21:56:10 +0000 (16:56 -0500)] 
gdb/buildsym: remove get_last_source_start_addr/set_last_source_start_addr methods

Nothing seems to use this anymore.  However, the private field is still
used internally by buildsym, so keep it.

Change-Id: Ie6fbd96110a3c5603359a483855bbecc4008e5b4
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/buildsym: remove m_last_source_file
Simon Marchi [Fri, 9 Jan 2026 21:56:09 +0000 (16:56 -0500)] 
gdb/buildsym: remove m_last_source_file

Nothing seems to use this anymore.

Change-Id: I6a767f2251ce9e683c231708466899a3e9ff4cb1
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb: remove buildsym-legacy
Simon Marchi [Fri, 9 Jan 2026 21:56:08 +0000 (16:56 -0500)] 
gdb: remove buildsym-legacy

With the removal of the COFF debug info support, nothing uses
buildsym-legacy anymore, remove it.

Change-Id: I46612509889b6868f5889a4347ad8d0a28d29127
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/coffread: remove debug info support
Simon Marchi [Fri, 9 Jan 2026 21:56:07 +0000 (16:56 -0500)] 
gdb/coffread: remove debug info support

This patch removes support for reading in the COFF debug info.

I am not a specialist of the COFF format, but my understanding is that
debug info in the COFF format consisted of extra symbol table entries
describing the standard symbol table entries.  For instance, when
compiling without debug info, a function would get a simple symbol
entry, akin to an ELF symbol.  We would create a minimal symbol out of
that.  When compiling with debug info, that symbol table entry would be
followed by special additional entries, describing things like
parameters and local variables (what would now be in DWARF).  We would
create some full symbols out of that.

This patch removes everything that reads this extra information, on the
basis that any target still used today would not use it anymore, having
switched to DWARF instead.  We still read the standard symbol table
entries and create minimal symbols out of that.  This can be seen when
loading a Windows executable (the only COFF executable kind I know how
to produce):

    $ ./gdb -nx -q --data-directory=data-directory -ex "set debug symtab-create 2" -ex "file a.exe"
    ...
    [symtab-create] record_full: recording minsym:  mst_file_bss                  0x140008018     6  argv
    [symtab-create] record_full: recording minsym:  mst_file_bss                  0x140008008     6  managedapp
    [symtab-create] record_full: recording minsym:  mst_text                      0x1400013e0     0  WinMainCRTStartup
    [symtab-create] record_full: recording minsym:  mst_text                      0x140001400     0  mainCRTStartup
    [symtab-create] record_full: recording minsym:  mst_text                      0x140001420     0  atexit
    [symtab-create] record_full: recording minsym:  mst_file_data                 0x140005000     3  __EH_FRAME_BEGIN__
    [symtab-create] record_full: recording minsym:  mst_file_bss                  0x140008060     6  obj
    ...
    [symtab-create] install: installing 299 minimal symbols of objfile /home/smarchi/src/binutils-gdb/gdb/a.exe

I did not and can't easily test more than that.  At least, the remaining
code is understandable enough that I think we would be able to fix any
bug that comes up.

This change should not alter the debugging experience on Windows.

For more info on the COFF symbol table format:

  https://www.delorie.com/djgpp/doc/coff/symtab.html

Change-Id: I83220589b8e5b242a4ac42a842e504a4aa47aada
Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb/coffread: replace bfd_map_over_sections with iteration
Simon Marchi [Fri, 9 Jan 2026 21:56:06 +0000 (16:56 -0500)] 
gdb/coffread: replace bfd_map_over_sections with iteration

Replace two uses of bfd_map_over_sections with an iteration over
gdb_bfd_sections.

Re-use cs_to_bfd_section in cs_section_address to simplify it.

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