Commit Graph

119480 Commits

Author SHA1 Message Date
Simon Marchi
2e7c4d0fe5 gdb: add program_space parameter to lookup_minimal_symbol_linkage
Make the current_program_space reference bubble up one level.

Change-Id: Ic349dc96b7d375ad7c66022d84657136f0de8c87
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12 10:38:29 -04:00
Simon Marchi
3b996cc7ae gdb: add program_space parameter to get_symbol_leading_char
Make the current_program_space references bubble up one level.  In this
case, I think it makes sense to use m_objfile's program space.

Change-Id: Ibecb89b5e8a0363328240f1675d0fb95ff99c99a
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12 10:37:06 -04:00
Simon Marchi
4144d36a68 gdb: add program_space parameter to lookup_minimal_symbol
>From what I can see, lookup_minimal_symbol doesn't have any dependencies
on the global current state other than the single reference to
current_program_space.  Add a program_space parameter and make that
current_program_space reference bubble up one level.

Change-Id: I759415e2f9c74c9627a2fe05bd44eb4147eee6fe
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12 10:31:09 -04:00
Simon Marchi
8d2f4b7c31 gdb: remove lookup_bound_minimal_symbol
Now that lookup_minimal_symbol has default values for sfile and objf,
calling lookup_bound_minimal_symbol is identical to calling
lookup_minimal_symbol without sfile and objf.  Remove
lookup_bound_minimal_symbol, replace call sites with
lookup_minimal_symbol.

Change-Id: I0a420fb56de1de8bee8a7303228c9e4546e3577b
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12 10:31:09 -04:00
Simon Marchi
c8979ae4fb gdb: make lookup_minimal_symbol objf and sfile parameters optional
Most calls to lookup_minimal_symbol don't pass a value for sfile and
objf.  Make these parameters optional (have a default value of
nullptr).  And since passing a value to `objf` is much more common than
passing a value to `sfile`, swap the order so `objf` comes first, to
avoid having to pass a nullptr value to `sfile` when wanting to pass a
value to `objf`.

Change-Id: I8e9cc6b942e593bec640f9dfd30f62786b0f5a27
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12 10:31:09 -04:00
Simon Marchi
03b40f6f55 gdb: drop struct keyword when using bound_minimal_symbol
This is a simple find / replace from "struct bound_minimal_symbol" to
"bound_minimal_symbol", to make things shorter and more consisten
througout.  In some cases, move variable declarations where first used.

Change-Id: Ica4af11c4ac528aa842bfa49a7afe8fe77a66849
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12 10:31:09 -04:00
Simon Marchi
10ac7e80c0 gdb: remove find_and_open_solib so_list method
Now that the nto port is removed, this is unused.

Change-Id: I86565310cdbcde17a837eb10585cdd153f4f03d8
Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-08-12 10:21:15 -04:00
Simon Marchi
554822d670 gdbsupport: remove #ifndef REALTIME_LO in signals.cc
REALTIME_LO was only possibly previously defined in config/nm-nto.h,
which is now removed.  So we can remove the #ifndef protecting against a
redefinition of REALTIME_LO in gdbsupport/signals.cc.

Change-Id: I021b9518ceaa6223bd480ff1e07e9a978b0b241e
Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-08-12 10:21:15 -04:00
Simon Marchi
36fb20fa93 gdb: remove QNX Neutrino support
Remove the support for the QNX Neutrino OS (tdep and native bits).  This
has been unmaintained for years, and we don't have a way to see if it
works (or even builds, for the native parts).  Without somebody actively
maintaining it, this is just a burden for developers, especially that
this port does a few weird unique things that require reasoning about
when doing big change.

Support for GDBserver was removed in 2020, commit 613f149a90
("gdbserver: remove support for Neutrino").

Change-Id: I4e25ec26ab06636629adebd02ceb161ee31c232d
Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-08-12 10:21:15 -04:00
Simon Marchi
7ee8372bdb gdb: rename target-delegates.c to target-delegates-gen.c
Following this suggestion:

