]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
10 days agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Jul 2025 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 days agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Jul 2025 00:01:29 +0000 (00:01 +0000)] 
Automatic date update in version.in

11 days agogprofng: do not skip weak symbols
Dmitrii Bordukov [Sat, 19 Jul 2025 12:21:46 +0000 (15:21 +0300)] 
gprofng: do not skip weak symbols

PR gprofng/33151

gprofng ignores functions that are compiled as weak symbols. This
heavily affects C++ class methods that are always compiled by g++
and clang++ as weak symbols. In this case 'gprofng display text'
just displays <static>@ADDRESS(<FILENAME>) instead of proper method
name.

The bug has been introduced in the commit 470a0288a818.

11 days ago[gdb/cli] Document \001 and \002 usage for set prompt
Tom de Vries [Sat, 19 Jul 2025 15:37:01 +0000 (17:37 +0200)] 
[gdb/cli] Document \001 and \002 usage for set prompt

PR cli/28887 reports the following problem when using a custom prompt.

First, we set up the custom prompt (with ^ marking the position of the
blinking cursor on the line above):
...
$ gdb -q -ex "set prompt \033[31mgdb$ \033[0m"
gdb$
     ^
...

Then we type some string, and enter it into the command history:
...
gdb$ some long command
❌️ Undefined command: "some".  Try "help".
gdb$
     ^
...

We use C-p to fetch the previous command:
...
gdb$ some long command
                      ^
...
Sofar, so good.

Finally, we use C-a which should move the cursor to just after the prompt, but
instead we get:
...
gdb$ some long command
              ^
...

