]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 12 Oct 2025 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 11 Oct 2025 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 10 Oct 2025 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 weeks agoAutomatic date update in version.in
GDB Administrator [Thu, 9 Oct 2025 00:02:30 +0000 (00:02 +0000)] 
Automatic date update in version.in

4 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 8 Oct 2025 00:03:16 +0000 (00:03 +0000)] 
Automatic date update in version.in

4 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 7 Oct 2025 00:03:06 +0000 (00:03 +0000)] 
Automatic date update in version.in

4 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 6 Oct 2025 00:02:19 +0000 (00:02 +0000)] 
Automatic date update in version.in

4 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Oct 2025 00:02:53 +0000 (00:02 +0000)] 
Automatic date update in version.in

4 weeks ago[gdb] Fix assertion failure due to null frame
Tom de Vries [Sat, 4 Oct 2025 00:16:43 +0000 (02:16 +0200)] 
[gdb] Fix assertion failure due to null frame

PR gdb/33512 reports an assertion failure in test-case
gdb.ada/access_to_packed_array.exp on i386-linux:
...
(gdb) maint print symbols
gdb/frame.c:3400: internal-error: reinflate: \
  Assertion `m_cached_level >= -1' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: $exp: \
  maint print symbols (GDB internal error)
...

I haven't been able to reproduce the failure by running the test-case on
x86_64-linux with target board unix/-m32, but I'm able to reproduce on
x86_64-linux by using the exec attached to the PR:
...
$ cat gdb.in
file foo
maint expand-symtabs
maint print symbols
$ gdb -q -batch -ex "set trace-commands on" -x gdb.in
   ...
         c_to: array (gdb/frame.c:3395: internal-error: reinflate: \
                Assertion `m_cached_level >= -1' failed.
...

The problem happens when trying to print variable c_to:
...
 <4><f227>: Abbrev Number: 3 (DW_TAG_variable)
    <f228>   DW_AT_name        : c_to
    <f230>   DW_AT_type        : <0xf214>
...
with type:
...
 <4><f214>: Abbrev Number: 7 (DW_TAG_array_type)
    <f215>   DW_AT_type        : <0x9f39>
 <5><f21d>: Abbrev Number: 12 (DW_TAG_subrange_type)
    <f21e>   DW_AT_type        : <0x9d6c>
    <f222>   DW_AT_upper_bound : <0xf209>
...
with upper bound:
...
 <4><f209>: Abbrev Number: 89 (DW_TAG_variable)
    <f20a>   DW_AT_name        : system__os_lib__copy_file__copy_to__TTc_toSP1___U
    <f20e>   DW_AT_type        : <0x9d6c>
    <f212>   DW_AT_artificial  : 1
    <f212>   DW_AT_location    : 1 byte block: 57       (DW_OP_reg7 (edi))
...

The backtrace at the point of the assertion failure is:
...
 (gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>,
     signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
 #1  0x00007ffff62a8e7f in __pthread_kill_internal (signo=6,
     threadid=<optimized out>) at pthread_kill.c:78
 #2  0x00007ffff6257842 in __GI_raise (sig=sig@entry=6)
     at ../sysdeps/posix/raise.c:26
 #3  0x00007ffff623f5cf in __GI_abort () at abort.c:79
 #4  0x00000000010e7ac6 in dump_core () at gdb/utils.c:223
 #5  0x00000000010e81b8 in internal_vproblem(internal_problem *, const char *, int, const char *, typedef __va_list_tag __va_list_tag *) (
     problem=0x2ceb0c0 <internal_error_problem>,
     file=0x1ad5a90 "gdb/frame.c", line=3395,
     fmt=0x1ad5a08 "%s: Assertion `%s' failed.", ap=0x7fffffffc3c0)
     at gdb/utils.c:475
 #6  0x00000000010e82ac in internal_verror (
     file=0x1ad5a90 "gdb/frame.c", line=3395,
     fmt=0x1ad5a08 "%s: Assertion `%s' failed.", ap=0x7fffffffc3c0)
     at gdb/utils.c:501
 #7  0x00000000019be79f in internal_error_loc (
     file=0x1ad5a90 "gdb/frame.c", line=3395,
     fmt=0x1ad5a08 "%s: Assertion `%s' failed.")
     at gdbsupport/errors.cc:57
 #8  0x00000000009b5c16 in frame_info_ptr::reinflate (this=0x7fffffffc878)
     at gdb/frame.c:3395
 #9  0x00000000009b66f9 in frame_info_ptr::operator-> (this=0x7fffffffc878)
     at gdb/frame.h:290
 #10 0x00000000009b4bd5 in get_frame_arch (this_frame=...)
     at gdb/frame.c:3075
 #11 0x000000000081dd89 in dwarf_expr_context::fetch_result (
     this=0x7fffffffc810, type=0x410d600, subobj_type=0x410d600,
     subobj_offset=0, as_lval=true)
     at gdb/dwarf2/expr.c:1006
 #12 0x000000000081e2ef in dwarf_expr_context::evaluate (this=0x7fffffffc810,
     addr=0x7ffff459ce6b "W\aF\003", len=1, as_lval=true,
     per_cu=0x7fffd00053f0, frame=..., addr_info=0x7fffffffcc30, type=0x0,
     subobj_type=0x0, subobj_offset=0)
     at gdb/dwarf2/expr.c:1136
 #13 0x0000000000877c14 in dwarf2_locexpr_baton_eval (dlbaton=0x3e99c18,
     frame=..., addr_stack=0x7fffffffcc30, valp=0x7fffffffcab0,
     push_values=..., is_reference=0x7fffffffc9b0)
     at gdb/dwarf2/loc.c:1604
 #14 0x0000000000877f71 in dwarf2_evaluate_property (prop=0x3e99ce0,
     initial_frame=..., addr_stack=0x7fffffffcc30, value=0x7fffffffcab0,
     push_values=...) at gdb/dwarf2/loc.c:1668
 #15 0x00000000009def76 in resolve_dynamic_range (dyn_range_type=0x3e99c50,
     addr_stack=0x7fffffffcc30, frame=..., rank=0, resolve_p=true)
     at gdb/gdbtypes.c:2198
 #16 0x00000000009e0ded in resolve_dynamic_type_internal (type=0x3e99c50,
     addr_stack=0x7fffffffcc30, frame=..., top_level=true)
     at gdb/gdbtypes.c:2934
 #17 0x00000000009e1079 in resolve_dynamic_type (type=0x3e99c50, valaddr=...,
     addr=0, in_frame=0x0) at gdb/gdbtypes.c:2989
 #18 0x0000000000488ebc in ada_discrete_type_low_bound (type=0x3e99c50)
     at gdb/ada-lang.c:710
 #19 0x00000000004eb734 in print_range (type=0x3e99c50, stream=0x30157b0,
     bounds_preferred_p=0) at gdb/ada-typeprint.c:156
 #20 0x00000000004ebffe in print_array_type (type=0x3e99d10, stream=0x30157b0,
     show=1, level=9, flags=0x1bdcf20 <type_print_raw_options>)
     at gdb/ada-typeprint.c:381
 #21 0x00000000004eda3c in ada_print_type (type0=0x3e99d10,
     varstring=0x401f710 "c_to", stream=0x30157b0, show=1, level=9,
     flags=0x1bdcf20 <type_print_raw_options>)
     at gdb/ada-typeprint.c:1015
 #22 0x00000000004b4627 in ada_language::print_type (
     this=0x2f949b0 <ada_language_defn>, type=0x3e99d10,
     varstring=0x401f710 "c_to", stream=0x30157b0, show=1, level=9,
     flags=0x1bdcf20 <type_print_raw_options>)
     at gdb/ada-lang.c:13681
 #23 0x0000000000f74646 in print_symbol (gdbarch=0x3256270, symbol=0x3e99db0,
     depth=9, outfile=0x30157b0) at gdb/symmisc.c:545
 #24 0x0000000000f737e6 in dump_symtab_1 (symtab=0x3ddd7e0, outfile=0x30157b0)
     at gdb/symmisc.c:313
 #25 0x0000000000f73a69 in dump_symtab (symtab=0x3ddd7e0, outfile=0x30157b0)
     at gdb/symmisc.c:370
 #26 0x0000000000f7420f in maintenance_print_symbols (args=0x0, from_tty=0)
     at gdb/symmisc.c:481
 #27 0x00000000006c7fde in do_simple_func (args=0x0, from_tty=0, c=0x321e270)
     at gdb/cli/cli-decode.c:94
 #28 0x00000000006ce65a in cmd_func (cmd=0x321e270, args=0x0, from_tty=0)
     at gdb/cli/cli-decode.c:2826
 #29 0x0000000001005b78 in execute_command (p=0x3f48fe3 "", from_tty=0)
     at gdb/top.c:564
 #30 0x0000000000966095 in command_handler (
     command=0x3f48fd0 "maint print symbols")
     at gdb/event-top.c:613
 #31 0x0000000001005141 in read_command_file (stream=0x3011a40)
     at gdb/top.c:333
 #32 0x00000000006e2a64 in script_from_file (stream=0x3011a40,
     file=0x7fffffffe21f "gdb.in")
     at gdb/cli/cli-script.c:1705
 #33 0x00000000006bb88c in source_script_from_stream (stream=0x3011a40,
     file=0x7fffffffe21f "gdb.in", file_to_open=0x7fffffffd760 "gdb.in")
     at gdb/cli/cli-cmds.c:706
 #34 0x00000000006bba12 in source_script_with_search (
     file=0x7fffffffe21f "gdb.in", from_tty=0, search_path=0)
     at gdb/cli/cli-cmds.c:751
 #35 0x00000000006bbab2 in source_script (file=0x7fffffffe21f "gdb.in",
     from_tty=0) at gdb/cli/cli-cmds.c:760
 #36 0x0000000000b835cb in catch_command_errors (
     command=0x6bba7e <source_script(char const*, int)>,
     arg=0x7fffffffe21f "gdb.in", from_tty=0, do_bp_actions=false)
     at gdb/main.c:510
 #37 0x0000000000b83803 in execute_cmdargs (cmdarg_vec=0x7fffffffd980,
     file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND, ret=0x7fffffffd8c8)
     at gdb/main.c:606
 #38 0x0000000000b84d79 in captured_main_1 (context=0x7fffffffdb90)
     at gdb/main.c:1349
 #39 0x0000000000b84fe4 in captured_main (context=0x7fffffffdb90)
     at gdb/main.c:1372
 #40 0x0000000000b85092 in gdb_main (args=0x7fffffffdb90)
     at gdb/main.c:1401
 #41 0x000000000041a382 in main (argc=9, argv=0x7fffffffdcc8)
     at gdb/gdb.c:38
 (gdb)