https://inbox.sourceware.org/gdb-patches/2a0520ec-ccfe-4fc3-b051-7b8c60294de5@efficios.com/T/#md537792a1871addf153f3e406224f9baf025414a

Change-Id: I30988c46505f130ca16155891958f92621cada97
Approved-By: John Baldwin <jhb@FreeBSD.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12 09:45:51 -04:00
GDB Administrator
3338faa385 Automatic date update in version.in 2024-08-12 00:00:29 +00:00
GDB Administrator
3fa12f5bd6 Automatic date update in version.in 2024-08-11 00:00:36 +00:00
H.J. Lu
602f5cf7e3 ld: Add PR ld/32067 tests
Add PR ld/32067 tests with the compiler driver since the -plugin option
is needed to trigger this --oformat binary bug.

	PR ld/32067
	* testsuite/ld-i386/i386.exp: Run PR ld/32067 test.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/start.s: Add .note.GNU-stack section.
	* testsuite/ld-x86-64/pr32067.s: New file.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-10 07:26:40 -07:00
Alan Modra
ec8f5671b4 PR32067, ld -Wl,--oformat,binary crash in _bfd_elf_link_keep_memory
The direct fix for this segfault is to test for a non-NULL bed in
_bfd_elf_link_keep_memory, but also there isn't much point in running
code for LTO if the output is binary.

	PR 32067
	* elflink.c (_bfd_elf_link_keep_memory): Test for non-NULL bed.
	(elf_link_add_object_symbols): Don't run the loop setting
	non_ir_ref_regular if the output hash table is not ELF.
2024-08-10 10:28:32 +09:30
GDB Administrator
e34f53c5e6 Automatic date update in version.in 2024-08-10 00:00:30 +00:00
Bernd Edlinger
9d13bd76f8 Fix test failure when TUI is not enabled
This adds a missing allow_tui_tests guard.

When tui is not enabled this test case does
typically fail:

FAIL: gdb.base/new-ui.exp: do_test_invalid_args: new-ui with tui

Approved-By: Tom de Vries <tdevries@suse.de>
2024-08-09 12:33:15 +02:00
Stephan Rohr
49e607f511 gdb: adjust the default place of 'list' to main's prologue
The 'list' command prints around the 'main' function if the current
source location is not set.  The prologue of 'main' is skipped and the
first real line of 'main' is offset by 'lines_to_print - 1'.  This is
incorrect, the location should be defaulted to main's prologue without
applying offsets (similar to 'list main').  Printing around the selected
line is then done in 'list_around_line'.

The patch also fixes an issue if the list command is used before the
program is started.  For example, with the following code:

26 static void attribute ((used)) ambiguous_fun (void) {}
27
28 static int attribute ((used)) ambiguous_var;
29
30
31
32
33
34
35
36
37
38 int
39 main (void)
40 {
41   return 0;
42 }

GDB offsets the relevant line by 'lines_to_print - 1' and then by another
'lines_to_print / 2' and prints:

(gdb) list
27
28 static int attribute ((used)) ambiguous_var;
29
30
31
32
33
34
35
36

With this patch, GDB correctly prints:

37
38      int
39      main (void)
40      {
41        return 0;
42      }

Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-09 11:29:51 +01:00
Jan Beulich
7dd0dfbde7 gas: drop scrubber states 14 and 15
While sadly 5262831592 doesn't say anything on why these would have
been needed, the latest with the removal of most of the opcode vs
operands distinction in the scrubber these shouldn't be needed anymore.
The implementation was a little questionable anyway, in moving back to
states expecting labels, when clearly labels shouldn't really be
following predicates (in practice, due to another bug, at least ia64
permits such).
2024-08-09 12:00:26 +02:00
Jan Beulich
6ae8a30d44 gas: have scrubber retain more whitespace
According to the description of the state machine, the expectation
appears to be that (leaving aside labels) any insn mnemonic or
directive would be followed by a comma separated list of operands. That
may have been true very long ago, but the latest with the advent of more
elaborate macros this isn't rhe case anymore. Neither macro parameters
in macro definitions nor macro arguments in macro invocations are
required to be separated by commas. Hence whitespace serves a crucial
role there. Plus even without "real" macros issues exist, in e.g.

	.irp n, ...
	insn\n\(suffix)	operand1, operand2
	.endr