This is fixed by using \001 and \002:
...
(gdb) set prompt \001\033[31m\002gdb$ \001\033[0m\002
...
aka as RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE [1].

Add an example to the documentation showing the use of these markers.

The added example is the equivalent of the "\[\e[0;34m\](gdb)\[\e[0m\]"
example documented at gdb.prompt.substitute_string that can be used with
"set extended-prompt".

While working on this, I noticed that "show prompt" doesn't show back the
original string, using '\e' instead of '\033':
...
gdb$ show prompt
Gdb's prompt is "\001\e[31m\002gdb$ \001\e[0m\002".
...
and that the shown string can't be used as an argument to "set prompt":
...
gdb$ set prompt \001\e[31m\002gdb$ \001\e[0m\002
e[31mgdb$ e[0m
...

I've filed this as PR cli/33184.

Approved-By: Eli Zaretskii <eliz@gnu.org>
[1] https://tiswww.case.edu/php/chet/readline/readline.html

11 days ago[gdb/testsuite] Restructure gdb.base/backtrace-through-cu-nodebug.exp
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Restructure gdb.base/backtrace-through-cu-nodebug.exp

I noticed that the test names in test-case
gdb.base/backtrace-through-cu-nodebug.exp are a bit inconsistent:
...
PASS: $exp: no-cfi: maint frame-unwinder disable ARCH
PASS: $exp: verify no-filters unwind fail without CFI
PASS: $exp: maint flush register-cache
PASS: $exp: verify unwind fail without CFI
PASS: $exp: cfi: maint frame-unwinder disable ARCH
PASS: $exp: Verify unwinding works based only on CFI information
...

There's both a no-cfi prefix, and "without CFI".

Fix this by using proc_with_prefix, getting us a consistent prefix:
...
PASS: $exp: no-cfi: maint frame-unwinder disable ARCH
PASS: $exp: no-cfi: verify no-filters unwind fail
PASS: $exp: no-cfi: maint flush register-cache
PASS: $exp: no-cfi: verify unwind fail
PASS: $exp: cfi: maint frame-unwinder disable ARCH
PASS: $exp: cfi: Verify unwinding works
...

While we're at it, use multi_line to make a regexp more readable.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
11 days ago[gdb/testsuite] Fix gdb.base/backtrace-through-cu-nodebug.exp without python support
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Fix gdb.base/backtrace-through-cu-nodebug.exp without python support

With a gdb build without python support, and test-case
gdb.base/backtrace-through-cu-nodebug.exp I run into:
...
(gdb) bt^M
Required frame unwinder may have been disabled, \
  see 'maint info frame-unwinders'^M
(gdb) FAIL: $exp: verify unwind fail without CFI
...

With a gdb build with python support we have instead:
...
(gdb) bt^M
Python Exception <class 'gdb.error'>: \
  Required frame unwinder may have been disabled, \
  see 'maint info frame-unwinders'^M
(gdb) PASS: $exp: verify unwind fail without CFI
...
but if I change the "bt" into "bt -no-filters" I get the same FAIL and
corresponding output.

So there are two scenarios here.

In the first:
- the bt command is called
- frame #0 is printed
- trying to get the next frame fails and an error is thrown, aborting the
  backtrace
- the error is caught and printed

In the second:
- the bt command is called
- the frame filter is applied
- doing so triggers the same error, which is caught and printed by
  gdbpy_apply_frame_filter, returning EXT_LANG_BT_NO_FILTERS
- frame #0 is printed
- getting the next frame fails, and the backtrace stops

It seems worthwhile to exercise both scenarios if possible, so add a
"bt -no-filters" test.

Fix the FAIL by updating the regexp to allow both scenarios.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
11 days ago[gdb/testsuite] Fix gdb.multi/pending-bp.exp without python support
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Fix gdb.multi/pending-bp.exp without python support

With a gdb build without python support and test-case
gdb.multi/pending-bp.exp, I run into:
...
(gdb) python bp=[b for b in gdb.breakpoints() if b.number == 5][0]^M
Python scripting is not supported in this copy of GDB.^M
(gdb) FAIL: $exp: py_test_toggle_thread: find Python gdb.Breakpoint object
...

Fix this by requiring python support for part of the test-case.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
11 days ago[gdb/testsuite] Fix gdb.base/break-dbg.exp without xml support
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Fix gdb.base/break-dbg.exp without xml support

With a gdb build without xml support and test-case gdb.base/break-dbg.exp, I
run into:
...
(gdb) catch syscall^M
warning: Can not parse XML syscalls information; \
  XML support was disabled at compile time.^M
Catchpoint 11 (any syscall)^M
(gdb) FAIL: $exp: catch syscall
...

Fix this by updating the regexp.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
11 days agoRe: RELOC_AGAINST_DISCARDED_SECTION zero size reloc sections
Alan Modra [Sat, 19 Jul 2025 05:57:04 +0000 (15:27 +0930)] 
Re: RELOC_AGAINST_DISCARDED_SECTION zero size reloc sections

Update the testsuite, so that is_generic ELF targets still do the
linkonce1 test (as linkonce3).

12 days agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Jul 2025 00:01:16 +0000 (00:01 +0000)] 
Automatic date update in version.in

12 days agoRELOC_AGAINST_DISCARDED_SECTION zero size reloc sections
Alan Modra [Thu, 17 Jul 2025 23:56:10 +0000 (09:26 +0930)] 
RELOC_AGAINST_DISCARDED_SECTION zero size reloc sections

For some reason the initial implementation (commit 0672748ac053) of
this macro didn't allow discarding of all relocs in a section, perhaps
because doing so would require a testsuite change.  This patch allows
zero size relocation sections to result, and adjusts the testsuite.
i386, x86_64, ppc and ppc64 code that avoids a memmove is also changed
to allow zero size reloc sections, and arc fixed to actually adjust
the reloc section header.

12 days ago[gdb/testsuite] Fix gdb.arch/amd64-disp-step-self-call.exp on freebsd
Tom de Vries [Fri, 18 Jul 2025 17:51:46 +0000 (19:51 +0200)] 
[gdb/testsuite] Fix gdb.arch/amd64-disp-step-self-call.exp on freebsd

On x86_64-freebsd, with test-case gdb.arch/amd64-disp-step-self-call.exp, I
run into:
...
(gdb) continue
Continuing.

Program received signal SIGBUS, Bus error.
Object-specific hardware error.
0x000000080051492c in alarm () from /lib/libc.so.7
(gdb) FAIL: $exp: continue to breakpoint: test_call
...

The behaviour is not specific to gdb, it can be reproduced by running the
test-case executable:
...
$ ./outputs/gdb.arch/amd64-disp-step-self-call/amd64-disp-step-self-call
Bus error (core dumped)
$
...

The bus error happens when executing this instruction in alarm:
...
0000000000093910 <alarm>:
   ...
   9392c: 0f 29 45 d0                   movaps %xmm0, -0x30(%rbp)
...
because $rbp is not 16-byte aligned.

This can be fixed by adding the missing frame setup instructions at the start
of main in amd64-disp-step-self-call.S:
...
 main:
+ pushq %rbp
+ movq %rsp, %rbp
...

Instead, fix this by moving main from the assembly file to the c file, which
has the same effect.

Also remove the done label, which looks like a copy-past left-over.  Instead,
add an unreachable function and use it where appropriate.

Do the same for i386 case (which makes the source files identical for the
amd64 and i386 case, but I decided to leave it like that).

Tested on x86_64-freebsd and x86_64-linux.

12 days agogdb/testsuite: mark the start of each gdb.in.* log file
Andrew Burgess [Wed, 16 Jul 2025 14:30:48 +0000 (15:30 +0100)] 
gdb/testsuite: mark the start of each gdb.in.* log file

Emit a line in the gdb.log file each time a new gdb.in.NUM command log
is started.  The gdb.log line includes the full filename for the new
gdb.in.NUM file.

This change will make it trivial to go from a FAIL in the gdb.log file
to the gdb.in.NUM file that (should) reproduce the failure.  When I
encounter a failing test one of my first steps is usually to identify
the gdb.in.NUM file and try re-running it to see if that reproduces
the failure.  Some tests create many very similar gdb.in.NUM files, so
finding the exact one can sometimes be difficult.  With this patch
that task is now trivial.

There should be no change in what is tested after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
12 days agold: Limit PR ld/25617 tests to glibc targets
H.J. Lu [Thu, 17 Jul 2025 12:34:22 +0000 (05:34 -0700)] 
ld: Limit PR ld/25617 tests to glibc targets

Since PR ld/25617 tests expects glibc specific features, limit PR ld/25617
tests to glibc targets.

PR ld/33169
* testsuite/ld-elf/no-section-header.exp: Return if not glibc
targets.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
12 days agoFix more unused variable warnings
Alan Modra [Fri, 18 Jul 2025 07:23:38 +0000 (16:53 +0930)] 
Fix more unused variable warnings

12 days agoFix unused variable warnings
Alan Modra [Fri, 18 Jul 2025 05:10:17 +0000 (14:40 +0930)] 
Fix unused variable warnings

12 days agoasan: undefined shift
Alan Modra [Fri, 18 Jul 2025 04:56:56 +0000 (14:26 +0930)] 
asan: undefined shift

 .bundle_align_mode 32
 nop
read.c:776:26: runtime error: shift exponent 32 is too large for
32-bit type 'unsigned int'

Avoid this by using wider types in the expressions.

13 days agovisium: use RELOC_AGAINST_DISCARDED_SECTION
Alan Modra [Thu, 17 Jul 2025 23:54:30 +0000 (09:24 +0930)] 
visium: use RELOC_AGAINST_DISCARDED_SECTION

The initial visium support added in commit d924db559be9 didn't make
use of RELOC_AGAINST_DISCARDED_SECTION, and so lacked code to remove
relocations in debug sections.

13 days agoMETAG_RELOC_AGAINST_DISCARDED_SECTION
Alan Modra [Thu, 17 Jul 2025 23:52:43 +0000 (09:22 +0930)] 
METAG_RELOC_AGAINST_DISCARDED_SECTION

Delete this macro which duplicates RELOC_AGAINST_DISCARDED_SECTION,
and instead add an rnone parameter to the standard version.

13 days agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Jul 2025 00:01:20 +0000 (00:01 +0000)] 
Automatic date update in version.in

13 days ago[gdb/testsuite] Use pagination_prompt var more often
Tom de Vries [Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)] 
[gdb/testsuite] Use pagination_prompt var more often

In some test-cases, matching the pagination prompt is split up to address a
matching race but that's no longer necessary, thanks to commit c3f814a1433
("Fix paginate-*.exp races").

Fix this by using the pagination_prompt variable.

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
13 days ago[gdb/testsuite] Require minimum width in gdb.base/style.exp
Tom de Vries [Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)] 
[gdb/testsuite] Require minimum width in gdb.base/style.exp

In test-case gdb.base/style.exp, we have proc test_pagination_prompt_styling,
which:
- determines a "desired width" by parsing the output of "info files",
- sets width to the "desired width", and
- runs "info files" again.

The "desired width" on my system is 88, but if I override it to 65, I run
into:
...
(gdb) info files^M
Symbols from "^[[32;49;22;27m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.base/style/style^[[m".^M
--Type <RET> for more, q to quit, c to continue without paging--^M
^MFAIL: gdb.base/style.exp: check pagination prompt styling (timeout)
...
with make target check, and with check-read1 into:
...
(gdb) info files^M
Symbols from "^[[32;49;22;27m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.base/style/style^[[m".^M
--Type <RET> for more, q to quit, c to continue without paging--^M
^M^[[A^M
Native process:^M
        Using the running image of child process 6179.^M
--Type <RET> for more, q to quit, c to continue without paging--ERROR: Window too small.
UNRESOLVED: gdb.base/style.exp: check pagination prompt styling
...

This is caused by the following.

The size of the pagination prompt is 64:
...
         1         2         3         4         5         6
1234567890123456789012345678901234567890123456789012345678901234
--Type <RET> for more, q to quit, c to continue without paging--
...
and because we have TERM=ansi and width == 65, readline wraps at 64:
...
(gdb) maint info screen
Number of characters gdb thinks are in a line is 65.
Number of characters readline reports are in a line is 64.
...

In other words, readline wraps when printing the pagination prompt.

This causes some unusual output, and the test is not prepared to handle this.

Fix this by requiring that desired_width is at least
<length of pagination prompt> + 2.

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
PR testsuite/33167
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33167

13 days ago[gdb/testsuite] Fix regexp in gdb.base/style.exp
Tom de Vries [Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)] 
[gdb/testsuite] Fix regexp in gdb.base/style.exp

In test-case gdb.base/style.exp, we have proc test_pagination_prompt_styling,
which:
- determines a "desired width" by parsing the output of "info files",
- sets width to the "desired width", and
- runs "info files" again.

The "desired width" on my system is 88, but if I override it to 66, I run into:
...
FAIL: gdb.base/style.exp: check pagination prompt styling
...
due to the test classifying this line as a bad line:
...
  $hex - $hex is .init_array in --Type <RET> for more, ...
...

This is due to a bug in this regexp:
...
    # For lines that don't match this pattern, we cannot comment on
    # where the style reset should occur, so lets just claim the line
    # is fine.
    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } {
return true
    }
...
which is supposed to determine whether the line needs to contain a style
reset.

For aforementioned line, the regexp matches, so the test concludes that the
line should have a style reset, and because it hasn't, it classifies it as a
bad line.

Fix this by making the regexp more strict:
...
    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } {
...

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
13 days ago[gdb/testsuite] Stabilize test name in gdb.base/style.exp
Tom de Vries [Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)] 
[gdb/testsuite] Stabilize test name in gdb.base/style.exp

With test-case gdb.base/style.exp, I get:
...
PASS: gdb.base/style.exp: set width 88
...

The 88 is not a constant, it's a variable:
...
gdb_test_no_output "set width $desired_width"
...
which is calculated by parsing the output of "info files".

When running with target board unix/-m32, I get instead:
...
PASS: gdb.base/style.exp: set width 67
...

Stabilize the test name by using instead:
...
PASS: gdb.base/style.exp: set width to desired width
...

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
13 days agogdb/risc-v: fix ISA string detection for disassembly
Marek Pikuła [Wed, 28 May 2025 11:54:47 +0000 (13:54 +0200)] 
gdb/risc-v: fix ISA string detection for disassembly

Commit 3f61a38 introduced a regression where the ISA string was no
longer detected based on the ELF header. The mechanism was changed from
directly referencing `abfd` to using `disassembler_info->section`, which
was not properly initialized for RISC-V.

The previous implementation ignored the object in scope, leading to
issues such as failing to decode RVV instructions when a library was
compiled as `rv64gcv` and the main application as `rv64gc`.

This patch resolves both problems by initializing
`disassembler_info->section` with the object currently in scope,
ensuring correct ISA string detection during disassembly.

Approved-By: Andrew Burgess <aburgess@redhat.com>
13 days agogdb: fix formatting in solib.c
Simon Marchi [Thu, 17 Jul 2025 12:30:41 +0000 (08:30 -0400)] 
gdb: fix formatting in solib.c

Change-Id: I7ae1ca4a822ecc2805025fac59a22af5d2a41166

13 days agobinutils: drop unused note_size, contents, old variables
Sam James [Thu, 17 Jul 2025 12:18:05 +0000 (13:18 +0100)] 
binutils: drop unused note_size, contents, old variables

GCC trunk recently had improvements to its -Wunused-but-set-variable which
picked up that contents and hence note_size & old aren't used at all in the
end.

* objcopy.c (merge_gnu_build_notes): Drop unused 'note_size', 'contents',
and 'old' variables.

13 days agobfd: drop unused elt_no
Sam James [Thu, 17 Jul 2025 12:16:31 +0000 (13:16 +0100)] 
bfd: drop unused elt_no

GCC trunk recently had improvements to its -Wunused-but-set-variable which
picked up that elt_no isn't used at all in the end.

* archive.c (_bfd_compute_and_write_armap): Drop unused elt_no.

13 days agoRemove sframe relocs against discarded sections
Alan Modra [Thu, 17 Jul 2025 05:12:31 +0000 (14:42 +0930)] 
Remove sframe relocs against discarded sections

Commit d7f343eaad3f testsuite change resulted in a regression for
s390x-linux.  This extends the x86_64 fix to other targets.

PR ld/33156
* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Remove .sframe
relocs too.

2 weeks agoreadelf v850 notes
Alan Modra [Wed, 16 Jul 2025 23:27:11 +0000 (08:57 +0930)] 
readelf v850 notes

This patch was prompted by a clang warning:
readelf.c:23317:37: warning: pointer comparison always evaluates to false [-Wtautological-compare]
 23317 |           || inote.namedata + inote.namesz < inote.namedata)
       |                                            ^

