]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
77 min agoFix configure rebuild master
John David Anglin [Sun, 14 Dec 2025 21:57:28 +0000 (16:57 -0500)] 
Fix configure rebuild

2025-12-14  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* configure: Regenerate.

ld/ChangeLog:

* configure: Regenerate.

2 hours agoFix binutils build on hppa64-hpux with gcc-16 (v3)
John David Anglin [Sun, 14 Dec 2025 21:11:19 +0000 (16:11 -0500)] 
Fix binutils build on hppa64-hpux with gcc-16 (v3)

With recent gcc versions, implicit function declarations are errors.
We need to ensure that ffs() and strtoull() are declared and correctly
checked for by configure.

strtoull() is not declared on hpux but it's provided by libiberty.

An unnecessary include of strings.h in elf32-xtensa.c is removed.

Approved-By: Jan Beulich <jbeulich@suse.com>
2025-12-14  John David Anglin  <danglin@gcc.gnu.org>

bfd/ChangeLog:

* configure.ac: Check for strtoull declaration.
* elf32-xtensa.c: Remove strings.h include.
* configure: Regenerate.
* config.in: Regenerate.
* sysdep.h: Include strings.h and declare strtoull()
if a declaration for it isn't found by configure.

ld/ChangeLog:

* configure.ac: Check for strtoull declaration.
* configure: Regenerate.
* config.in: Regenerate.
* sysdep.h: Declare strtoull() if a declaration for it
isn't found by configure.

23 hours agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

35 hours agogdb: use the pid from inferior in setup_inferior
Tankut Baris Aktemur [Sat, 13 Dec 2025 11:50:47 +0000 (12:50 +0100)] 
gdb: use the pid from inferior in setup_inferior

This is a step to reduce the dependency on the global inferior_ptid
variable.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
44 hours agoLoongArch: Set the default ABI of loongarch*-elf targets to double-float
Lulu Cai [Thu, 11 Dec 2025 07:40:58 +0000 (15:40 +0800)] 
LoongArch: Set the default ABI of loongarch*-elf targets to double-float

The ABI setting for the elf target was ommitted in commit "db614f37cab".
Set the default ABI for elf to double-float.

In addition, test case failures caused by the loongarch*-elf linker not
supporting relevant options have also been skipped.

gas/

        * config/tc-loongarch.c (loongarch_after_parse_args): Set
  default ABI to double-float for other targets.

ld/

        * testsuite/ld-loongarch-elf/la32.d: Skip tests when not
  supported.
        * testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Likewise.
        * testsuite/ld-loongarch-elf/relax.exp: Likewise.

46 hours agoRe: ld: testsuite: Add sframe test for PR 33401
Alan Modra [Fri, 12 Dec 2025 23:00:46 +0000 (09:30 +1030)] 
Re: ld: testsuite: Add sframe test for PR 33401

If user CXXFLAGS include -fno-inline the test fails with
FAIL: PR ld/33401 (Step 1: Create relocatable object and check R_*_NONE)
This should not be a FAIL.  If the compiler does not generate R_*_NONE
(a good thing!) then it should be UNTESTED, which means the readelf
check can't be done by run_cc_link_tests.  I haven't made that change
in this patch, just worked around a user -fno-inline.

47 hours agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 days agogdb/breakpoint.c: fix style issues in get_sal_arch
Lancelot SIX [Fri, 8 Nov 2024 19:52:55 +0000 (19:52 +0000)] 
gdb/breakpoint.c: fix style issues in get_sal_arch

Fix coding standard related issues in get_sal_arch.

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

2 days agold: testsuite: Add sframe test for PR 33401
Claudiu Zissulescu [Fri, 12 Dec 2025 15:02:32 +0000 (17:02 +0200)] 
ld: testsuite: Add sframe test for PR 33401

When linking for a relocable output file (-r), one or more R_*_NONE
relocations may be generated for .sframe section. Two new tcl
procedures are added to sframe.exp file. 'check-dump' is checking if
an input bin file has the same relocation as specified in the second
input argument. 'check_pr33401' is the main checking function for
PR33401 which calls twice the ld tool to produce an relocable output
file.

ld:

PR33401
* testsuite/ld-sframe/StateClient.cpp: New file.
* testsuite/ld-sframe/StatePlaying.cpp: Likewise.
* testsuite/ld-sframe/pr33401.rd: Likewise.
* testsuite/ld-sframe/sframe.exp (check_pr33401): New procedure.

Co-authored-by: Indu Bhagat <indu.bhagat@oracle.com>
Reviewed-by: Indu Bhagat <indu.bhagat@oracle.com>
2 days agobfd: ld: sframe: skip R_*_NONE relocations from input bfds
Indu Bhagat [Fri, 12 Dec 2025 15:02:32 +0000 (17:02 +0200)] 
bfd: ld: sframe: skip R_*_NONE relocations from input bfds

Fix PR ld/33401 - SFrame assertion when linking gav-0.9.1

As the issue demonstrates, R_*_NONE relocations are not necessarily
at the end of .sframe section (previously thought so with PR ld/33127).
Skip over R_*_NONE relocs when they are strewn intermittently inside the
.rela.sframe section.

bfd/
PR ld/33401
* elf-sframe.c (sframe_decoder_init_func_bfdinfo):  Skip over
R_*_NONE relocations.

2 days agogas/gen-sframe: avoid gcc extension using __VA_ARGS__
Jan Beulich [Fri, 12 Dec 2025 14:00:41 +0000 (15:00 +0100)] 
gas/gen-sframe: avoid gcc extension using __VA_ARGS__

We shouldn't be using extensions when we don't have a suitable fallback in
place. Introducing a format-argument-less counterpart macro would feel a
little odd here. Instead make the sole use site have a (fake) argument
(the non-translatable part of the string).

2 days agold/pe-dll: Don't auto-export symbols from .tls section
LIU Hao [Fri, 12 Dec 2025 14:00:15 +0000 (15:00 +0100)] 
ld/pe-dll: Don't auto-export symbols from .tls section

The .tls section of an image contains template data that will be duplicated
for each new thread to be created. Accessing thread-local data involves an
image-specific global variable, _tls_used, for calculation. Therefore, it is
impossible to export thread-local variables from a DLL.

The only symbol that exists in the .tls input section is _tls_start, but it's
a CRT symbol and is never auto-exported. It's only necessary to check for
user symbols, which are always generated in the subsection .tls$ by default,
or in subsections like .tls$$<symbol> when -fdata-sections is specified.

Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881
Signed-off-by: LIU Hao <lh_mouse@126.com>
2 days agobfd: Add minimal support to handle note that describes xsave layout
Vignesh Balasubramanian [Fri, 12 Dec 2025 13:59:49 +0000 (14:59 +0100)] 
bfd: Add minimal support to handle note that describes xsave layout

This note section is already supported by Linux kernel.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/x86/kernel/fpu/xstate.c?id=ba386777a30b38dabcc7fb8a89ec2869a09915f7

Co-Authored-By: Jini Susan George <jinisusan.george@amd.com>
2 days agogas/d30v: make use of tc_symbol_chars[]
Jan Beulich [Fri, 12 Dec 2025 13:59:20 +0000 (14:59 +0100)] 
gas/d30v: make use of tc_symbol_chars[]

... instead of having arch-specific code in app.c.

2 days ago[gdb/testsuite] Fix timeout in gdb.base/async-shell.exp
Tom de Vries [Fri, 12 Dec 2025 08:35:23 +0000 (09:35 +0100)] 
[gdb/testsuite] Fix timeout in gdb.base/async-shell.exp

For test-case gdb.base/async-shell.exp, I usually get:
...
(gdb) run &^M
Starting program: async-shell ^M
(gdb) PASS: $exp: run &
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
shell echo foo^M
foo^M
(gdb) PASS: $exp: shell echo foo
...

