]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
5 months agogdb/record: add support for floating point vmov instructions
Guinevere Larsen [Mon, 6 Jan 2025 18:24:25 +0000 (15:24 -0300)] 
gdb/record: add support for floating point vmov instructions

This commit updates GDB's record-full to be able to record vmov[ss|sd]
and vmov [u|a] [ps|pd] AVX instructions, and tests for them.

Unlike the vmovdq[u|a] instructions, the aligned and unalgined versions
of vmov?[ps|pd] have different opcodes. The mechanics of recording them
is the same, but the aligned version has opcodes 0x28 and 0x29, while
the unaligned has the same opcode as vmov[ss|sd] instruction, 0x10 and
0x11.

Approved-By: Guinevere Larsen <guinevere@redhat.com>
5 months agold: regenerate
Sam James [Tue, 14 Jan 2025 16:36:28 +0000 (16:36 +0000)] 
ld: regenerate

80dc29527ff9b5179741c360418e77e5064f2b69 contained some changes from
non-vanilla autoconf. Regenerate.

ChangeLog:

* config.in: Regenerate.
* configure: Regenerate.

5 months agold: Add --enable-memory-seal configure option
Adhemerval Zanella [Thu, 22 Aug 2024 19:13:03 +0000 (16:13 -0300)] 
ld: Add --enable-memory-seal configure option

Add --enable-memory-seal linker configure option to enable memory
sealing (GNU_PROPERTY_MEMORY_SEAL) by default.

Change-Id: I4ce4ff33657f0f09b1ceb06210b6fcaa501f1799

5 months agoelf: Add GNU_PROPERTY_MEMORY_SEAL gnu property
Adhemerval Zanella [Wed, 14 Aug 2024 17:04:55 +0000 (17:04 +0000)] 
elf: Add GNU_PROPERTY_MEMORY_SEAL gnu property

The GNU_PROPERTY_MEMORY_SEAL gnu property is a way to mark binaries
to be memory sealed by the loader, to avoid further changes of
PT_LOAD segments (such as unmapping or change permission flags).
This is done along with Linux kernel (the mseal syscall [1]), and
C runtime supports to instruct the kernel on the correct time during
program startup (for instance, after RELRO handling).  This support
is added along the glibc support to handle the new gnu property [2].

This is a opt-in security features, like other security hardening
ones like NX-stack or RELRO.

The new property is ignored if present on ET_REL objects, and only
added on ET_EXEC/ET_DYN if the linker option is used.  A gnu property
is used instead of DT_FLAGS_1 flag to allow memory sealing to work
with ET_EXEC without PT_DYNAMIC support (at least on glibc some ports
still do no support static-pie).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8be7258aad44b5e25977a98db136f677fa6f4370
[2] https://sourceware.org/pipermail/libc-alpha/2024-September/160291.html

Change-Id: Id47fadabecd24be0e83cff45653f7ce9a900ecf4

5 months agoFix a syntax error in sim/common/cgen-mem.h
Ella MA [Fri, 10 Jan 2025 12:15:33 +0000 (13:15 +0100)] 
Fix a syntax error in sim/common/cgen-mem.h

5 months agold: Update mixed LTO and non-LTO relocatable output tests
H.J. Lu [Tue, 14 Jan 2025 01:09:28 +0000 (09:09 +0800)] 
ld: Update mixed LTO and non-LTO relocatable output tests

Since mixed LTO and non-LTO relocatable output is only supported on ELF
platforms, limit these tests to ELF targets.  Since powerpc64 elfv1
defines a function symbol on its procedure descriptor, which is in a
data section, rather than on the code for that function, allow both D
and T for nm test on mixed object.

* testsuite/ld-plugin/lto.exp: Limits  mixed LTO and non-LTO
relocatable output tests to ELF targets.  Allow both D and T for
nm test on mixed object.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 months agoaarch64 SFrame: skip with warning new CFI directive used with pauth_lr
Matthieu Longo [Thu, 21 Nov 2024 18:44:22 +0000 (18:44 +0000)] 
aarch64 SFrame: skip with warning new CFI directive used with pauth_lr

Today, SFrame v2 specification does not describe how to encode the
information corresponding to the PAuth_LR PAC signing method (it only
supports PAuth PAC signing method).
SFrame v3 specification should hopefully specify it.

In the meantime, if the GNU assembler finds .cfi_negate_ra_state_with_pc
and --gsframe is specified, it will output a warning to the user and
will fail to generate the FDE entry.

A new SFrame test for .cfi_negate_ra_state_with_pc is also added to
reflect this issue.

Approved-by: Indu Bhagat <indu.bhagat@oracle.com>
5 months agoaarch64 DWARF: add new CFI directive for PAuth_LR
Matthieu Longo [Mon, 25 Nov 2024 12:17:56 +0000 (12:17 +0000)] 
aarch64 DWARF: add new CFI directive for PAuth_LR

This patch adds a new CFI directive (cfi_negate_ra_state_with_pc) which
set an additional bit in the RA state to inform that RA was signed with
SP but also PC as an additional diversifier.

RA state | Description
0b00     | Return address not signed (default if no cfi_negate_ra_state*)
0b01     | Return address signed with SP (cfi_negate_ra_state)
0b10     | Invalid state
0b11     | Return address signed with SP+PC (cfi_negate_ra_state_with_pc)

Approved-by: Indu Bhagat <indu.bhagat@oracle.com>
Approved-by: Jan Beulich <jbeulich@suse.com>
5 months agoaarch64 SFrame: use preferred CFI directive for AArch64 PAC
Matthieu Longo [Thu, 21 Nov 2024 18:40:41 +0000 (18:40 +0000)] 
aarch64 SFrame: use preferred CFI directive for AArch64 PAC

ARMv8.3 addded support for a new security feature named Pointer
Authentication. Support for this feature in SFrame already exists.

In GCC 14 and older, the Sparc DWARF extension .cfi_gnu_window_save
is emitted instead of .cfi_negate_ra_state.
GCC 15 fixed this issue, but this behavior is preserved for backward
compatibility.

The existing sframe test for AArch64 PAC was using .cfi_gnu_window_save.
This patch replaces this CFI in the existing test by the preferred one,
and adds a new test to check for backward compatibility when using
.cfi_gnu_window_save.

Approved-by: Indu Bhagat <indu.bhagat@oracle.com>
5 months agoaarch64: make explicit that CFI gnu_window_save is for Sparc, not AArch64
Matthieu Longo [Thu, 21 Nov 2024 18:44:07 +0000 (18:44 +0000)] 
aarch64: make explicit that CFI gnu_window_save is for Sparc, not AArch64

- add a detailed comment when parsing DW_CFA_GNU_window_save in SFrame to
  explain why we are checking whether the targeted architecture is AArch64,
  whereas this CFI is a Sparc extension.
- replace .cfi_gnu_window_save by .cfi_negate_ra_state in existing AArch64
  DWARF tests as this is the preferred directive since GCC 15.
- add a new AArch64 test to check backward compatibility with old GCC
  versions that emits .cfi_gnu_window_save.

Approved-by: Indu Bhagat <indu.bhagat@oracle.com>
Approved-by: Richard Earnshaw <richard.earnshaw@arm.com>
5 months agogdbserver: remove handling of the 'L' tracepoint action
Tankut Baris Aktemur [Tue, 14 Jan 2025 09:10:31 +0000 (10:10 +0100)] 
gdbserver: remove handling of the 'L' tracepoint action

Now that static tracepoint support is removed from gdbserver, it makes
sense to remove handling of the 'L' tracepoint action, too.  The code
that checks received actions already has a default case that tolerates
unrecognized actions:

        default:
          trace_debug ("unknown trace action '%c', ignoring...", *act);

In case 'L' is unexpectedly received, we would at least be able to see
this in the logs.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agogdbserver: remove the static_tracepoint enum value
Tankut Baris Aktemur [Tue, 14 Jan 2025 09:10:31 +0000 (10:10 +0100)] 
gdbserver: remove the static_tracepoint enum value

As a continuation of the previous patches that remove UST from
gdbserver, remove the `static_tracepoint` enum value from
`tracepoint_type` and all the associated code.

Now that the last use of `write_e_static_tracepoints_not_supported`
is gone, also remove that function.

The handling of the 'S' option, where the `static_tracepoint` enum
value was being used, is removed completely, because recognizing that
option makes sense only when static tracepoint support is announced.

This patch is easier to view with "git show -w".

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agogdbserver: do not announce static tracepoint support
Tankut Baris Aktemur [Tue, 14 Jan 2025 09:10:30 +0000 (10:10 +0100)] 
gdbserver: do not announce static tracepoint support

Remove the announcement that `qXfer:statictrace:read` and
`StaticTracepoints` are supported.  Associated to this, remove the
handling of "qTfSTM", "qTsSTM", and "qTSTMat" packets and the
qXfer:statictrace:read handling.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agogdbserver: remove UST (static tracepoint) support (part 2)
Tankut Baris Aktemur [Tue, 14 Jan 2025 09:10:30 +0000 (10:10 +0100)] 
gdbserver: remove UST (static tracepoint) support (part 2)

With the removal of UST, the `in_process_agent_supports_ust` query
would essentially always be false.  Remove the function and adjust
the uses, comments, and warning/error messages.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agogdbserver: remove UST (static tracepoint) support (part 1)
Tankut Baris Aktemur [Tue, 14 Jan 2025 09:10:30 +0000 (10:10 +0100)] 
gdbserver: remove UST (static tracepoint) support (part 1)

UST support in gdbserver is substantially outdated.  Simon says:

  ...[having HAVE_UST defined] never happens nowadays because it used
  a version of lttng-ust that has been deprecated for a loooong time
  (the 0.x series).  So everything in HAVE_UST just bitrots.  It might
  be possible to update all this code to use lttng-ust 2.x (1.x never
  existed), but I don't think it's going to happen unless somebody
  specifically asks for it.  I would suggest removing support for UST
  from gdbserver.  ...If we ever want to resurrect the support for UST
  and port to 2.x, we can get the code from the git history.

This patch removes the support, mostly mechanically by deleting code
guarded by `#ifdef HAVE_UST`.  After these removals, `struct
static_tracepoint_ctx` becomes unused.  So, remove it, too.

The following patches remove more code.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agogdb, doc: describe the 'L' tracepoint action
Tankut Baris Aktemur [Tue, 14 Jan 2025 09:10:30 +0000 (10:10 +0100)] 
gdb, doc: describe the 'L' tracepoint action

I noticed that 'L' is a tracepoint action but it is not defined in the
document.  Add the description.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
5 months agogdb, doc: mention the 'S' option for the QTDP packet
Tankut Baris Aktemur [Tue, 14 Jan 2025 09:10:29 +0000 (10:10 +0100)] 
gdb, doc: mention the 'S' option for the QTDP packet

I noticed that gdbserver accepts an 'S' option for the QTDP packet to
create a static tracepoint, but this is not mentioned in the document.
Update the document.

I first thought about updating the argument as `[:Flen|:S]`, but then
opted for `[:Flen][:S]`.  Although it is odd that ':F' and ':S' are
allowed to co-exist, the implementation at the gdbserver side allows
this and handles the packet arguments so that the right-most
positioned ':F' or ':S' overwrites the final tracepoint type.  When
the documentation is missing, the implementation usually determines
the behavior.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
5 months agold: Call cmdline_check_object_only_section only if plugin is enabled
H.J. Lu [Tue, 14 Jan 2025 08:12:37 +0000 (16:12 +0800)] 
ld: Call cmdline_check_object_only_section only if plugin is enabled