Use the same sanity checks as used by process_notes_at.  (See commit
5396a86e4396).  While we are at it, print all the v850 note info in
one place to properly handle error conditions.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Jul 2025 00:01:17 +0000 (00:01 +0000)] 
Automatic date update in version.in

2 weeks agogdb: remove unused includes in break-*.c
Simon Marchi [Wed, 16 Jul 2025 14:48:17 +0000 (10:48 -0400)] 
gdb: remove unused includes in break-*.c

These are reported as unused by clangd.

Change-Id: I80871e08b9d29c540f61d6ea91904197faf92065

2 weeks agogas: improve --gsframe documentation
Sam James [Wed, 16 Jul 2025 05:59:14 +0000 (06:59 +0100)] 
gas: improve --gsframe documentation

I omitted documentation in 8aad677a12832885acd5be1de8f41e740b8e713d in
error. Rectify that with:
1) changing ---help to mention bare `--gsframe` too, as we're not
   getting rid of that;

2) adding the new --gsframe=[no|yes] form to as.texi.

PR gas/33125
* gas/as.c (parse_args): Tweak --gsframe= help text.
* gas/doc/as.texi: Document --gsframe=[no|yes].

2 weeks agox86-64: Remove sframe relocs against discarded sections
H.J. Lu [Tue, 15 Jul 2025 02:41:25 +0000 (10:41 +0800)] 
x86-64: Remove sframe relocs against discarded sections

Since unlike eh_frame editing code, sframe editing code keeps
R_X86_64_NONE reloc as is, its r_offset is wrong, we must not
generate R_X86_64_NONE reloc in sframe section against discarded
sections for "ld -r".

bfd/

PR ld/33156
* elf64-x86-64.c (elf_x86_64_relocate_section): Also remove
sframe relocations against discarded sections for "ld -r".

ld/

PR ld/33156
* testsuite/ld-elf/eh-group.exp (as_gsframe): New.
Assemble eh-group.o with $as_gsframe.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agox86: Decouple AMX-AVX512 from AVX10.2 and imply AVX512F
Haochen Jiang [Tue, 15 Jul 2025 06:11:37 +0000 (14:11 +0800)] 
x86: Decouple AMX-AVX512 from AVX10.2 and imply AVX512F

In ISE058, the AVX10.2 imply is removed from AMX-AVX512. This
leads to re-consideration on the imply for AMX-AVX512.

Since it is using zmm register and using zmm register only, we
need to at least imply AVX512F. AVX512VL is not needed since it
is not using xmm/ymms.

On the other hand, if we imply AVX10.1 for AMX-AVX512, disabling
avx10.1 will lead to disabling AMX-AVX512. This would be a surprise
for users.

Based on the two reasons above, the patch is decoupling AMX-AVX512
from AVX10.2 and imply AVX512F.

opcodes/ChangeLog:

* i386-gen.c: Imply AVX512F instead of AVX10.2.
* i386-init.h: Regenerated.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Jul 2025 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 weeks agoUpdated translations for various sub-directories
Nick Clifton [Tue, 15 Jul 2025 12:37:09 +0000 (13:37 +0100)] 
Updated translations for various sub-directories

2 weeks agoOnly parse attributes in ELF sections with the SHT_GNU_ATTRIBUTES type if the OS...
Rainer Orth [Tue, 15 Jul 2025 10:15:46 +0000 (11:15 +0100)] 
Only parse attributes in ELF sections with the SHT_GNU_ATTRIBUTES type if the OS is not Solaris.  Set the is_solaris flag for Sparc solaris

PR 33153

2 weeks agogas: Re-indent case OPTION_SFRAME:
H.J. Lu [Tue, 15 Jul 2025 02:16:40 +0000 (10:16 +0800)] 
gas: Re-indent case OPTION_SFRAME:

PR gas/33125
* gas/as.c (parse_args): Re-indent case OPTION_SFRAME:

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agogas: support --gsframe=no
Sam James [Thu, 3 Jul 2025 11:53:22 +0000 (12:53 +0100)] 
gas: support --gsframe=no

Being able to explicitly disable SFrames on the command line is useful,
especially when looking at a gas that enables SFrames by default. The
binutils testsuite will benefit from this as there's testcases that don't
expect their presence.

In summary:
* Nothing is passed       => no SFrames (no change from before)
* --gsframe is passed     => SFrames    (no change from before)
* --gsframe=yes is passed => SFrames    (previously rejected)
* --gsframe-no  is passed => no SFrames (previously rejected)

PR gas/33125
* gas/as.c (parse_args): Accept --gsframe=no, --gsframe=yes.

2 weeks agoRevert "gas: support --gsframe=no"
Sam James [Tue, 15 Jul 2025 00:29:22 +0000 (01:29 +0100)] 
Revert "gas: support --gsframe=no"

This reverts commit e6b2368b9556ea6298a1f0de97baeabf1b5b18fd.

I made a last minute style change and oopsed it.

2 weeks agogas: support --gsframe=no
Sam James [Thu, 3 Jul 2025 11:53:22 +0000 (12:53 +0100)] 
gas: support --gsframe=no

Being able to explicitly disable SFrames on the command line is useful,
especially when looking at a gas that enables SFrames by default. The
binutils testsuite will benefit from this as there's testcases that don't
expect their presence.

In summary:
* Nothing is passed       => no SFrames (no change from before)
* --gsframe is passed     => SFrames    (no change from before)
* --gsframe=yes is passed => SFrames    (previously rejected)
* --gsframe-no  is passed => no SFrames (previously rejected)

PR gas/33125
* gas/as.c (parse_args): Accept --gsframe=no, --gsframe=yes.

2 weeks agolibsframe: relax the assertion limit for fre_start_addr
Indu Bhagat [Tue, 15 Jul 2025 00:01:53 +0000 (17:01 -0700)] 
libsframe: relax the assertion limit for fre_start_addr

Fix PR ld/33131 Failed assertion when linking gccgo

Make amendments in both sframe_decoder_get_fre and
sframe_encoder_add_fre.

Since GNU as and the dw2gencfi code generally accepts such CFI, its best
to allow in SFrame FREs too.