And with taskset -c 11, I get instead:
...
(gdb) run &^M
Starting program: async-shell ^M
(gdb) PASS: $exp: run &
shell echo foo^M
foo^M
(gdb) PASS: $exp: shell echo foo
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
...

With a gdb 16.3 based package I ran into:
...
(gdb) run &
Starting program: async-shell
(gdb) PASS: $exp: run &
shell echo foo
foo
(gdb) [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
FAIL: $exp: shell echo foo (timeout)
...

I have tried to reproduce this using various timing tricks, but haven't
managed.  Nevertheless, I believe this can reproduced with trunk, so fix this
using -no-prompt-anchor.

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

2 days agoRISC-V: avoid ld crashes due to bogus use by testcases
Jan Beulich [Fri, 12 Dec 2025 07:06:41 +0000 (08:06 +0100)] 
RISC-V: avoid ld crashes due to bogus use by testcases

Specifying a little-endian emulation isn't very helpful when the target is
big-endian (and hence gas defaults to that). Surely the linker better
wouldn't crash when invoked like this, but making sure of this isn't the
purpose of any of these tests (afaict). Make assembly output match linker
options.

With this the ld testsuite completes successfully for me. binutils and gas
testsuites still have issues.

2 days agox86: replace XFAILs in "GOTX default" tests
Jan Beulich [Fri, 12 Dec 2025 07:05:11 +0000 (08:05 +0100)] 
x86: replace XFAILs in "GOTX default" tests

The use of XFAIL was wrong here. XFAIL marks tests which in principle
should work, but where making them work requires extra effort.

2 days agogas/macro: drop ISSEP()
Jan Beulich [Fri, 12 Dec 2025 07:04:41 +0000 (08:04 +0100)] 
gas/macro: drop ISSEP()

I've been irritated by it more than once: It very obviously doesn't cover
all separators, hence resulting in inconsistent behavior. Nor do both use
sites look to really want the same set of separators. In macro_expand() we
really can pull the get_token() call ahead. If we don't find the expected
'=' we can simply continue parsing from the original position.

The use in get_any_string() is dead code afaict, inherited from gasp. The
sole leftover thereof is handled in the scrubber (see H_TICK_HEX,
LEX_IS_H, and alike there). With that dropped, ISBASE() also can be.

2 days agold/ELF: correct tidying of sec64k object files
Jan Beulich [Fri, 12 Dec 2025 07:02:33 +0000 (08:02 +0100)] 
ld/ELF: correct tidying of sec64k object files

These consume quite a bit of space (especially noticeable during batch
testing), but are rather mechanical to (re)create. In 2.28, when the
object file names used were changed (from dump<N>.o to names derived from
source file names), the tidying code wasn't updated (and hence lost its
effect).

2 days agold/ELF: leave note sections alone for relocatable linking
Jan Beulich [Fri, 12 Dec 2025 07:02:12 +0000 (08:02 +0100)] 
ld/ELF: leave note sections alone for relocatable linking

Commit 023e60ced0c8 ("ld: Move note sections after .rodata section") had a
rather undesirable effect for relocatable links (which typically wouldn't
use a custom linker script): .note.GNU-stack, which isn't even a proper
notes sections (it's SHT_PROGBITS instead, which likely will want
correcting independently), would be moved immediately past .text and
.rodata (and alike), ahead of any custom notes sections. A later final
link, possibly simply combining all .note and .note.* sections, would then
find .note.GNU-stack first, resulting in the output section to also become
SHT_PROGBITS. This way consumers looking for SHT_NOTE wouldn't find the
data they're after.

The goal of mentioning some known .note.* in the linker scripts is to
avoid orphan section diagnostics. That's not typically of interest for
relocatable links, though (people caring about this will want to have
custom scripts anyway, much like they may need to if they had any custom
.note.* sections). Therefore suppress that part of the linker script for
relocatable links.

2 days agold/Linux: determine program name in a more reliable manner
Jan Beulich [Fri, 12 Dec 2025 07:01:53 +0000 (08:01 +0100)] 
ld/Linux: determine program name in a more reliable manner

What argv[0] holds can be pretty arbitrary. As long as it's used for just
diagnostics, that may be pretty okay to go from, but ld also uses it to
find linker scripts. For that we want to be sure we start from the real
executable name. Which on Linux we can determine from the /proc/self/exe
symbolic link target (provided of course procfs is mounted).

While there constify program_name as well.

2 days agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 days agoUse -wrap in two test cases
Tom Tromey [Thu, 11 Dec 2025 21:10:18 +0000 (14:10 -0700)] 
Use -wrap in two test cases

Both Baris and Tom pointed out spots in recent patches where -wrap
could have been used.  This patch changes both the relevant tests to
use it.

3 days ago[pre-commit] Add pre-commit setup check
Tom de Vries [Thu, 11 Dec 2025 21:38:30 +0000 (22:38 +0100)] 
[pre-commit] Add pre-commit setup check

I wrote a patch and accidentally introduced a typo in the commit message.

This didn't get detected because codespell-log didn't run.

I installed pre-commit on that setup a while back, before codespell-log was
around and consequently only the .git/hooks/pre-commit script was installed.

This is a bit hard to notice given that all other hooks do run.

Add a pre-commit check that checks for this situation:
...
$ rm .git/hooks/commit-msg
$ git commit --amend
  ...
pre-commit-setup........................................................Failed
- hook id: pre-commit-setup
- exit code: 1

missing hook: .git/hooks/commit-msg (please run pre-commit install)
  ...
$
...

This is a bit niche, but worthwhile if you're using a dozen build and test
installations.

3 days ago[gdb/testsuite] Add tclint-plugin.py
Tom de Vries [Thu, 11 Dec 2025 21:31:49 +0000 (22:31 +0100)] 
[gdb/testsuite] Add tclint-plugin.py

Tclint v0.6.2 adds the possibility to specify a dynamic plugin using:
...
$ tclint --commands tclint-plugin.py
...

Update the pre-commit tclint version to v0.6.2, and add a plugin
gdb/testsuite/tclint-plugin.py.

The new plugin informs tclint about procs like proc_with_prefix which have a
script-type parameter, making tclint check the body of proc foo:
...
proc_with_prefix foo {} {
    ...
}
...

Declaring proc_with_prefix a builtin command makes tclint issue a
redefined-builtin for the definition of proc_with_prefix.  Fix this by adding
"tclint-disable redefined-builtin" at the start of each file containing such
procs.

The plugin is not complete.  Most entries were found by grepping for something
like "proc.*body".

The hope is that eventually we get to a situation where we can drop the
plugin and instead annotate like this [1]:
...
 # tclint-args: name: any, arguments: any, body: script
 proc proc_with_prefix { name arguments body } {
     ...
 }
...

One fix in the testsuite, in test-case gdb.python/py-missing-objfile.exp.

[1] https://github.com/nmoroze/tclint/issues/121#issuecomment-3319368338

3 days agogdb/testsuite: use with_timeout_factor in huge.exp testcases
Jan Vrany [Thu, 11 Dec 2025 16:21:51 +0000 (16:21 +0000)] 
gdb/testsuite: use with_timeout_factor in huge.exp testcases

I occasionally run GDB testsuite on sluggish targets that need higher
timeout. The usual remedy I use is to set timeout to higher value in
site.exp.

This does not help with gdb.fortran/huge.exp, gdb.base/huge.exp and
gdb.ada/huge.exp, which set the timeout to fixed value of 30,
regardless of whether the timeout has been increased or not, causing
them to fail on some of my machines.

This commit fixes the problem by using with_timeout_factor.

Approved-By: Tom Tromey <tom@tromey.com>
3 days agold: Remove elf_i386_ldso reference
Rainer Orth [Thu, 11 Dec 2025 15:27:14 +0000 (16:27 +0100)] 
ld: Remove elf_i386_ldso reference