...

The immediate problem is in dwarf_expr_context::fetch_result where we're
calling get_frame_arch:
...
      switch (this->m_location)
{
case DWARF_VALUE_REGISTER:
  {
    gdbarch *f_arch = get_frame_arch (this->m_frame);
...
with a null frame:
...
(gdb) p this->m_frame.is_null ()
$1 = true
(gdb)
...

Fix this using ensure_have_frame in dwarf_expr_context::execute_stack_op for
DW_OP_reg<n> and DW_OP_regx, getting us instead:
...
         c_to: array (<>) of character; computed at runtime
...

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33512
(cherry picked from commit 32a7293a027d1bf7690d428075e52aa97dbf8350)

4 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Oct 2025 00:03:02 +0000 (00:03 +0000)] 
Automatic date update in version.in

5 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Oct 2025 00:03:52 +0000 (00:03 +0000)] 
Automatic date update in version.in

5 weeks agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Oct 2025 00:02:38 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Oct 2025 00:02:27 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Sep 2025 00:02:29 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Sep 2025 00:02:39 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Sep 2025 00:03:22 +0000 (00:03 +0000)] 
Automatic date update in version.in

5 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Sep 2025 00:02:38 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Sep 2025 00:04:26 +0000 (00:04 +0000)] 
Automatic date update in version.in

6 weeks agoPowerPC: Fix typo in PowerPC note pseudo-section names
Abhay Kandpal [Thu, 25 Sep 2025 09:55:02 +0000 (04:55 -0500)] 
PowerPC: Fix typo in PowerPC note pseudo-section names

The recent tidy-up commit 09e56f0515c3 ("Code tidy: bfd/elf.c:
Tidy up core note handling code.") introduced regressions in the
PowerPC core note handling.  The pseudo-section names for TM_CVSX,
TM_SPR, VSX and VMX notes were defined with an underscore instead of a
hyphen, breaking GDB test cases.  The same goes for one riscv and one
s390 define.

This patch restores the correct section names by using hyphens in the
definitions, fixing 897 GDB test failures on PowerPC.

bfd/
* elf.c: (NOTE_PSEUDO_SECTION_PPC_TM_CVSX),
(NOTE_PSEUDO_SECTION_PPC_TM_SPR, NOTE_PSEUDO_SECTION_PPC_VSX),
(NOTE_PSEUDO_SECTION_PPC_VMX, NOTE_PSEUDO_SECTION_RISCV_CSR),
(NOTE_PSEUDO_SECTION_S390_CTRS): Use hyphens in section names
instead of underscores.

(cherry picked from commit 30300ceca334a1a8997809b41ee7550bafa29b71)

6 weeks agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Sep 2025 00:01:49 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 24 Sep 2025 00:03:11 +0000 (00:03 +0000)] 
Automatic date update in version.in

6 weeks agoChange return value of _bfd_mmap_temporary
Tom Tromey [Thu, 4 Sep 2025 20:12:52 +0000 (14:12 -0600)] 
Change return value of _bfd_mmap_temporary

_bfd_mmap_temporary will return MAP_FAILED in some cases, but only one
caller was prepared for this.  This caused a couple of issues in gdb.

This patch chnages _bfd_mmap_temporary to always return NULL on
failure.  It also changes the logic to fall back to bfd_malloc if mmap
fails.

I took the opportunity to change some "(void *) -1" to MAP_FAILED
where appropriate.

Tested by "make check" in binutils, and also by applying a hack from
bug 33354 to gdb and testing something approximating the original
report.

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

(cherry picked from commit 8b50cc76f19d129b3887dbcb58f8286a7b36099f)

6 weeks agoFix crash in f-typeprint.c
Tom Tromey [Sat, 13 Sep 2025 19:44:10 +0000 (13:44 -0600)] 
Fix crash in f-typeprint.c

I noticed a crash in f-typeprint.c that was hidden by an xfail:

XFAIL: gdb.fortran/vla-array.exp: print variable length string array type (GDB internal error) (PRMS gcc/101826)

I think this was introduced by commit 6594ca4a ("do not handle a NULL
linebuffer in pager_file::puts") but not detected due to the xfail.

It seems bad for an xfail to cover up a crash but I haven't
investigated that.

Meanwhile, this patch fixes the crash by checking for a NULL pointer
when calling gdb_puts.

Approved-by: Kevin Buettner <kevinb@redhat.com>
(cherry picked from commit 18400a9cdf6b3d84996a99697a97774f268576c2)

6 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 23 Sep 2025 00:02:47 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 weeks agoUpdate HFILES_NO_SRCDIR in gdb/Makefile.in
Tom Tromey [Sat, 6 Sep 2025 18:30:35 +0000 (12:30 -0600)] 
Update HFILES_NO_SRCDIR in gdb/Makefile.in

I noticed a header file from dwarf2/ was missing from HFILES_NO_SRCDIR
in gdb/Makefile.in.  Looking more, I found many missing files.  This
patch adds them all and sorts the list -- using "sort", though, and
not the advice at the top of Makefile.in that, IMO, seems hard to
implement.

This also removes some code from the 'tags' rule that I think is
obsolete.

(cherry picked from commit 58f22c76b29088c69eb6f272da7f20fdc5a80c50)

6 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 22 Sep 2025 00:01:31 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 21 Sep 2025 00:02:03 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 weeks agoNew '--binary-output' command line option, fix gdb.mi/ testing on Windows
Pedro Alves [Mon, 8 Sep 2025 19:10:22 +0000 (20:10 +0100)] 
New '--binary-output' command line option, fix gdb.mi/ testing on Windows

MI testcases currently all fail on native Windows with:

 Running /c/gdb/src/gdb/testsuite/gdb.mi/mi-simplerun.exp ...
 ERROR: (timeout) GDB never initialized after 10 seconds.

This is because when GDB is started in MI mode, it prints info to the
terminal before -iex options are processed.  I.e., before the "maint
set console-translation-mode binary" command in

 gdb -nw -nx -q -iex "set height 0" -iex "set width 0" \
    -iex "set interactive-mode on" \
    -iex "maint set console-translation-mode binary" \
    -i=mi

... is processed.  This results in GDB printing early output with
\r\r\n, like can be easily seen by passing --debug to runtest:

  expect: does "=thread-group-added,id="i1"\r\r\n=cmd-param-changed,param="width",value="4294967295"\r\r\n=cmd-param-changed,param="interactive-mode",value="on"\r\r\n(gdb) \r\n" (spawn_id exp10) match regular expression "~"GNU.*\r\n~".*[(]gdb[)] \r\n$"? Gate "~"GNU*\r\n~"*gdb? \r\n"? gate=no

Fix this by adding a new Windows-only --binary-output command line
option to GDB, which is processed much earlier than -iex, and making
the testsuite pass that instead of "maint set console-translation-mode
binary".

Remove "maint set console-translation-mode" completely, since the only
reason it existed was for the testsuite, and it was never included in
any release.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Tom de Vries <tdevries@suse.de>
Change-Id: I4632707bb7c8ca573cffff9641ddeb33a0e150af

6 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 20 Sep 2025 00:05:05 +0000 (00:05 +0000)] 
Automatic date update in version.in