libsframe/
PR ld/33131.
* sframe.c (sframe_decoder_get_fre): Relax the assertion a bit.
(sframe_encoder_add_fre): Likewise.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Jul 2025 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 weeks agosframe: Allow input R_*_NONE relocations
H.J. Lu [Sat, 12 Jul 2025 20:56:16 +0000 (04:56 +0800)] 
sframe: Allow input R_*_NONE relocations

"ld -r" generates R_*_NONE relocations in sframe section if input
relocations in sframe section are against discarded section.  Allow
input R_*_NONE relocations if there are more relocation entries than
SFrame entries, instead of assuming number of SFrame entries == number
of relocation entries.

bfd/

PR ld/33127
* elf-sframe.c (sframe_decoder_init_func_bfdinfo): Allow input
R_*_NONE relocations if there are more relocation entries than
SFrame entries.

ld/

PR ld/33127
* testsuite/ld-x86-64/sframe-reloc-2a.s: New file.
* testsuite/ld-x86-64/sframe-reloc-2b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/33127 tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agogdb/amd64-linux-tdep: add missing space
Simon Marchi [Mon, 14 Jul 2025 18:12:46 +0000 (14:12 -0400)] 
gdb/amd64-linux-tdep: add missing space

Change-Id: I4e15eae9791329f71321a9b00d682e22dd6e2f6d

2 weeks agoUpdated Ukranian translation for the opcodes sub-directory
Nick Clifton [Mon, 14 Jul 2025 15:54:15 +0000 (16:54 +0100)] 
Updated Ukranian translation for the opcodes sub-directory

2 weeks agoMore updates to the 'how to make a release' documentation
Nick Clifton [Mon, 14 Jul 2025 15:43:24 +0000 (16:43 +0100)] 
More updates to the 'how to make a release' documentation

2 weeks agoUpdated Ukranian translation for the binutils sub-directory
Nick Clifton [Mon, 14 Jul 2025 15:42:04 +0000 (16:42 +0100)] 
Updated Ukranian translation for the binutils sub-directory

2 weeks agoUpdated Spanish translation for the gas sub-directory
Nick Clifton [Mon, 14 Jul 2025 15:39:36 +0000 (16:39 +0100)] 
Updated Spanish translation for the gas sub-directory

2 weeks agos390x sframe regressions
Alan Modra [Mon, 14 Jul 2025 09:38:12 +0000 (19:08 +0930)] 
s390x sframe regressions

Commit 6ab3f09a682a resulted in regressions.
s390x-linux-gnu  FAIL: SFrame simple link
s390x-linux-gnu  FAIL: SFrame for plt0 and pltN

Commit 939eb467b21d exposed the problem further.
s390x-linux-gnu  FAIL: LTO 4a
s390x-linux-gnu  FAIL: LTO 4c
s390x-linux-gnu  FAIL: LTO 4d

* elf64-s390.c (elf_s390_create_dynamic_sections): Set plt_sframe
ELF section type.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
2 weeks agogas deferrred diags leak
Alan Modra [Mon, 14 Jul 2025 09:58:14 +0000 (19:28 +0930)] 
gas deferrred diags leak

asan complains when running the gas all/cond-diag test.

* read.c (deferred_diag_head, deferred_diag_tail): Renamed
from deferred_diags and last_deferred_diag, making the tail
pointer a deferred_diag**.
(s_errwarn_if): Simplify appending to list.  Free unused diag
on error.
(evaluate_deferred_diags): Free list.

2 weeks agoDelete AM_PO_SUBDIRS invocation
Alan Modra [Mon, 14 Jul 2025 06:55:29 +0000 (16:25 +0930)] 
Delete AM_PO_SUBDIRS invocation

These aren't needed since commit 862776f26a59.

2 weeks agogas/NEWS: Corrected the information about mapping symbol $x for risc-v
Nelson Chu [Mon, 14 Jul 2025 01:45:07 +0000 (09:45 +0800)] 
gas/NEWS: Corrected the information about mapping symbol $x for risc-v

2 weeks agogas: accept leading zeros on dollar local labels in z80 sdcc compat mode
Aaron Griffith [Mon, 14 Jul 2025 08:38:52 +0000 (10:38 +0200)] 
gas: accept leading zeros on dollar local labels in z80 sdcc compat mode

SDCC assembly output uses 5-digit numeric dollar sign labels, padded
with zeros. Commit 226749d made these invalid, and broke the Z80 SDCC
compatibility mode in GAS.

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=226749d5a6ff0d5c607d6428d6c81e1e7e7a994b

This restores SDCC compatibility by replacing the leading zeros with
spaces when inside dollar local labels and when SDCC compatibility is
enabled. It also restores the SDCC test case to represent actual
syntax emitted by SDCC, and adds a note explaining the purpose of
the test.

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

2 weeks agold: Clear map_head_is_link_order for .gnu_object_only
H.J. Lu [Sun, 13 Jul 2025 21:21:32 +0000 (05:21 +0800)] 
ld: Clear map_head_is_link_order for .gnu_object_only

Clear map_head_is_link_order when generating .gnu_object_only section so
that lang_add_section can add new sections and .sframe sections will be
properly merged by _bfd_elf_merge_section_sframe.

PR ld/33146
* ldlang.c (cmdline_emit_object_only_section): Clear
map_head_is_link_order.
* testsuite/ld-plugin/lto.exp (as_gsframe): New.
(lto_link_tests): Add $as_gsframe to compile lto-4b.o and
lto-4c.o.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoRe: gas: Move gas_sframe_check to binutils-common.exp
Alan Modra [Sun, 13 Jul 2025 23:23:07 +0000 (08:53 +0930)] 
Re: gas: Move gas_sframe_check to binutils-common.exp

PR ld/33146

Correct TCL errors trying to access error output file in commit
ef7a634dc01d.  In fact, get rid of the output file test entirely since
gas exit status is sufficient.

Also there is no need to firstly check for ELF support.

Set check_as_sframe_result, and remove ld-lib.exp check_as_sframe.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Jul 2025 00:01:10 +0000 (00:01 +0000)] 
Automatic date update in version.in

2 weeks agogas: Move gas_sframe_check to binutils-common.exp
H.J. Lu [Sun, 13 Jul 2025 20:45:43 +0000 (04:45 +0800)] 
gas: Move gas_sframe_check to binutils-common.exp

Move gas_sframe_check to binutils-common.exp so that it can be used in
linker tests to check if a target assembler supports --gsframe.

binutils/

PR ld/33146
* testsuite/lib/binutils-common.exp (gas_sframe_check): Moved
from cfi-sframe.exp.  Replace gas_host_run with remote_exec.

gas/

PR ld/33146
* testsuite/gas/cfi-sframe/cfi-sframe.exp (gas_sframe_check):
Moved to binutils-common.exp.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoFix compile time warning message about optarg parameter shadowing global variable
Nick Clifton [Sun, 13 Jul 2025 10:35:01 +0000 (11:35 +0100)] 
Fix compile time warning message about optarg parameter shadowing global variable

2 weeks agoUpdates to how-to-make-a-release document after creating the 2.45 branch
Nick Clifton [Sun, 13 Jul 2025 08:20:25 +0000 (09:20 +0100)] 
Updates to how-to-make-a-release document after creating the 2.45 branch

2 weeks agoUpdate version number on mainline
Nick Clifton [Sun, 13 Jul 2025 07:57:08 +0000 (08:57 +0100)] 
Update version number on mainline

2 weeks agoAdd markers for 2.45 branch
Nick Clifton [Sun, 13 Jul 2025 07:35:45 +0000 (08:35 +0100)] 
Add markers for 2.45 branch

2 weeks ago[gdb/build] Work around GCC ipa-modref bug
Tom de Vries [Sun, 13 Jul 2025 05:25:43 +0000 (07:25 +0200)] 
[gdb/build] Work around GCC ipa-modref bug

PR mi/32571 reports the following problem:
...
$ gdb -q -batch -ex "b bla.c:100"
<random output>
Make breakpoint pending on future shared library load? (y or [n]) \
  [answered N; input not from terminal]
...
while this is expected:
...
$ gdb -q -batch -ex "b bla.c:100"
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) \
  [answered N; input not from terminal]
...

A few factors in reproducing this are building gdb using gcc 14,
"-O2 -flto=auto" and --disable-nls.  For more details, see the PR.