There's still a reference to the removed elf_i386_ldso emulation, breaking
the build with --enable-targets=all.

Tested on x86_64-pc-linux-gnu.

2025-12-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

ld:
* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_ldso.c.
* Makefile.in: Regenerate.

3 days agoaarch64: Update parse_vector_reg_list comment
Alice Carlotti [Wed, 10 Dec 2025 21:17:24 +0000 (21:17 +0000)] 
aarch64: Update parse_vector_reg_list comment

The information about indexes was wrong.  I've also adjusted the
formatting and improved other parts of the comment.

3 days agoaarch64: Add support for FEAT_LSCP
Richard Ball [Thu, 11 Dec 2025 14:10:24 +0000 (14:10 +0000)] 
aarch64: Add support for FEAT_LSCP

This patch adds the new instructions from FEAT_LSCP.
These instructions are LDAP, LDAPP and STLP.

3 days agoCleanup bfd target vectors and ld emulations on Solaris (missed part)
Rainer Orth [Thu, 11 Dec 2025 14:02:37 +0000 (15:02 +0100)] 
Cleanup bfd target vectors and ld emulations on Solaris (missed part)

This reordering of the x86_64-*-solaris2.1[01] entry in config.bfd was
missed in the original commit.

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

bfd:
* config.bfd [BFD64] <x86_64-*-solaris2.1[01]*>: Move down.

3 days agoFix "unset local-environment" when clearenv not available
Tom Tromey [Wed, 10 Dec 2025 14:23:37 +0000 (07:23 -0700)] 
Fix "unset local-environment" when clearenv not available

Tom de Vries pointed out that clearenv isn't available on all hosts.
Since this seems like a niche command at best, it seemed fine to
disable this command on such platforms.

Reviewed-By: Tom de Vries <tdevries@suse.de>
3 days agoCleanup bfd target vectors and ld emulations on Solaris
Rainer Orth [Thu, 11 Dec 2025 13:43:16 +0000 (14:43 +0100)] 
Cleanup bfd target vectors and ld emulations on Solaris

This patch is a major cleanup of the Solaris configurations of both bfd and ld.

The Solaris cases in both bfd/config.bfd and ld/configure.tgt have seen a
major cleanup, making the support for various Solaris versions explicit,
correcting several inconsistencies, and making it easier to remove support
for some versions in the future.

* All 32-bit-only configurations (Solaris < 7 on SPARC, Solaris < 10 on
  x86) only include the 32-bit target vectors and linker emulations.

* For 32-bit-default targets on 64-bit systems (Solaris >= 7 on SPARC,
  Solaris >= 10 on x86), the 32-bit target vectors and linker emulations
  are the default while supporting the 64-bit ones.

* For 64-bit-default targets on 64-bit systems, it's the other way round.
  They default to 64-bit target vectors etc. while also supporting the
  32-bit ones.

* Added a warning to all Solaris cases in config.bfd not to include the
  non-*_sol2 vectors to avoid the ambiguity reported in PR binutils/27666.

* On x86, the iamcu target vectors and linker emulations have been
  removed: Solaris never supported the Intel MCU.

* On x86, the PE and PEI target vectors have been removed: they were only
  supported in binutils proper.  Their only use would be on EFI files
  e.g. in GRUB, which doesn't justify their inclusion.

* With iamcu support gone, a few gas tests had to be disabled as on
  VxWorks.

* The 32-bit Solaris/x86 ld configuration currently includes the
  elf_i386_ldso emulation, which was never a emulation in its own right but
  just an implementation detail of the elf_i386_sol2 emulation.  Instead,
  the settings that are not already provided by sourced .sh files are moved
  into elf_i386_sol2.sh.  Many settings became superfluous by just sourcing
  elf_i386.sh as is already done in elf_x86_64_sol2.sh, massively
  simplifying the emulation.

* Solaris-specific settings in generic emulparams scripts have been moved
  to the *_sol2.sh files.

* NATIVE_LIB_DIRS in ld/configure.tgt now uses the default setting:
  /usr/ccs/lib contains just a bunch of symlinks into /usr/lib at least
  since Solaris 8.

* ld/emulparams/solaris2.sh now sets ELF_INTERPRETER_NAME to
  /usr/lib/amd64/ld.so.1, matching both the native linker and
  elf_i386_sol2.sh.

* The SEARCH_DIR statements in linker scripts on 64-bit targets contained
  both the native (64-bit) and non-default (32-bit) directies.  The latter
  are completely pointless and are omitted using a new
  LIBPATH_SKIP_NONNATIVE setting.

Tested on {amd64,i386}-pc-solaris2.11 and {sparcv9,sparc}-sun-solaris2.11,
and {x86_64,i686}-pc-linux-gnu as well as with gcc trunk bootstraps on the
Solaris targets.  On those, I've compared the gas/ld and gas/gld 2.45.50
testresults with 2.45 ones.

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

bfd:
* config.bfd <i[3-7]86-*-solaris2*>: Split into ...
<i[3-7]86-*-solaris2.1[01]*> ... this.
(targ_selvecs): Remove iamcu_elf32_vec, i386_coff_vec, i386_pei_vec.
(targ64_selvecs): Remove x86_64_pe_vec, x86_64_pei_vec.
<i[3-7]86-*-solaris2.[0-9]*>: ... and this.
[BFD64] <x86_64-*-solaris2*>: Change into x86_64-*-solaris2.1[01]*.
(targ_defvecs): Change to x86_64_elf64_sol2_vec.
(targ_selvecs): Remove iamcu_elf32_vec, i386_coff_vec,
i386_pei_vec, x86_64_pe_vec, x86_64_pei_vec.
<sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*>: Split into ...
<sparc-*-solaris2.[7-9]* | sparc-*-solaris2.1[01]*>: ... this.
<sparc-*-solaris2.[0-6]*>: ... this.
[BFD64] <sparc-*-solaris2* | sparcv9-*-solaris2* |
sparc64-*-solaris2*>: Omit sparc-*-solaris2*.
(targ_defvec): Swap with targ_selvecs.

* testsuite/gas/i386/i386.exp: Disable iamcu tests on Solaris.

ld:
* configure.tgt <i[3-7]86-*-solaris2>: Split into ...
<i[3-7]86-*-solaris2.1[01]*>: .. this.
(targ_extra_emuls): Remove elf_i386_ldso and elf_iamcu.
<i[3-7]86-*-solaris2.[0-9]*>: ... and this.
<sparc64-*-solaris2*, sparcv9-*-solaris2*>: Change into ...
<sparc64-*-solaris2.[7-9]* | sparc64-*-solaris2.1[01]* |
sparcv9-*-solaris2.[7-9]* | sparcv9-*-solaris2.1[01]*>: ... this
(targ_extra_emuls): Reorder.
(tdir_elf32_sparc): Remove.
<sparc-*-solaris2.[7-9]* | sparc-*-solaris2.1[01]*>: New case.
<sparc-*-solaris2.[0-6]*, sparc-*-solaris2.[0-6].*>: Change into ...
<sparc-*-solaris2.[0-6]*>: ... this.
<sparc-*-solaris2*>: Remove.
<x86_64-*-solaris2*>: Change into ...
<x86_64-*-solaris2.1[01]*>: ... this.
(targ_extra_emuls): Reorder.  Remove elf_i386_ldso, elf_iamcu.
(tdir_elf_i386): Remove.
(NATIVE_LIB_DIRS): Remove Solaris handling.