* ldfile.c (ldfile_try_open_bfd): Call
cmdline_check_object_only_section only if BFD_SUPPORTS_PLUGINS
is defined.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 months agox86: Remove "NE" in mnemonics for convert insns related to AI data types
Haochen Jiang [Tue, 14 Jan 2025 02:30:44 +0000 (10:30 +0800)] 
x86: Remove "NE" in mnemonics for convert insns related to AI data types

NE is quite ambiguous and misleading in mnemonics since it should be
Rounding to Nearest Even, but could be mis-interpretated to No
Exception.

Under its correct meaning, which means rounding, it should only be used
in down-convert, since up-convert is always exact for normal values
It could be difficult to judge which kind of convert it is if we have
the convert between same bit float types.

For all AI data types including BF16 and FP8, the default rounding is
Rounding to Nearest Even. So removing them in mnemonics would reduce
burden for programmers to consider whether it should be added or not
in mnemonics and stop the ambiguous meaning on "NE" itself.

If the convert itself is using a rounding mode other than RNE, it would
be explicitly added in mnemonics (e.g., Long used "T" and "BIAS"
introduced in AVX10.2).

gas/ChangeLog:

* testsuite/gas/i386/avx10_2-256-cvt-intel.d: Refine testcases
according to mnemonics change.
* testsuite/gas/i386/avx10_2-256-cvt.d: Ditto.
* testsuite/gas/i386/avx10_2-256-cvt.s: Ditto.
* testsuite/gas/i386/avx10_2-256-satcvt-intel.d: Ditto.
* testsuite/gas/i386/avx10_2-256-satcvt.d: Ditto.
* testsuite/gas/i386/avx10_2-256-satcvt.s: Ditto.
* testsuite/gas/i386/avx10_2-512-cvt-intel.d: Ditto.
* testsuite/gas/i386/avx10_2-512-cvt.d: Ditto.
* testsuite/gas/i386/avx10_2-512-cvt.s: Ditto.
* testsuite/gas/i386/avx10_2-512-satcvt-intel.d: Ditto.
* testsuite/gas/i386/avx10_2-512-satcvt.d: Ditto.
* testsuite/gas/i386/avx10_2-512-satcvt.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-cvt-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-cvt.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-cvt.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-satcvt-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-satcvt.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-satcvt.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-cvt-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-cvt.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-cvt.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-satcvt-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-satcvt.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-satcvt.s: Ditto.

opcodes/ChangeLog:

* i386-dis-evex-prefix.h: Remove ne in mnemonics for
convert insns.
* i386-opc.tbl: Ditto.
* i386-mnem.h: Regenerated.
* i386-tbl.h: Ditto.

5 months agox86: Rename VCOMSBF16 to VCOMISBF16
Haochen Jiang [Tue, 14 Jan 2025 02:30:43 +0000 (10:30 +0800)] 
x86: Rename VCOMSBF16 to VCOMISBF16

The functionality for VCOMSBF16 is exactly the same as the VCOMISD/S/H.
The only difference is the bf16 type. Thus, it should be VCOMISBF16.
This patch would fix that.

gas/ChangeLog:

* testsuite/gas/i386/avx10_2-256-bf16-intel.d: Refine testcase
according to mnemonics change.
* testsuite/gas/i386/avx10_2-256-bf16.d: Ditto.
* testsuite/gas/i386/avx10_2-256-bf16.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-bf16-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-bf16.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-bf16.s: Ditto.

opcodes/ChangeLog:

* i386-dis-evex-prefix.h: Rename VCOMSBF16 to VCOMISBF16.
* i386-opc.tbl: Ditto.
* i386-mnem.h: Regenerated.
* i386-tbl.h: Ditto.

5 months agox86: Remove "P" and "NE" in mnemonics for BF16 arithmetic insns
Haochen Jiang [Tue, 14 Jan 2025 02:30:42 +0000 (10:30 +0800)] 
x86: Remove "P" and "NE" in mnemonics for BF16 arithmetic insns

Since the bf16 is an AI data types, it will be implicitly packed. Thus,
"P" (for packed) is omitted in mnemonics from its introduction. AVX10.2
BF16 arithmetic insns are introduced with "P" in mnemonics with packed.
This patch will remove them for consistency.

NE is quite ambiguous and misleading in mnemonics since it should be
Rounding to Nearest Even, but could be mis-interpretated to No
Exception. While AI data types like BF16 and FP8 are using Rounding to
Nearest Even as default rounding modes. There is no need to use the
ambiguous mnemonics in AVX10.2 insns. This patch will also remove them.

For convert insns, it will be handled in the upcoming patch.

gas/ChangeLog:

* testsuite/gas/i386/avx10_2-256-bf16-intel.d: Refine testcase
according to new mnemonics.
* testsuite/gas/i386/avx10_2-256-bf16.d: Ditto.
* testsuite/gas/i386/avx10_2-256-bf16.s: Ditto.
* testsuite/gas/i386/avx10_2-256-miscs-intel.d: Ditto.
* testsuite/gas/i386/avx10_2-256-miscs.d: Ditto.
* testsuite/gas/i386/avx10_2-256-miscs.s: Ditto.
* testsuite/gas/i386/avx10_2-512-bf16-intel.d: Ditto.
* testsuite/gas/i386/avx10_2-512-bf16.d: Ditto.
* testsuite/gas/i386/avx10_2-512-bf16.s: Ditto.
* testsuite/gas/i386/avx10_2-512-miscs-intel.d: Ditto.
* testsuite/gas/i386/avx10_2-512-miscs.d: Ditto.
* testsuite/gas/i386/avx10_2-512-miscs.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-bf16-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-bf16.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-bf16.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-miscs-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-miscs.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-256-miscs.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-bf16-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-bf16.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-bf16.s: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-miscs-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-miscs.d: Ditto.
* testsuite/gas/i386/x86-64-avx10_2-512-miscs.s: Ditto.

opcodes/ChangeLog:

* i386-dis-evex-prefix.h: Remove p and ne in bf16 mnemonics.
* i386-opc.tbl: Ditto.
* i386-mnem.h: Regenerated.
* i386-tbl.h: Ditto.

5 months agoSupport Intel AMX-AVX512
Haochen Jiang [Tue, 14 Jan 2025 02:30:40 +0000 (10:30 +0800)] 
Support Intel AMX-AVX512

This patch will support AMX-AVX512. In disassmbler, we pull out all
GPR mode out of the vex length switch to make it more general.

gas/ChangeLog:

* NEWS: Mention the full support on DMR AMX ISAs.
* config/tc-i386.c: Add amx_avx512.
* doc/c-i386.texi: Document .amx_avx512.
* testsuite/gas/i386/x86-64.exp: Run AMX-AVX512 tests.
* testsuite/gas/i386/x86-64-amx-avx512-intel.d: New test.
* testsuite/gas/i386/x86-64-amx-avx512.d: Ditto.
* testsuite/gas/i386/x86-64-amx-avx512.s: Ditto.

opcodes/ChangeLog:

* i386-dis-evex-len.h: Add EVEX_LEN_0F384A_X86_64_W_0,
EVEX_LEN_0F386D_X86_64_W_0, EVEX_LEN_0F3A07_X86_64_W_0,
EVEX_LEN_0F3A77_X86_64_W_0.
* i386-dis-evex-prefix.h: Add PREFIX_EVEX_0F384A_W_0_L_2,
PREFIX_EVEX_0F386D_W_0_L_2, PREFIX_EVEX_0F3A07_W_0_L_2,
PREFIX_EVEX_0F3A77_W_0_L_2.
* i386-dis-evex-w.h: Add EVEX_W_0F384A_X86_64, EVEX_W_0F386D_X86_64,
EVEX_W_0F3A07_X86_64, EVEX_W_0F3A77_X86_64.
* i386-dis-evex-x86-64.h: Add X86_64_EVEX_0F384A, X86_64_EVEX_0F386D,
X86_64_EVEX_0F3A07, X86_64_EVEX_0F3A77.
* i386-dis-evex.h: Ditto.
* i386-dis.c (EVEX_LEN_0F384A_X86_64_W_0): New.
(EVEX_LEN_0F386D_X86_64_W_0): Ditto.
(EVEX_LEN_0F3A07_X86_64_W_0): Ditto.
(EVEX_LEN_0F3A77_X86_64_W_0): Ditto.
(MOD_EVEX_0F384A_X86_64_W_0): Ditto.
(MOD_EVEX_0F386D_X86_64_W_0): Ditto.
(MOD_EVEX_0F3A07_X86_64_W_0): Ditto.
(MOD_EVEX_0F3A77_X86_64_W_0): Ditto.
(PREFIX_EVEX_0F384A_W_0_L_2): Ditto.
(PREFIX_EVEX_0F386D_W_0_L_2): Ditto.
(PREFIX_EVEX_0F3A07_W_0_L_2): Ditto.
(PREFIX_EVEX_0F3A77_W_0_L_2): Ditto.
(EVEX_W_0F384A_X86_64): Ditto.
(EVEX_W_0F386D_X86_64): Ditto.
(EVEX_W_0F3A07_X86_64): Ditto.
(EVEX_W_0F3A77_X86_64): Ditto.
(X86_64_EVEX_0F384A): Ditto.
(X86_64_EVEX_0F386D): Ditto.
(X86_64_EVEX_0F3A07): Ditto.
(X86_64_EVEX_0F3A77): Ditto.
(OP_VEX): Pull out all GPR mode out of the vector length switch.
* i386-gen.c (isa_dependencies): Add AMX-AVX512.
(cpu_flags): Ditto.
* i386-init.h: Regenerated.
* i386-mnem.h: Ditto.
* i386-opc.h (CpuAMX_AVX512): New.
(i386_cpu_flags): Add cpuamx_avx512.
* i386-opc.tbl: Add AMX-AVX512 instructions.
* i386-tbl.h: Regenerated.

5 months agoSupport Intel AMX-MOVRS
Hu, Lin1 [Tue, 14 Jan 2025 02:30:38 +0000 (10:30 +0800)] 
Support Intel AMX-MOVRS

This patch will support AMX-MOVRS feature. Unlike all the other
AMX insns in vector space where we pass vex_len_table before
vex_w_table, we first pass vex_w_table for tileloaddrs[,t1] to
align with the order in EVEX space. The reason why we first pass
vex_w_table in EVEX space is due to AMX-AVX512, where tcvtrowd2ps
and tilemovrow with r32 shares the same opcode with tileloaddrs[,t1].
All of them have evex.w = 0 but with different evex.length. Re-doing
that shortly is not ideal.

APX_F extension is also implemented in this patch. The encoding will
be:
  - EVEX.128.NP/66.MAP5.W0 F8/F9 !(11):rrr:100 for
    T2RPNTLVW[Z0,Z1]RS[,T1] with NF=0.
  - EVEX.128.F2/66.0F38.W0 4A !(11):rrr:100 FOR TILELOADDRS[,T1] with
    NF=0.

For APX_F extension, we could not use APX_F(AMX_TRANSPOSE&AMX_MOVRS)
since the transformation could not be done. Instead, we will use
AMX_TRANSPOSE & APX_F(AMX_MOVRS). Thus, we should set AMX_TRANSPOSE
for "any" for cpu_flags in assembler. Since it will only affect the
cpu_flags_match, handle that there.