This turns out to be caused by a GCC PR [1], more specifically a problem in
ipa-modref.

Work around this by disabling ipa-modref for GCC versions 12-15 and 16.0,
assuming the GCC 16.1 release will contain a fix.

Tested on aarch64-linux and x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32571

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120987

2 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 13 Jul 2025 00:02:42 +0000 (00:02 +0000)] 
Automatic date update in version.in

2 weeks agogdb: add Aaron Griffith to gdb/MAINTAINERS
Aaron Griffith [Sat, 12 Jul 2025 12:34:56 +0000 (08:34 -0400)] 
gdb: add Aaron Griffith to gdb/MAINTAINERS

2 weeks agold/aarch64elf: add support for DT_AARCH64_MEMTAG_STACK dynamic tag
Indu Bhagat [Wed, 9 Jul 2025 21:13:58 +0000 (23:13 +0200)] 
ld/aarch64elf: add support for DT_AARCH64_MEMTAG_STACK dynamic tag

Add new command line option -z memtag-stack for aarch64 elf.  This
option instructs the linker to generate the necessary dynamic tag
DT_AARCH64_MEMTAG_STACK, which the dynamic loader can then use to
protect the stack memory with PROT_MTE.  Linker issues an
'unrecognized option' error when -z memtag-stack is specified for
non-aarch64 based emulations.

readelf displays the dynamic tag when present:

$ readelf -d <exectutable>
Dynamic section at offset 0xfdd8 contains XX entries:
Tag        Type                         Name/Value
0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
0x000000000000000c (INIT)               0x400520
0x000000000000000d (FINI)               0x400b64
0x0000000000000019 (INIT_ARRAY)         0x41fdc8
...                 ...                 ...
0x000000007000000c (AARCH64_MEMTAG_STACK) 0x1
...                 ...                 ...

ChangeLog:

        * bfd/elfnn-aarch64.c (elfNN_aarch64_late_size_sections): Emit
DT_AARCH64_MEMTAG_STACK dynamic tag.
        * bfd/elfxx-aarch64.h (struct aarch64_memtag_opts): Add new
member for tracking whether stack access uses MTE insns.
        * binutils/readelf.c (get_aarch64_dynamic_type): Handle
DT_AARCH64_MEMTAG_STACK.
        * ld/emultempl/aarch64elf.em: Add new command line option.
        * ld/ld.texi: Add documentation for -z memtag-stack.
        * ld/testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
        * ld/testsuite/ld-aarch64/dt-memtag-stack.d: New test.

include/ChangeLog:

        * elf/aarch64.h (DT_AARCH64_MEMTAG_STACK): New definition.

2 weeks agold/aarch64elf: add support for DT_AARCH64_MEMTAG_MODE dynamic tag
Indu Bhagat [Sat, 12 Jul 2025 09:10:23 +0000 (11:10 +0200)] 
ld/aarch64elf: add support for DT_AARCH64_MEMTAG_MODE dynamic tag

Add new command line option -z memtag-mode=<mode> to aarch64 elf,
where <mode> can be one of none, sync, or async.  For mode of sync or
async, a DT_AARCH64_MEMTAG_MODE dynamic tag with a value of 0 or 1
respectively is emitted.

readelf displays the dynamic tag when present:

$ readelf -d <exectutable>
Dynamic section at offset 0xfdd8 contains XX entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x400520
 0x000000000000000d (FINI)               0x400b64
 0x0000000000000019 (INIT_ARRAY)         0x41fdc8
 ...                 ...                 ...
 0x0000000070000009 (AARCH64_MEMTAG_MODE) 0x1
 ...                 ...                 ...

Note that this patch doesn't add support for the "asymm" MTE mode,
which is an Armv8.7 extension.

ChangeLog:

        * bfd/elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Add
new member for memtag properties.
        (bfd_elfNN_aarch64_set_options): New argument to pass memtag
properties.
(elfNN_aarch64_late_size_sections): Emit DT_AARCH64_MEMTAG_MODE
dynamic tag.
        * bfd/elfxx-aarch64.h: New definition for the various memtag
properties.
        * binutils/readelf.c (get_aarch64_dynamic_type): Handle
DT_AARCH64_MEMTAG_MODE.
        * ld/emultempl/aarch64elf.em: Likewise.
        * ld/ld.texi: Add documentation for the new option
-z memtag-mode.
        * ld/testsuite/ld-aarch64/aarch64-elf.exp: New test.
        * ld/testsuite/ld-aarch64/dt-memtag.d: New test.
        * ld/testsuite/ld-aarch64/dt-memtag-mode.s: New test.

include/ChangeLog:

        * elf/aarch64.h (DT_AARCH64_MEMTAG_MODE): New definition.

2 weeks agold: aarch64: make EH Frame parsing aware of augmentation char 'G'
Indu Bhagat [Sat, 12 Jul 2025 09:08:06 +0000 (11:08 +0200)] 
ld: aarch64: make EH Frame parsing aware of augmentation char 'G'

As per the DWARF for the Arm 64-bit Architecture (AArch64)
specification, the augmentation char 'G' indicates that associated
frames may modify MTE tags on the stack space they use.

Add knowledge of the 'G' augmentation char to the EH Frame parsing
code.

ChangeLog:

        * bfd/elf-eh-frame.c (_bfd_elf_parse_eh_frame): Accommodate
augmentation char 'G'.
        * ld/testsuite/ld-aarch64/aarch64-elf.exp: New test.
        * ld/testsuite/ld-aarch64/mte-tagged-frame-bar.s: New test.
        * ld/testsuite/ld-aarch64/mte-tagged-frame-foo.s: New test.
        * ld/testsuite/ld-aarch64/mte-tagged-frame.d: New test.

2 weeks agogas: aarch64: suppport CFI directive .cfi_mte_tagged_frame
Indu Bhagat [Sat, 12 Jul 2025 09:05:15 +0000 (11:05 +0200)] 
gas: aarch64: suppport CFI directive .cfi_mte_tagged_frame

Process a new aarch64-specific CFI directive: .cfi_mte_tagged_frame
(LLVM uses this CFI directive already).  The CFI directive, when
present for a function, indicates that the stack frame for the
function may modify the MTE tags of the stack space it uses.  The
assembler emits char 'G' in the CIE augmentation string to indicate
the same.

ChangeLog:

        * gas/config/tc-aarch64.c (s_aarch64_mte_tagged_frame): New
definition.
        * gas/config/tc-aarch64.h (tc_fde_entry_extras): Add
memtag_frame_p.
        (tc_cie_entry_extras): Likewise.
        (tc_fde_entry_init_extra): Likewise.
        (tc_cie_fde_equivalent_extra): Likewise.
        (tc_cie_entry_init_extra): Likewise.
        * gas/doc/c-aarch64.texi: Add documentation for
.cfi_mte_tagged_frame directive.
        * gas/testsuite/gas/aarch64/mte_tagged_stack.d: New test.
        * gas/testsuite/gas/aarch64/mte_tagged_stack.s: New test.

2 weeks agobinutils: make read_cie aware of new augmentation char 'G'
Indu Bhagat [Wed, 9 Jul 2025 21:09:15 +0000 (23:09 +0200)] 
binutils: make read_cie aware of new augmentation char 'G'

This allows objdump/readelf to dump DWARF/EH Frame info when the stack
frame makes use of MTE tagging.

ChangeLog:

        * binutils/dwarf.c (is_aarch64_augmentation): Add handling for augmentation
char 'G'.

---
[No change in V3]

2 weeks agobfd: fix recognition of arch-specific augmentations
Jose E. Marchesi [Sat, 12 Jul 2025 08:58:06 +0000 (10:58 +0200)] 
bfd: fix recognition of arch-specific augmentations

This patch fixes _bfd_elf_parse_eh_frame so it will not recognize
machine/architecture specific augmentation characters in EH Frame
CFIs.

Regtested in x86_64-linux-gnu and aarch64-linux-gnu.

bfd/ChangeLog:

* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Recognize augmentation
'B' only if targetting aarch64.

2 weeks agobinutils: factorize handling of arch-specific DWARF augmentations
Jose E. Marchesi [Sat, 12 Jul 2025 08:56:45 +0000 (10:56 +0200)] 
binutils: factorize handling of arch-specific DWARF augmentations