Whitespace following the closing parenthesis would have been removed
(ahead of even processing the .irp), as the "opcode" was deemed to have
ended earlier already.

Therefore, squash the distinction between "opcode" and operands, i.e.
fold state 10 back into state 3. Also drop most of the distinction
between "symbol chars" and "relatively normal" ones. Not entirely
unexpectedly this results in the need to skip whitespace in a few more
places in arch-specific code (and quite likely more changes are needed
for insn forms not covered by the testsuite).

As a result the D10V special case is no longer necessary.

In config/tc-sparc.c also move a comment to be next to the code being
commented.

In opcodes/cgen-asm.in some further cleanup is done, following the local
var adjustments.
2024-08-09 11:59:31 +02:00
Jan Beulich
eb2b444321 MIPS: relax gas testsuite whitespace expectations
In a subsequent change the scrubber is going to be changed to retain
further whitespace.  Test case expectations generally would better not
depend on the specific whitespace treatment by the scrubber, unless of
course a test is specifically about it.  Adjust relevant test cases to
permit blanks where those will subsequently appear.
2024-08-09 11:52:42 +02:00
Jan Beulich
e052622907 aarch64: relax gas testsuite whitespace expectations
In a subsequent change the scrubber is going to be changed to retain
further whitespace. Test case expectations generally would better not
depend on the specific whitespace treatment by the scrubber, unless of
course a test is specifically about it. Adjust relevant test cases to
permit blanks where those will subsequently appear.
2024-08-09 11:52:18 +02:00
Jan Beulich
a7421f0323 Arm: relax gas testsuite whitespace expectations
In a subsequent change the scrubber is going to be changed to retain
further whitespace. Test case expectations generally would better not
depend on the specific whitespace treatment by the scrubber, unless of
course a test is specifically about it. Adjust relevant test cases to
permit blanks where those will subsequently appear.
2024-08-09 11:51:47 +02:00
Jan Beulich
3a4de19d4e m32r: move scrubber override to target header
Other than LEX_IS_* settings, such #define-s don't belong into the
common source file.
2024-08-09 11:49:36 +02:00
Jan Beulich
eb3cc508ee Arm: respect line separators for .symver scrubber special case
Directives end at "line" (really: statement) separators, not just at
new-line chars.
2024-08-09 11:49:04 +02:00
Jan Beulich
d5de496c0e gas: respect CR_EOL also for scrubbing
While apparently intended to be only externally controlled (e.g. via
specifying CFLAGS at make invocation), we should still keep scrubber and
lexer in sync in this regard. There's one place which imo was previously
wrong already, but would go further wrong and hence is being adjusted
right here: An .mri directive can be terminated by any kind of "line"
(really: statement) separators.
2024-08-09 11:48:32 +02:00
Jan Beulich
8d627d3b31 gas: have scrubber also respect quoted labels
For the handling of ':' elsewhere in the scrubber to be correct with
regard to labels, the state after parsing a string found at the start of
a line must match that after finding a symbol character at the start of
a line. (Things are largely okay when there's whitespace ahead of the
label: Whitespace after the colon then is retained rather than dropped
for typical targets like x86, but read.c will know to deal with that.)
2024-08-09 11:48:05 +02:00
Nelson Chu
04c9cf0a8c RISC-V: PR32014, .option directives shuoldn't affect elf attribute.
The .option arch/rvc/norvc/push/pop directives can only take effect for a
small/large specific code region, so they are not file-level architecture
setting.  They should only affect the mapping symbols only rather than the
file-level elf architecture attribute.  Otherwise, the elf architecture
attribute will appear to missing some extensions when -flto merges files
with different .option architecture settings.