7 weeks agoCorrect bounds check when working around GAS DWARF 5 directory table bug
Keith Seitz [Fri, 19 Sep 2025 17:51:57 +0000 (10:51 -0700)] 
Correct bounds check when working around GAS DWARF 5 directory table bug

Recent Go toolchains are causing GDB to crash on a relatively recent
workaround for a GAS bug:

commit a833790a626d9620319d0ca6aee23daa584d445c
Date:   Wed Nov 1 00:33:12 2023 +0100

    [gdb/symtab] Work around gas PR28629

In the original GAS bug, the first directory table entry did not contain
the current directory of the compilation. So the above commit added a
workaround fix to prepend the second directory table entry.

However recent Go toolchain compilations (specifically on aarch64)
only output a single directory table entry. Looking at the workaround:

       if (lh->version == 5 && lh->is_valid_file_index (1))
         {
           std::string dir = lh->include_dir_at (1);
           fnd.set_comp_dir (std::move (dir));
         }

`lh->is_valid_file_index (1)' is true, but since the directory table only
has one entry, `include_dir_at (1)' returns nullptr. Consequently the
std::string ctor will segfault. Since there are no guarantees that the file
and directory tables are the same size, a better bounds check is to simply
rely on `include_dir_at' to ensure a valid directory table entry.

I have updated the workaround commit's test, gdb.dwarf2/dw2-gas-workaround.exp
and tested on x86_64 and aarch64 RHEL 9 and Fedora 41.

Approved-By: Andrew Burgess <aburgess@redhat.com>
(cherry picked from commit 31cb4bb676dde0db3f24e03380a02ae92633c98f)

7 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 19 Sep 2025 00:02:08 +0000 (00:02 +0000)] 
Automatic date update in version.in

7 weeks agoHave gdb.ThreadExitedEvent inherit from gdb.ThreadEvent
Tom Tromey [Wed, 17 Sep 2025 14:49:27 +0000 (08:49 -0600)] 
Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent

The documentation says that ThreadExitedEvent is derived from
ThreadEvent, but the code does not actually implement this.

This patch fixes the problem.  I propose applying this to gdb 17 as
well.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33444
Approved-By: Simon Marchi <simon.marchi@efficios.com>
(cherry picked from commit 3a9f5df6ea8adcae7769f271cccbc2da8553c08d)

7 weeks agoAutomatic date update in version.in
GDB Administrator [Thu, 18 Sep 2025 00:05:20 +0000 (00:05 +0000)] 
Automatic date update in version.in

7 weeks agoGDB: aarch64: Use GCS features to calculate hash of struct aarch64_features
Thiago Jung Bauermann [Thu, 11 Sep 2025 01:46:07 +0000 (22:46 -0300)] 
GDB: aarch64: Use GCS features to calculate hash of struct aarch64_features

Luis noticed that when adding the gcs and gcs_linux members to struct
aarch64_features in my Guarded Control Stack patch series, I neglected to
modify struct hash<aarch64_features>::operator() to take them into account
when computing its hash.

This can cause GDB to use the wrong aarch64_features object during a
debugging session.

Regression tested on aarch64-linux-gnu.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33440
Suggested-by: Luis Machado <luis.machado.foss@gmail.com>
Approved-By: Luis Machado <luis.machado.foss@gmail.com>
(cherry picked from commit 86e6907244c89bde0d1584dbcbd617b53319d0f9)

7 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 17 Sep 2025 00:03:23 +0000 (00:03 +0000)] 
Automatic date update in version.in

7 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Sep 2025 00:03:10 +0000 (00:03 +0000)] 
Automatic date update in version.in

7 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Sep 2025 00:02:04 +0000 (00:02 +0000)] 
Automatic date update in version.in

7 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Sep 2025 00:04:43 +0000 (00:04 +0000)] 
Automatic date update in version.in

7 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Sep 2025 00:02:16 +0000 (00:02 +0000)] 
Automatic date update in version.in

8 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Sep 2025 00:01:17 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 weeks agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Sep 2025 00:03:11 +0000 (00:03 +0000)] 
Automatic date update in version.in

8 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Sep 2025 00:02:36 +0000 (00:02 +0000)] 
Automatic date update in version.in

8 weeks agoFix gdb.Value.dynamic_type attribute
Hannes Domani [Tue, 9 Sep 2025 17:28:36 +0000 (19:28 +0200)] 
Fix gdb.Value.dynamic_type attribute

gdb currently crashes if you try to get the dynamic_type from a
gdb.Value of a POD struct:

(gdb) py print(gdb.parse_and_eval('pod').dynamic_type)
Fatal signal: Segmentation fault

It happens because value_rtti_type() returns NULL for them, and this is
not handled correctly.

Fixed by using val->type() as a fallback in this case.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
8 weeks agogdb: Add i386-gnu-tdep to the list of objects for x86_64-*-gnu*
Sergio Durigan Junior [Fri, 5 Sep 2025 18:03:56 +0000 (14:03 -0400)] 
gdb: Add i386-gnu-tdep to the list of objects for x86_64-*-gnu*

When starting GDB on Hurd amd64, one will currently see the following
warning:

  # gdb -q
  gdb: warning: A handler for the OS ABI "GNU/Hurd" is not built into this configuration
  of GDB.  Attempting to continue with the default i386 settings.
  (gdb)

This happens because, in gdb/configure.tgt, the "x86_64-*-gnu*" target
is not pulling in the i386-gnu-tdep.o object, which means that only
64-bit debugging is currently supported.

The fix here is to add i386-gnu-tdep.o to the gdb_target_obs for Hurd
amd64.

Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
Suggested-by: Andrew Burgess <aburgess@redhat.com>
Reported-by: Mark Wielaard <mark@klomp.org>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33377
Approved-by: Kevin Buettner <kevinb@redhat.com>
(cherry picked from commit 3d22a6cee4b27866c544d67a82e2272ae4201f9e)

8 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Sep 2025 00:02:24 +0000 (00:02 +0000)] 
Automatic date update in version.in

8 weeks agogdb: Add svr4-tls-tdep.o to list of objects of i*86 targets
Sergio Durigan Junior [Sun, 7 Sep 2025 21:57:09 +0000 (17:57 -0400)] 
gdb: Add svr4-tls-tdep.o to list of objects of i*86 targets

GDB currently fails to build from source on i386 if compiled with
--enable-64-bit-bfd.  This is happening because svr4-tls-tdep.o is
missing from the gdb_target_obs variable, while amd64-linux-tdep.o is
obviously there.

Fix the problem by adding svr4-tls-tdep.o to the object list, but only
when --enable-64-bit-bfd is provided.

Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33399
(cherry picked from commit b318480f27322c15c6b10c1bab4418e81d44b77e)

8 weeks agogdb/testsuite: small fix for amd64-extended-prologue-analysis.exp
Andrew Burgess [Mon, 8 Sep 2025 09:18:09 +0000 (10:18 +0100)] 
gdb/testsuite: small fix for amd64-extended-prologue-analysis.exp

I noticed I was sometimes getting this failure:

  FAIL: gdb.arch/amd64-extended-prologue-analysis.exp: offset \
      initialization: ASM source: gdb_breakpoint: set breakpoint \
      at *0x0000000000401151

The problem was introduced in commit:

  commit f9aa48dc545ef511e19f4dfab88a196b820fd2da
  Date:   Thu Aug 28 11:50:13 2025 +0000

      gdb, amd64: extend the amd64 prologue analyzer to skip register pushes

A gdb_test_multiple exits early when processing the results of a
'disassemble' command, without waiting for the prompt to be seen.
This can leave unhandled output in expect's input buffer, which will
then throw off the next test.

Update the gdb_test_multiple to wait for the prompt before declaring
the test passed.

After this I'm no longer seeing the above failure.

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

2 months agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Sep 2025 00:02:33 +0000 (00:02 +0000)] 
Automatic date update in version.in

2 months agoAutomatic date update in version.in
GDB Administrator [Sun, 7 Sep 2025 00:02:17 +0000 (00:02 +0000)] 
Automatic date update in version.in

2 months agoBump GDB's version number to 17.0.90.DATE-git.
Joel Brobecker [Sat, 6 Sep 2025 22:35:12 +0000 (15:35 -0700)] 
Bump GDB's version number to 17.0.90.DATE-git.

This commit changes gdb/version.in to 17.0.90.DATE-git.

2 months agoSet GDB version number to 17.0.90.
Joel Brobecker [Sat, 6 Sep 2025 22:23:17 +0000 (15:23 -0700)] 
Set GDB version number to 17.0.90.

This commit changes gdb/version.in to 17.0.90.

2 months agogdb/NEWS: Change "since GDB 16" into "in GDB 17"
Joel Brobecker [Sat, 6 Sep 2025 22:20:29 +0000 (15:20 -0700)] 
gdb/NEWS: Change "since GDB 16" into "in GDB 17"

Now that the major release version number is confirmed, we can adjust
the title of the corresponding section in the gdb/NEWS file.

2 months agoSet development mode to "off" by default.
Joel Brobecker [Sat, 6 Sep 2025 22:09:03 +0000 (15:09 -0700)] 
Set development mode to "off" by default.

This is done by setting the "development" variable to "false"
in bfd/development.sh.

2 months agoBump version to 17.0.90.DATE-git.
Joel Brobecker [Sat, 6 Sep 2025 22:08:52 +0000 (15:08 -0700)] 
Bump version to 17.0.90.DATE-git.

Now that the GDB 17 branch has been created,
this commit bumps the version number in gdb/version.in to
17.0.90.DATE-git

For the record, the GDB 17 branch was created
from commit 46ada32fc979550ad4f46792b74c182bb7232aeb.

2 months agoUpdate x86: Add GLIBC_ABI_GNU2_TLS version dependency gdb-17-branchpoint
H.J. Lu [Sat, 6 Sep 2025 13:19:25 +0000 (06:19 -0700)] 
Update x86: Add GLIBC_ABI_GNU2_TLS version dependency

commit 0d1e88f8bfb0e62f37bf8a89172cd91373ace5e6
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jul 4 08:39:03 2025 +0800

    x86: Add GLIBC_ABI_GNU2_TLS version dependency

added solaris2-x86-64.em to accommodate moving x86-64 specific extra
emulation bits to elf-x86-64.em.  Update emulparams/elf_x86_64_sol2.sh
to use it.

* emulparams/elf_x86_64_sol2.sh (EXTRA_EM_FILE): Set to
"solaris2-x86-64".

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 months agoRe: tekhex test for commit bf0f85df1254
Alan Modra [Fri, 5 Sep 2025 13:22:30 +0000 (22:52 +0930)] 
Re: tekhex test for commit bf0f85df1254

* testsuite/binutils-all/objcopy.exp (objcopy_tek2bin): Correct
isremote to is_remote.

2 months agoAutomatic date update in version.in
GDB Administrator [Sat, 6 Sep 2025 00:00:59 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 months agobfd: configure.ac: Fix mention of flag to enable 64-bit BFD in comment
Thiago Jung Bauermann [Thu, 4 Sep 2025 23:11:29 +0000 (20:11 -0300)] 
bfd: configure.ac: Fix mention of flag to enable 64-bit BFD in comment

It was changed back in 1994.  Fixing because it misled me into using the
wrong flag in a build.

2 months agoAllow conversion of 128-bit integers to Python
Tom Tromey [Fri, 5 Sep 2025 11:31:34 +0000 (05:31 -0600)] 
Allow conversion of 128-bit integers to Python

Currently, trying to convert a 128-bit integer from a gdb.Value to a
Python integer will fail.  This is surprising because Python uses
bigints internally.

The bug here is that valpy_long uses value_as_long, which fails for
anything wider than LONGEST.  This patch fixes the problem by using
the recommended Python API.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33366
Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.base, part 3
Tom de Vries [Fri, 5 Sep 2025 13:36:23 +0000 (15:36 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.base, part 3

Fix fallout in gdb.base from erroring out on clean_restart
<absolute filename>.

Tested on x86_64-linux.

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.base, part 2
Tom de Vries [Fri, 5 Sep 2025 13:36:23 +0000 (15:36 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.base, part 2

Manually fix the test-cases found by:
...
$ find gdb/testsuite/gdb.base -name *.exp* \
  | xargs grep -l 'clean_restart[^;]*binfile'
$ find gdb/testsuite/gdb.base -name *.exp* \
  | xargs grep -l 'prepare_for_testing.*bin'
...
except for gdb.base/foll-vfork.exp and gdb.base/solib-overlap.exp.

Tested on x86_64-linux.

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.base, part 1
Tom de Vries [Fri, 5 Sep 2025 13:36:23 +0000 (15:36 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.base, part 1

Run:
...
$ find gdb/testsuite/gdb.base/ -name *.exp* \
    | xargs sed -i 's/^\([ \t]*\)clean_restart $binfile$/\1clean_restart\n\1gdb_load $binfile/'
$ find gdb/testsuite/gdb.base/ -name *.exp* \
    | xargs sed -i 's/^\([ \t]*\)clean_restart ${binfile}$/\1clean_restart\n\1gdb_load $binfile/'
$ find gdb/testsuite/gdb.base/ -name *.exp* \
    | xargs sed -i 's/^\([ \t]*\)clean_restart $::binfile$/\1clean_restart\n\1gdb_load $::binfile/'
$ find gdb/testsuite/gdb.base/ -name *.exp* \
    | xargs sed -i 's/^\([ \t]*\)clean_restart ${::binfile}$/\1clean_restart\n\1gdb_load $::binfile/'
...

Revert the change in test-case gdb.base/foll-vfork.exp, which does
'set binfile $testfile'.

Tested on x86_64-linux.

The only modified test-case I was not able to test is
gdb.base/dtrace-probe.exp (filed PR testsuite/33379 about this).  The change
in the test-case is trivial though.

2 months agoreadelf: Handle 0 sh_entsize of GOT sections
H.J. Lu [Thu, 4 Sep 2025 13:05:33 +0000 (06:05 -0700)] 
readelf: Handle 0 sh_entsize of GOT sections

Gold, lld and mold set sh_entsize to 0 on .got and .got.plt sections.
If sh_entsize of GOT sections is 0, assume 8 for ELFCLASS64 and 4 for
ELFCLASS32, except for x32 which uses 8.

PR binutils/33368
* readelf.c (process_got_section_contents): Handle 0 sh_entsize
of GOT sections.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 months agoRevert "MicroBlaze: Add microblaze_get_next_pcs"
Gopi Kumar Bulusu [Fri, 5 Sep 2025 09:50:59 +0000 (15:20 +0530)] 
Revert "MicroBlaze: Add microblaze_get_next_pcs"

This reverts commit c6df5d79aac5c4a77c06314fd26c837470360f70.

Causes buildbot failure. Bug 33381

2 months agogdb: ensure bp_location::section is set correct to avoid an assert
Andrew Burgess [Wed, 3 Sep 2025 18:57:42 +0000 (19:57 +0100)] 
gdb: ensure bp_location::section is set correct to avoid an assert

While reviewing and testing another patch I set a breakpoint on an
gnu ifunc function, then restarted the inferior, and this assert
triggered:

  ../../src/gdb/breakpoint.c:14747: internal-error: breakpoint_free_objfile: Assertion `loc->symtab == nullptr' failed.