This patch factorizes the handling of architecture/machine specific
augmentation characters in CIEs.

Based on an idea proposed by Richard Earnshaw.

binutils/ChangeLog:

* dwarf.c (is_mach_augmentation_ftype): New type.
(is_mach_augmentation): New variable.
(is_nomach_augmentation): New function.
(is_aarch64_augmentation): Likewise.
(init_dwarf_by_elf_machine_code): Set is_mach_augmentation as
appropriate.
(init_dwarf_by_bfd_arch_and_mach): Likewise.
(read_cie): Handle architecture-specific augmentation characters
in a generic way.

2 weeks agobinutils: generalize init_dwarf_regnames_by_* functions
Jose E. Marchesi [Sat, 12 Jul 2025 08:54:46 +0000 (10:54 +0200)] 
binutils: generalize init_dwarf_regnames_by_* functions

This patch renames the functions:

  init_dwarf_regnames_by_elf_machine_code
  init_dwarf_regnames_by_bfd_arch_and_mach

to

  init_dwarf_by_elf_machine_code
  init_dwarf_by_bfd_arch_and_mach

The idea is to start using these functions to perform general
architecture/machine specific initializations beyond register names.

Regtested in x86_64-linux-gnu and aarch64-linux-gnu targets.

binutils/ChangeLog:

* dwarf.c (init_dwarf_regnames_by_elf_machine_code): Rename to
init_dwarf_by_elf_machine_code.
(init_dwarf_regnames_by_bfd_arch_and_mach): Rename to
init_dwarf_by_bfd_arch_and_mach.
* dwarf.h: Adjust prototypes accordingly.
* readelf.c (process_file_header): Adjust call to
init_dwarf_regnames_by_elf_machine_code accordingly.
* objdump.c (dump_dwarf): Adjust call to
init_dwarf_regnames_by_bfd_arch_and_mach accordingly.

2 weeks agoaarch64: Add support for --march=armv9.6-a
Alice Carlotti [Sat, 12 Jul 2025 07:47:14 +0000 (08:47 +0100)] 
aarch64: Add support for --march=armv9.6-a

2 weeks agoaarch64: Disable sysreg guards by default
Alice Carlotti [Wed, 9 Jul 2025 21:59:11 +0000 (22:59 +0100)] 
aarch64: Disable sysreg guards by default

Add a new flag -menable-sysreg-checking to restore previous behaviour.
This existing behaviour is quite inconsistent, so the gating will
probably be updated in the future.  (In particular, many system
registers are currently gated with the architecture version they were
released with instead of the lower architecture version that they
actually require).

This patch retains the +d128 requirement for msrr/mrrs.

Co-Authored-By: Srinath Parvathaneni <srinath.parvathaneni@arm.com>
2 weeks agoaarch64: Add missing F_STRICT flags
Alice Carlotti [Sat, 12 Jul 2025 02:53:21 +0000 (03:53 +0100)] 
aarch64: Add missing F_STRICT flags

By default, NIL qualifiers are treated as matching any qualifier when
checking operand constraints.  For many SVE instructions, this would
allow operands with missing type suffixes to be assembled as if they had
any explicit type specified.  To prevent this, the F_STRICT flag is used
to specify that NIL qualifiers should match only NIL qualifiers.

Unfortunately, several SVE instructions incorrectly omitted this
F_STRICT flag.  The bug has existed in the *MATMUL_SVE* macros since
they were added in 2019.  The macro LUT_SVE2_INSN was added last year,
and the other incorrect macros are new in this release.

LUTv2_SME2_INSN and LUTv2_SME2p1_INSN were not actually broken, because
we reject untyped vector lists already during parsing.  However, I have
added the F_STRICT flag here anyway, since this is more consistent and
would be more robust if those operands start accepting untyped vector
lists in the future.  The new luti4 tests are the only ones that were
already rejected before this change.

BFLOAT16_SVE_INSN has been unused since it was originally added, so I
just deleted the macro.

The SVE LUT instructions were using the lut instruction class, which
has special handling only for SIMD operands, and isn't recognised by
aarch64_decode_variant_using_iclass (which sets the qualifiers during
decode for most SVE instructions).  To prevent these instructions
failing to disassemble, I changed their instruction class to sve_misc.

2 weeks agoaarch64: Remove redundant feature requirements
Alice Carlotti [Fri, 11 Jul 2025 12:01:52 +0000 (13:01 +0100)] 
aarch64: Remove redundant feature requirements

Many instructions explicitly specified SVE/SVE2/SME/SME2 as a required
feature when it was already implied by another required feature (at
least while the SME->SVE2 implication is retained internally).  These
redundant features were used to determine both the valid symbol names
for immediate operands, and the choice of error message for invalid
movprfx sequences.  Those two scenarios no longer use architecture
features, so the redundant features are now truly redundant.

2 weeks agoaarch64: Use operand class to select movprfx error
Alice Carlotti [Fri, 11 Jul 2025 11:41:51 +0000 (12:41 +0100)] 
aarch64: Use operand class to select movprfx error

Previously the choice of error message for an invalid movprfx sequence
used the architecture requirements to determine whether an instruction
was an SVE instruction or not.  This meant specifying SVE or SVE2 as an
explicit architecture requirement for all SVE instructions, even when
this was already implied by another feature.  As more architecture
features are added and with the partial removal of the SME->SVE2
dependency, these extra feature requirements were getting messier and
easier to forget.

Instead, we now look at the operand types.  If there is an SVE_REG,
SVE_REGLIST or PRED_REG operand, then we treat the instruction as an SVE
instruction.  This does change behaviour slightly, but it only affects
the choice of error message and the new choice should be a bit more
consistent.

There is one testsuite update required, because Ezra's SVE_AES2 patch
temporarily broke classification of FEAT_SVE_AES instructions.  This
patch restores the original behaviour.

2 weeks agoaarch64: Refactor exclusion of reg names in immediates
Alice Carlotti [Fri, 11 Jul 2025 06:55:45 +0000 (07:55 +0100)] 
aarch64: Refactor exclusion of reg names in immediates

When parsing immediate values, register names should not be
misinterpreted as symbols.  However, for backwards compatibility we need
to permit some newer register names within older instructions.  The
current mechanism for doing so depends on the list of explicit
architecture requirements for the instructions, which is fragile and
easy to forget, and grows increasingly messy as more architecture
features are added.

This patch add explicit flags to each opcode to indicate which set of
register names is disallowed in each instance.  These flags are
mandatory for all opcodes with immediate operands, which ensures that
the choice of disallowed names will always be deliberate and explicit.

This patch should have no functional change.

2 weeks agoaarch64: Remove redundant ORs with 0
Alice Carlotti [Fri, 11 Jul 2025 07:11:16 +0000 (08:11 +0100)] 
aarch64: Remove redundant ORs with 0

2 weeks agolibsframe: bump version to 2.0
Indu Bhagat [Sat, 12 Jul 2025 08:09:17 +0000 (01:09 -0700)] 
libsframe: bump version to 2.0

Remove LIBSFRAME_1.1, LIBSFRAME_1.0 nodes and add a new LIBSFRAME_2.0
node (non-inheritance version) to create new global versioned symbols.
Also announce libsframe.so.2 in NEWS.

New APIs:
     sframe_decoder_get_flags;
     sframe_decoder_get_offsetof_fde_start_addr;
     sframe_encoder_get_flags;
     sframe_encoder_get_offsetof_fde_start_addr;

Removed APIs: (already deprecated since X-2 release)
     sframe_get_funcdesc_with_addr;

APIs with changed semantics:
     sframe_decoder_get_funcdesc_v2;
     sframe_encoder_add_funcdesc_v2;
     sframe_encoder_write;

lisbframe/
* libsframe.ver: Define new LIBSFRAME_2.0.
* libtool-version: Bump the 'current' numeral to indicate a binary
incompatible release.
include/
* sframe-api.h (sframe_get_funcdesc_with_addr): Remove
deprecated interface.
libsframe/
* sframe.c (sframe_get_funcdesc_with_addr): Likewise.
binutils/
* NEWS: Announce new versioned release of libsframe.