gas/
	PR 32014
	* config/tc-riscv.c (file_arch_str): New const char *, rather than the
	arch_str in the riscv_rps_as.subset_list, it's file-level so only be
	affected by .attribute arch directive.
	(riscv_reset_subsets_list_arch_str): Renamed to riscv_set_arch_str, and
	also can handle both file_arch_str and arch_str in subset_list, just
	give the pointer address as the input.
	(riscv_set_arch): Called by -march and .attribute arch, so set both
	file_arch_str and arch_str in subset_list.
	(s_riscv_option): Updated .option arch/rvc/norvc/push/pop that only
	set the arch_str in subset_list.
	(riscv_write_out_attrs): Output elf architecture attribute according to
	file_arch_str.  Freed file_arch_str.
	* doc/c-riscv.texi: Added destrbution that .option directives shouldn't
	affect the elf attribute settings.
	* testsuite/gas/riscv/option-arch.s: From option-arch-01/02/03 merged.
	* testsuite/gas/riscv/option-arch-dis.d: Likewise, for dis-assembler.
	* testsuite/gas/riscv/option-arch-attr.d: Likewise, to check readelf -A.
2024-08-09 10:38:34 +08:00
GDB Administrator
2fba6c8908 Automatic date update in version.in 2024-08-09 00:00:28 +00:00
Richard Henderson
a7b0384d54 gas: sparc: Fix faligndatai assembly and disassembly
The first operand is a general register, not an fp register;
the third operand is encoded into RS2, not RS3;
the second operand must match the destination operand.
2024-08-09 08:32:54 +10:00
Tom de Vries
647adc6812 [gdb/python] Fix handling of ^C during disassembly
Inspired by the trigger patch I used here [1], I tried this in
gdbpy_print_insn:
...
   /* Call into the registered disassembler to (possibly) perform the
      disassembly.  */