gas/ChangeLog:

* config/tc-i386.c (cpu_arch): Add amx_movrs.
(cpu_flags_match): Set any bitfield for multiple cpuid
enabled insns.
* doc/c-i386.texi: Document .amx_movrs.
* testsuite/gas/i386/x86-64.exp: Run AMX-MOVRS tests.
* testsuite/gas/i386/x86-64-amx-movrs-intel.d: New test.
* testsuite/gas/i386/x86-64-amx-movrs-inval.l: Ditto.
* testsuite/gas/i386/x86-64-amx-movrs-inval.s: Ditto.
* testsuite/gas/i386/x86-64-amx-movrs.d: Ditto.
* testsuite/gas/i386/x86-64-amx-movrs.s: Ditto.

opcodes/ChangeLog:

* i386-dis-evex-len.h (EVEX_LEN_0F384A_X86_64_W_0): New.
* i386-dis-evex-w.h (EVEX_W_0F384A_X86_64): Ditto.
* i386-dis-evex-x86-64.h (X86_64_EVEX_0F384A): Ditto.
* i386-dis-evex.h: New entry for AMX-MOVRS.
* i386-dis.c:
(PREFIX_VEX_0F384A_X86_64_L_0_W_0): New.
(PREFIX_VEX_MAP5_F8_X86_64_L_0_W_0): Ditto.
(PREFIX_VEX_MAP5_F9_X86_64_L_0_W_0): Ditto.
(X86_64_VEX_0F384A): Ditto.
(X86_64_VEX_MAP5_F8): Ditto.
(X86_64_VEX_MAP5_F9): Ditto.
(X86_64_EVEX_0F384A): Ditto.
(VEX_LEN_0F384A_X86_64_W_0): Ditto.
(VEX_LEN_MAP5_F8_X86_64): Ditto.
(VEX_LEN_MAP5_F9_X86_64): Ditto.
(EVEX_LEN_0F384A_X86_64_W_0): Ditto.
(VEX_W_0F384A_X86_64): Ditto.
(VEX_W_MAP5_F8_X86_64): Ditto.
(VEX_W_MAP5_F9_X86_64): Ditto.
(EVEX_W_0F384A_X86_64): Ditto.
(prefix_table): New entry for AMX-MOVRS.
(x86_64_table): Ditto.
(vex_len_table): Ditto.
(vex_w_table): Ditto.
(map5_f8_opcode): New.
(map5_f9_opcode): Ditto.
(get_valid_dis386): Handle VEX_MAP5 opcode for AMX-MOVRS.
* i386-gen.c (isa_dependencies): Add AMX_MOVRS.
(cpu_flags): Ditto.
* i386-init.h: Regenerated.
* i386-mnem.h: Ditto.
* i386-opc.h (CpuAMX_MOVRS): New.
(i386_cpu_flags): Add cpuamx_movrs.
* i386-opc.tbl: Add AMX-MOVRS instructions.
* i386-tbl.h: Regenerated.

Co-authored-by: Haochen Jiang <haochen.jiang@intel.com>
5 months agoSupport Intel MOVRS
Hu, Lin1 [Tue, 14 Jan 2025 02:30:36 +0000 (10:30 +0800)] 
Support Intel MOVRS

This patch focus on supporting MOVRS ISA. We could take this full ISA
as four part: PREFETCHRST2, MOVRS, MOVRS APX_F extension and MOVRS AVX10.2
extension.

The APX_F extension for MOVRS will be:
  - EVEX.LLZ.NP.MAP4.WIG 8A !(11):rrr:bbb for r8/m8 with NF=0 and
    ND=0
  - EVEX.LLZ.NP/66.MAP4.SCALABLE 8B !(11):rrr:bbb for rv/mv with NF=0
    and ND=0

We did not merge the table together for APX_F since there is an explicit
x64 for movrs insn. The current APX_F() did not support the combination
between CPUIDs. Also, the space is different for legacy and apx_f forms.

gas/ChangeLog:

* NEWS: Support Intel MOVRS.
* config/tc-i386.c: Add MOVRS.
* doc/c-i386.texi: Document .movrs.
* testsuite/gas/i386/i386.exp: Run MOVRS tests.
* testsuite/gas/i386/x86-64.exp: Ditto.
        * testsuite/gas/i386/x86-64-apx-evex-promoted-intel.d: Add MOVRS
tests.
        * testsuite/gas/i386/x86-64-apx-evex-promoted-wig.d: Ditto.
        * testsuite/gas/i386/x86-64-apx-evex-promoted.d: Ditto.
        * testsuite/gas/i386/x86-64-apx-evex-promoted.s: Ditto.
* testsuite/gas/i386/lfence-load.d: Add prefetchrst2.
* testsuite/gas/i386/lfence-load.s: Ditto.
* testsuite/gas/i386/nops-8.d: Ditto.
* testsuite/gas/i386/prefetch-intel.d: Ditto.
* testsuite/gas/i386/prefetch.d: Ditto.
* testsuite/gas/i386/x86-64-lfence-load.d: Ditto.
* testsuite/gas/i386/x86-64-lfence-load.s: Ditto.
* testsuite/gas/i386/x86-64-prefetch-intel.d: Ditto.
* testsuite/gas/i386/x86-64-prefetch.d: Ditto.
* testsuite/gas/i386/movrs-intel.d: New test.
* testsuite/gas/i386/movrs-inval.l: Ditto.
* testsuite/gas/i386/movrs-inval.s: Ditto.
* testsuite/gas/i386/movrs.d: Ditto.
* testsuite/gas/i386/movrs.s: Ditto.
* testsuite/gas/i386/x86-64-movrs-avx10_2-256-intel.d: Ditto.
* testsuite/gas/i386/x86-64-movrs-avx10_2-256.d: Ditto.
* testsuite/gas/i386/x86-64-movrs-avx10_2-256.s: Ditto.
* testsuite/gas/i386/x86-64-movrs-avx10_2-512-intel.d: Ditto.
* testsuite/gas/i386/x86-64-movrs-avx10_2-512.d: Ditto.
* testsuite/gas/i386/x86-64-movrs-avx10_2-512.s: Ditto.
* testsuite/gas/i386/x86-64-movrs-intel.d: Ditto.
* testsuite/gas/i386/x86-64-movrs.d: Ditto.
* testsuite/gas/i386/x86-64-movrs.s: Ditto.
* testsuite/gas/i386/x86-64-movrs-intel-suffix.d: Ditto.
* testsuite/gas/i386/x86-64-movrs-suffix.d: Ditto.
* testsuite/gas/i386/x86-64-movrs-suffix.s: Ditto.

opcodes/ChangeLog:

* i386-dis-evex-prefix.h: Add PREFIX_EVEX_MAP5_6F_X86_64.
* i386-dis-evex-x86.h: Add X86_64_EVEX_MAP5_6F.
* i386-dis-evex.h (evex_table): New entry for movrs.
* i386-dis.c (MOD_0F18_REG_4): New.
(PREFIX_EVEX_MAP5_6F_X86_64): Ditto.
(X86_64_0F388A): Ditto.
(X86_64_0F388B): Ditto.
(X86_64_EVEX_MAP5_6F): Ditto.
(three_byte_table): New entry for MOVRS.
(reg_table): Ditto.
(mod_table): Ditto.
(x86_64_table): Ditto. Also include i386-dis-evex-x86.h.
* i386-gen.c (cpu_flags): Add MOVRS.
* i386-init.h: Regenerated.
* i386-mnem.h: Ditto.
* i386-opc.h (i386_cpu_flags): Add cpumovrs.
* i386-opc.tbl: Add MOVRS instrctions.
* i386-tbl.h: Regenerated.

Co-authored-by: Haochen Jiang <haochen.jiang@intel.com>
Co-authored-by: Lili Cui <lili.cui@intel.com>
5 months agox86: Remove mod_table pass for MVexSIBMEM
Haochen Jiang [Tue, 14 Jan 2025 02:30:32 +0000 (10:30 +0800)] 
x86: Remove mod_table pass for MVexSIBMEM

When using MVexSIBMEM, OP_M will help check modrm. Thus, no need
to pass mod_table.

Since we have OP_M do the work, from now on, mod_table[] should
not gain any new entries, unless both slots of them are populated,
e.g., different modrm leading to different insns could not be
combined (Bad_Opcode is not the case since OP_M could handle that).

opcodes/ChangeLog:

* i386-dis.c: Remove mod_table pass for MVexSIBMEM.

