In SFrame stack trace format, the representation of stack offsets allows
for either 1-byte, 2-byte or 4-byte integers.
Add new internal function sframe_fre_stack_offset_bound_p () which
checks if the given offset is within bounds (at most as a 4-byte
integer). Use this to check if CFA offset is within bounds, if not skip
emitting the FDE, and warn the user.
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
PR gas/33277
* gen-sframe.c (sframe_fre_stack_offset_bound_p): New
definition.
(sframe_xlate_do_def_cfa): Check bounds of offset.
(sframe_xlate_do_def_cfa_offset): Likewise.
gas/testsuite/
PR gas/33277
* gas/cfi-sframe/cfi-sframe.exp: Add new test.
* gas/cfi-sframe/cfi-sframe-x86_64-empty-pr33277.d: Likewise.
* gas/cfi-sframe/cfi-sframe-x86_64-empty-pr33277.s: Likewise.
This change fixes the allocation logic in allocate_dynrel_entries and
elf64_hppa_finalize_dynreloc. It also fixes addend calculation for
segment based relocations.
Some applications now link successfully on HP-UX but there are still
issues with external weak symbols. This breaks linking with libgcc.
It looks like we need support for .rela.data.rel.ro, ...
2025-11-04 John David Anglin <danglin@gcc.gnu.org>
bfd/ChangeLog:
* elf64-hppa.c (allocate_dynrel_entries): Correct hh->want_opd
if condition.
(elf64_hppa_finalize_dynreloc): Likewise. Use symbol address
instead of OPD address. Include sec->output_offset in value2
calculation.
(elf64_hppa_finalize_opd): Likewise.
(elf64_hppa_finalize_dlt): Likewise.
(elf_hppa_final_link_relocate): Fix symbol address calculation.
IBM Z instruction format RIL-a has a 32-bit immediate operand in
instruction bits 16 to 47. Enable the assembler to emit a 32-bit
direct or PC-relative relocation when processing a fixup, similar
as it is already done for 16-bit immediate operands in bits 16-31.
This enables to assemble the following:
lgfi %r1,symbol # R_390_32
lgfi %r1,symbol-. # R_390_PC32
Furthermore it brings GNU assembler on par with LLVM assembler in
that regard.
gas/
* config/tc-s390.c (md_apply_fix): Emit 32-bit direct or
PC-relative relocation for 32-bit immediate operand in
instruction bits 16-47.
gas/testsuite/
* gas/s390/zarch-reloc.d: Add tests for relocation of RIL-a
32-bit immediate operand.
* gas/s390/zarch-reloc.s: Likewise.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
This changes gdb.rust tests to use plain "return" rather than
"return -1". In these spots, the "-1" has no meaning.
Approved-by: Kevin Buettner <kevinb@redhat.com>
1. Referenced symbol without '@' has no version.
2. Defined symbol without the .symver directive has no version if there
is no linker version script.
Symbol without version shouldn't have the base version in its DT_VERSYM
entry. Instead, its DT_VERSYM entry should be all zero to indicate that
the symbol doesn't have a version.
NB: Symbol with the base version has a '@' suffix, like "foo@", defined
with
.symver hide_original_foo, foo@
bfd/
PR ld/33577
* elflink.c (elf_link_output_extsym): Don't set its DT_VERSYM
entry for the symbol without version.
ld/
PR ld/33577
* ld-elfvers/vers16.dsym: Remove the "Base" version on symbols
without version.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
In stopped_by_sw_breakpoint() and stopped_by_hw_breakpoint(), we check
whether any thread is replaying. This is unnecessary as it only matters
if inferior_ptid is replaying.
Narrow the check to inferior_ptid.
The record btrace target does not create or destroy threads. There is no
reason to override the update_thread_list() and thread_alive() target
methods.
Similar to the parent commit, simplify schedlock_applies() by only
checking the argument thread.
When resuming that thread, GDB will automatically stop replaying its
inferior. The replay state of other inferiors is not considered by
user_visible_resume_ptid(), so let's not consider them in
schedlock_applies(), either.
Approved-By: Tom Tromey <tom@tromey.com>
When scheduler-locking is set to replay and we're resuming a thread at the
end of its execution history, we check whether anything is replaying in
user_visible_resume_ptid() only to check again in clear_proceed_status()
before we stop replaying the current process.
What really matters is whether the selected thread is replaying or will
start replaying.
Simplify this by removing redundant checks.
Also avoid a redundant pass over all threads to check whether anything is
replaying before stopping replaying. Make record_stop_replaying() handle
the case when we're not replaying gracefully.
Approved-By: Tom Tromey <tom@tromey.com>
remote::wait () may get called rather frequently, polluting the logging
output with tons of
[remote] wait: enter
[remote] wait: exit
messages.
Similarly, remote_target::remote_notif_remove_queued_reply () will print
the debug message even if nothing was actually removed. Change that to
only print a debug message if a stop reply was removed.
Approved-By: Tom Tromey <tom@tromey.com>
When record_btrace::wait() is called and no threads are moving, we set the
wait status to no_resumed. Change that to ignore.
This helps with enabling per-inferior run-control for the record btrace
target as it avoids breaking out of do_target_wait() too early with
no_resumed when there would have been an event on another thread.
We don't really need three inferiors to test multi-inferior recording.
We don't really need to check info record before starting recording.
If we were recording, there would be output, causing a fail.
This just complicates the test when there is something to debug.
When we stop replaying a thread, it moves to the end of its execution
history. It retains its state from when it was replaying, though, so a
subsequent 'info program' command would show wrong information.
Clear all execution state used by the 'info program' command.
With asynchronous commands, a thread can be replaying in the background
while it is being moved using the 'record goto' command in the foreground.
Do not allow that.
With asynchronous stepping commands, one may start replaying a thread in
the background and then stop recording its inferior in the foreground.
This causes the execution history to be cleared and the record target to
be unpushed while the thread is using said execution history.
I fail to see a use-case for this, so rather than trying to make this
work, I prevent such a scenario by not allowing replaying or recording to
be stopped while a thread is running.
We could do this only when a thread is running in replay mode and preserve
the existing behavior of being able to stop recording while threads are
running in recording mode. It seems more consistent to not allow this for
both replaying and recording threads, though.
In record_btrace_stop_replaying_at_end, we know that we are at the end of
the execution history, so PC must match the current PC if we're not
replaying.
We're not changing any other registers during btrace replay, so we should
be fine leaving the regcache.
But we need to reinit the frame cache, since current frames used the
btrace unwinder.
The main motivation for this, however, is that future patches extend stop
replaying in ways that is not relevant to stop replaying at the end.
As a side effect of the 'record stop' command, threads may move to the end
of their execution history if they had been replaying.
When using CLI or TUI, there is no indication of that move for the
selected thread.
Notify about the frame change for the selected thread. This makes CLI
print the selected frame and TUI update their view.
Add a note to the MI record-stopped event.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
GDB fails with an assertion when stopping recording on a replaying thread
and then resuming that thread. Stopping recording left the thread
replaying but the record target is gone.
Stop replaying all threads in the selected inferior before stopping recording.
I had to change the stepping test slightly to account for different
compilers generating slightly different debug information, so when
stepping the 'return 0' after 'record stop' I would end up in a different
location depending on which compiler I used. The test still covers all
stepping commands.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19340
Approved-By: Andrew Burgess <aburgess@redhat.com>
Existing code checks that the first uint64_t ctfa_magic field is
available before reading but neglects to check that the last uint64_t
ctfa_ctfs is available before reading it in ctf_arc_bufpreamble.
ctf_arc_bufopen sets up a pointer to the struct ctf_archive in
ctf_new_archive_internal. Extend the check to cover the entire struct.
PR 33548
PR 33549
* ctf-archive.c (ctf_arc_bufpreamble, ctf_arc_bufopen): Check
that buffer contains at least an entire struct ctf_archive
when accessing such a struct.
In CLANG_PLUGIN_FILE it is possible for plugin_file to be non-NULL
when LLVMgold.so does not exist.
configure output is messy, with results not printed against their
"checking.." line, eg.
checking for clang... (cached) yes
checking for clang plugin file... checking for x86_64-pc-linux-gnu-ar... (cached) ar --plugin /usr/lib/llvm-20/lib/clang/20/../../LLVMgold.so
/usr/lib/llvm-20/lib/clang/20/../../LLVMgold.so
This patch fixes those problems, and a similar interposition of other
configure output between AC_MSG_CHECKING and AC_MSG_RESULT in
gcc-plugin.m4. It also tidies some of the message text, and makes
similar code in gcc-plugin.m4 and clang-plugin.m4 a little more
consistent.
config/
* clang-plugin.m4 (CLANG_PLUGIN_FILE): Don't place checks for
tools (llvm-config, ar) inside AC_MSG_CHECKING..AC_MSG_RESULT
for clang plugin file. Clear plugin_file before loop exit.
(CLANG_PLUGIN_FILE_FOR_TARGET): Similarly.
* gcc-plugin.m4 (GCC_PLUGIN_OPTION): Similarly.
(GCC_PLUGIN_OPTION_FOR_TARGET): Correct AC_MSG_CHECKING. Tidy
return code.
binutils/
* testsuite/lib/binutils-common.exp <llvm_plug_opt>: Set for
non-native.
* configure: Regenerate.
/
* configure: Regenerate.
bfd/
* configure: Regenerate.
gas/
* configure: Regenerate.
gdb/
* configure: Regenerate.
gprof/
* configure: Regenerate.
gprofng/
* configure: Regenerate.
* libcollector/configure: Regenerate.
ld/
* configure: Regenerate.
libbacktrace/
* configure: Regenerate.
libctf/
* configure: Regenerate.
libiberty/
* configure: Regenerate.
libsframe/
* configure: Regenerate.
opcodes/
* configure: Regenerate.
sim/
* configure: Regenerate.
zlib/
* configure: Regenerate.
A reloc howto set up with EMPTY_HOWTO has a NULL name. More than one
place emitting diagnostics assumes a reloc howto won't have a NULL
name.
PR 33455
* coffcode.h (coff_slurp_reloc_table): Don't allow a howto with
a NULL name.
There is progress in implementing 64-bit shared library support.
Fixes link error compiling vdso64.so. HP-UX dynamic linker no longer
complains that libgcc_s.4 linked with GNU ld is an invalid shared library.
Relocations are now generated for all slots in .rela.data, .rela.dlt
and .rela.opd. Relocation counts for libgcc_s.4 linked using GNU and
HP ld are the same except .rela.plt. That may be okay as GNU ld directs
pc-relative calls to stubs.
Glibc's ld.so.new appears to link okay. However, libgcc_s.4 linked with
GNU ld is still broken on HP-UX.
There are six unexpected fails in the testsuite and three unexpected
passes. There's at least one fail due to name munging in the .dynsym
table.
2025-11-02 John David Anglin <danglin@gcc.gnu.org>
bfd/ChangeLog:
* elf64-hppa.c (struct elf64_hppa_link_hash_entry): Remove
sym_ind and owner fields. Rename hash entries for __text_seg
and __data_seg. Adjust all users.
(global_sym_index): Remove.
(hppa64_elf_local_refcounts): Assert size is not 0.
(elf64_hppa_check_relocs): Drop NEED_PLT from R_PARISC_FPTR64
relocation. Don't stash abfd and r_symndx in hh->owner and
hh->sym_indx. Add global symbols with hh->eh.dynindx equal
-1 to dynamic table. Don't record section symbols to the
local dynamic symbol table.
(allocate_global_data_dlt): Don't add symbol to local dynamic
symbol table.
(allocate_global_data_opd): Likewise.
(elf64_hppa_late_size_sections): Rework code to add __text_seg
and __data_seg symbols to the dynamic table.
(elf64_hppa_finalize_dlt): Revise to use __text_seg and
__data_seg symbols.
(elf64_hppa_finalize_dynreloc): Likewise.
(elf_hppa_final_link_relocate): When generating a shared
library, ignore relocs in debugging sections. Revise
relocations needing DLT and OPD dynamic relocations to output
dynamic relocatios for local symbols. Move code to initialize
segment base values back to SEGREL case.
Convert symtab to use obstack_new, and have a real constructor. The
filename, filename_for_id and m_compunit, members should really not
change once the symtab has been created, so make these members private
(m_compunit was already private) and set them just once from the
constructor. The set_compunit function has been deleted, and new
getter functions for filename and filename_for_id have been added.
The language is also set at construction time, but can be updated
later, so set the language in the constructor, but retain
symtab::set_language for when the language needs to be updated.
Prior to this patch the symtab was allocated with OBSTACK_ZALLOC which
would zero out the symtab object. With the call to objstack_new
fields in the symtab would no longer be initialised, so I've added
default member initialisation for everything not set in the
constructor.
The interesting changes are in symtab.h, and symfile.c. Everything
else is just updating to handle symfile::filename and
symfile::filename_for_id becoming methods.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Instead of the current sframe_func_desc_entry (on-disk format
representation) data structure.
The decoder context in libsframe, so far, has been internally directly
tied to the sframe_func_desc_entry (on-disk format representation) data
structure. While this allows libsframe to avoid some operations, this
is not desirable anymore as the format evolves: we will need to support
reading in of older version(s) of SFrame FDE, as well as a newer on-disk
representations for SFrame FDE.
Use sf_fde_tbl internally in the decoder context. Note that libsframe
already does _not_ use sframe_func_desc_entry in any external-facing,
user-visible APIs.
Note that this commit is simply preparatory in nature. At the moment,
the 'sf_fde_tbl' internally uses the sframe_func_desc_entry (on-disk
format representation). When need arises (as SFrame FDE evolves), we
may change sf_fde_tbl to use an alternative (but still libsframe
internal) definition of SFrame FDE.
lisbframe/
* sframe-impl.h (sf_fde_tbl, sf_fre_tbl): Move definition before use.
Use sf_fde_tbl instead of sframe_func_desc_entry in struct
sframe_decoder_ctx.
* sframe.c (sframe_fde_tbl_alloc): New internal definition.
(sframe_fde_tbl_init): Likewise.
(sframe_decoder_get_funcdesc_at_index): Adjust for sf_fde_tbl
usage.
(sframe_decoder_get_secrel_func_start_addr): Likewise.
(sframe_fre_check_range_p): Likewise.
(sframe_decode): Likewise.
(sframe_get_funcdesc_with_addr_internal): Likewise.
Future versions of the format may have alternative representation of an
FDE. As the format evolves, endian flipping of the SFrame header may
need to be version aware.
flip_header () now takes the SFrame version as argument and also returns
SFRAME_ERR in case of error. Currently the SFrame version as argument
remains unused.
SFrame encoder, at the momemnt, writes the SFrame data in the most recent
format version by default.
libsframe/
* sframe.c (flip_header): Make version aware.
(sframe_decode): Adjust usage of flip_header.
(sframe_encoder_write): Likewise.
Future versions of the format may have a different representation of an
SFrame FDE. As the format evolves, endian flipping will need to be version
aware.
Refactor flip_fde a bit by carving out an internal sframe_decode_fde API
which can read information from an on-disk SFrame FDE.
libsframe/
* sframe.c (flip_fde): Make version aware.
(sframe_decode_fde): New internal definition.
(flip_sframe): Use the new definitions.
commit b21318bd2c
Author: Joseph Myers <joseph@codesourcery.com>
Date: Thu May 11 14:31:09 2023 +0000
Add LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [GCC PR109128]
added the LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook for offload
support. Since the V2 linker plugin hook doesn't claim the offload IR if
known_used is unset, set input plugin_format to bfd_plugin_no only if
known_used is set or the V2 linker plugin hook is unused.
PR ld/33584
* plugin.c (plugin_object_p): Set plugin_format to bfd_plugin_no
only if known_used is set or the V2 linker plugin hook is unused.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Fix odd behaviour of objcopy -I -B on tic4x, where the tms320c4x
string reported by objcopy --info isn't a valid arch string.
* cpu-tic4x.c (tic4x_scan): Match arch string reported by
objcopy --info.
objcopy -I binary -O some_coff_target does not currently work without
choosing a valid arch with -B. This used to be the case for ELF
targets too, until commit 6765ee1825.
* testsuite/binutils-all/objcopy.exp (binary_symbol): Pass
-B arch to objcopy. Choose different output object files for
the two tests.
2025-10-30 John David Anglin <danglin@gcc.gnu.org>
bfd/ChangeLog:
* elf64-hppa.c (elf64_hppa_finalize_opd): Use address of
__text_seg symbol instead of hppa_info->text_segment_base.
2025-10-30 John David Anglin <danglin@gcc.gnu.org>
bfd/ChangeLog:
* elf64-hppa.c (elf_hppa_final_link_relocate): Use address of
__text_seg symbol insted of hppa_info->text_segment_base.
2025-10-30 John David Anglin <danglin@gcc.gnu.org>
bfd/ChangeLog:
* elf64-hppa.c (struct elf64_hppa_link_hash_table): Add
data_segment field.
(allocate_global_data_opd): Move code to initialize text
segment section symbol to elf64_hppa_late_size_sections.
(elf64_hppa_late_size_sections): Add code to setup
__data_seg section symbol.
We don't need anything in this release, but I think it doesn't hurt to
just stay up to date. The new version has a new include file, stl.h.
To keep things clean and separated, move the imported files to a new
sub-directory. This requires a small change in
gdb/check-include-guards.py, to be able to ignore the whole new
directory.
Change-Id: Ic8c5d0dd5ea8b6691c99975d6ca78f637175ef42
Approved-By: Tom Tromey <tom@tromey.com>
Some `files` regexes use a ^ anchor, some don't. I think it's good to
be explicit about it (and consistent), so use it everywhere.
Change-Id: I14eb2082a1c0ff6bc219e202fb16c3f12001fd73
Approved-By: Tom Tromey <tom@tromey.com>
This covers Python files under gdb/contrib and gdb/testsuite, which are
now flake8-clean.
Change-Id: If587964d0735f6f585c72d18df40439424215644
Approved-By: Tom Tromey <tom@tromey.com>