2 weeks agolibsframe: fixup comment and minor style issues
Indu Bhagat [Sat, 12 Jul 2025 07:10:36 +0000 (00:10 -0700)] 
libsframe: fixup comment and minor style issues

Also, use ATTRIBUTE_UNUSED consistently.

libsframe/
* sframe.c (sframe_encoder_add_funcdesc): Fix function-level
comment and use ATTRIBUTE_UNUSED consistently.
(sframe_encoder_add_funcdesc_v2): Use ATTRIBUTE_UNUSED
consistently.

2 weeks agogas: elf: binutils: add new section type SHT_GNU_SFRAME
Indu Bhagat [Sat, 12 Jul 2025 06:32:58 +0000 (23:32 -0700)] 
gas: elf: binutils: add new section type SHT_GNU_SFRAME

So far, SFrame sections were of type SHT_PROGBITS.

As per ELF specification, SHT_PROGBITS indicates that the section holds
information defined by the program, whose format and meaning are
determined solely by the program.

On the linker side, SHT_PROGBITS should be reserved for the simple "cat
contents after applying relocs" semantics.

Currently, the only way to know that a section contains SFrame stack
trace data is if consumer checks for section name.  Such a check for
section name is not quite conformant to ELF principles.

Some of this was discussed here
https://sourceware.org/pipermail/binutils/2025-March/140181.html

With this change, the SFrame sections generated by gas, ld will have
section type set to SHT_GNU_SFRAME.   The new section type is defined in
the SHT_LOOS/SHT_HIOS space.  The SFrame parsing routine
_bfd_elf_parse_sframe () now admits sections only when the the section
type is SHT_GNU_SFRAME.

No special handling / validation is done at the moment for the case of
manual creation of SFrame sections via obj_elf_section ().  Add function
level comments for now to add a note about this.

Although the default handling for (sh_type >= SHT_LOOS && sh_type <=
SHT_HIOS) is sufficient when SHT_GNU_SFRAME is in that range, it makes
sense to add it as a case of its own.

bfd/
* elf-sframe.c (_bfd_elf_parse_sframe): Check if section type is
SHT_GNU_SFRAME.
(_bfd_elf_set_section_sframe): Set SHT_GNU_SFRAME for output
SFrame section.
* elflink.c (obj_elf_section): Use section type for check
instead of section name.
* elfxx-x86.c: Set SHT_GNU_SFRAME for SFrame sections for
.plt* sections.
* elf.c (bfd_section_from_shdr): Add case for SHT_GNU_SFRAME.
binutils/
* readelf.c (get_os_specific_section_type_name): Add
SHT_GNU_SFRAME.
gas/
* NEWS: Announce emitted SFrame sections have SHT_GNU_SFRAME
set.
* config/obj-elf.c (obj_elf_attach_to_group): Add comments to
indicate no special handling for SFrame yet.
* dw2gencfi.c (cfi_finish): Set SHT_GNU_SFRAME for emitted
SFrame section.
ld/
* NEWS: Announce emitted SFrame sections have SHT_GNU_SFRAME
set.
gas/testsuite/
* gas/cfi-sframe/cfi-sframe.exp: Add new test.
* gas/cfi-sframe/cfi-sframe-common-1b.d: New test.
* gas/cfi-sframe/cfi-sframe-common-1b.s: New test.
include/
* elf/common.h (SHT_GNU_SFRAME): Add new section type for SFrame
stack trace information.
libsframe/doc/
* sframe-spec.texi: Add expected ELF section type.

2 weeks agogas: sframe: guard block with support_sframe_p
Indu Bhagat [Sat, 12 Jul 2025 06:31:50 +0000 (23:31 -0700)] 
gas: sframe: guard block with support_sframe_p

SFrame is generated for ELF targets only.  Guard the block with
support_sframe_p like others for consistency.

Also, in a later commit, we would like to do a:
  elf_section_type (sframe_seg) = SHT_GNU_SFRAME;

This cannot be done for non-ELF targets, hence the need to guard with
some pre-processor conditional to enable it for only OBJ_ELF.  Guarding
with support_sframe_p works for now, because those targets that support
SFrame define support_sframe_p:
  - x86_64 and aarch64 define support_sframe_p when OBJ_ELF is defined
  - s390x has no non-LEF target.

We continue to issue an error on targets where SFrame is not supported:
    .sframe not supported for target

gas/
* dw2gencfi.c (cfi_finish): Guard with support_sframe_p.
(support_sframe_p): Remove stub to define to false for backends
not supporting SFrame.

2 weeks ago{binutils, gas, ld}/NEWS: Announce LoongArch changes in 2.45
WANG Xuerui [Fri, 11 Jul 2025 07:49:08 +0000 (15:49 +0800)] 
{binutils, gas, ld}/NEWS: Announce LoongArch changes in 2.45

Signed-off-by: WANG Xuerui <git@xen0n.name>
2 weeks agoLoongArch: Un-skip cross-segment alignment compensation during relax pass 2
WANG Xuerui [Fri, 11 Jul 2025 07:49:07 +0000 (15:49 +0800)] 
LoongArch: Un-skip cross-segment alignment compensation during relax pass 2

It turned out wrong to skip compensating for segment alignment if the
current section is closed for deletion, as my recent system update with
binutils trunk revealed link failures of many high-profile packages such
as ffmpeg, numpy and wxGTK -- the dreaded "relocation truncated to fit"
errors regarding improperly produced R_LARCH_PCREL20_S2.

As it's near 2.45 branching time, revert the problematic change and
XFAIL the original test case for now.

Suggested-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: WANG Xuerui <git@xen0n.name>
2 weeks agoMIPS: Fix linker for REL TLS HI16/LO16 relocs
Alan Modra [Sat, 12 Jul 2025 00:25:53 +0000 (01:25 +0100)] 
MIPS: Fix linker for REL TLS HI16/LO16 relocs

With REL targets TLS HI16/LO16 relocations need to combine the low part
with the high part just as all the remaining HI16/LO16 relocations, so
as to determine the borrow in calculation correctly.

2025-07-12  Alan Modra  <amodra@gmail.com>

bfd/
PR 19977
* elfxx-mips.c (tls_hi16_reloc_p): New function.
(mips_elf_add_lo16_rel_addend): Handle tls relocs.
(_bfd_mips_elf_relocate_section): Likewise.

2025-07-12  Maciej W. Rozycki  <macro@orcam.me.uk>

ld/
PR 19977
* testsuite/ld-mips-elf/pr19977.d: New test.
* testsuite/ld-mips-elf/pr19977-mips16.d: New test.
* testsuite/ld-mips-elf/pr19977-micromips.d: New test.
* testsuite/ld-mips-elf/pr19977-r.d: New test.
* testsuite/ld-mips-elf/pr19977-r-mips16.d: New test.
* testsuite/ld-mips-elf/pr19977-r-micromips.d: New test.
* testsuite/ld-mips-elf/pr19977-r.s: New test source.
* testsuite/ld-mips-elf/pr19977.ld: New test linker script.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

2 weeks agoMIPS: Correct HI/LO rel reloc howto special_function entries
Alan Modra [Sat, 12 Jul 2025 00:25:53 +0000 (01:25 +0100)] 
MIPS: Correct HI/LO rel reloc howto special_function entries

This corrects the DTPREL_HI16/LO16 and TPREL_HI16/LO16 howtos to use
_bfd_mips_elf_{hi,lo}16_reloc special functions, in order to support
addends outside the range [0,32767] on these relocations.

R_MIPS_GOT_HI16, R_MIPS_GOT_LO16, R_MIPS_CALL_HI16 and R_MIPS_CALL_LO16
are left alone as it seems that we (quite reasonably) only support
zero addends for those relocs.