5 months agoAutomatic date update in version.in
GDB Administrator [Tue, 14 Jan 2025 00:00:18 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 months agoh8300: Handle .gnu_object_only section
H.J. Lu [Tue, 27 Oct 2020 13:39:59 +0000 (06:39 -0700)] 
h8300: Handle .gnu_object_only section

PR ld/12291
PR ld/12430
PR ld/13298
* config/tc-h8300.c (h8300_elf_section): Handle .gnu_object_only
section.

5 months agold: Document mixing LTO and non-LTO objects for -r
H.J. Lu [Fri, 10 Jan 2025 23:23:27 +0000 (07:23 +0800)] 
ld: Document mixing LTO and non-LTO objects for -r

* ld.texi: Document mixing LTO and non-LTO relocatable files for
"ld -r".

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 months agold: Add LTO and none-LTO output support for ld -r
H.J. Lu [Mon, 4 Nov 2013 17:17:45 +0000 (09:17 -0800)] 
ld: Add LTO and none-LTO output support for ld -r

Link with mixed IR/non-IR objects

* 2 kinds of object files
  o non-IR object file has
    * non-IR sections
  o IR object file has
    * IR sections
    * non-IR sections
    * The output of "ld -r" with mixed IR/non-IR objects should work with:
        o Compilers/linkers with IR support.
o Compilers/linkers without IR support.
* Add the mixed object file which has
  o IR sections
  o non-IR sections:
    * Object codes from IR sections.
    * Object codes from non-IR object files.
  o Object-only section:
    * With section name ".gnu_object_only" and SHT_GNU_OBJECT_ONLY type
    on ELF:
    https://gitlab.com/x86-psABIs/Linux-ABI
    #define SHT_GNU_OBJECT_ONLY 0x6ffffff8 /* Object only */
    * Contain non-IR object file.
    * Input is discarded after link.
* Linker action:
  o Classify each input object file:
    * If there is a ".gnu_object_only" section, it is a mixed object file.
    * If there is a IR section, it is an IR object file.
    * Otherwise, it is a non-IR object file.
  o Relocatable non-IR link:
    * Prepare for an object-only output.
    * Prepare for a regular output.
    * For each mixed object file:
      * Add IR and non-IR sections to the regular output.
      * For object-only section:
* Extract object only file.
* Add it to the object-only output.
* Discard object-only section.
    * For each IR object file:
      * Add IR and non-IR sections to the regular output.
    * For each non-IR object file:
      * Add non-IR sections to the regular output.
      * Add non-IR sections to the object-only output.
    * Final output:
      * If there are IR objects, non-IR objects and the object-only
      output isn't empty:
* Put the object-only output into the object-only section.
* Add the object-only section to the regular output.
* Remove the object-only output.
  o Normal link and relocatable IR link:
    * Prepare for output.
    * IR link:
      * For each mixed object file:
* Compile and add IR sections to the output.
* Discard non-IR sections.
* Object-only section:
  * Extract object only file.
  * Add it to the output.
  * Discard object-only section.
      * For each IR object file:
        * Compile and add IR sections to the output.
* Discard non-IR sections.
      * For each non-IR object file:
* Add non-IR sections to the output.
    * Non-IR link:
      * For each mixed object file:
* Add non-IR sections to the output.
* Discard IR sections and object-only section.
      * For each IR object file:
* Add non-IR sections to the output.
* Discard IR sections.
      * For each non-IR object file:
* Add non-IR sections to the output.

This is useful for Linux kernel build with LTO.

bfd/

PR ld/12291
PR ld/12430
PR ld/13298
* bfd.c (bfd_lto_object_type): Add lto_mixed_object.
(bfd): Add object_only_section.
(bfd_group_signature): New.
* elf.c (special_sections_g): Add .gnu_object_only.
* format.c: Include "plugin-api.h" and "plugin.h" if
BFD_SUPPORTS_PLUGINS is defined.
(bfd_set_lto_type): Set type to lto_mixed_object for
GNU_OBJECT_ONLY_SECTION_NAME section.
(bfd_check_format_matches): Don't check the plugin target twice
if the plugin target is explicitly specified.
* opncls.c (bfd_extract_object_only_section): New.
* plugin.c (bfd_plugin_fake_text_section): New.
(bfd_plugin_fake_data_section): Likewise.
(bfd_plugin_fake_bss_section): Likewise.
(bfd_plugin_fake_common_section): Likewise.
(bfd_plugin_get_symbols_in_object_only): Likewise.
* plugin.c (add_symbols): Call
bfd_plugin_get_symbols_in_object_only and count
plugin_data->object_only_nsyms.
(bfd_plugin_get_symtab_upper_bound): Count
plugin_data->object_only_nsyms.
bfd_plugin_get_symbols_in_object_only and add symbols from
object only section.
(bfd_plugin_canonicalize_symtab): Remove fake_section,
fake_data_section, fake_bss_section and fake_common_section.
Set udata.p to NULL.  Use bfd_plugin_fake_text_section,
bfd_plugin_fake_data_section, bfd_plugin_fake_bss_section and
bfd_plugin_fake_common_section.
Set udata.p to NULL.
* plugin.h (plugin_data_struct): Add object_only_nsyms and
object_only_syms.
* section.c (GNU_OBJECT_ONLY_SECTION_NAME): New.
* bfd-in2.h: Regenerated.

binutils/

PR ld/12291
PR ld/12430
PR ld/13298
* objcopy.c (group_signature): Removed.
(is_strip_section): Replace group_signature with
bfd_group_signature.
(setup_section): Likewise.
* readelf.c (get_os_specific_section_type_name): Handle
SHT_GNU_OBJECT_ONLY.

gas/

PR ld/12291
PR ld/12430
PR ld/13298
* testsuite/gas/elf/section9.s: Add the .gnu_object_only test.
* testsuite/gas/elf/section9.d: Updated.

include/

PR ld/12291
PR ld/12430
PR ld/13298
* elf/common.h (SHT_GNU_OBJECT_ONLY): New.

ld/

PR ld/12291
PR ld/12430
PR ld/13298
* ld.h (ld_config_type): Add emit_gnu_object_only and
emitting_gnu_object_only.
* ldelf.c (orphan_init_done): Make it file scope.
(ldelf_place_orphan): Rename hold to orig_hold.  Initialize hold
from orig_hold at run-time.
(ldelf_finish): New.
* ldelf.h (ldelf_finish): New.
* ldexp.c (ldexp_init): Take a bfd_boolean argument to supprt
object-only output.
(ldexp_finish): Likewise.
* ldexp.h (ldexp_init): Take a bfd_boolean argument.
(ldexp_finish): Likewise.
* ldfile.c (ldfile_try_open_bfd): Call
cmdline_check_object_only_section.
* ldlang.c: Include "ldwrite.h" and elf-bfd.h.
* ldlang.c (cmdline_object_only_file_list): New.
(cmdline_object_only_archive_list): Likewise.
(cmdline_temp_object_only_list): Likewise.
(cmdline_lists_init): Likewise.
(cmdline_list_new): Likewise.
(cmdline_list_append): Likewise.
(print_cmdline_list): Likewise.
(cmdline_on_object_only_archive_list_p): Likewise.
(cmdline_object_only_list_append): Likewise.
(cmdline_get_object_only_input_files): Likewise.
(cmdline_arg): Likewise.
(setup_section): Likewise.
(copy_section): Likewise.
(cmdline_fopen_temp): Likewise.
(cmdline_add_object_only_section): Likewise.
(cmdline_emit_object_only_section): Likewise.
(cmdline_extract_object_only_section): Likewise.
(cmdline_check_object_only_section): Likewise.
(cmdline_remove_object_only_files): Likewise.
(lang_init): Take a bfd_boolean argument to supprt object-only
output.  Call cmdline_lists_init.
(load_symbols): Call cmdline_on_object_only_archive_list_p
to check if an archive member should be loaded.
(lang_process): Handle object-only link.
* ldlang.h (lang_init): Take a bfd_boolean argument.
(cmdline_enum_type): New.
(cmdline_header_type): Likewise.
(cmdline_file_type): Likewise.
(cmdline_bfd_type): Likewise.
(cmdline_union_type): Likewise.
(cmdline_list_type): Likewise.
(cmdline_emit_object_only_section): Likewise.
(cmdline_check_object_only_section): Likewise.
(cmdline_remove_object_only_files): Likewise.
* ldmain.c (main): Call xatexit with
cmdline_remove_object_only_files.  Pass FALSE to lang_init,
ldexp_init and ldexp_finish.  Use ld_parse_linker_script.
Set link_info.output_bfd to NULL after close.  Call
cmdline_emit_object_only_section if needed.
(add_archive_element): Call cmdline_check_object_only_section.
(ld_parse_linker_script): New.
* ldmain.h (ld_parse_linker_script): New.
* plugin.c (plugin_maybe_claim): Call
cmdline_check_object_only_section on claimed IR files.
* scripttempl/elf.sc: Also discard .gnu_object_only sections.
* scripttempl/elf64hppa.sc: Likewise.
* scripttempl/elfxtensa.sc: Likewise.
* scripttempl/mep.sc: Likewise.
* scripttempl/pe.sc: Likewise.
* scripttempl/pep.sc: Likewise.
* emultempl/aarch64elf.em (gld${EMULATION_NAME}_finish): Replace
finish_default with ldelf_finish.
* emultempl/alphaelf.em (alpha_finish): Likewise.
* emultempl/avrelf.em (avr_finish): Likewise.
* emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/ppc32elf.em (ppc_finish): Likewise.
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Likewise.
* emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Likewise.
* testsuite/ld-plugin/lto-10.out: New file.
* testsuite/ld-plugin/lto-10a.c: Likewise.
* testsuite/ld-plugin/lto-10b.c: Likewise.
* testsuite/ld-plugin/lto-10r.d: Likewise.
* testsuite/ld-plugin/lto-4.out: Likewise.
* testsuite/ld-plugin/lto-4a.c: Likewise.
* testsuite/ld-plugin/lto-4b.c: Likewise.
* testsuite/ld-plugin/lto-4c.c: Likewise.
* testsuite/ld-plugin/lto-4r-a.d: Likewise.
* testsuite/ld-plugin/lto-4r-b.d: Likewise.
* testsuite/ld-plugin/lto-4r-c.d: Likewise.
* testsuite/ld-plugin/lto-4r-d.d: Likewise.
* testsuite/ld-plugin/lto.exp (lto_link_tests): Prepare for
"LTO 4[acd]", "lto-4r-[abcd]" and "LTO 10" tests.
(lto_run_tests): Add "LTO 4[acd]" and "LTO 10" tests.
Build liblto-4.a.  Run "lto-4r-[abcd]" tests.
Run lto-10r and create tmpdir/lto-10.o.
Add test for nm on mixed LTO/non-LTO object.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 months agoFix AIX CI build break.
Aditya Vidyadhar Kamath [Mon, 13 Jan 2025 14:56:14 +0000 (08:56 -0600)] 
Fix AIX CI build break.

In AIX a recent commit caused a build break with the error as shown below.
In file included from python/py-color.h:23,
                 from python/python.c:39:
python/python-internal.h:86:10: fatal error: Python.h: No such file or directory
   86 | #include <Python.h>

In AIX, we run builds with and without python for our internal CI's.

A feature development made by the recent commit https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6447969d0ac774b6dec0f95a0d3d27c27d158690
missed to guard Python.h in HAVE_PYTHON macro.

This commit is a fix for the same.

Approved-By: Tom Tromey <tom@tromey.com>
5 months agoHandle case where DAP line can be None
Tom Tromey [Mon, 6 Jan 2025 14:45:33 +0000 (07:45 -0700)] 
Handle case where DAP line can be None

A comment in bugzilla pointed out a bug in my earlier patch to handle
the DAP "linesStartAt1" setting.  In particular, in the backtrace
code, "line" can be None, which would lead to an exception from
export_line.

This patch fixes the problem.

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

5 months agobfd/ELF: slightly "better" file alignment for object files
Jan Beulich [Mon, 13 Jan 2025 12:32:19 +0000 (13:32 +0100)] 
bfd/ELF: slightly "better" file alignment for object files

PR gas/32435

Commit 1f1b5e506bf0 ("bfd/ELF: restrict file alignment for object
files") caused an issue in the Linux kernels modpost utility, which was
building upon .rodata sections to be 4-byte aligned in the file when
they have 4-byte alignment. While we don't want to revert back to
original behavior, apply the same alignment "capping" as done originally
in two other places also for "ordinary" sections.

5 months agogdb, doc: do a minor fix in the description of qTSTMat
Tankut Baris Aktemur [Mon, 13 Jan 2025 07:58:00 +0000 (08:58 +0100)] 
gdb, doc: do a minor fix in the description of qTSTMat

Fix a typo and do a format change.

5 months agogdb/jit: use correctly-sized array view in deprecated_frame_register_read call
Simon Marchi [Mon, 13 Jan 2025 03:29:51 +0000 (22:29 -0500)] 
gdb/jit: use correctly-sized array view in deprecated_frame_register_read call

Commit 7fcdec025c05 ("GDB: Use gdb::array_view for buffers used in
register reading and unwinding") introduces a regression in
gdb.base/jit-reader.exp:

    $ ./gdb -q -nx --data-directory=data-directory testsuite/outputs/gdb.base/jit-reader/jit-reader -ex 'jit-reader-load /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/jit-reader/jit-reader.so' -ex r -batch

    This GDB supports auto-downloading debuginfo from the following URLs:
      <https://debuginfod.archlinux.org>
    Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
    Debuginfod has been disabled.
    To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1".

    Program received signal SIGTRAP, Trace/breakpoint trap.
    Recursive internal problem.

The "Recusive internal problem" part is not good, but it's not the point
of this patch.  It still means we hit an internal error.

The stack trace is:

    #0  internal_error_loc (file=0x55555ebefb20 "/home/simark/src/binutils-gdb/gdb/frame.c", line=1207, fmt=0x55555ebef500 "%s: Assertion `%s' failed.") at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:53
    #1  0x0000555561604d83 in frame_register_unwind (next_frame=..., regnum=16, optimizedp=0x7ffff12e5a20, unavailablep=0x7ffff12e5a30, lvalp=0x7ffff12e5a40, addrp=0x7ffff12e5a60, realnump=0x7ffff12e5a50, buffer=...)
        at /home/simark/src/binutils-gdb/gdb/frame.c:1207
    #2  0x0000555561608334 in deprecated_frame_register_read (frame=..., regnum=16, myaddr=...) at /home/simark/src/binutils-gdb/gdb/frame.c:1496
    #3  0x0000555561a74259 in jit_unwind_reg_get_impl (cb=0x7ffff1049ca0, regnum=16) at /home/simark/src/binutils-gdb/gdb/jit.c:988
    #4  0x00007fffd26e634e in read_register (callbacks=0x7ffff1049ca0, dw_reg=16, value=0x7fffffffb4c8) at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jit-reader.c:100
    #5  0x00007fffd26e645f in unwind_frame (self=0x50400000ac10, cbs=0x7ffff1049ca0) at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jit-reader.c:143
    #6  0x0000555561a74a12 in jit_frame_sniffer (self=0x55556374d040 <jit_frame_unwind>, this_frame=..., cache=0x5210002905f8) at /home/simark/src/binutils-gdb/gdb/jit.c:1042
    #7  0x00005555615f499e in frame_unwind_try_unwinder (this_frame=..., this_cache=0x5210002905f8, unwinder=0x55556374d040 <jit_frame_unwind>) at /home/simark/src/binutils-gdb/gdb/frame-unwind.c:138
    #8  0x00005555615f512c in frame_unwind_find_by_frame (this_frame=..., this_cache=0x5210002905f8) at /home/simark/src/binutils-gdb/gdb/frame-unwind.c:209
    #9  0x00005555616178d0 in get_frame_type (frame=...) at /home/simark/src/binutils-gdb/gdb/frame.c:2996
    #10 0x000055556282db03 in do_print_frame_info (uiout=0x511000027500, fp_opts=..., frame=..., print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1) at /home/simark/src/binutils-gdb/gdb/stack.c:1033

The problem is that function `jit_unwind_reg_get_impl` passes field
`gdb_reg_value::value`, a gdb_byte array of 1 element (used as a
flexible array member), as the array view parameter of
`deprecated_frame_register_read`.  This results in an array view of size
1.  The assertion in `frame_register_unwind` that verifies the passed in
buffer is larger enough to hold the unwound register value then fails.

Fix this by explicitly creating an array view of the right size.

Change-Id: Ie170da438ec9085863e7be8b455a067b531635dc
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
5 months agoRISC-V: Cleanup the imply code and test cases for vendor xsf extensions.
Nelson Chu [Mon, 13 Jan 2025 02:58:13 +0000 (10:58 +0800)] 
RISC-V: Cleanup the imply code and test cases for vendor xsf extensions.

5 months agoAutomatic date update in version.in
GDB Administrator [Mon, 13 Jan 2025 00:00:17 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 months agoAdd an option with a color type.
Andrei Pikas [Sat, 5 Oct 2024 19:27:44 +0000 (22:27 +0300)] 
Add an option with a color type.

Colors can be specified as "none" for terminal's default color, as a name of
one of the eight standard colors of ISO/IEC 6429 "black", "red", "green", etc.,
as an RGB hexadecimal tripplet #RRGGBB for 24-bit TrueColor, or as an
integer from 0 to 255.  Integers 0 to 7 are the synonyms for the standard
colors.  Integers 8-15 are used for the so-called bright colors from the
aixterm extended 16-color palette.  Integers 16-255 are the indexes into xterm
extended 256-color palette (usually 6x6x6 cube plus gray ramp).  In
general, 256-color palette is terminal dependent and sometimes can be
changed with OSC 4 sequences, e.g. "\033]4;1;rgb:00/FF/00\033\\".

It is the responsibility of the user to verify that the terminal supports
the specified colors.

PATCH v5 changes: documentation fixed.
PATCH v6 changes: documentation fixed.
PATCH v7 changes: rebase onto master and fixes after review.
PATCH v8 changes: fixes after review.

5 months agoFix grammar in "Debug Names" node of the manual
Tom Tromey [Sun, 12 Jan 2025 18:52:17 +0000 (11:52 -0700)] 
Fix grammar in "Debug Names" node of the manual

I noticed that an article was missing in the "Debug Names" node.  I'm
checking this in to correct the error.

5 months agoRemove unused declaration and macros
Tom Tromey [Sun, 12 Jan 2025 13:30:57 +0000 (06:30 -0700)] 
Remove unused declaration and macros

event-top.h declares the_prompts, but it is never defined.  It's a
leftover from some ancient refactoring.

Similarly, top.c defines a few prompt-related macros, but these are
unused.

This patch removes these.

5 months agold: Update function prototypes for compilers defaulting to -std=gnu23
H.J. Lu [Sun, 12 Jan 2025 07:14:38 +0000 (15:14 +0800)] 
ld: Update function prototypes for compilers defaulting to -std=gnu23

Since GCC 15 defaults to -std=gnu23, update function prototypes in linker
tests for compilers defaulting to -std=gnu23.

PR ld/32546
* ld-shared/main.c (shlib_checkfunptr1): Update prototype for
compilers defaulting to -std=gnu23.
(shlib_checkfunptr2): Likewise.
* ld-shared/sh1.c (shlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
* ld-srec/sr1.c (fn1): Likewise.
(fn2): Likewise.
* ld-srec/sr2.c (fn1): Likewise.
(fn2): Likewise.
* ld-vsb/main.c (shlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
* ld-vsb/sh1.c (hlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 months agoFix typo in gdb/csky-linux-tdep.c
Sergio Durigan Junior [Sun, 12 Jan 2025 06:24:56 +0000 (01:24 -0500)] 
Fix typo in gdb/csky-linux-tdep.c

This was flagged by Debian's lintian.

Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
5 months agoAutomatic date update in version.in
GDB Administrator [Sun, 12 Jan 2025 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 months agoUpdate comment in linespec.c
Tom Tromey [Sat, 11 Jan 2025 18:54:50 +0000 (11:54 -0700)] 
Update comment in linespec.c

I belatedly realized I had forgotten to update a bool-related comment
in linespec.c.  This patch fixes the oversight.

5 months agoUse bool in linespec
Tom Tromey [Wed, 8 Jan 2025 01:30:10 +0000 (18:30 -0700)] 
Use bool in linespec

This changes various spots in linespec to use a bool rather than an
int.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoHoist lambda in linespec.c:add_matching_symbols_to_info
Tom Tromey [Wed, 8 Jan 2025 01:29:39 +0000 (18:29 -0700)] 
Hoist lambda in linespec.c:add_matching_symbols_to_info

I noticed that two parts of linespec.c:add_matching_symbols_to_info
use the same lambda, and hoisting this seems slightly more efficient.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoMinor cleanup in linespec.c:add_minsym
Tom Tromey [Wed, 8 Jan 2025 01:26:49 +0000 (18:26 -0700)] 
Minor cleanup in linespec.c:add_minsym

This cleans up a 'return' in linespec.c:add_minsym.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoUse std::vector in linespec_state
Tom Tromey [Wed, 8 Jan 2025 01:10:19 +0000 (18:10 -0700)] 
Use std::vector in linespec_state

This changes linespec_state to use a std::vector, and changes
linespec_canonical_name to use std::string.  This removes some manual
memory management, including some odd cleanup code in in
decode_line_full.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoUse gdb::unordered_set in linespec_state
Tom Tromey [Wed, 8 Jan 2025 01:03:28 +0000 (18:03 -0700)] 
Use gdb::unordered_set in linespec_state

This patch changes linespec_state to use gdb::unordered_set.  This
simplifies the code a little and removes some manual management.  It
also replaces address_entry with a std::pair, which simplifies the
code even more; and since this is a private type, IMO it doesn't
reduce readability at all.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoAdd constructor and destructor to linespec_state
Tom Tromey [Wed, 8 Jan 2025 00:54:27 +0000 (17:54 -0700)] 
Add constructor and destructor to linespec_state

This changes linespec_state to have real constructors and a
destructor.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoAutomatic date update in version.in
GDB Administrator [Sat, 11 Jan 2025 00:00:17 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 months agoGDB: Use gdb::array_view for buffers used in register reading and unwinding
Thiago Jung Bauermann [Sun, 1 Sep 2024 17:56:10 +0000 (14:56 -0300)] 
GDB: Use gdb::array_view for buffers used in register reading and unwinding

This allows checking the size of the given buffer.  Changes
frame_register_unwind (), frame_unwind_register (), get_frame_register ()
and deprecated_frame_register_read ().

As pointed out by Baris, in the case of MIPS target code this is best
done by changing a couple of alloca-based buffers in
mips_read_fp_register_single and mips_print_fp_register to
gdb::byte_vector instances.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoGDB: frame: Make VALUEP argument optional in frame_register_unwind
Thiago Jung Bauermann [Fri, 10 Jan 2025 00:43:10 +0000 (21:43 -0300)] 
GDB: frame: Make VALUEP argument optional in frame_register_unwind

It already accepts a nullptr value and a couple of places were always
calling it that way, so make it possible to omit the argument entirely.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoaarch64: Add support for FEAT_SME_B16B16 feature.
Srinath Parvathaneni [Fri, 10 Jan 2025 16:47:32 +0000 (16:47 +0000)] 
aarch64: Add support for FEAT_SME_B16B16 feature.

This patch adds support for SME ZA-targeting non-widening BFloat16 instructions,
under tick FEAT_SME_B16B16 and command line flag "+sme-b16b16".

FEAT_SME_B16B16 implements FEAT_SME2 and FEAT_SVE_B16B16, in accordance with that
"+sme-b16b16" enables "+sme2" and "+sve-b16b16".

Also the test files related to FEAT_SME_B16B16 are prefixed with sme-b16b16*.
eg: sme-b16b16-1.s, sme-b16b16-1.d.

The spec for this feature and instructions is availabe here [1]:
[1]: https://developer.arm.com/documentation/ddi0602/2024-06/SME-Instructions?lang=en

5 months agoaarch64: Add support for FEAT_SVE_B16B16 min and max instructions.
Srinath Parvathaneni [Fri, 10 Jan 2025 16:47:31 +0000 (16:47 +0000)] 
aarch64: Add support for FEAT_SVE_B16B16 min and max instructions.

This patch adds support for SME Z-targeting multi-vector non-widening
BFloat16 instructions, under tick FEAT_SVE_B16B16 and command line flag
"+sve-b16b16+sme2".

Also the test files related to FEAT_SVE_B16B16 (+sme2) are prefixed with
sve-b16b16-sme2*.
eg: sve-b16b16-sme2-1.s, sve-b16b16-sme2-1.d.

The spec for this feature and instructions is availabe here [1]:
[1]: https://developer.arm.com/documentation/ddi0602/2024-06/SME-Instructions?lang=en

5 months agoaarch64: Add support for FEAT_SVE_B16B16 feature.
Srinath Parvathaneni [Fri, 10 Jan 2025 16:47:30 +0000 (16:47 +0000)] 
aarch64: Add support for FEAT_SVE_B16B16 feature.

In the current code, SVE2 Bfloat16 instructions are implemented with tick
FEAT_B16B16 and command line flag "+b16b16" and this feature was suspended
due to incomplete support.

In the new spec available here[1], FEAT_B16B16 is replaced with
FEAT_SVE_B16B16 and command line flag "+b16b16" is replace with "sve-b16b16".

Also the test files related to FEAT_SVE_B16B16 are prefixed with sve-b16b16*.
eg: sve-b16b16-sve2-1.s, sve-b16b16-sve2-1.d.

This patch supports the SVE Z-targeting non-widening BFloat16 instructions
with command line flag "+sve-b16b16+sve2".
[1]: https://developer.arm.com/documentation/ddi0602/2024-06/SVE-Instructions?lang=en

5 months agoaarch64: Make VGx4 symbol mandatory for fvdotb and fvdott
Andrew Carlotti [Wed, 21 Aug 2024 19:08:40 +0000 (20:08 +0100)] 
aarch64: Make VGx4 symbol mandatory for fvdotb and fvdott

Add tests for this, and update the existing fvdotb and fvdott tests to
include the VGx4 symbol so that they continue to test for the intended
errors.

5 months agoaarch64: Rename AARCH64_OPND_SME_ZT0_INDEX2_12
Andrew Carlotti [Mon, 6 Jan 2025 18:06:51 +0000 (18:06 +0000)] 
aarch64: Rename AARCH64_OPND_SME_ZT0_INDEX2_12

Rename to AARCH64_OPND_SME_ZT0_INDEX_MUL_VL.

5 months agoaarch64: Add tests for movt with missing "mul vl"
Andrew Carlotti [Mon, 6 Jan 2025 17:50:42 +0000 (17:50 +0000)] 
aarch64: Add tests for movt with missing "mul vl"

The error message really isn't appropriate (both here and elsewhere in
the test file), but I don't currently have time to investigate further.

5 months agoaarch64: Remove redundant sme-lutv2 qualifiers and operands
Andrew Carlotti [Mon, 6 Jan 2025 17:36:27 +0000 (17:36 +0000)] 
aarch64: Remove redundant sme-lutv2 qualifiers and operands

5 months agoaarch64: Fix incorrect gating of sme-lutv2 instructions
Andrew Carlotti [Mon, 6 Jan 2025 16:56:22 +0000 (16:56 +0000)] 
aarch64: Fix incorrect gating of sme-lutv2 instructions

Only the strided form of the luti4 intrinsic requires FEAT_SME2p1.

5 months agoMinor test case updates for gnat-llvm
Tom Tromey [Tue, 7 Jan 2025 20:54:17 +0000 (13:54 -0700)] 
Minor test case updates for gnat-llvm

gnat-llvm seems to be a bit more aggressive about eliminating unused
variables.  This patch improves the test results a tiny bit by
arranging for some variables to appear to be used.

Note the copyright dates on the new files are done that way because I
simply copied existing files.

5 months agoaarch64: Add support for FEAT_SME_F16F16 fcvt and fcvtl instructions.
Srinath Parvathaneni [Fri, 10 Jan 2025 14:07:19 +0000 (14:07 +0000)] 
aarch64: Add support for FEAT_SME_F16F16 fcvt and fcvtl instructions.

This patch adds support for FEAT_SME_F16F16 instructions fcvt and fcvtl,
which are available on passing command line flags +sme-f16f16 and the
spec is available here[1].
[1]: https://developer.arm.com/documentation/ddi0602/2024-06/SME-Instructions?lang=en

5 months agoaarch64: Add support for FEAT_SME_F16F16 fmla and fmls instructions.
Srinath Parvathaneni [Fri, 10 Jan 2025 14:07:17 +0000 (14:07 +0000)] 
aarch64: Add support for FEAT_SME_F16F16 fmla and fmls instructions.

This patch adds support for FEAT_SME_F16F16 instructions fmla and fmls,
which are available on passing command line flags +sme-f16f16 and the
spec is available here[1].
[1]: https://developer.arm.com/documentation/ddi0602/2024-06/SME-Instructions?lang=en

5 months agoaarch64: Add support for FEAT_SME_F16F16 fmops and fmopa instructions.
Srinath Parvathaneni [Fri, 10 Jan 2025 14:07:13 +0000 (14:07 +0000)] 
aarch64: Add support for FEAT_SME_F16F16 fmops and fmopa instructions.

This patch adds support for FEAT_SME_F16F16 instructions fmops and fmopa,
which are available on passing command line flags +sme-f16f16 and the
spec is available here[1].
[1]: https://developer.arm.com/documentation/ddi0602/2024-06/SME-Instructions?lang=en

5 months agoaarch64: Add support for FEAT_SME_F16F16 feature.
Srinath Parvathaneni [Fri, 10 Jan 2025 14:07:06 +0000 (14:07 +0000)] 
aarch64: Add support for FEAT_SME_F16F16 feature.

This patch adds support for FEAT_SME_F16F16 feature (Non-widening
half-precision FP16 to FP16 arithmetic for SME2), which is enabled
using command line flags +sme-f16f16 to -march (which enables both
FEAT_SME2 and FEAT_SME_F16F16).

There are couple of instructions (fadd and fsub variants) which should
be allowed by the assembler on either passing +sme-f16f16 or +sme-f8f16.
Those instructions are already supported in the current assembler, this
patch adds tests for those instructions as well.

5 months ago[gdb/tdep] Fix gdb.cp/non-trivial-retval.exp on riscv64-linux
Tom de Vries [Fri, 10 Jan 2025 09:32:00 +0000 (10:32 +0100)] 
[gdb/tdep] Fix gdb.cp/non-trivial-retval.exp on riscv64-linux

With test-case gdb.cp/non-trivial-retval.exp on riscv64-linux, I ran into:
...
(gdb) finish^M
Run till exit from #0  f1 (i1=i1@entry=23, i2=i2@entry=100) \
  at non-trivial-retval.cc:34^M
main () at non-trivial-retval.cc:163^M
163       B b = f2 (i1, i2);^M
Value returned is $6 = {a = -5856}^M
(gdb) FAIL: $exp: finish from f1
...
where "Value returned is $6 = {a = 123}" is expected.

The problem is that gdb thinks that the return value is in $a0:
...
$ gdb -q -batch non-trivial-retval \
  -ex "b f1" \
  -ex run \
  -ex "set debug riscv infcall on" \
  -ex finish
Breakpoint 1 at 0x80a: file non-trivial-retval.cc, line 34.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1".

Breakpoint 1, f1 (i1=i1@entry=23, i2=i2@entry=100) at non-trivial-retval.cc:34
34      {
[riscv-infcall] riscv_return_value: \
  [R] type: 'A', length: 0x4, alignment: 0x4, register a0
[riscv-infcall] riscv_return_value: \
  [R] type: 'A', length: 0x4, alignment: 0x4, register a0
[riscv-infcall] riscv_return_value: \
  [R] type: 'A', length: 0x4, alignment: 0x4, register a0
main () at non-trivial-retval.cc:163
163       B b = f2 (i1, i2);
Value returned is $1 = {a = -3568}
...
while $a0 actually contains a pointer to the returned value 123:
...
(gdb) p /x $a0
$3 = 0x3ffffff210
(gdb) p  *((unsigned int *)$a0)
$5 = 123
...

The returned type is:
...
class A
{
public:
  A () {}
  A (A &obj);

  int a;
};
...
which is a C++ aggregate with a nontrivial (because it's user-defined) copy
constructor:

According to the ABI [1], indeed this is returned by reference:
...
Values are returned in the same manner as a first named argument of the same
type would be passed.  If such an argument would have been passed by
reference, the caller allocates memory for the return value, and passes the
address as an implicit first parameter.
  ...
Aggregates larger than 2×XLEN bits are passed by reference and are replaced in
the argument list with the address, as are C++ aggregates with nontrivial copy
constructors, destructors, or vtables.
...

Fix this in riscv_call_arg_scalar_int by checking for
language_pass_by_reference ().trivially_copy_constructible.

The vtable case is explictly mentioned in the ABI, but AFAIU already covered
by the nontrivial copy constructor case.

The nontrivial destructor case is also not supported, but the testsuite
doesn't seem to trigger this.

Fix this by:
- extending the test-case to cover this scenario, and
- fixing it in riscv_call_arg_scalar_int by checking for
  language_pass_by_reference ().trivially_destructible.

Tested on riscv64-linux.

PR tdep/32152
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32152

Approved-By: Andrew Burgess <aburgess@redhat.com>
[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc

5 months ago[gdb/testsuite] Fix gdb.rust/completion.exp timeout on riscv64-linux
Tom de Vries [Fri, 10 Jan 2025 07:53:29 +0000 (08:53 +0100)] 
[gdb/testsuite] Fix gdb.rust/completion.exp timeout on riscv64-linux

On riscv64-linux, with test-case gdb.rust/completion.exp I run into the
following timeout:
...
(gdb) complete break pars^M
FAIL: gdb.rust/completion.exp: complete break pars (timeout)
...

Replaying the scenario outside the testsuite show us that the command takes
~13 seconds:
...
$ gdb -q -batch -x gdb.in
  ...
2025-01-08 12:23:46.853 - command started
+complete break pars
break parse.rs
break parse_printf_format
break parse_running_mmaps_unix.rs
break parser.rs
2025-01-08 12:23:59.600 - command finished
Command execution time: 12.677752 (cpu), 12.748565 (wall)
...
while the timeout is 10 seconds.

The riscv64 processor on the server (cfarm91) is not fast (a fair amount of
the skip_huge_test test-cases times out), but something else is going on as
well.

For x86_64-linux, roughly measuring the size of debug info in the exec get us:
...
$ readelf -wi outputs/gdb.rust/completion/completion | wc -l
2007
...
while on the riscv64 server I get:
...
$ readelf -wi outputs/gdb.rust/completion/completion | wc -l
1606950
...

So it seems reasonable that the test is somewhat slower on riscv64.

Fix this by using timeout factor 2.

Tested on riscv64-linux and x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
5 months agox86: Support x86 Zhaoxin PadLockRNG2 instruction
MayShao-oc [Fri, 10 Jan 2025 07:44:22 +0000 (08:44 +0100)] 
x86: Support x86 Zhaoxin PadLockRNG2 instruction

This patch adds support for Zhaoxin PadLock RNG2 instruction, the
CPUID EDX bit[23] indicates its enablement, it includes REP XRNG2
instruction.

gas/ChangeLog:

* NEWS: Support Zhaoxin PadLock RNG2 instruction.
* config/tc-i386.c (add_branch_prefix_frag_p): Don't add prefix to
PadLock RNG2 instruction.
(output_insn): Handle PadLock RNG2 instruction.
* doc/c-i386.texi: Document PadLock RNG2.
* testsuite/gas/i386/i386.exp: Add PadLock RNG2 test.
* testsuite/gas/i386/padlock_rng2.d: Ditto.
* testsuite/gas/i386/padlock_rng2.s: Ditto.

opcodes/ChangeLog:

* i386-dis.c: Add PadLockRNG2.
* i386-gen.c: Ditto
* i386-opc.h (CpuPadLockRNG2): New.
* i386-opc.tbl: Add Zhaoxin PadLock RNG2 instruction.
* i386-tbl.h: Regenerated.
* i386-mnem.h: Ditto.
* i386-init.h: Ditto.

5 months agogas: consolidate . latching
Jan Beulich [Fri, 10 Jan 2025 07:43:02 +0000 (08:43 +0100)] 
gas: consolidate . latching

... by purging dot_{frag,value}. Right now these two and dot_symbol are
updated independently, which can't be quite right. Centralize .-related
information in dot_symbol, updating it also where previously
dot_{frag,value} were updated. Since S_GET_VALUE() can't be used to
retrieve what used to be dot_value, introduce a new helper to fetch both
frag and offset.

5 months agoaarch64: re-work PR gas/27217 fix again
Jan Beulich [Fri, 10 Jan 2025 07:42:41 +0000 (08:42 +0100)] 
aarch64: re-work PR gas/27217 fix again

Commit c1723a8118f0 ("Arm64: re-work PR gas/27217 fix") really was only
a band-aid; Nick's original solution to the problem was technically
preferable, yet didn't work when . came into play. Undo most of that
change, now that expr_defer expression parsing mode latches dot as is
desired here.

Also add testing for the . case, which I should have done already back
at the time.

5 months agogas: make deferred expression evaluation generally latch dot
Jan Beulich [Fri, 10 Jan 2025 07:42:00 +0000 (08:42 +0100)] 
gas: make deferred expression evaluation generally latch dot

Deferring expression evaluation is often necessary. However, the value
current_location() records typically is intended to represent the
location at the point of use of the expression, with the exception being
.eqv (or its == equivalent). Change how expr_defer behaves in this
regard, and introduce a special mode just for pseudo_set() to use.

Introduce a predicate to cover both "deferred" modes, and use it
everywhere except in current_location(), where only the new mode wants
checking for.

5 months ago[gdb/build, c++20] Fix build with gcc 10
Tom de Vries [Fri, 10 Jan 2025 07:40:11 +0000 (08:40 +0100)] 
[gdb/build, c++20] Fix build with gcc 10

With gcc 10 and -std=c++20, we run into the same problem as reported in commit
6feae66da1d ("[gdb/build, c++20] Handle deprecated std::allocator::construct").

The problem was fixed using:
...
-template<typename T, typename A = std::allocator<T>>
+template<typename T,
+         typename A
+#if __cplusplus >= 202002L
+         = std::pmr::polymorphic_allocator<T>
+#else
+         = std::allocator<T>
+#endif
+        >
...
but that doesn't work for gcc 10, because it defines __cplusplus differently:
...
 $ echo | g++-10 -E -dD -x c++ - -std=c++20 2>&1 | grep __cplusplus
 #define __cplusplus 201709L
 $ echo | g++-11 -E -dD -x c++ - -std=c++20 2>&1 | grep __cplusplus
 #define __cplusplus 202002L
...

Fix this by using the library feature test macro
__cpp_lib_polymorphic_allocator [1], which is undefined for c++17 and defined
for c++20:
...
 $ echo | g++-10 -E -dD -x c++ - -include memory_resource -std=c++17 2>&1 \
   | grep __cpp_lib_polymorphic_allocator
 $ echo | g++-10 -E -dD -x c++ - -include memory_resource -std=c++20 2>&1 \
   | grep __cpp_lib_polymorphic_allocator
 #define __cpp_lib_polymorphic_allocator 201902L
 $
...

A similar problem exists for commit 3173529d7de ("[gdb/guile, c++20] Work
around Werror=volatile in libguile.h").  Fix this by testing for 201709L
instead.

Tested on x86_64-linux, by building gdb with
{gcc 10, clang 17.0.6} x {-std=c++17, -std=c++20}.

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

Approved-By: Tom Tromey <tom@tromey.com>
[1] https://en.cppreference.com/w/cpp/feature_test#cpp_lib_polymorphic_allocator

5 months agoGDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
Thiago Jung Bauermann [Thu, 22 Aug 2024 22:42:45 +0000 (19:42 -0300)] 
GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg

The goal is to ensure that it is available in frame_unwind_got_bytes () to
make sure that the provided buf isn't larger than the size of the register
being provisioned.

In the process, regcache's cached_reg_t::data also needed to be
converted to a gdb::byte_vector, so that the register contents' size can
be tracked.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoGDB: remote: Print total bytes received in debug message
Thiago Jung Bauermann [Sat, 5 Oct 2024 04:26:53 +0000 (01:26 -0300)] 
GDB: remote: Print total bytes received in debug message

This is useful information I missed while debugging issues with
the g packet reply.

Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoAutomatic date update in version.in
GDB Administrator [Fri, 10 Jan 2025 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 months ago[gdb/tdep] Fix gdb.base/readnever.exp on s390x
Tom de Vries [Thu, 9 Jan 2025 13:32:19 +0000 (14:32 +0100)] 
[gdb/tdep] Fix gdb.base/readnever.exp on s390x

On s390x-linux, I run into:
...
 (gdb) backtrace
 #0  0x000000000100061a in fun_three ()
 #1  0x000000000100067a in fun_two ()
 #2  0x000003fffdfa9470 in ?? ()
 Backtrace stopped: frame did not save the PC
 (gdb) FAIL: gdb.base/readnever.exp: backtrace
...

This is really due to a problem handling the fun_three frame.  When generating
a backtrace from fun_two, everying looks ok:
...
 $ gdb -readnever -q -batch outputs/gdb.base/readnever/readnever \
     -ex "b fun_two" \
     -ex run \
     -ex bt
   ...
 #0  0x0000000001000650 in fun_two ()
 #1  0x00000000010006b6 in fun_one ()
 #2  0x00000000010006ee in main ()
...

For reference the frame info with debug info (without -readnever) looks like this:
...
$ gdb -q -batch outputs/gdb.base/readnever/readnever \
    -ex "b fun_three" \
    -ex run \
    -ex "info frame"
  ...
Stack level 0, frame at 0x3fffffff140:
 pc = 0x1000632 in fun_three (readnever.c:20); saved pc = 0x100067a
 called by frame at 0x3fffffff1f0
 source language c.
 Arglist at 0x3fffffff140, args: a=10, b=49 '1', c=0x3fffffff29c
 Locals at 0x3fffffff140, Previous frame's sp in v0
...

But with -readnever, like this instead:
...
Stack level 0, frame at 0x0:
 pc = 0x100061a in fun_three; saved pc = 0x100067a
 called by frame at 0x3fffffff140
 Arglist at 0xffffffffffffffff, args:
 Locals at 0xffffffffffffffff, Previous frame's sp in r15
...

An obvious difference is the "Previous frame's sp in" v0 vs. r15.

Looking at the code:
...
0000000001000608 <fun_three>:
 1000608: b3 c1 00 2b        ldgr %f2,%r11
 100060c: b3 c1 00 0f        ldgr %f0,%r15
 1000610: e3 f0 ff 50 ff 71  lay %r15,-176(%r15)
 1000616: b9 04 00 bf        lgr %r11,%r15
...
it becomes clear what is going on.  This is an unusual prologue.

Rather than saving r11 (frame pointer) and r15 (stack pointer) to stack,
instead they're saved into call-clobbered floating point registers.

[ For reference, this is the prologue of fun_two:
...
0000000001000640 <fun_two>:
 1000640: eb bf f0 58 00 24  stmg %r11,%r15,88(%r15)
 1000646: e3 f0 ff 50 ff 71  lay %r15,-176(%r15)
 100064c: b9 04 00 bf        lgr %r11,%r15
...
where the first instruction stores registers r11 to r15 to stack. ]

Gdb fails to properly analyze the prologue, which causes the problems getting
the frame info.

Fix this by:
- adding handling of the ldgr insn [1] in s390_analyze_prologue, and
- recognizing the insn as saving a register in
  s390_prologue_frame_unwind_cache.

This gets us instead:
...
Stack level 0, frame at 0x0:
 pc = 0x100061a in fun_three; saved pc = 0x100067a
 called by frame at 0x3fffffff1f0
 Arglist at 0xffffffffffffffff, args:
 Locals at 0xffffffffffffffff, Previous frame's sp in f0
...
and:
...
 (gdb) backtrace^M
 #0  0x000000000100061a in fun_three ()^M
 #1  0x000000000100067a in fun_two ()^M
 #2  0x00000000010006b6 in fun_one ()^M
 #3  0x00000000010006ee in main ()^M
 (gdb) PASS: gdb.base/readnever.exp: backtrace
...

Tested on s390x-linux.

PR tdep/32417
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32417

Approved-By: Andreas Arnez <arnez@linux.ibm.com>
[1] https://www.ibm.com/support/pages/sites/default/files/2021-05/SA22-7871-10.pdf

5 months ago[gdb/tdep] Use symbolic constants in s390_prologue_frame_unwind_cache
Tom de Vries [Thu, 9 Jan 2025 13:32:19 +0000 (14:32 +0100)] 
[gdb/tdep] Use symbolic constants in s390_prologue_frame_unwind_cache

In s390_prologue_frame_unwind_cache there are two loops using a hardcoded
constant 16:
...
  for (i = 0; i < 16; i++)
    if (s390_register_call_saved (gdbarch, S390_R0_REGNUM + i)
  ...
  for (i = 0; i < 16; i++)
    if (s390_register_call_saved (gdbarch, S390_F0_REGNUM + i)
...

Fix this by using symbolic constants S390_NUM_GPRS and S390_NUM_FPRS instead.

Tested on s390x-linux, by rebuilding.

Approved-By: Andreas Arnez <arnez@linux.ibm.com>
5 months agogdbserver: introduce and use regcache::set_register_status
Tankut Baris Aktemur [Thu, 9 Jan 2025 12:45:51 +0000 (13:45 +0100)] 
gdbserver: introduce and use regcache::set_register_status

Introduce and use a setter method in regcache to set the status of a
register.  There already exists get_register_status.  So, it made
sense to add the setter to control access to the register_status
field.

In two places, we also do cosmetic improvements to for-loops.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months ago[gdb/testsuite] Run one more test-case with ASAN_OPTIONS=verify_asan_link_order=0
Tom de Vries [Thu, 9 Jan 2025 12:14:57 +0000 (13:14 +0100)] 
[gdb/testsuite] Run one more test-case with ASAN_OPTIONS=verify_asan_link_order=0

After building gdb with asan, and running test-case
gdb.trace/basic-libipa.exp, I got:
...
(gdb) run ^M
Starting program: basic-libipa ^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
==7705==ASan runtime does not come first in initial library list; you should \
  either link runtime to your application or manually preload it with \
  LD_PRELOAD.^M
[Inferior 1 (process 7705) exited with code 01]^M
(gdb) FAIL: gdb.trace/basic-libipa.exp: runto: run to main
...

Fix this in the same way as in commit 75948417af8 ("[gdb/testsuite] Run two
test-cases with ASAN_OPTIONS=verify_asan_link_order=0").

Tested on x86_64-linux.

5 months agogdb: boolify thread_info's 'stop_requested' field
Tankut Baris Aktemur [Thu, 9 Jan 2025 11:54:25 +0000 (12:54 +0100)] 
gdb: boolify thread_info's 'stop_requested' field

Boolify the field.  The 'set_stop_requested' function was already
taking a bool parameter, whose value is assigned to the field.

Approved-By: Andrew Burgess <aburgess@redhat.com>
5 months agoPR32238, ld -r slowdown since 21401fc7bf
Alan Modra [Sat, 4 Jan 2025 01:03:27 +0000 (11:33 +1030)] 
PR32238, ld -r slowdown since 21401fc7bf

PR 32238
* ldlang.c (struct out_section_hash_entry): Add "tail".
(output_section_statement_newfunc_1): New, extracted from..
(output_section_statement_newfunc): ..here.  Init tail.
(lang_output_section_statement_lookup): Use tail to avoid
list traversal.

5 months agogdbserver: dump 'xx...x' in collect_register_as_string for unavailable register
Tankut Baris Aktemur [Thu, 9 Jan 2025 08:06:00 +0000 (09:06 +0100)] 
gdbserver: dump 'xx...x' in collect_register_as_string for unavailable register

Fix 'collect_register_as_string' so that unavailable registers are
dumped as 'xx...x' instead of arbitrary values, in particular when
reporting expedited registers in a resume reply packet.  This change
gives the opportunity that we can reuse 'collect_register_as_string'
in 'registers_to_string' for additional code simplification.

Reviewed-By: Luis Machado <luis.machado@arm.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
5 months agoxfail quad-div2 test for am33
Alan Modra [Tue, 7 Jan 2025 05:52:42 +0000 (16:22 +1030)] 
xfail quad-div2 test for am33

5 months agoExcessive gas .irpt count
Alan Modra [Thu, 9 Jan 2025 04:37:49 +0000 (15:07 +1030)] 
Excessive gas .irpt count

There is a test in do_repeat to error on "negative" repeat counts.
Just at what value a ssize_t is negative of course depends on the
host.  Change the excessive repeat count to a fixed value, 0x80000000,
ie. what would be seen as negative on a 32-bit host.

5 months agold: Utilize specific digit ranges for different numeral systems
Xiao Zeng [Tue, 7 Jan 2025 01:54:55 +0000 (09:54 +0800)] 
ld: Utilize specific digit ranges for different numeral systems

        * ldlex.l: Utilize specific digit ranges for different
numeral systems.

Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
5 months agoRISC-V: Add partial instruction display tests
Charlie Jenkins [Tue, 7 Jan 2025 21:35:45 +0000 (13:35 -0800)] 
RISC-V: Add partial instruction display tests

When objdump is specified with a stop address that ends up in the middle
of an instruction, the partial instruction is expected to be displayed.
These three tests check that the partial instruction is correctly
displayed when there are 1, 2, or 3 bytes of the instruction dumped.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
5 months agoRISC-V: Fix display of partial instructions
Charlie Jenkins [Tue, 7 Jan 2025 21:35:44 +0000 (13:35 -0800)] 
RISC-V: Fix display of partial instructions

As of commit e43d8768d909 ("RISC-V: Fix disassemble fetch fail return
value.") partial instructions are no longer displayed by objdump. While
that commit fixed the behavior of print_insn_riscv() returning the
arbitrary status value upon failure, it caused the behavior of dumping
instructions to change. Allow partial instructions to be displayed once
again and only return -1 if no part of the instruction was able to be
displayed.

Fixes: e43d8768d909 ("RISC-V: Fix disassemble fetch fail return
value.")

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Acked-By: Andrew Burgess <aburgess@redhat.com>
5 months agoAutomatic date update in version.in
GDB Administrator [Thu, 9 Jan 2025 00:00:14 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 months agoRename two Ada test suite functions
Tom Tromey [Wed, 8 Jan 2025 20:05:16 +0000 (13:05 -0700)] 
Rename two Ada test suite functions

I happened to notice that the Ada compiler emitted a warning when
compiling a couple of DAP tests.  This wasn't intentional, and this
patch renames the functions to match the filename.

5 months agoGDB, gdbserver: Convert regcache_register_size function to method
Thiago Jung Bauermann [Sat, 2 Nov 2024 02:56:21 +0000 (23:56 -0300)] 
GDB, gdbserver: Convert regcache_register_size function to method

The regcache_register_size function has one implementation in GDB, and
one in gdbserver.  Both of them have a gdb::checked_static_cast to their
corresponding regcache class.  This can be avoided by defining a
pure virtual register_size method in the
reg_buffer_common class, which is then implemented by the reg_buffer
class in GDB, and by the regcache class in gdbserver.

Calls to the register_size () function from methods of classes in the
reg_buffer_common hierarchy need to be changed to calls to the newly
defined method, otherwise the compiler complains that a matching method
cannot be found.

Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Change-Id: I7f4f74a51e96c42604374e87321ca0e569bc07a3

5 months ago[gdb/testsuite] Check gnatmake version in gdb.ada/scalar_storage.exp
Tom de Vries [Wed, 8 Jan 2025 15:24:11 +0000 (16:24 +0100)] 
[gdb/testsuite] Check gnatmake version in gdb.ada/scalar_storage.exp

On a system with gcc 14.2.0 and gnatmake 13.3.0 I run into:
...
(gdb) PASS: gdb.ada/scalar_storage.exp: print V_LE
get_compiler_info: gcc-14-2-0
print V_BE^M
$2 = (value => 126, another_value => 12, color => red)^M
(gdb) FAIL: gdb.ada/scalar_storage.exp: print V_BE
...

The test-case contains a corresponding kfail:
...
 # This requires a compiler fix that is in GCC 14.
 if {[gcc_major_version] < 14} {
     setup_kfail "DW_AT_endianity on enum types" *-*-*
 }
...
which doesn't trigger because it checks the gcc version rather than the
gnatmake version.

Fix this by checking the gnatmake version instead.

Tested on aarch64-linux and x86_64-linux.

5 months ago[gdb/testsuite] Require can_spawn_for_attach in gdb.base/gstack.exp
Tom de Vries [Wed, 8 Jan 2025 15:07:08 +0000 (16:07 +0100)] 
[gdb/testsuite] Require can_spawn_for_attach in gdb.base/gstack.exp

I ran test-case gdb.base/gstack.exp on a machine with kernel.yama.ptrace_scope
set to 1 and ran into:
...
PASS: gdb.base/gstack.exp: spawn gstack
ptrace: Operation not permitted.^M
GSTACK-END^M
PASS: gdb.base/gstack.exp: gstack exits with no error
PASS: gdb.base/gstack.exp: gstack's exit status is 0
FAIL: gdb.base/gstack.exp: got backtrace
...

Fix this by requiring can_spawn_for_attach.

Tested on x86_64-linux.

5 months ago[gdb/testsuite] Require supports_process_record in gdb.reverse/test_ioctl_TCSETSW.exp
Tom de Vries [Wed, 8 Jan 2025 11:48:08 +0000 (12:48 +0100)] 
[gdb/testsuite] Require supports_process_record in gdb.reverse/test_ioctl_TCSETSW.exp

I ran test-case gdb.reverse/test_ioctl_TCSETSW.exp on riscv64-linux, and got:
...
(gdb) record full^M
Process record: the current architecture doesn't support record function.^M
(gdb) FAIL: gdb.reverse/test_ioctl_TCSETSW.exp: record full
...

Fix this by requiring supports_process_record.

Tested on riscv64-linux and x86_64-linux.

5 months ago[gdb/testsuite] Fix gdb.base/reset-catchpoint-cond.exp for !supports_catch_syscall
Tom de Vries [Wed, 8 Jan 2025 09:06:28 +0000 (10:06 +0100)] 
[gdb/testsuite] Fix gdb.base/reset-catchpoint-cond.exp for !supports_catch_syscall

I ran test-case gdb.base/reset-catchpoint-cond.exp on riscv64-linux, and got:
...
(gdb) catch syscall write^M
The feature 'catch syscall' is not supported on this architecture yet.^M
(gdb) FAIL: $exp: mode=syscall: catch syscall write
...

Fix this by checking for supports_catch_syscall.

Tested on riscv64-linux and x86_64-linux.

5 months agoFix 32085 Source file not recognized for gcc 11.4.0-compiled code
Vladimir Mezentsev [Tue, 7 Jan 2025 05:40:12 +0000 (21:40 -0800)] 
Fix 32085 Source file not recognized for gcc 11.4.0-compiled code

gprofng cannot read compressed section.
In the next release we plan to use libbfd everywhere instead of our ELF reader.
But in this release I use bfd_get_full_section_contents() only
when bfd_is_section_compressed() returns true.

gprofng/ChangeLog
2025-01-06  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

PR gprofng/32085
* src/Elf.cc: Use bfd_get_full_section_contents to decompress a section.
* src/Elf.h: Define SEC_DECOMPRESSED.

5 months agoSupport Intel AMX-FP8
Liwei Xu [Wed, 8 Jan 2025 03:38:48 +0000 (11:38 +0800)] 
Support Intel AMX-FP8

In this patch, we will support AMX-FP8 feature. Since in the
foreseeable future, only AMX-MOVRS will also use VEX_MAP5, we
currently will not add a table of 256 entries and handle just
like MAP7.

gas/ChangeLog:

* config/tc-i386.c: Add amx_fp8.
* doc/c-i386.texi: Document .amx_fp8.
* testsuite/gas/i386/x86-64.exp: Run AMX-FP8 tests.
* testsuite/gas/i386/x86-64-amx-fp8-bad.d: New test.
* testsuite/gas/i386/x86-64-amx-fp8-bad.s: Ditto.
* testsuite/gas/i386/x86-64-amx-fp8-intel.d: Ditto.
* testsuite/gas/i386/x86-64-amx-fp8-inval.l: Ditto.
* testsuite/gas/i386/x86-64-amx-fp8-inval.s: Ditto.
* testsuite/gas/i386/x86-64-amx-fp8.d: Ditto.
* testsuite/gas/i386/x86-64-amx-fp8.s: Ditto.

opcodes/ChangeLog:

* i386-dis.c (PREFIX_VEX_MAP5_FD_X86_64_L_0_W_0): New.
(X86_64_VEX_MAP5_FD): Ditto.
(VEX_LEN_MAP5_FD_X86_64): Ditto.
(VEX_W_MAP5_FD_X86_64_L_0):Ditto.
(prefix_table): Add PREFIX_VEX_MAP5_FD_X86_64_L_0_W_0.
(x86_64_table): Add X86_64_VEX_MAP5_FD.
(vex_len_table): Add VEX_LEN_MAP5_FD_X86_64.
(vex_w_table): Add VEX_W_MAP5_FD_X86_64_L_0.
* i386-gen.c: Add CPU_AMX_FP8_FLAGS and
CPU_ANY_AMX_FP8_FLAGS.
* i386-init.h: Regenerated.
* i386-mnem.h: Ditto.
* i386-opc.h: Add cpuamx_fp8.
* i386-opc.tbl: Add AMX_FP8 instructions.
* i386-tbl.h: Regenerated.

Co-authored-by: Haochen Jiang <haochen.jiang@intel.com>
5 months agoRename two maint commands
Tom Tromey [Sun, 5 Jan 2025 22:20:50 +0000 (15:20 -0700)] 
Rename two maint commands

This renames two maint commands, removing a hyphen from
"check-symtabs" and "check-psymtabs"; that is, moving them under the
existing "maint check" prefix.

Regression tested on x86-64 Fedora 40.

Reviewed-By: Tom de Vries <tdevries@suse.de>
Approved-By: Andrew Burgess <aburgess@redhat.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
5 months agoAutomatic date update in version.in
GDB Administrator [Wed, 8 Jan 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 months agoUpdated Malay translation for the bfd sub-directory
Nick Clifton [Tue, 7 Jan 2025 15:01:05 +0000 (15:01 +0000)] 
Updated Malay translation for the bfd sub-directory

5 months agoFix crash in DWARF indexer
Tom Tromey [Mon, 6 Jan 2025 20:34:47 +0000 (13:34 -0700)] 
Fix crash in DWARF indexer

Iain pointed out a crash in the DWARF indexer when run on a certain D
program.  The DWARF in this case has a nameless enum class; this
causes an assertion failure.

This patch arranges to simply ignore such types.  The fact that an
enum class is nameless in this case appears to be a compiler bug.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32518
Approved-By: Tom de Vries <tdevries@suse.de>