+  set_quit_flag ();
   PyObject *insn_disas_obj = (PyObject *) disasm_info;
   gdbpy_ref<> result (PyObject_CallFunctionObjArgs (hook.get (),
                                                    insn_disas_obj,
...
and with test-case gdb.python/py-disasm-exec.exp ran into:
...
(gdb) disassemble test^M
Dump of assembler code for function test:^M
   0x00000000004101ac <+0>:     Python Exception <class 'KeyboardInterrupt'>: ^M
^M
unknown disassembler error (error = -1)^M
(gdb)
...

This is incorrect, the KeyboardInterrupt should propagate and interrupt the
command.

Fix this by using gdbpy_print_stack_or_quit instead of gdbpy_print_stack in
gdbpy_print_insn, giving us instead:
...
(gdb) disassemble test^M
Dump of assembler code for function test:^M
   0x00000000004101ac <+0>:     ^M
Quit^M
(gdb)
...

Tested on aarch64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>

[1] https://sourceware.org/pipermail/gdb-patches/2024-July/210798.html
2024-08-08 23:52:00 +02:00
Tom de Vries
c45c3b4162 [gdb] Handle ^C during disassembly
In PR gdb/32025, a fatal error was reported when sending a SIGINT to gdb while
disassembling.

I managed to reproduce this on aarch64-linux in a Leap 15.5 container using
this trigger patch:
...
 gdb_disassembler_memory_reader::dis_asm_read_memory
   (bfd_vma memaddr, gdb_byte *myaddr, unsigned int len,
    struct disassemble_info *info) noexcept
 {
+  set_quit_flag ();
   return target_read_code (memaddr, myaddr, len);
 }
...
and a simple gdb command line calling the disassemble command:
...
$ gdb -q -batch a.out -ex "disassemble main"
...

The following scenario leads to the fatal error:
- the disassemble command is executed,
- set_quit_flag is called in
  gdb_disassembler_memory_reader::dis_asm_read_memory, pretending that a
  user pressed ^C,
- target_read_code calls QUIT, which throws a
  gdb_exception_quit,
- the exception propagation mechanism reaches c code in libopcodes and a fatal
  error triggers because the c code is not compiled with -fexception.

Fix this by:
- wrapping the body of gdb_disassembler_memory_reader::dis_asm_read_memory in
  catch_exceptions (which consequently needs moving to a header file), and
- reraising the caught exception in default_print_insn using QUIT.

Tested on aarch64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32025
2024-08-08 23:52:00 +02:00
GDB Administrator
5b84cbc35a Automatic date update in version.in 2024-08-08 00:00:35 +00:00
Jan Beulich
52e7f037db score: drop TC_ALPHA code
I can't see how that could ever have come into play.
2024-08-07 16:32:43 +02:00
Jan Beulich
b962d73b83 gas: drop dead VMS code from command line handling
The only time 'v' was overridden, allowing for an optional value, was
when OBJ_VMS support still existed (until a little less than 20 years
ago). Drop the respective leftovers.

With that OPTION_VERBOSE also becomes redundant and hence is being
dropped.
2024-08-07 16:32:15 +02:00
Jan Beulich
5715e0b51c VAX: drop OBJ_VMS leftovers
OBJ_VMS support was dropped almost 20 years ago (e330299ed5). Drop
respective code from tc-vax.c as well.

While there, make adjustments for OBJ_ELF as well: -K was dropped over
20 years ago (530556a951), yet left in md_shortopts. OPTION_PIC isn't
really necessary either; 'k' can be used instead. And then the ELF
options available weren't displayed by md_show_usage().
2024-08-07 16:31:54 +02:00
Jan Beulich
544248c027 gas: improve unrecognized command line option diagnostic
Printing optc with %c makes sense only when optc is actually a
character. Add logic to also deal with unrecognized long options,
rejected by md_parse_option() rather than get_opt_long_only(). Also
quote the reproduced strings, such that possible included whitespace
can be recognized.
2024-08-07 16:31:00 +02:00
Nelson Chu
643f8ace5c gas/NEWS: Moved RISC-V Zimop/Zcmop changes into 2.43 section due to backport. 2024-08-07 16:19:07 +08:00
Alan Modra
b93dcd1cdd loongarch ld testsuite xpasses
Some tests started passing with commit 3a83f0342e.  However,
supporting a changed ld output format is not so simple, and the change
to the loongarch_elf_hash_table macro needs further changes to the
rest of the code.  It is true that some uses of
loongarch_elf_hash_table do not need to check the type of the hash
table, but others like loongarch_elf_relax_section do need to check.
bfd_relax_section is called in lang_size_sections using the input bfd,
not the output bfd.  If the input bfd may be of different type to the
output, then the hash table type must be checked before accessing
elements of the hash table.  This patch corrects
loongarch_elf_relax_section.  I haven't checked all the uses of the
hash table throughout the loongarch backend.

bfd/
	* elfnn-loongarch.c (loongarch_elf_relax_section): Don't relax
	unless the hash table is loongarch_elf_link_hash_table.
	Move variable declarations.  Formatting.
ld/
	* testsuite/ld-elf/pr21884.d: Don't xfail loongarach.
	* testsuite/ld-unique/pr21529.d: Likewise.
2024-08-07 09:37:12 +09:30
GDB Administrator
c42ee4a1ca Automatic date update in version.in 2024-08-07 00:00:28 +00:00
Hannes Domani
8fdd2b2bcd Mark unavailable bytes of limited-length arrays when allocating contents
Using 'output' to print arrays larger than max-value-size, with only
repeating elements, can cause gdb to crash:
```
$ cat a.c:
char a[1000000];

int main()
{
  return a[0];
}
$ gdb -q a
(gdb) print a
$1 = {0 '\000' <repeats 65536 times>, <unavailable> <repeats 934464 times>}
(gdb) output a

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
```

Using 'print' works, because value::record_latest sets the unavailable
bytes of the value when it's added to the value history.
But 'outout' doesn't do that, so the printing tries to access more bytes
than are available.

The original problem in PR32015 was about using 'print' of a dynamic
array in a D program.
Here the crash happens because for 'print' the value was a struct with
length/ptr fields, which is converted in d-valprint.c into an array.
So value::record_latest didn't have a chance to mark the unavailable
bytes in this case.

To make sure the unavailable bytes always match the contents, this fixes
it by marking the unavailable bytes immediately after the contents are
allocated.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32015
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-06 19:36:25 +02:00
Indu Bhagat
bb07e97d25 gas: scfi: replace verbose expressions with local vars
Replace the scattered and repeated uses of verbose expressions with
variables.  E.g.,
  ginsn_get_src_reg (src1)  -> src1_reg
  ginsn_get_src_type (src1) -> src1_type
etc.

This hopefully makes the logic bit more maintainable.  While at it,
include minor adjustments to make few checks in gen_scfi_ops () more
precise:
  - When getting imm value from src operand, ensure the src type is
    GINSN_SRC_IMM,
  - When getting reg from src operand, ensure the src type is checked
    too (GINSN_SRC_REG or GINSN_SRC_INDIRECT as appropriate).

On the other hand, the changes in verify_heuristic_traceable_reg_fp ()
and verify_heuristic_traceable_stack_manipulation () are purely
mechanical.

gas/
        * scfi.c (verify_heuristic_traceable_reg_fp): Add new local
	vars and reuse them.
        (verify_heuristic_traceable_stack_manipulation): Likewise.
        (gen_scfi_ops): Likewise.  Additionally, make some conditionals
	more precise.
2024-08-06 09:46:06 -07:00
Hau Hsu
87e720ad35 RISC-V: map zext.h to pack/packw if Zbkb is enabled
The `zext.h` is zero-extend halfword instruction that belongs to Zbb.
Currently `zext.h` falls back to 2 shifts if Zbb is not enabled.  However, the
encoding and operation is a special case of `pack/packw rd, rs1, rs2`, which
belongs to Zbkb.  The instructions pack the low halves of rs1 and rs2 into rd.
When rs2 is zero (x0), they behave like zero-extend instruction, and the
encoding are exactly the same as zext.h.

Thus we can map `zext.h` to `pack` or `packw` (rv64) if Zbkb is enabled,
instead of 2 shifts. This reduces one instruction.

This patch does this by making `zext.h` also available for Zbkb.

opcodes/
	* riscv-opc.c (riscv_opcodes): Update `zext.h` entries to use
	`ZBB_OR_ZBKB` instruction class.

gas/
	* testsuite/gas/riscv/zext-to-pack.s: Add test for mapping zext to
	pack/packw encoding.
	* testsuite/gas/riscv/zext-to-pack-encoding.d: Likewise.
	* testsuite/gas/riscv/zext-to-packw-encoding.d: Likewise.
2024-08-06 16:07:27 +08:00
Mary Bennett
2f1739a348 RISC-V: Add support for XCvBitmanip extension in CV32E40P
Spec: https://docs.openhwgroup.org/projects/cv32e40p-user-manual/en/latest/instruction_set_extensions.html

Contributors:
  Mary Bennett <mary.bennett682@gmail.com>
  Nandni Jamnadas <nandni.jamnadas@embecosm.com>
  Pietra Ferreira <pietra.ferreira@embecosm.com>
  Charlie Keaney
  Jessica Mills
  Craig Blackmore <craig.blackmore@embecosm.com>
  Simon Cook <simon.cook@embecosm.com>
  Jeremy Bennett <jeremy.bennett@embecosm.com>
  Helene Chelin <helene.chelin@embecosm.com>

bfd/ChangeLog:
	* elfxx-riscv.c (riscv_multi_subset_supports): Add `xcvbitmanip`
	instruction class.
	(riscv_multi_subset_supports_ext): Likewise.

gas/ChangeLog:
	* config/tc-riscv.c (validate_riscv_insn): Add custom operands `Xc6` and `Xc7`.
	(riscv_ip): Likewise.
	* doc/c-riscv.texi: Note XCVbitmanip as an additional ISA extension
	for CORE-V.
	* testsuite/gas/riscv/march-help.l: Add xcvbitmanip.
	* testsuite/gas/riscv/x-cv-bitmanip-fail.d: New Test.
	* testsuite/gas/riscv/x-cv-bitmanip-fail.l: New Test.
	* testsuite/gas/riscv/x-cv-bitmanip-fail.s: New Test.
	* testsuite/gas/riscv/x-cv-bitmanip.d: New Test.
	* testsuite/gas/riscv/x-cv-bitmanip.s: New Test.

include/opcode/ChangeLog:
	* riscv-opc.h: Add corresponding MATCH and MASK macros for
	XCVbitmanip.
	* riscv.h: Add corresponding EXTRACT and ENCODE macros for
	XCVbitmanip.
	(enum riscv_insn_class): Add the XCVbitmanip instruction class.

opcodes/ChangeLog:
	* riscv-dis.c (print_insn_args): Add custom operands `Xc6` and `Xc7`.
	* riscv-opc.c: Add XCvBitmanip instructions.
2024-08-06 13:57:33 +08:00
Xiao Zeng
8a3ffa7194 RISC-V: Add support for Zcmop extension
This implements the Zcmop (Compressed Zimop) extension, as of version 1.0.

View detailed information in:
<https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc>

The Zcmop extension requires the Zca extension.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Handle Zcmop.
	(riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

	* NEWS: Updated.
	* testsuite/gas/riscv/march-help.l: Ditto.
	* testsuite/gas/riscv/zcmop.d: New test.
	* testsuite/gas/riscv/zcmop.s: New test.

include/ChangeLog:

	* opcode/riscv-opc.h (DECLARE_INSN): New declarations for Zcmop.
	(MATCH_C_MOP_1, MATCH_C_MOP_3, MATCH_C_MOP_5, MATCH_C_MOP_7,
	MATCH_C_MOP_9, MATCH_C_MOP_11, MATCH_C_MOP_13, MATCH_C_MOP_15): Define.
	(MASK_C_MOP_1, MASK_C_MOP_3, MASK_C_MOP_5, MASK_C_MOP_7,
	MASK_C_MOP_9, MASK_C_MOP_11, MASK_C_MOP_13, MASK_C_MOP_15): Ditto.
	* opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZCMOP.

opcodes/ChangeLog:

	* riscv-opc.c: Add Zcmop instructions.
2024-08-06 13:36:21 +08:00
Xiao Zeng
3ba06284d2 RISC-V: Add support for Zimop extension
This implements the Zimop (May-Be-Operations) extension, as of version 1.0.

View detailed information in:
<https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc>

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Handle Zimop
	(riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

	* NEWS: Updated.
	* testsuite/gas/riscv/march-help.l: Ditto.
	* testsuite/gas/riscv/zimop.d: New test.
	* testsuite/gas/riscv/zimop.s: New test.

include/ChangeLog:

	* opcode/riscv-opc.h (DECLARE_INSN): New declarations for Zimop.
	(MATCH_MOP_R_0, MATCH_MOP_R_1, MATCH_MOP_R_2, MATCH_MOP_R_3,
	MATCH_MOP_R_4, MATCH_MOP_R_5, MATCH_MOP_R_6, MATCH_MOP_R_7,
	MATCH_MOP_R_8, MATCH_MOP_R_9, MATCH_MOP_R_10, MATCH_MOP_R_11,
	MATCH_MOP_R_12, MATCH_MOP_R_13, MATCH_MOP_R_14, MATCH_MOP_R_15,
	MATCH_MOP_R_16, MATCH_MOP_R_17, MATCH_MOP_R_18, MATCH_MOP_R_19,
	MATCH_MOP_R_20, MATCH_MOP_R_21, MATCH_MOP_R_22, MATCH_MOP_R_23,
	MATCH_MOP_R_24, MATCH_MOP_R_25, MATCH_MOP_R_26, MATCH_MOP_R_27,
	MATCH_MOP_R_28, MATCH_MOP_R_29, MATCH_MOP_R_30, MATCH_MOP_R_31,
	MATCH_MOP_RR_0, MATCH_MOP_RR_1, MATCH_MOP_RR_2, MATCH_MOP_RR_3,
	MATCH_MOP_RR_4, MATCH_MOP_RR_5, MATCH_MOP_RR_6, MATCH_MOP_RR_7): Define.
	(MASK_MOP_R_0, MASK_MOP_R_1, MASK_MOP_R_2, MASK_MOP_R_3, MASK_MOP_R_4,
	MASK_MOP_R_5, MASK_MOP_R_6, MASK_MOP_R_7, MASK_MOP_R_8, MASK_MOP_R_9,
	MASK_MOP_R_10, MASK_MOP_R_11, MASK_MOP_R_12, MASK_MOP_R_13,
	MASK_MOP_R_14, MASK_MOP_R_15, MASK_MOP_R_16, MASK_MOP_R_17,
	MASK_MOP_R_18, MASK_MOP_R_19, MASK_MOP_R_20, MASK_MOP_R_21,
	MASK_MOP_R_22, MASK_MOP_R_23, MASK_MOP_R_24, MASK_MOP_R_25,
	MASK_MOP_R_26, MASK_MOP_R_27, MASK_MOP_R_28, MASK_MOP_R_29,
	MASK_MOP_R_30, MASK_MOP_R_31, MASK_MOP_RR_0, MASK_MOP_RR_1,
	MASK_MOP_RR_2, MASK_MOP_RR_3, MASK_MOP_RR_4, MASK_MOP_RR_5,
	MASK_MOP_RR_6, MASK_MOP_RR_7): Ditto.
	* opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZIMOP.

opcodes/ChangeLog:

	* riscv-opc.c: Add Zimop instructions.
2024-08-06 13:10:31 +08:00
GDB Administrator
60d4fed4e3 Automatic date update in version.in 2024-08-06 00:00:29 +00:00
Simon Marchi
61fd04f37c gdb: rename gdbarch.c to gdbarch-gen.c
For clarity and symmetry with `gdbarch-gen.h`.  I wouldn't mind
if all generated files had the `-gen` suffix.

Change-Id: Icb70194fb0e3e2fa9d1c6f0d9331be09b805b428
Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-08-05 10:41:45 -04:00
Jan Beulich
b43f37b77f gas: maintain line numbers correctly after #APP / #NO_APP
Maintaining line numbers correctly both inside the region and past it
requires special care. The SB produced there is somewhat different from
that produced for e.g. macro expansions, and hence also needs treating
differently: In particular we aren't doing anything resembling macro
expansion here.

The new testcase may be a little misplaced in macros/, but that's where
all the other #APP / #NO_APP ones are.
2024-08-05 16:29:54 +02:00
Jan Beulich
526363dbe4 gas: generalize / tighten #APP / #NO_APP recognition
For one '#' may not be in line_comment_chars[] in the first place. Look
for just it when it is (these "directives" are akin to C preprocessor
directives after all), but accept any other line comment character
otherwise (in read.c further requiring a match on the counterpart
"directive").

Then, when in the middle of a file, the constructs should be all on
their own on a line.  There needs to be a newline ahead of them and
after them.

Finally '\n' may not be the only end-of-line character. Accept any (but
not end-of-statement ones) in read.c, while making sure in input-file.c
there is one in the first place - merely any kind of whitespace isn't
good enough.
2024-08-05 16:29:28 +02:00
Jan Beulich
1068b74548 gas: recognize #APP at start-of-physical-line only
It's not valid to recognize it after mere line separators (often
semicolon) or after labels, let alone after tc_unrecognized_line()
perhaps having parsed off parts of a line. It shouldn't even be
preceded by whitespace, aiui.

However, keep ignoring line comments as before, for backwards
compatibility.
2024-08-05 16:28:43 +02:00