The backtrace at the time of the assert is:

  #6  0x00000000005ffee0 in breakpoint_free_objfile (objfile=0x4064b30) at ../../src/gdb/breakpoint.c:14747
  #7  0x0000000000c33ff2 in objfile::~objfile (this=0x4064b30, __in_chrg=<optimized out>) at ../../src/gdb/objfiles.c:478
  #8  0x0000000000c38da6 in std::default_delete<objfile>::operator() (this=0x7ffc1a49d538, __ptr=0x4064b30) at /usr/include/c++/9/bits/unique_ptr.h:81
  #9  0x0000000000c3782a in std::unique_ptr<objfile, std::default_delete<objfile> >::~unique_ptr (this=0x7ffc1a49d538, __in_chrg=<optimized out>) at /usr/include/c++/9/bits/unique_ptr.h:292
  #10 0x0000000000caf1bd in owning_intrusive_list<objfile, intrusive_base_node<objfile> >::erase (this=0x3790d68, i=...) at ../../src/gdb/../gdbsupport/owning_intrusive_list.h:111
  #11 0x0000000000cacd0c in program_space::remove_objfile (this=0x3790c80, objfile=0x4064b30) at ../../src/gdb/progspace.c:192
  #12 0x0000000000c33e1c in objfile::unlink (this=0x4064b30) at ../../src/gdb/objfiles.c:408
  #13 0x0000000000c34fb9 in objfile_purge_solibs (pspace=0x3790c80) at ../../src/gdb/objfiles.c:729
  #14 0x0000000000edf6f7 in no_shared_libraries (pspace=0x3790c80) at ../../src/gdb/solib.c:1359
  #15 0x0000000000fb3f6c in target_pre_inferior () at ../../src/gdb/target.c:2466
  #16 0x0000000000a724d7 in run_command_1 (args=0x0, from_tty=0, run_how=RUN_NORMAL) at ../../src/gdb/infcmd.c:390
  #17 0x0000000000a72a97 in run_command (args=0x0, from_tty=0) at ../../src/gdb/infcmd.c:514
  #18 0x00000000006bbb3d in do_simple_func (args=0x0, from_tty=0, c=0x39124b0) at ../../src/gdb/cli/cli-decode.c:95
  #19 0x00000000006c1021 in cmd_func (cmd=0x39124b0, args=0x0, from_tty=0) at ../../src/gdb/cli/cli-decode.c:2827