* emulparams/elf32_sparc_sol2.sh (ELF_INTERPRETER_NAME): New
variable.
* emulparams/elf64_sparc.sh <sparc*-solaris*> (LIBPATH_SUFFIX):
Move ...
* emulparams/elf64_sparc_sol2.sh: ... here.
(LIBPATH_SKIP_NONNATIVE): New variable.
(ELF_INTERPRETER_NAME): Likewise.
* emulparams/elf_i386_ldso.sh: Merge into ...
* emulparams/elf_i386_sol2.sh: ... this.
Remove duplicate variables.
Source elf_i386.sh instead of elf_i386_ldso.sh.
* emulparams/elf_x86_64.sh <*-*-solaris2*> (ELF_INTERPRETER_NAME):
Move ...
* emulparams/elf_x86_64_sol2.sh: ... here.
Use /usr/lib/amd64/ld.so.1.
(LIBPATH_SKIP_NONNATIVE): New variable.
* emulparams/solaris2.sh: Fix comment.

* genscripts.sh: Fix typos.
Heed LIBPATH_SKIP_NONNATIVE.

3 days agolto: Compile LTO 15 test with -fno-fat-lto-objects
H.J. Lu [Thu, 11 Dec 2025 00:33:05 +0000 (08:33 +0800)] 
lto: Compile LTO 15 test with -fno-fat-lto-objects

When -ffat-lto-objects is used to compile binutils, LTO 15 test fails on
32-bit targets the same way as -fno-lto, where the builtin function is
used to divide unsigned 64-bit integers.  Compile LTO 15 test with
-fno-fat-lto-objects so that it passes on both 32-bit and 64-bit targets.

PR ld/33709
* testsuite/ld-plugin/lto.exp (lto_link_tests): Compile lto-15a.c
and lto-15b.c with -fno-fat-lto-objects.

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

4 days agoLoongArch32: Fix and add testcases
Lulu Cai [Thu, 6 Nov 2025 11:32:53 +0000 (19:32 +0800)] 
LoongArch32: Fix and add testcases

Fixed several test failures caused by the LoongArch32 assembler adding
labels during assembly. Additionally, skipped tests specific to LoongArch64.

Add test for new relocations.
Add test for tls type transition, got relaxation and call30 relaxation.

4 days agoLoongArch: Add linker relaxation for got_pcadd_hi20 and got_pcadd_lo12
mengqinggang [Mon, 22 Sep 2025 03:43:41 +0000 (11:43 +0800)] 
LoongArch: Add linker relaxation for got_pcadd_hi20 and got_pcadd_lo12

.L1:
pcaddu12i $t0, %got_pcadd_hi20(a)     -> pcaddu12i $t0, %pcadd_hi20(a)
ld.w/d $t0, $t0, %got_pcadd_lo12(.L1) -> addi.w/d $t0, $t0, %pcadd_lo12(.L1)

4 days agoLoongArch: Add support for tls type transition on LA32
mengqinggang [Sun, 21 Sep 2025 06:43:49 +0000 (14:43 +0800)] 
LoongArch: Add support for tls type transition on LA32

desc -> le
ie -> le
desc -> ie

For desc/ie -> le, need to change the symbol of le_lo12 to the symbol of
[desc|ie]_pcadd_hi20.

4 days agoLoongArch: Add linker relaxation support for R_LARCH_CALL30
mengqinggang [Tue, 9 Sep 2025 07:39:38 +0000 (15:39 +0800)] 
LoongArch: Add linker relaxation support for R_LARCH_CALL30

Relax call30 to bl, relax tail30 to b.

4 days agoLoongArch: LA32R macros expand
mengqinggang [Mon, 8 Sep 2025 09:01:46 +0000 (17:01 +0800)] 
LoongArch: LA32R macros expand

Define a symbol .Lpcadd_hi* at R_LARCH_*_PCADD_HI20
if the instruction expand from macro.
Change the symbol of R_LARCH_PCADD_LO12 to .Lpcadd_hi*
if the instruction expand from macro.

4 days agoLoongArch: LA32 macros support
mengqinggang [Wed, 8 Oct 2025 05:25:06 +0000 (13:25 +0800)] 
LoongArch: LA32 macros support

Change pcalau12i to pcaddu12i for LA32 macros.
Add call/tail and call30/tail30 macros, call/tail can expand to
call36/tail36 or call30/tail30 by mabi option.

4 days agoLoongArch: Add processing for LA32/LA32R relocations
mengqinggang [Sun, 7 Sep 2025 09:43:56 +0000 (17:43 +0800)] 
LoongArch: Add processing for LA32/LA32R relocations

R_LARCH_CALL30:
  pcaddu12i $ra, %call30(func)
  jirl     $ra, $ra, 0
Similar with R_LARCH_CALL36, pcaddu12i and jirl must be adjacent.

R_LARCH_PCADD_HI20, R_LARCH_PCADD_LO12:
.Lpcadd_hi0:
  pcaddu12i $t0, %pcadd_hi20(sym)
  addi.w    $t0, $t0, %pcadd_lo12(.Lpcadd_hi0)
Similar with RISCV PCREL_HI20, PCREL_LO12, R_LARCH_PCADD_LO12 reference to the
symbol at R_LARCH_PCADD_HI20.

4 days agoLoongArch: Add LA32 and LA32R relocations
mengqinggang [Sun, 7 Sep 2025 07:47:56 +0000 (15:47 +0800)] 
LoongArch: Add LA32 and LA32R relocations

LA32 and LA32R do not have pcaddu18i.
LA32R does not have pcalau12i.

Add R_LARCH_CALL30 for pcaddu12i + jirl used in LA32 and LA32R.
Add R_LARCH_*_PCADD_HI20 for pcaddu12i used in LA32R.
Add R_LARCH_*_PCADD_LO12 for addi.w/ld.w used in LA32R.

4 days agoLoongArch: Enable all instructions by default on LA32 like LA64
mengqinggang [Sun, 7 Sep 2025 07:24:55 +0000 (15:24 +0800)] 
LoongArch: Enable all instructions by default on LA32 like LA64

Glibc checks LSX/LASX support when configure.
Kernel has float instructions but with -msoft-float option.

4 days agoLoongArch: Add R_LARCH_TLS_LE_ADD_R relocation support for add.w
mengqinggang [Mon, 5 May 2025 03:29:52 +0000 (11:29 +0800)] 
LoongArch: Add R_LARCH_TLS_LE_ADD_R relocation support for add.w

Fix compiler error for "add.w $r12,$r12,$r2,%le_add_r(a)".

4 days agoLoongArch: Change DWARF2_CIE_DATA_ALIGNMENT to -4 for loongarch32
Jiajie Chen [Mon, 16 Dec 2024 07:27:36 +0000 (15:27 +0800)] 
LoongArch: Change DWARF2_CIE_DATA_ALIGNMENT to -4 for loongarch32

4 days agoLoongArch: Enable loongarch_elf64_vec loongarch64_pei_vec on LA32 target
mengqinggang [Mon, 8 Sep 2025 08:43:05 +0000 (16:43 +0800)] 
LoongArch: Enable loongarch_elf64_vec loongarch64_pei_vec on LA32 target

Fix -march=loongarch64 error on LA32 target.

4 days agoRevert "[gdb/guile] Use SCM_DEBUG_TYPING_STRICTNESS 0"
Thiago Jung Bauermann [Wed, 3 Dec 2025 23:15:13 +0000 (20:15 -0300)] 
Revert "[gdb/guile] Use SCM_DEBUG_TYPING_STRICTNESS 0"

This reverts commit 852cbc7ffadf9daf173e13ea56caff49d52733af.

It fixed the build with libguile v2.0.9, but now GDB only supports
Guile >= 2.2.

I was able to build GDB using -std=c++20 with both Guile 2.2 and
Guile 3.0 (tested with GCC 14.3) without any error or warning.

Approved-By: Tom Tromey <tom@tromey.com>
4 days agoGDB: Guile: Remove procedures ineffectual since Guile 2.2
Thiago Jung Bauermann [Fri, 5 Dec 2025 04:05:49 +0000 (01:05 -0300)] 
GDB: Guile: Remove procedures ineffectual since Guile 2.2