PR 19977
bfd/
* elf32-mips.c (elf_mips_howto_table_rel): Set special_function
to _bfd_mips_elf_hi16_reloc for R_MIPS_TLS_DTPREL_HI16 and
R_MIPS_TLS_TPREL_HI16.  Set special_function to
_bfd_mips_elf_lo16_reloc for R_MIPS_TLS_DTPREL_LO16 and
R_MIPS_TLS_TPREL_LO16
(elf_mips16_howto_table_rel): Likewise for
R_MIPS16_TLS_DTPREL_HI16, R_MIPS16_TLS_DTPREL_LO16,
R_MIPS16_TLS_TPREL_HI16 and R_MIPS16_TLS_TPREL_LO16.
(elf_micromips_howto_table_rel): Likewise for
R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
R_MICROMIPS_TLS_TPREL_HI16 and R_MICROMIPS_TLS_TPREL_LO16.
* elf64-mips.c (mips_elf64_howto_table_rel): Similarly.
(mips16_elf64_howto_table_rel): Similarly.
(micromips_elf64_howto_table_rel): Similarly.
* elfn32-mips.c: As for elf64-mips.c.
gas/
* testsuite/gas/mips/pr19977.d,
* testsuite/gas/mips/pr19977.s: New test.
* testsuite/gas/mips/mips.exp: Run it.

2 weeks agoPR 19977: MIPS: Add missing pairing for REL PCHI/PCLO relocations
Maciej W. Rozycki [Sat, 12 Jul 2025 00:25:53 +0000 (01:25 +0100)] 
PR 19977: MIPS: Add missing pairing for REL PCHI/PCLO relocations

Just as with all HI/LO 16-bit partial relocations the newly-introduced
MIPSr6 PC-relative R_MIPS_PCHI16 and R_MIPS_PCLO16 relocations require
pairing for correct borrow propagation from the low part to the high
part with REL targets, another case for PR 19977.

Unlike with absolute relocation, there is a complication here in that
both parts represent a calculation that is relative to the PC at the
individual relocation's location rather than both referring to the
location of the R_MIPS_PCHI16 relocation, normally applied to an AUIPC
instruction, the location of which is used for the run-time calculation
executed by hardware.

To take this semantics into account, the addend of the R_MIPS_PCLO16
relocation matching a given R_MIPS_PCHI16 relocation is expected to be
adjusted in the source assembly file for the distance between the two
relocations in a single pair, so that once both relocations have been
calculated by the linker, the expression calculated at run time is such
as if the combined 32-bit immediate was added at the location of the
AUIPC instruction.

So for matching R_MIPS_PCHI16 and R_MIPS_PCLO16 relocations into pairs
GAS needs to check for the distance between the two relocations to be
equal to the difference between the addends supplied, and then the
linker has to subtract the low part of the distance between the two
relocations from the low part in calculating the high part, so as to
factor in any borrow.

A further complication is that `_bfd_mips_elf_lo16_reloc' handler is
supplied with the addend differently depending on whether it has been
called by GAS via `bfd_install_relocation', or by the generic linker via
`bfd_perform_relocation'.  In the former case the addend is supplied
with the relocation itself while in the latter one it comes from the
field being relocated.

We currently ignore the addend supplied with the relocation and it works
for calculating absolute high-part relocations, because the same addend
has been previously supplied with them when `_bfd_mips_elf_hi16_reloc'
was called, however this approach does not work for the PC-relative case
because as noted above the low-part addend is different and we need to
consistently apply the distance adjustment both with GAS and LD.

Since the supplied addend and one retrieved from field being relocated
won't ever be both nonzero, just use the sum of the two values.

The low-part addend in `mips_elf_add_lo16_rel_addend' always comes from
the field being relocated, so there's no complication there, we just
need to apply the same adjustment.

New linker test cases verify that the same ultimate machine code is
produced both for ELF and S-record output formats, ensuring that the
both the MIPS/ELF linker and the generic linker behave in the correct
way, consistent with each other.

2 weeks agoMIPS/BFD: Use helper function for LO relocation sign-extension
Maciej W. Rozycki [Sat, 12 Jul 2025 00:25:53 +0000 (01:25 +0100)] 
MIPS/BFD: Use helper function for LO relocation sign-extension

A calculation for LO relocations has been recently fixed with commit
ce08b3bb19b3 ("MIPS/BFD: Fix RELA handling of borrow in the generic
linker"), however it was missed that for the updated arithmetic we
already have a helper function available, `_bfd_mips_elf_sign_extend'.

Replace the open-coded statement then with an equivalent call to said
function.  No functional change.

2 weeks agoMIPS/LD/testsuite: Remove duplicate HI/LO relocation test dump files
Maciej W. Rozycki [Sat, 12 Jul 2025 00:25:53 +0000 (01:25 +0100)] 
MIPS/LD/testsuite: Remove duplicate HI/LO relocation test dump files

There are only nonessential differences between corresponding o32 and
n32 HI/LO relocation test dump files, so reduce the number of files by
reusing the same dump between the two ABIs.  Adjust test naming, also
for the n64 ABI, for consistency with other tests.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Jul 2025 00:00:54 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 weeks agolibsframe: testsuite: fix PR libsframe/33140
Indu Bhagat [Fri, 11 Jul 2025 16:39:24 +0000 (09:39 -0700)] 
libsframe: testsuite: fix PR libsframe/33140

Commit 0d4d5a2633f missed some necessary adjustments to the testcase
after rebase.  SFrame FDE function start address data is now an offset
in PCREL encoding; reflect with a new flag SFRAME_F_FDE_START_ADDR_PCREL
in the header.

Adjust the newly added testcase.

PR libsframe/33140 SFrame test failures on x86-64

libsframe/testsuite/
* libsframe.find/plt-findfre-2.c: Adjust for the new FDE func
start addr encoding.

2 weeks agogdb: remove two unused includes of gdbcore.h
Simon Marchi [Fri, 11 Jul 2025 16:50:03 +0000 (12:50 -0400)] 
gdb: remove two unused includes of gdbcore.h

clangd claims they are unused.

Change-Id: I3c5e16279ff3b59679b8262a9d24a6e515a718f5

2 weeks agogdb: fix formatting in solib.c
Simon Marchi [Fri, 11 Jul 2025 16:45:59 +0000 (12:45 -0400)] 
gdb: fix formatting in solib.c

There are many instances of `_ (...)` that should be `_(...)`, fix them.

Change-Id: I9715019c9b62b72208b4849f3cfd531964480dd2

2 weeks agogdb/solib-svr4: use program space from solib in find_debug_base_for_solib
Simon Marchi [Wed, 9 Jul 2025 14:18:46 +0000 (10:18 -0400)] 
gdb/solib-svr4: use program space from solib in find_debug_base_for_solib

Instead of using the current global program space, I think it makes
sense to fetch the program space from the solib.  The comment for
solib::objfile indicates that it may be nullptr (which is true), but in
this case, the callers (all in
svr4_iterate_over_objfiles_in_search_order) find the solib from an
objfile, so we know that solib::objfile (the link in the opposite
direction) is set for these solibs at this point.

Change-Id: I75037d0b2c39ab1b3a3792432be134e200438efe
Approved-by: Kevin Buettner <kevinb@redhat.com>
2 weeks agogdb/record: Add support for more vmov-style instructions
Guinevere Larsen [Tue, 17 Jun 2025 12:35:03 +0000 (09:35 -0300)] 
gdb/record: Add support for more vmov-style instructions

This commit adds support for a few more vmov instructions:
* VMOV[LH|HL]PS
* VMOVLPD
* VMOVHP[S|D]
* VMOVDDUP

And associated tests. The testsuite had some minor re-working, adding a
function to zero buffers, to make later tests less fragile.

2 weeks agogdb/record: add support for AVX conversion instructions.
Guinevere Larsen [Fri, 13 Jun 2025 17:39:50 +0000 (14:39 -0300)] 
gdb/record: add support for AVX conversion instructions.

WIP

This commit adds support for instructions to convert from one type to
another, which are in the form:
* VCVTDQ2[PS|PD]
* VCVTPS2[DQ|PD]
* VCVTPD2[PS|DQ]
* VCVTSD2[SI|SS]
* VCVTSI2[SS|SD]
* VCVTSS2[SD|SI]
* VCVTTP[S|D]2DQ
* VCVTTS[S|D]2SI

It also adds support to vpsadbw, since it was trivial and only one
instruction. Finally, I have slightly reorder the case statements to
keep them in numerical order.

2 weeks agogdb/record: add support for 'pack' AVX instructions
Guinevere Larsen [Fri, 13 Jun 2025 16:47:11 +0000 (13:47 -0300)] 
gdb/record: add support for 'pack' AVX instructions

This commit adds support for the following instructions VPACK[S|U]S[WB|DW] and associated tests.