The function breakpoint_free_objfile is being called when an objfile
representing a shared library is being unloaded ahead of the inferior
being restarted, the function is trying to remove references to
anything that could itself reference the objfile that is being
deleted.

The assert is making the claim that, for a bp_location, which has a
single address, the objfile of the symtab associated with the location
will be the same as the objfile associated with the section of the
location.

This seems reasonable to me now, as it did when I added the assert in
commit:

  commit 5066f3680667ec0f2d1745847a2372d85973a1e7
  Date:   Mon Nov 11 21:45:17 2024 +0000

      gdb: do better in breakpoint_free_objfile

The bp_location::section is maintained, according to the comments in
breakpoint.h, to aid overlay debugging (is that even used any more),
and looking at the code, this does appear to be the case.

The problem in the above case arises when we are dealing with an ifunc
function.  What happens is that we end up with a section from one
objfile, but a symtab from a different objfile.

This problem originates from minsym_found (in linespec.c).  The user
asked for 'break gnu_ifunc' where 'gnu_ifunc' is an ifunc function.
What this means is that gnu_ifunc is actually a resolver function that
returns the address of the actual function to use.

In this particular test case, the resolver function is in a shared
library, and the actual function to use is in the main executable.

So, when GDB looks for 'gnu_ifunc' is finds the minimal_symbol with
that name, and spots that this has type mst_text_gnu_ifunc.  GDB then
uses this to figure out the actual address of the function that will
be run.

GDB then creates the symtab_and_line using the _real_ address and the
symtab in which that address lies, in our case this will all be
related to the main executable objfile.

But, finally, in minsym_found, GDB fills in the symtab_and_line's
section field, and this is done using the section containing the
original minimal_symbol, which is from the shared library objfile.

The minimal symbol and section are then use to initialise the
bp_location object, and this is how we end up in, what I think, is an
unexpected state.

So what to do about this?

The symtab_and_line::msymbol field is _only_ set within minsym_found,
and is then _only_ used to initialise the bp_location::msymbol field.

The bp_location::msymbol field is _only_ used in the function
set_breakpoint_location_function, and we only really care about the
msymbol type, we check to see if it's an ifunc symbol or not.  This
allows us to set the name of the function correctly.

The bp_location::section is used, as far as I can tell, extensively
for overlay handling.  It would seem to me, that this section should
be the section containing the actual breakpoint address.  If the
question we're asking is, is this breakpoint mapped in or not?  Then
surely we need to ask about the section holding the breakpoint's
address, and not the section holding some other code (e.g. the
resolver function).  In fact, in a memory constrained environment,
you'd expect the resolver functions to get mapped out pretty early on,
but while the actual functions might still be mapped in.

Finally, symtab_and_line::section.  This is mostly set using calls to
find_pc_overlay.  The minsym_found function is one of the few places
where we do things differently.  In the places where the section is
used, it is (almost?) always used in conjunction with the
symtab_and_line::pc to lookup information, e.g. calls to
block_for_pc_sect, or find_pc_sect_containing_function.  In all these
cases, it appears to me that the assumption is that the section will
be the section that contains the address.

So, where does this leave us?

I think what we need to do is update minsym_found to just use
find_pc_overlay, which is how the symtab_and_line::section is set in
most other cases.  What this actually means in practise is that the
section field will be set to NULL (see find_pc_overlay in symfile.c).
But given that this is how the section is computed in most other
cases, I don't see why it should be especially problematic for this
case.  In reality, I think this just means that the section is
calculated via a call to find_pc_section when it's needed, as an
example, see lookup_minimal_symbol_by_pc_section (minsyms.c).

I do wonder if we should be doing better when creating the
symtab_and_line, and insist that the section be calculated correctly
at that point, but I really don't want to open that can of worms right
now, so I think just changing minsym_found to "do it just like
everyone else" should be good enough.

I've extended the existing ifunc test to expose this issue, the
updated test fails without this patch, and passes with.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months agogdb: pass core file to gdbarch_core_read_x86_xsave_layout
Andrew Burgess [Wed, 27 Aug 2025 19:24:02 +0000 (20:24 +0100)] 
gdb: pass core file to gdbarch_core_read_x86_xsave_layout

Continuing the removal of 'current_program_space->core_bfd ()' from
GDB, this commit updates the gdbarch method
'gdbarch_core_read_x86_xsave_layout' to take the core file BFD as a
reference parameter.  For now this just moves the
'current_program_space->core_bfd ()' calls up the program stack into
core_target::fetch_x86_xsave_layout.  In the future I plan to move the
core file BFD object out of the program_space and into the
core_target, at which point these new global accesses can also be
removed.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months agogdb: pass core file to gdbarch_core_thread_name method
Andrew Burgess [Wed, 27 Aug 2025 19:14:03 +0000 (20:14 +0100)] 
gdb: pass core file to gdbarch_core_thread_name method

Continuing the removal of 'current_program_space->core_bfd ()' from
GDB, this commit updates the gdbarch method 'gdbarch_core_thread_name'
to take the core file BFD as a reference parameter.  For now this just
moves the 'current_program_space->core_bfd ()' calls up the program
stack into core_target::thread_name.  In the future I plan to move the
core file BFD object out of the program_space and into the
core_target, at which point these new global accesses can also be
removed.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months agogdb: pass core file through gdbarch API when loading shared libraries
Andrew Burgess [Wed, 27 Aug 2025 19:11:06 +0000 (20:11 +0100)] 
gdb: pass core file through gdbarch API when loading shared libraries

Continuing the removal of 'current_program_space->core_bfd ()' from
GDB, this commit updates two gdbarch methods:

  gdbarch_core_xfer_shared_libraries
  gdbarch_core_xfer_shared_libraries_aix

to take the core file BFD as a reference parameter.  For now this just
moves the 'current_program_space->core_bfd ()' calls up the program
stack into core_target::xfer_partial.  In the future I plan to move
the core file BFD object out of the program_space and into the
core_target, at which point these new global accesses can also be
removed.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months ago[gdb/testsuite] Fix gdb.base/fileio.exp for local-remote-host-native
Tom de Vries [Fri, 5 Sep 2025 07:54:41 +0000 (09:54 +0200)] 
[gdb/testsuite] Fix gdb.base/fileio.exp for local-remote-host-native