The manual mentions since GDB 10 that the functions for getting and setting
the size of memory port buffers are deprecated, and don't work when using
Guile 2.2 or later.  Since now GDB only supports Guile 2.2 and newer,
perform the promised removal.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
4 days agoGDB: Guile: Remove code meant for Guile < 2.2
Thiago Jung Bauermann [Thu, 4 Dec 2025 22:30:50 +0000 (19:30 -0300)] 
GDB: Guile: Remove code meant for Guile < 2.2

Approved-By: Tom Tromey <tom@tromey.com>
4 days agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 days ago[gdb] Fix whitespace in NEWS
Tom de Vries [Tue, 9 Dec 2025 23:25:20 +0000 (00:25 +0100)] 
[gdb] Fix whitespace in NEWS

Fix this:
...
$ empty=$(git hash-object -t tree /dev/null)
$ git diff-index --check $empty gdb/NEWS
gdb/NEWS:1874: space before tab in indent.
+                            [--basename | --dirname]
...
and add the file to the clean list in
gdb/contrib/check-whitespace-pre-commit.py.

[ I'm not sure if NEWS has an official style.

There are no settings for NEWS in .gitattributes, so the whitespace attribute
defaults to trailing-space (shorthand for blank-at-eol, blank-at-eof) and
space-before-tab.

We could require either spaces only (tab-in-indent) in gdb/.gitattributes:
...
NEWS whitespace=space-before-tab,tab-in-indent,trailing-space
...
or tab style (indent-with-non-tab):
...
NEWS whitespace=space-before-tab,indent-with-non-tab,trailing-space
...

For tab-in-indent, we get:
...
$ git diff-index --check $empty gdb/NEWS  | wc -l
228
...
and for indent-with-non-tab instead:
...
$ git diff-index --check $empty gdb/NEWS  | wc -l
40
...
so the more common style seems to be tab style.

But I'm leaving this as is for now. ]

4 days ago[gdb] Fix whitespace in *.def
Tom de Vries [Tue, 9 Dec 2025 23:25:20 +0000 (00:25 +0100)] 
[gdb] Fix whitespace in *.def

Add indent-with-non-tab for *.def in gdb*/.gitattributes.

Fix whitespace in the *.def files in gdb*, and add these files to the clean
list in gdb/contrib/check-whitespace-pre-commit.py.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
4 days ago[gdb] Fix whitespace in *.[ly]
Tom de Vries [Tue, 9 Dec 2025 23:25:19 +0000 (00:25 +0100)] 
[gdb] Fix whitespace in *.[ly]

Add indent-with-non-tab for *.[ly] in gdb/.gitattributes.

Fix whitespace in the *.[ly] files in gdb, and add these files to the clean
list in gdb/contrib/check-whitespace-pre-commit.py.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
4 days ago[gdb] Fix whitespace in *.c
Tom de Vries [Tue, 9 Dec 2025 23:25:19 +0000 (00:25 +0100)] 
[gdb] Fix whitespace in *.c

Fix whitespace in the *.c files in gdb, and add these files to the clean list
in gdb/contrib/check-whitespace-pre-commit.py.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
4 days ago[gdb] Fix whitespace in *.h
Tom de Vries [Tue, 9 Dec 2025 23:25:19 +0000 (00:25 +0100)] 
[gdb] Fix whitespace in *.h

Fix whitespace in the *.h files in gdb, and add these files to the clean list
in gdb/contrib/check-whitespace-pre-commit.py.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
4 days agox86: Add _bfd_elf_x86_copy_special_section_fields
H.J. Lu [Mon, 8 Dec 2025 23:33:28 +0000 (07:33 +0800)] 
x86: Add _bfd_elf_x86_copy_special_section_fields

When Linux/x86 objcopy is used on Solaris binary, it sets EI_OSABI to
ELFOSABI_SOLARIS, but it doesn't set the sh_info and sh_link fields of
Solaris specific sections.

Add _bfd_elf_x86_copy_special_section_fields to return false for Solaris
binary to properly set the sh_info and sh_link fields of Solaris specific
sections.

PR binutils/33705
* elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
Removed.
(elf_backend_copy_special_section_fields): Likewise.
* elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
Likewise.
(elf_backend_copy_special_section_fields): Likewise.
* elfxx-x86.c (_bfd_elf_x86_copy_special_section_fields): New.
* elfxx-x86.h (_bfd_elf_x86_copy_special_section_fields): Likewise.
(elf_backend_copy_special_section_fields): Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 days agoPartly rewrite dwarf2_get_symbol_read_needs
Tom Tromey [Fri, 14 Nov 2025 21:43:27 +0000 (14:43 -0700)] 
Partly rewrite dwarf2_get_symbol_read_needs

This patch partly rewries dwarf2_get_symbol_read_needs.  The goal is
to simplify it and perhaps make it a little more efficient.

With this patch, if an operation simply continues to the next
operation in the expression, then no manipulation of ops_to_visit is
needed.  This avoids excess pushes and pops.

Also, visited_ops is changed to be a std::vector<bool> rather than a
map.

Regression tested on x86-64 Fedora 41.

5 days agoImplement local-environment commands
Tom Tromey [Wed, 11 Dec 2024 18:33:12 +0000 (11:33 -0700)] 
Implement local-environment commands

A user noted that "set environment" does not affect things like
"shell" or "pipe".  This makes some sense, because the environment is
per-inferior, and also in the general case it may be affecting a
remote machine -- i.e., the settings may not be locally appropriate.

This patch adds a new set of "local-environment" commands (set, show,
and unset) that affect gdb's own environment.

Approved-By: Andrew Burgess <aburgess@redhat.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
5 days agoAllow NULL to be passed to environment-related functions
Tom Tromey [Wed, 11 Dec 2024 18:25:08 +0000 (11:25 -0700)] 
Allow NULL to be passed to environment-related functions

This changse the various environment-related helper functions to
accept a NULL environment pointer.  This special case means that the
function should affect gdb's global environment.

Approved-By: Andrew Burgess <aburgess@redhat.com>
Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
5 days agoSwitch environment-related functions to accept a pointer
Tom Tromey [Wed, 11 Dec 2024 18:20:47 +0000 (11:20 -0700)] 
Switch environment-related functions to accept a pointer

This changes the environment-related helper functions to accept a
pointer argument rather than a reference.

Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
5 days agoRefactor environment-related commands
Tom Tromey [Wed, 11 Dec 2024 18:11:41 +0000 (11:11 -0700)] 
Refactor environment-related commands

This patch refactors the various environment-related commands into
functions that accept gdb_environ parameter.

Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
5 days agoRewrite the "show environment" test
Tom Tromey [Tue, 9 Dec 2025 14:57:51 +0000 (07:57 -0700)] 
Rewrite the "show environment" test

In a review early in the year:

    https://inbox.sourceware.org/gdb-patches/874iz3f4ek.fsf@redhat.com/

Andrew pointed out that a new test I proposed failed with read1.
This test was essentially a copy of gdb.base/environ.exp.

I couldn't reproduce the read1 problem, but this patch rewrites the
one test there that seems like it could possibly fail in this mode.
Now it uses line-by-line mode and checks for a certain environment
variable appearing in the output.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 days agogdb: remove unused includes from c-lang.{c,h}
Simon Marchi [Mon, 8 Dec 2025 20:02:41 +0000 (15:02 -0500)] 
gdb: remove unused includes from c-lang.{c,h}

These includes are reported as unused by clangd.

Change-Id: Ib5c655d9c96e7a612e223bd87d124f90112acc5a

5 days agogdb: remove unused arch-utils.h include from solib-rocm.c
Simon Marchi [Mon, 8 Dec 2025 19:37:40 +0000 (14:37 -0500)] 
gdb: remove unused arch-utils.h include from solib-rocm.c

This include is reported as unused by clangd.

Change-Id: I4fe6048d072d445a2133ac17887fe37ccc5e2d90

5 days agogdb: adjust guile 2.0 NEWS entry
Simon Marchi [Tue, 9 Dec 2025 16:29:29 +0000 (11:29 -0500)] 
gdb: adjust guile 2.0 NEWS entry

I forgot to update the previous patch based on a review comment before
pushing.

Change-Id: Ib357d105ba67725bfa4772f95d0b658456173be6

5 days agogdb: more guile 2.0 support removal
Simon Marchi [Thu, 4 Dec 2025 17:25:13 +0000 (12:25 -0500)] 
gdb: more guile 2.0 support removal

Commit f14bbacae00d ("gdb/guile: remove support for Guile < 2.2")
removed some code supporting Guile 2.0.  This patch removes more bits
related to Guile 2.0, and adds a NEWS entry.

 * Remove Guile 2.0 mention from the doc.

 * Remove HAVE_GUILE_MANUAL_FINALIZATION, assume it is always true.

 * Remove guile-2.0 from the versions automatically tried by configure.

 * Remove check for scm_new_smob (HAVE_SCM_NEW_SMOB), assume it is
   always true.

 * Remove hack to fill ac_cv_guild_program_name when the .pc file
   wouldn't specify it.

Tested by rebuilding against guile-3.0 and guile-2.2.

Change-Id: I2e89bcd4a4429262f4c3a1c74b275768e60f0cb0
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
5 days agoBFD: Unify relocation error reporting
Maciej W. Rozycki [Tue, 9 Dec 2025 12:38:52 +0000 (12:38 +0000)] 
BFD: Unify relocation error reporting

A couple of targets use virtually the same code for error reporting in
relocation processing.  Merge the copies, removing small discrepancies
such as a fallback call to `abort' for NDS32 targets as per PR 17512,
and factor out for backends to use.

5 days agogdb: fix build error after forward_scope_exit changes
Andrew Burgess [Tue, 9 Dec 2025 10:34:11 +0000 (10:34 +0000)] 
gdb: fix build error after forward_scope_exit changes

After commit:

  commit 43db8f70d86b2492b79f59342187b919fd58b3dd
  Date:   Thu Oct 23 16:34:20 2025 +0100

      gdbsupport: remove undefined behaviour from (forward_)scope_exit

A build failure was reported[1] when using clang++.  The failure looks
like this:

    CXX    aarch64-fbsd-tdep.o
  In file included from /tmp/src/binutils-gdb/gdb/aarch64-fbsd-tdep.c:22:
  In file included from /tmp/src/binutils-gdb/gdb/gdbarch.h:28:
  In file included from /tmp/src/binutils-gdb/gdb/infrun.h:21:
  In file included from /tmp/src/binutils-gdb/gdb/gdbthread.h:35:
  /tmp/src/binutils-gdb/gdb/../gdbsupport/forward-scope-exit.h:112:20: error: too many template arguments
  for class template 'forward_scope_exit_policy'
    112 |         = scope_exit_base<forward_scope_exit_policy<Function,
        |                           ^
    113 |                                                     function, Res, Args...>>;
        |                                                                    ~~~~~~~~
  /tmp/src/binutils-gdb/gdb/../gdbsupport/forward-scope-exit.h:82:8: note: template is declared here
     81 | template<typename Function, Function *function, typename Signature>
        | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     82 | struct forward_scope_exit_policy;
        |        ^

The problem is that the forward_scope_exit_policy class expects 3
template arguments, but in forward-scope-exit.h we say:

  template<typename Function, Function *function,
    typename Res, typename... Args>
  using forward_scope_exit
   = scope_exit_base<forward_scope_exit_policy<Function,
       function, Res, Args...>>;

Which passes 4 template arguments.  Fix this by changing the above
'using' like too:

  template<typename Function, Function *function, typename Signature>
  using forward_scope_exit
   = scope_exit_base<forward_scope_exit_policy<Function, function,
       Signature>>;

This now compiles with clang++.

5 days agotail recursion in _bfd_elf_link_hide_symbol
Alan Modra [Tue, 9 Dec 2025 07:25:53 +0000 (17:55 +1030)] 
tail recursion in _bfd_elf_link_hide_symbol

We can clear the flags first if no backend hide_symbol function tests
or sets them, which is true.

* elflink.c (_bfd_elf_link_hide_symbol): Clear flags before
calling elf_backend_hide_symbol, to enable tail recursion.

5 days agogold testsuite volatile fixes
Alan Modra [Tue, 9 Dec 2025 07:25:12 +0000 (17:55 +1030)] 
gold testsuite volatile fixes

Avoid these mainline gcc complaints (C23 WG14 n2743).
copy_test_relro.cc:42:5: error: ‘++’ expression of ‘volatile’-qualified type is deprecated [-Werror=volatile]
icf_test_pr21066.cc:50:55: error: ‘volatile’-qualified parameter is deprecated [-Werror=volatile]

* testsuite/copy_test_relro.cc (segv): Avoid gcc warning.
* testsuite/icf_test_pr21066.cc (capture_exception_of_type):
Likewise.

5 days agobitwise operation between different enumeration types
Alan Modra [Tue, 9 Dec 2025 07:16:29 +0000 (17:46 +1030)] 
bitwise operation between different enumeration types

mips.cc:9478:50: error: bitwise operation between different enumeration types ‘elfcpp::<unnamed enum>’ and ‘elfcpp::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
 9478 |           merged_flags &= ~(elfcpp::EF_MIPS_ARCH | elfcpp::EF_MIPS_MACH);
      |                             ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

* mips.h: Define all the EF_MIPS values in one enum.

5 days agoLoongArch: Add support for the ud macro instruction
Lulu Cai [Fri, 28 Nov 2025 07:54:58 +0000 (15:54 +0800)] 
LoongArch: Add support for the ud macro instruction

In the "ud ui5" macro, the value of ui5 must be in the range 0–31. It
expands to "amswap.w $rd, $r1, $rj", where ui5 specifies the register
number for $rd in the amswap.w instruction, and $rd == $rj.

The test case have been adjusted to no longer report errors for illegal
operands of the amswap.w instruction.

gas/

* config/tc-loongarch.c (check_this_insn_before_appending): No
  longer check amswap.w.
* testsuite/gas/loongarch/illegal-operand.l: Update.
* testsuite/gas/loongarch/illegal-operand.s: Update.
* testsuite/gas/loongarch/macro_ud.d: New test.
* testsuite/gas/loongarch/macro_ud.s: New test.

include/

* opcode/loongarch.h: Add new macro for amswap.w.

opcodes/

* loongarch-opc.c: Add macro for ud.

5 days agolto-wrapper warning note
Alan Modra [Tue, 9 Dec 2025 00:26:03 +0000 (10:56 +1030)] 
lto-wrapper warning note

Current gcc adds a note to the LTO "using serial compilation" warning.

* lib/binutils-common.exp (prune_warnings_extra): Remove
lto-wrapper note.

5 days agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 days agoi386: Add GLIBC_ABI_GNU_TLS dependency only if used
H.J. Lu [Mon, 8 Dec 2025 02:06:43 +0000 (10:06 +0800)] 
i386: Add GLIBC_ABI_GNU_TLS dependency only if used

Add GLIBC_ABI_GNU_TLS version dependency only if ___tls_get_addr is
referenced by regular object.

bfd/

PR ld/33287
PR ld/33702
* elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set
has_tls_get_addr_call only if referenced by regular object.

ld/

PR ld/33287
PR ld/33702
* testsuite/ld-i386/i386.exp: Run PR ld/33702 test.
* testsuite/ld-i386/no-tls.c: New file.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 days agoRevert "Re: Add warning message to readelf for local symbols"
Alan Modra [Mon, 8 Dec 2025 21:02:57 +0000 (07:32 +1030)] 
Revert "Re: Add warning message to readelf for local symbols"

This reverts commit f70242a98f91b7f5ec5b375346d8bfa7f9a61c4a.
Nick already applied this..

6 days agoRe: Add warning message to readelf for local symbols
Alan Modra [Mon, 8 Dec 2025 09:14:35 +0000 (19:44 +1030)] 
Re: Add warning message to readelf for local symbols

Limit the warning to ET_REL.

6 days ago[gdb/contrib] Add more clean files in check-whitespace-pre-commit.py
Tom de Vries [Mon, 8 Dec 2025 20:05:04 +0000 (21:05 +0100)] 
[gdb/contrib] Add more clean files in check-whitespace-pre-commit.py

Add gdbsupport and gdbserver as whitespace-clean in
gdb/contrib/check-whitespace-pre-commit.py.

Likewise for *.ac and *.m4.

Also drop the ignore of configure, that's already taken care of in
.gitattributes.

Approved-By: Tom Tromey <tom@tromey.com>
6 days ago[gdb/testsuite] Simplify gdb.multi/remote-with-running-inferior.exp
Tom de Vries [Mon, 8 Dec 2025 15:38:29 +0000 (16:38 +0100)] 
[gdb/testsuite] Simplify gdb.multi/remote-with-running-inferior.exp

Simplify regexps in test-case gdb.multi/remote-with-running-inferior.exp using
string_to_regexp and {}.

While we're at it, also break an overly long line.

Tested on x86_64-linux.

6 days ago[gdb/testsuite] Fix two typos in gdb.multi/remote-with-running-inferior.exp
Tom de Vries [Mon, 8 Dec 2025 15:38:28 +0000 (16:38 +0100)] 
[gdb/testsuite] Fix two typos in gdb.multi/remote-with-running-inferior.exp

Fix two typos in test-case gdb.multi/remote-with-running-inferior.exp.

6 days ago[gdb/testsuite] Fix FAIL in gdb.multi/remote-with-running-inferior.exp
Tom de Vries [Mon, 8 Dec 2025 15:38:28 +0000 (16:38 +0100)] 
[gdb/testsuite] Fix FAIL in gdb.multi/remote-with-running-inferior.exp

Occasionally, with test-case gdb.multi/remote-with-running-inferior.exp I run
into:
...
(gdb) continue^M
Continuing.^M
^M
Thread 1.1 "remote-with-run" hit Breakpoint 1.1, main () at \
  remote-with-running-inferior.c:31^M
31        for (int i = 0; i < 30; ++i)^M
(gdb) PASS: $exp: target_non_stop=auto: non_stop=off: \
  continue to breakpoint: continue to breakpoint in breakpt
bt 1^M
(gdb) FAIL: $exp: target_non_stop=auto: non_stop=off: \
  check inferior 1 is in breakpt
...

The problem is a race between:
- inferior 1 reaching main, and
- gdb setting a breakpoint on main.

If the breakpoint on main is set before inferior 1 reaches main, the
breakpoint triggers for inferior 1, which the test-case doesn't expect.

Fix this by setting the breakpoint on main only for inferior 2.

Tested on x86_64-linux.

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

6 days agoreadelf: Only check for out of bounds local symbols in object files
Alan Modra [Mon, 8 Dec 2025 15:12:26 +0000 (15:12 +0000)] 
readelf: Only check for out of bounds local symbols in object files

6 days agoFix typo in aarch64-opc.c
Nick Clifton [Mon, 8 Dec 2025 15:12:02 +0000 (15:12 +0000)] 
Fix typo in aarch64-opc.c

6 days agogdbsupport: remove undefined behaviour from (forward_)scope_exit
Andrew Burgess [Thu, 23 Oct 2025 15:34:20 +0000 (16:34 +0100)] 
gdbsupport: remove undefined behaviour from (forward_)scope_exit

Our implementation of scope_exit and forward_scope_exit make use of
the Curiously Recurring Template Pattern (CRTP) to provide the
"release" functionality, this is done in the scope_exit_base class in
scope-exit.h.

The interesting (for this commit) parts of scope_exit_base look like
this:

  template <typename CRTP>
  class scope_exit_base
  {
  public:
    scope_exit_base () = default;

    ~scope_exit_base ()
    {
      if (!m_released)
        {
   auto *self = static_cast<CRTP *> (this);
   self->on_exit ();
        }
    }

    ... snip ...
  };

By the time ~scope_exit_base is called the destructor for the derived
class (called CRTP here) has already been run, which means any data
members in the derived class will have also have had their destructors
run.  As a result of this I believe that casting 'this' to the derived
type, and then calling the on_exit method is undefined behaviour, as
'this' can no longer be considered a valid instance of CRTP (the CRTP
part has been destructed).

In reality, the memory for the derived type is not reclaimed until
after ~scope_exit_base has finished, so as long as the data members of
the derived type are Plain Old Data (POD), then the current code
should be just fine; any data members of the derived class will remain
in place, and untouched, until ~scope_exit_base has completed.

But still, I don't think we should rely on undefined behaviour.

I actually ran into this when, in another series, I tried to reuse
scope_exit_base with a class where a data member was not POD, and in
this case GDB would crash because my new on_exit function was making
use of the non-POD data member after it had been destructed, and
resources released.

I propose that we move away from the CRTP, and instead flip the class
hierarchy.  Instead of derived classes like scope_exit inheriting from
scope_exit_base, scope_exit_base should inherit from scope_exit.

What this means, is that when ~scope_exit_base is called, ~scope_exit
will not yet have been run, and the data members of scope_exit will
still be valid.

To allow the existing names to be used, the plan is that the existing
scope_exit and forward_scope_exit classes are renamed to
scope_exit_policy and forward_scope_exit_policy.  These policy classes
will then be injected via a template argument as the base class for
scope_exit_base.  Finally, we can:

  template<typename EF>
  using scope_exit = scope_exit_base<scope_exit_policy<EF>>;

which defines the scope_exit type.  This type is a drop in replacement
with all of GDB's existing code, but avoids the undefined behaviour.
We can do something similar with forward_scope_exit.

There should be no user visible changes after this commit.

6 days agoreadelf: Do not warn about mapping symbols that extend beyond the end of mergeable...
Nick Clifton [Mon, 8 Dec 2025 12:17:28 +0000 (12:17 +0000)] 
readelf: Do not warn about mapping symbols that extend beyond the end of mergeable sections

6 days agoRevert "gdb/record_full: add ptid entry for history."
Guinevere Larsen [Mon, 8 Dec 2025 11:54:39 +0000 (08:54 -0300)] 
Revert "gdb/record_full: add ptid entry for history."

This reverts commit b8524f61e398072f83938fb805f377f22198f9a9.

It was pushed by mistake with an unrelated patch.

6 days agobfd: fix build with C23
Guinevere Larsen [Fri, 5 Dec 2025 18:55:38 +0000 (15:55 -0300)] 
bfd: fix build with C23

Starting in C23, strchr and strrchr will return const char *, if fed a
const char *.  This means that several files in the BFD directory will
fail to build as they are assigning the return of those functions to a
char *.

Fix this by const-ifying several variables. The only place where that
wasn't just that was in targets.c, where a variable was being used in
subsequent strrchr invocations to change the underlying string, so a new
variable had to be introduced.

No user-visible change should happen after this commit.

6 days agogdb/record_full: add ptid entry for history.
Guinevere Larsen [Thu, 30 Oct 2025 20:43:55 +0000 (17:43 -0300)] 
gdb/record_full: add ptid entry for history.

For record full to work on multi-threaded inferiors, we must know to
which thread any given recorded instruction belongs to. This commit adds
this as a new entry for each instruction when an inferior is
multi-threaded. This way, when replaying the instruction, the subsystem
is able to change inferior thread as needed, and avoid SIGILLs when
changing stuff

Ideally, we would only add the PTID entry when we actually need to
switch threads, but that is left as a future improvement.

WIP: replaying doesn't automatically change threads yet, but there was
an attempt

6 days agoPR 33676 ld segfaults when using binary input inside NOLOAD
Magnus Wållberg [Mon, 8 Dec 2025 09:33:40 +0000 (20:03 +1030)] 
PR 33676 ld segfaults when using binary input inside NOLOAD

The code at ldlang.c:2840-2841 checks if the output BFD is ELF format,
then unconditionally uses elf_section_type() on the input section
without verifying the input section is also ELF format.

This was introduced in commit d87be451e (PR ld/32787) which added
special handling for NOLOAD note sections.

PR 33676
PR 32787
* ldlang.c (lang_add_section): Check section owner's BFD
flavour before using elf_section_type.

6 days agoPR 33701, abort in byte_get_little_endian
Alan Modra [Mon, 8 Dec 2025 05:34:44 +0000 (16:04 +1030)] 
PR 33701, abort in byte_get_little_endian

PR 33701
* dwarf.c (process_debug_info): Set debug_info_p NULL when
DEBUG_INFO_UNAVAILABLE.

6 days agoPR 33698 and PR 33700
Alan Modra [Mon, 8 Dec 2025 05:30:16 +0000 (16:00 +1030)] 
PR 33698 and PR 33700

It is possible for dump_relocations to return on an error from
slurp_rela_relocs or slurp_rel_relocs without writing to
"all_relocations".  In that case an uninitialised r_symbol is passed
to free at the end of process_got_section_contents.

PR 33698
PR 33700
* readelf.c (update_all_relocations): Zero array.  Remove
unnecessary casts.

6 days agoPR 33697, fuzzer segfault
Alan Modra [Mon, 8 Dec 2025 05:28:33 +0000 (15:58 +1030)] 
PR 33697, fuzzer segfault

PR 33697
* readelf.c (process_relocs): Don't segfault on no sections.

6 days agoGAS: Change S parameter of find_no_app to CHAR* in order to avoid problems with STRST...
Nick Clifton [Mon, 8 Dec 2025 09:11:23 +0000 (09:11 +0000)] 
GAS: Change S parameter of find_no_app to CHAR* in order to avoid problems with STRSTR returning a CONST CHAR*

PR 33696

6 days ago[gdb/build] Add gdb subdirs in gdb.pot
Tom de Vries [Mon, 8 Dec 2025 08:30:25 +0000 (09:30 +0100)] 
[gdb/build] Add gdb subdirs in gdb.pot

I found that gettext strings from gdb/cli are not added to gdb.pot.

Fix this by explicitly listing the gdb subdirs in the po/$(PACKAGE).pot rule
in gdb/Makefile.in.

Tested by doing:
...
$ cd build/gdb
$ make po/gdb.pot
  ...
$ grep -c cli/ po/gdb.pot
345
...

6 days ago[gdb/build] Re-add *.[ch] in gdb.pot
Tom de Vries [Mon, 8 Dec 2025 08:30:25 +0000 (09:30 +0100)] 
[gdb/build] Re-add *.[ch] in gdb.pot

In commit 4a40fe05bf0 ("[gdb/build] Handle gdbsupport and gdbserver in
gdb.pot"), in order to handle '*.cc' files I did:
...
-   -name '*.[hc]' -print
+   -name '*.[hc]' -o -name '*.cc' -print
...
but failed to understand that this no longer printed the '*.[hc]' names.

Fix this by adding a '-print' for '*.[hc]'.

Tested by doing:
...
$ cd build/gdb
$ make po/gdb.pot
 ...
$ grep -c symtab.c po/gdb.pot
102
...

6 days agoelf: Add SHT_SUNW_ctf and SHT_SUNW_symnsort
H.J. Lu [Sat, 6 Dec 2025 02:17:39 +0000 (10:17 +0800)] 
elf: Add SHT_SUNW_ctf and SHT_SUNW_symnsort

On Solaris 11.4, there is SHT_SUNW_symnsort and no SHT_SUNW_symtabnsort.
SHT_SUNW_symnsort is defined to 0x6fffffec, which is the same as
SHT_SUNW_symtabnsort.  There is also SHT_SUNW_ctf.  Add SHT_SUNW_ctf and
rename SHT_SUNW_symtabnsort to SHT_SUNW_symnsort.  Move SHT_SUNW_phname
after SHT_SUNW_symnsort.

binutils/

* readelf.c (get_solaris_section_type): Add SHT_SUNW_ctf and
SHT_SUNW_symnsort.  Move SHT_SUNW_phname after SHT_SUNW_symnsort.
Remove SHT_SUNW_symtabnsort.

include/

* elf/common.h (SHT_SUNW_ctf): New.
(SHT_SUNW_symtabnsort): Renamed to ...
(SHT_SUNW_symnsort): This.
(SHT_SUNW_phname): Moved after SHT_SUNW_symnsort.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 days agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 days agoUnconditionally pass is_a_field_of_this in c-exp.y
Tom Tromey [Fri, 5 Dec 2025 18:43:08 +0000 (11:43 -0700)] 
Unconditionally pass is_a_field_of_this in c-exp.y

In a review to a different patch of mine, Simon asked for this change.
The idea here is that there's no need to pass null as the "field of
this" parameter, as lookup_language_this checks the language anyway.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
7 days ago[gdb/contrib] Check clean files in check-whitespace-pre-commit.sh
Tom de Vries [Sun, 7 Dec 2025 09:59:54 +0000 (10:59 +0100)] 
[gdb/contrib] Check clean files in check-whitespace-pre-commit.sh

The pre-commit check check-whitespace checks diffs.

Consequently, we detect something like this:
...
$ echo >> gdb/testsuite/lib/gdb.exp
$ git commit -a -m trailing-empty-line
  ...
check-whitespace.........................................................Failed
- hook id: check-whitespace
- duration: 0.01s
- exit code: 2

gdb/testsuite/lib/gdb.exp:11717: new blank line at EOF.
...

But say we work around the failing check using --no-verify, then we no longer
detect it after the commit has succeeded:
...
$ git commit -a -m trailing-empty-line --no-verify
[detached HEAD e6302105522] trailing-empty-line
 1 file changed, 1 insertion(+)
$ pre-commit run --all-files check-whitespace
check-whitespace.........................................................Passed
- hook id: check-whitespace
- duration: 0.3s
...

Fix this in check-whitespace-pre-commit.sh by distinguishing between clean and
other files.  Doing so is easier to do in a more advanced scripting language,
so rewrite into python.

Since a recent commit, gdb/testsuite is clean, so I'm using that as
simple classifier for now.

For the other files we do what we did before, and check just the staging area:
...
$ git --no-pager diff --staged --check "${other[@]}"
...

But for clean files, we check the entire file, including staged changes:
...
$ empty=$(git hash-object -t tree /dev/null)
$ git diff-index --cached --check $empty "${clean[@]}"
...

Consequently, we do see:
...
$ git commit -a -m trailing-empty-line --no-verify
[detached HEAD e6302105522] trailing-empty-line
 1 file changed, 1 insertion(+)
$ pre-commit run --all-files check-whitespace
check-whitespace.........................................................Failed
- hook id: check-whitespace
- duration: 0.64s
- exit code: 2

gdb/testsuite/lib/gdb.exp:11717: new blank line at EOF.
...

PR build/33616
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33616

7 days agoAutomatic date update in version.in
GDB Administrator [Sun, 7 Dec 2025 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in