When running test-case gdb.base/fileio.exp with host/target board
local-remote-host-native I run into:
...
gdb compile failed, fileio.c: In function 'test_open':
<command-line>:0:8: error: expected expression before '.' token
fileio.c:89:15: note: in expansion of macro 'OUTDIR'
   ret = open (OUTDIR FILENAME, O_CREAT | O_TRUNC | O_RDWR, S_IWUSR | S_IRUSR);
               ^~~~~~
...

Fix this by using:
- quote_for_host to pass -DOUTDIR to the compilation, and
- STRINGIFY to stringify OUTDIR in fileio.c.

Tested on x86_64-linux, with target board unix and host/target board
local-remote-host-native.

2 months agoMicroBlaze: Add microblaze_get_next_pcs
Gopi Kumar Bulusu [Fri, 5 Sep 2025 06:55:46 +0000 (12:25 +0530)] 
MicroBlaze: Add microblaze_get_next_pcs

This patch enables software single stepping for gdbserver target

* gdb/microblaze-tdep.c: Add microblaze_get_next_pcs

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in allow_aarch64_sme_tests
Tom de Vries [Fri, 5 Sep 2025 06:40:36 +0000 (08:40 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in allow_aarch64_sme_tests

Fix fallout on aarch64-linux with test-case
gdb.testsuite/gdb-caching-proc-consistency.exp from erroring out on
clean_restart <absolute filename>.

2 months ago[gdb/testsuite] Fix silent timeout in allow_aarch64_gcs_tests
Tom de Vries [Fri, 5 Sep 2025 06:37:30 +0000 (08:37 +0200)] 
[gdb/testsuite] Fix silent timeout in allow_aarch64_gcs_tests

I noticed on M1 aarch64-linux that test-case
gdb.testsuite/gdb-caching-proc-consistency.exp took a long time.

I saw lack of progress in gdb.log for proc allow_aarch64_gcs_tests.

This gdb_expect only handles the case that gcs support is detected:
...
    gdb_expect {
        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
            verbose -log "\n$me: gcs support detected"
            set allow_gcs_tests 1
        }
    }
...
but in my case, I get:
...
(gdb) run ^M
Starting program: allow_aarch64_gcs_tests.x ^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
[Inferior 1 (process 3336556) exited with code 01]^M
(gdb)
...
so the gdb_expect times out quietly, taking 10 seconds.

In the test-case, it does so 11 times.

Fix this by adding a gdb_expect clause handling the "with code 01" case.

Tested on aarch64-linux.

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

2 months agox86: check reloc types for relaxable branches
Jan Beulich [Fri, 5 Sep 2025 06:33:27 +0000 (08:33 +0200)] 
x86: check reloc types for relaxable branches

Bypassing _reloc() isn't a good idea, as there are various errors
checked for there. For example 16-bit JMP or Jcc may not use the @plt
form (resulting in a 32-bit relocation to be emitted for a 16-bit
field), which so far we only reject for 16-bit CALL. In exchange this
allows simplifying the setting up of the "reloc_type" local variable.

2 months agox86: make reloc() usable during late phases of assembly
Jan Beulich [Fri, 5 Sep 2025 06:32:25 +0000 (08:32 +0200)] 
x86: make reloc() usable during late phases of assembly

Introduce a clone with extra parameters, to allow subsequent use from
md_estimate_size_before_relax() (or elsewhere, should that turn out
necessary). There flag_code cannot be used and location information
needs to be provided for diagnostics.

2 months agogdb: run black on gdbarch_components.py
Simon Marchi [Fri, 5 Sep 2025 01:47:36 +0000 (21:47 -0400)] 
gdb: run black on gdbarch_components.py

Change-Id: Ifcf80faa240c7c235bfea4ddc79f0d6c39858c5e

2 months agoAutomatic date update in version.in
GDB Administrator [Fri, 5 Sep 2025 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 months agoGDB: aarch64-linux: Define HWCAP_GCS as unsigned long long value
Thiago Jung Bauermann [Thu, 4 Sep 2025 16:50:44 +0000 (13:50 -0300)] 
GDB: aarch64-linux: Define HWCAP_GCS as unsigned long long value

On platforms where long is 32 bits, this change fixes a build failure:

/home/linux/arm/gdb/src/gdb/aarch64-linux-tdep.c: In function ‘const target_desc* aarch64_linux_core_read_description(gdbarch*, target_ops*, bfd*)’:
/home/linux/arm/gdb/src/gdb/arch/aarch64-gcs-linux.h:27:24: error: left shift count >= width of type [-Werror=shift-count-overflow]
   27 | #define HWCAP_GCS (1UL << 32)
      |                    ~~~~^~~~~
/home/linux/arm/gdb/src/gdb/aarch64-linux-tdep.c:1714:47: note: in expansion of macro ‘HWCAP_GCS’
 1714 |   features.gcs = features.gcs_linux = hwcap & HWCAP_GCS;
      |                                               ^~~~~~~~~

Suggested-by: Tom de Vries <tdevries@suse.de>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33372

2 months agogdb/testsuite: revert recent changes to gdb.dap/scopes.exp
Andrew Burgess [Mon, 1 Sep 2025 16:08:26 +0000 (17:08 +0100)] 
gdb/testsuite: revert recent changes to gdb.dap/scopes.exp

After the previous commit, the changes to gdb.dap/scopes.exp from the
commit:

  commit 63b862be762e1e6e7ce667c6b4a1a3dd79939bf4
  Date:   Fri Mar 29 16:38:50 2019 +0100

      gdb, gdbserver: Add support of Intel shadow stack pointer register.

Are no longer needed, the test will now happily handle the shadow
stack pointer being unavailable.

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

Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
2 months agogdb/dap: check values are available before converting to int
Andrew Burgess [Mon, 1 Sep 2025 16:00:15 +0000 (17:00 +0100)] 
gdb/dap: check values are available before converting to int

In VariableReference.to_object, we try to convert a gdb.Value to an
int without checking if the value is actually available.  This came to
light in PR gdb/33345, after the x86 CET shadow stack patches were
merged.

If the x86 CET shadow stack register is available on the machine,
but the shadow stack feature is not enabled at run time, then the
register will show as "<unavailable>".

As the register is of type 'void *', then in the DAP code we try to
add a 'memoryReference' attribute with the value of the register
formatted as hex.  This will fail if the register is unavailable.

To test this change you'll need:

  (a) a machine which support the shadow stack feature, and

  (b) to revert the changes from commit 63b862be762e1e6e7 in the file
      gdb.dap/scopes.exp.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33345
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
2 months agogdb/python: add gdb.Value.is_unavailable attribute
Andrew Burgess [Mon, 1 Sep 2025 15:58:58 +0000 (16:58 +0100)] 
gdb/python: add gdb.Value.is_unavailable attribute

Add a new gdb.Value.is_unavailable attribute.  This is similar to the
existing Value.is_optimized_out attribute, but returns True if any
part of the value is <unavailable>.

The existing Value.is_optimized_out attribute returns true if any part
of the value is optimized out, so I thought that Value.is_unavailable
should work the same way.

There's also a test.

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

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
2 months agogdb, amd64: return after amd64_analyze_register_saves if current_pc reached
Pawel Kupczak [Thu, 28 Aug 2025 11:50:16 +0000 (11:50 +0000)] 
gdb, amd64: return after amd64_analyze_register_saves if current_pc reached

Make sure the function bails out early if CURRENT_PC is reached, to
avoid the call to amd64_analyze_stack_alloc.

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2 months agogdb, amd64: extend the amd64 prologue analyzer to skip stack alloc
Pawel Kupczak [Thu, 28 Aug 2025 11:50:15 +0000 (11:50 +0000)] 
gdb, amd64: extend the amd64 prologue analyzer to skip stack alloc

Following the previous patch (gdb, amd64: extend the amd64 prologue
analyzer to skip register pushes), this patch extends the analyzer
further to be able to skip stack space allocation as the next prologue
part, for functions with a frame pointer.  Implementation was based
on the i386 counterpart, which already had that functionality.

As of now, the stack allocation is not skipped.  Examples below use C
source listed below, compiled with gcc 11.4.0.
```
int foo (int n)
{
    int ns[] = { 1, 4, 9, 16, 25 };
    return ns[n];
}

int
main (int argc, char **argv)
{
    return foo (argc);
}
```

Compiling with "gcc -O0 -fno-omit-frame-pointer" we get:
```
(gdb) b foo
Breakpoint 1 at 0x1151
(gdb) r
...
Breakpoint 1, 0x0000555555555151 in foo ()
(gdb) disassemble
Dump of assembler code for function foo:
   0x0000555555555149 <+0>:     endbr64
   0x000055555555514d <+4>:     push   %rbp
   0x000055555555514e <+5>:     mov    %rsp,%rbp
=> 0x0000555555555151 <+8>:     sub    $0x30,%rsp
   0x0000555555555155 <+12>:    mov    %edi,-0x24(%rbp)
...
```

With this patch, it gets skipped the same way register pushes are:
```
(gdb) b foo
Breakpoint 1 at 0x1155
(gdb) r
...
Breakpoint 1, 0x0000555555555155 in foo ()
(gdb) disassemble
Dump of assembler code for function foo:
   0x0000555555555149 <+0>:     endbr64
   0x000055555555514d <+4>:     push   %rbp
   0x000055555555514e <+5>:     mov    %rsp,%rbp
   0x0000555555555151 <+8>:     sub    $0x30,%rsp
=> 0x0000555555555155 <+12>:    mov    %edi,-0x24(%rbp)
...
```

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2 months agogdb, amd64: return after amd64_analyze_frame_setup if current_pc reached
Pawel Kupczak [Thu, 28 Aug 2025 11:50:14 +0000 (11:50 +0000)] 
gdb, amd64: return after amd64_analyze_frame_setup if current_pc reached

Make sure the function bails out early if CURRENT_PC is reached, to
avoid the call to amd64_analyze_register_saves.

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2 months agogdb, amd64: extend the amd64 prologue analyzer to skip register pushes
Pawel Kupczak [Thu, 28 Aug 2025 11:50:13 +0000 (11:50 +0000)] 
gdb, amd64: extend the amd64 prologue analyzer to skip register pushes

A typical function's prologue can consist of setting up a frame pointer,
pushing registers onto the stack and allocating space on the stack.
Current amd64 prologue analyzer would stop after the frame setup.
This patch allows GDB to skip past register pushes, while also improving
unwinding pushed registers, for functions with a frame pointer, without
debug info and .cfi directives found in .eh_frame section that are used
for unwinding.  Skipping register pushes was also present for i386
targets before - the proposed changes are based on i386 implementation.

It also improves the unwinding even if .cfi directives are present,
because GDB can only unwind a register if it has reached a corresponding
.cfi directive, which won't be there before the pushes.

Additionally, at least gcc 11.4 and later by default doesn't emit
necessary debug info, which GDB would try to use to find prologue's end.
In that case, extended prologue analyzer would take effect.

Using C source listed below as an example, compiled with gcc 11.4.0:
```
int __attribute__ ((noinline))
bar (int a)
{
    return a + a;
}

int __attribute__ ((noinline))
foo (int a, int b, int c, int d, int e)
{
    int x = bar (a) + bar (b) + bar (c) + bar (d) + bar (e);
    return x;
}

int
main (int argc, char **argv)
{
    return foo (1, 2, 3, 4, 5);
}
```

Compiling with "gcc -O1 -fno-omit-frame-pointer
-fno-asynchronous-unwind-tables", we get:
```
(gdb) b foo
Breakpoint 1 at 0x1139
(gdb) r
...
Breakpoint 1, 0x0000555555555139 in foo ()
(gdb) disassemble
Dump of assembler code for function foo:
   0x0000555555555131 <+0>:     endbr64
   0x0000555555555135 <+4>:     push   %rbp
   0x0000555555555136 <+5>:     mov    %rsp,%rbp
=> 0x0000555555555139 <+8>:     push   %r15
   0x000055555555513b <+10>:    push   %r14
   0x000055555555513d <+12>:    push   %r13
   0x000055555555513f <+14>:    push   %r12
   0x0000555555555141 <+16>:    push   %rbx
   0x0000555555555142 <+17>:    sub    $0x8,%rsp
   0x0000555555555146 <+21>:    mov    %esi,%r15d
...
(gdb) ni
0x000055555555513b in foo ()
(gdb) p $r15
$1 = 140737354125376
(gdb) p $r15=1234
$2 = 1234
(gdb) p $r15
$3 = 1234
(gdb) up
#1  0x00005555555551b7 in main ()
(gdb) p $r15
$4 = 1234
```

With the proposed changes, breakpoint gets past those register pushes:
```
(gdb) b foo
Breakpoint 1 at 0x1142
(gdb) r
...
Breakpoint 1, 0x0000555555555142 in foo ()
(gdb) disassemble
Dump of assembler code for function foo:
   0x0000555555555131 <+0>:     endbr64
   0x0000555555555135 <+4>:     push   %rbp
   0x0000555555555136 <+5>:     mov    %rsp,%rbp
   0x0000555555555139 <+8>:     push   %r15
   0x000055555555513b <+10>:    push   %r14
   0x000055555555513d <+12>:    push   %r13
   0x000055555555513f <+14>:    push   %r12
   0x0000555555555141 <+16>:    push   %rbx
=> 0x0000555555555142 <+17>:    sub    $0x8,%rsp
   0x0000555555555146 <+21>:    mov    %esi,%r15d
...
```

Also, unwinding pushed registers now works:
```
...
Breakpoint 1, 0x0000555555555142 in foo ()
(gdb) disassemble
Dump of assembler code for function foo:
   0x0000555555555131 <+0>:     endbr64
   0x0000555555555135 <+4>:     push   %rbp
   0x0000555555555136 <+5>:     mov    %rsp,%rbp
   0x0000555555555139 <+8>:     push   %r15
   0x0000555555555139 <+8>:     push   %r15
   0x000055555555513b <+10>:    push   %r14
   0x000055555555513d <+12>:    push   %r13
   0x000055555555513f <+14>:    push   %r12
   0x0000555555555141 <+16>:    push   %rbx
=> 0x0000555555555142 <+17>:    sub    $0x8,%rsp
   0x0000555555555146 <+21>:    mov    %esi,%r15d
...
(gdb) p $r15
$1 = 140737354125376
(gdb) p $r15=1234
$2 = 1234
(gdb) p $r15
$3 = 1234
(gdb) up
#1  0x00005555555551b7 in main ()
(gdb) p $r15
$4 = 140737354125376
```

Additionally a new test was added to verify this behavior.

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2 months agoDon't require "Bss=" in qOffsets response
Tom Tromey [Thu, 4 Sep 2025 15:33:07 +0000 (09:33 -0600)] 
Don't require "Bss=" in qOffsets response

The "Bss=" part of the qOffsets response is documented as being
optional, but gdb in fact requires it.  This patch fixes the bug.

I couldn't find a straightforward way to test this.  gdbserver does
send 'Bss=' -- but this code is only enabled for a fairly specific
setup:

    #if (defined(__UCLIBC__) \
 && defined(HAS_NOMMU) \
 && defined(PT_TEXT_ADDR) \
 && defined(PT_DATA_ADDR) \
 && defined(PT_TEXT_END_ADDR))
    #define SUPPORTS_READ_OFFSETS
    #endif

I also considered changing gdbserver to not send Bss=, but decided
against this, reasoning that we may as well not break compatibility
with older versions of gdb.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33319
Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months agogdb/testsuite: fix possible TCL errors in gdb.threads/threadcrash.exp
Guinevere Larsen [Mon, 1 Sep 2025 14:48:30 +0000 (11:48 -0300)] 
gdb/testsuite: fix possible TCL errors in gdb.threads/threadcrash.exp

The test gdb.threads/threadcrash.exp, among other things, creates a list
of the threads seen in the order that the "thread apply all backtrace"
would generate them, tests that this list is the same size as GDB's
count of threads, and then loops over the list to check that each
thread has the expected backtrace.

A problem occurs because the loop iterates on GDB's internal count of
threads, rather than the size of the list, but then attempts to acces
the n-th element of the list. If the list size is smaller than GDB's
internal thread count, it'll access past the end of the list and
generate TCL errors.

This commit fixes this by using the list's length instead.

Approved-By: Tom Tromey <tom@tromey.com>
2 months agogdb: remove most global core file accesses from fbsd-tdep.c
Andrew Burgess [Wed, 27 Aug 2025 18:40:30 +0000 (19:40 +0100)] 
gdb: remove most global core file accesses from fbsd-tdep.c

This commit removes many places in fbsd-tdep.c where we access the
current core file via current_program_space, and replaces these
accesses with a function argument that is passed in.

There are still two uses of 'current_program_space->core_bfd ()' in
the file, these will be addressed in future work (not in this series
though).

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months agogdb: pass core file to gdbarch_core_xfer_siginfo
Andrew Burgess [Wed, 27 Aug 2025 10:49:24 +0000 (11:49 +0100)] 
gdb: pass core file to gdbarch_core_xfer_siginfo

Another patch that aims to remove 'current_program_space->core_bfd ()'
from GDB.  This time I'm passing the core file BFD as an argument to
the gdbarch method gdbarch_core_xfer_siginfo.

In corelow.c the core file is being passed, this does introduce a new
instance of 'current_program_space->core_bfd ()', but this is OK.  My
long term plan is to move the core bfd into core_target, in which case
the call to gdbarch_core_xfer_siginfo will have access to the core bfd
as a member variable.

For now though, this patch moves the accesses via global state up the
call stack, and consolidates the two calls from fbsd-tdep.c and
linux-tdep.c into the one call in corelow.c.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months agogdb: remove most global core file accesses from record-full.c
Andrew Burgess [Wed, 27 Aug 2025 10:30:47 +0000 (11:30 +0100)] 
gdb: remove most global core file accesses from record-full.c

This commit continues my ongoing work to reduce the number of global
accesses to the current core file BFD in GDB.  The global accesses I'm
working on removing look like 'current_program_space->core_bfd ()'.

This commit targets record-full.c.  All global accesses are removed
except for two in record_full_open, which is used to implements the
two commands 'target record-full' and 'record full restore'.

All other global accesses to the core file are removed by passing the
core file through as an argument from this one top level function.

As I followed the code through I noticed that record_full_restore,
which currently includes this check:

  if (current_program_space->core_bfd () == nullptr)
    return;

could never actually be called without a core file being set.  As the
argument is now 'struct bfd &', then there is no longer an option for
the incoming argument to be NULL, and the above check is removed.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months agogdb: remove some dead code from core_target_open
Andrew Burgess [Wed, 27 Aug 2025 18:51:56 +0000 (19:51 +0100)] 
gdb: remove some dead code from core_target_open

In core_target_open we call target_preopen which pops all targets
above the file_stratum, this will include the core_target, if the core
target is currently loaded.

Currently, the core file BFD is stored in the program_space of an
inferior.  The only way to set the core file BFD is by creating a
core_target (in core_target_open).  And when a core_target is closed
the core file BFD within the program_space is reset to nullptr (see
core_target::close and core_target::clear_core, both in corelow.c).

What this means is that, if there is no core_target loaded then there
will be no core file BFD in the program_space.  And in
core_target_open, after the call to target_preopen, there will be no
core_target loaded, and thus, no core file BFD in the program_space.

There is currently code in core_target_open which checks to see if
there is a core file BFD set in the current program space.  For the
reasons given above, I believe this is dead code and can be removed.

I've added some asserts to validate my assumptions.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/*.exp
Tom de Vries [Thu, 4 Sep 2025 14:15:26 +0000 (16:15 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/*.exp

Fix clean_restart <absolute filename> in gdb.arch/*.exp.

The fixed test-cases are supported on archs sh, ia64, mips, pa and sparc.

I haven't tested these.

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/powerpc*.exp
Tom de Vries [Thu, 4 Sep 2025 14:15:26 +0000 (16:15 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/powerpc*.exp

Fix clean_restart <absolute filename> in gdb.arch/powerpc*.exp.

Likewise in gdb.arch/ppc*.exp, gdb.arch/altivec*.exp, gdb.arch/e500*.exp and
gdb.arch/vsx*.exp.

Tested on ppc64le-linux.

The following test-cases only run on 32-bit ppc:
- gdb.arch/e500-abi.exp
- gdb.arch/e500-prologue.exp
- gdb.arch/e500-regs.exp
- gdb.arch/powerpc-aix-prologue.exp
- gdb.arch/powerpc-prologue.exp
- gdb.arch/powerpc-prologue-frame.exp
- gdb.arch/powerpc-trap.exp
so these haven't been tested.

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/thumb*.exp
Tom de Vries [Thu, 4 Sep 2025 14:15:26 +0000 (16:15 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/thumb*.exp

Fix clean_restart <absolute filename> in gdb.arch/thumb*.exp.

Likewise in test-case gdb.arch/pr25124.exp.

Tested on arm-linux, target boards unix/-marm and unix/-mthumb.

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/arm*.exp
Tom de Vries [Thu, 4 Sep 2025 14:15:26 +0000 (16:15 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/arm*.exp

Fix clean_restart <absolute filename> in gdb.arch/arm*.exp.

Tested on:
- arm-linux, target boards unix/-marm and unix/-mthumb
- aarch64-linux

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/aarch64*.exp
Tom de Vries [Thu, 4 Sep 2025 14:15:26 +0000 (16:15 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/aarch64*.exp

Fix clean_restart <absolute filename> in gdb.arch/aarch64*.exp.

Tested on aarch64-linux, M1 system.

There's a large number (44) of unsupported, for the following reasons:
- allow_aarch64_gcs_tests
- allow_aarch64_mops_tests
- allow_aarch64_sve_tests / target does not support SVE
- memory tagging unsupported

Consequently, we mostly use the simple substitution:
...
clean_restart $binfile
->
clean_restart
gdb_load $binfile
...

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/i386*.exp
Tom de Vries [Thu, 4 Sep 2025 14:15:26 +0000 (16:15 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/i386*.exp

Fix clean_restart <absolute filename> in gdb.arch/i386*.exp.

Tested on x86_64-linux, with target board unix/-m32 and gcc 15.

The only unsupported test-case is gdb.arch/i386-avx512.exp, which isn't
changed by this commit.

2 months ago[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/amd64*.exp
Tom de Vries [Thu, 4 Sep 2025 14:15:26 +0000 (16:15 +0200)] 
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.arch/amd64*.exp

Fix clean_restart <absolute filename> in gdb.arch/amd64*.exp.

Tested on x86_64-linux, with kernel version 6.16.3.

The only unsupported test-case is gdb.arch/amd64-lam.exp, which isn't changed
by this commit.

2 months agoRISC-V: Don't generate R_RISCV_RELATIVE if symbol referenced section is SH_ABS
Nelson Chu [Thu, 21 Aug 2025 04:33:04 +0000 (12:33 +0800)] 
RISC-V: Don't generate R_RISCV_RELATIVE if symbol referenced section is SH_ABS

It's werid if it's absolute symbol but have a relative reloc for got entry
under pie.  So don't generate relative reloc if symbol referenced section is
SH_ABS.  However, x86 allows the absolute symbol defined in linker script has
a relative reloc, not sure if risc-v needs this or not.

2 months agoRISC-V: Don't overwrite got entry to zero for IRELATIVE/RELATIVE relocation
Nelson Chu [Thu, 21 Aug 2025 04:33:03 +0000 (12:33 +0800)] 
RISC-V: Don't overwrite got entry to zero for IRELATIVE/RELATIVE relocation

Even the final result is correct since we encode the relocation into r_addend,
so glibc won't need to get the content of got entry when resolving relative
relocation, it still werid that finish_dynamic_symbol cleans what we filled in
the relocate_section.

2 months agoRISC-V: Fixed missed GOT relocation against a symbol that has a defined value
Nelson Chu [Thu, 14 Aug 2025 04:01:38 +0000 (12:01 +0800)] 
RISC-V: Fixed missed GOT relocation against a symbol that has a defined value

SImilar to aarch64, commit eac4eb8ecb26

There are two problems when GOT relocation against a symbol that has a defined
value,
1. Pesudo la with pic and pseudo lga lost the relocations.
2. %got_pcrel_hi generates R_RISCV_GOT_HI20 with addend, which is wrong since
   commit 50331d64f108.

The solution is to use deferred_expression for GOT relocation.  Maybe other
relocations also have same problem and need the deferred_expression, but we can
add in the future patches.