Commit Graph

2795 Commits

Author SHA1 Message Date
Tsukasa OI
41d6ac5da6 RISC-V: Cache management instructions
This commit adds 'Zicbom' / 'Zicboz' instructions.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Add handling for
	new instruction classes.

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_CBO_CLEAN, MASK_CBO_CLEAN,
	MATCH_CBO_FLUSH, MASK_CBO_FLUSH, MATCH_CBO_INVAL,
	MASK_CBO_INVAL, MATCH_CBO_ZERO, MASK_CBO_ZERO): New macros.
	* opcode/riscv.h (enum riscv_insn_class): Add new instruction
	classes INSN_CLASS_ZICBOM and INSN_CLASS_ZICBOZ.

opcodes/ChangeLog:

	* riscv-opc.c (riscv_opcodes): Add cache-block management
	instructions.
2022-03-18 15:32:22 +08:00
Tsukasa OI
3b374308d3 RISC-V: Prefetch hint instructions and operand set
This commit adds 'Zicbop' hint instructions.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Add handling for
	new instruction class.

gas/ChangeLog:

	* config/tc-riscv.c (riscv_ip): Add handling for new operand
	type 'f' (32-byte aligned pseudo S-type immediate for prefetch
	hints).
	(validate_riscv_insn): Likewise.

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_PREFETCH_I, MASK_PREFETCH_I,
	MATCH_PREFETCH_R, MASK_PREFETCH_R, MATCH_PREFETCH_W,
	MASK_PREFETCH_W): New macros.
	* opcode/riscv.h (enum riscv_insn_class): Add new instruction
	class INSN_CLASS_ZICBOP.

opcodes/ChangeLog:

	* riscv-dis.c (print_insn_args): Add handling for new operand
	type.
	* riscv-opc.c (riscv_opcodes): Add prefetch hint instructions.
2022-03-18 15:32:16 +08:00
Simon Marchi
0c857ef4df binutils/readelf: handle AMDGPU relocation types
Make readelf recognize AMDGPU relocation types, as documented here:

  https://llvm.org/docs/AMDGPUUsage.html#amdgpu-relocation-records

The user-visible change looks like:

    -000000000004  000400000001 unrecognized: 1       0000000000000000 SCRATCH_RSRC_DWORD0
    -00000000000c  000500000001 unrecognized: 1       0000000000000000 SCRATCH_RSRC_DWORD1
    -000000000014  000600000007 unrecognized: 7       0000000000000000 global_var0
    -00000000001c  000700000008 unrecognized: 8       0000000000000000 global_var1
    -000000000024  000800000009 unrecognized: 9       0000000000000000 global_var2
    -00000000002c  00090000000a unrecognized: a       0000000000000000 global_var3
    -000000000034  000a0000000b unrecognized: b       0000000000000000 global_var4
    +000000000004  000400000001 R_AMDGPU_ABS32_LO 0000000000000000 SCRATCH_RSRC_DWORD0
    +00000000000c  000500000001 R_AMDGPU_ABS32_LO 0000000000000000 SCRATCH_RSRC_DWORD1
    +000000000014  000600000007 R_AMDGPU_GOTPCREL 0000000000000000 global_var0
    +00000000001c  000700000008 R_AMDGPU_GOTPCREL 0000000000000000 global_var1
    +000000000024  000800000009 R_AMDGPU_GOTPCREL 0000000000000000 global_var2
    +00000000002c  00090000000a R_AMDGPU_REL32_LO 0000000000000000 global_var3
    +000000000034  000a0000000b R_AMDGPU_REL32_HI 0000000000000000 global_var4

binutils/ChangeLog:

	* readelf.c (dump_relocations): Handle EM_AMDGPU.

include/ChangeLog:

	* elf/amdgpu.h: Add relocation values.

Change-Id: I2ed4589f4cd37ea11ad2e0cb38d4b682271e1334
2022-03-16 09:01:54 -04:00
Simon Marchi
28cdbb183b binutils/readelf: handle NT_AMDGPU_METADATA note name
Handle the NT_AMDGPU_METADATA note, which is described here:

  https://llvm.org/docs/AMDGPUUsage.html#code-object-v3-note-records

As of this patch, just print out the name, not the contents, which is in
the msgpack format.

binutils/ChangeLog:

	* readelf.c (get_amdgpu_elf_note_type): New.
	(process_note): Handle "AMDGPU" notes.

include/ChangeLog:

	* elf/amdgcn.h (NT_AMDGPU_METADATA): New.

Change-Id: Id2dba2e2aeaa55ef7464fb35aee9c7d5f96ddb23
2022-03-16 09:01:26 -04:00
Simon Marchi
c077c5802c binutils/readelf: decode AMDGPU-specific e_flags
Decode and print the AMDGPU-specific fields of e_flags, as documented
here:

  https://llvm.org/docs/AMDGPUUsage.html#header

That is:

 - The specific GPU model
 - Whether the xnack and sramecc features are enabled

The result looks like:

-  Flags:                             0x52f
+  Flags:                             0x52f, gfx906, xnack any, sramecc any

The flags for the "HSA" OS ABI are properly versioned and documented on
that page.  But the NONE, PAL and MESA3D OS ABIs are not well documented
nor versioned.  Taking a peek at the LLVM source code, we see that they
encode their flags the same way as HSA v3.  For example, for PAL:

  c8b614cd74/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp (L601)

So for those other OS ABIs, we read them the same as HSA v3.

binutils/ChangeLog:

	* readelf.c: Include elf/amdgcn.h.
	(decode_AMDGPU_machine_flags): New.
	(get_machine_flags): Handle flags for EM_AMDGPU machine type.

include/ChangeLog:

	* elf/amdgcn.h: Add EF_AMDGPU_MACH_AMDGCN_* and
	EF_AMDGPU_FEATURE_* defines.

Change-Id: Ib5b94df7cae0719a22cf4e4fd0629330e9485c12
2022-03-16 09:01:15 -04:00
Simon Marchi
37870be874 binutils/readelf: handle AMDGPU OS ABIs
When the machine is EM_AMDGPU, handle the various OS ABIs described
here:

  https://llvm.org/docs/AMDGPUUsage.html#header

For a binary with the HSA OS ABI, the change looks like:

-  OS/ABI:                            <unknown: 40>
+  OS/ABI:                            AMD HSA

binutils/ChangeLog:

	* readelf.c (get_osabi_name): Handle EM_AMDGPU OS ABIs.

include/ChangeLog:

	* elf/common.h (ELFOSABI_AMDGPU_PAL, ELFOSABI_AMDGPU_MESA3D):
	New.

Change-Id: I383590c390f7dc2fe0f902f50038735626d71863
2022-03-16 09:01:04 -04:00
Simon Marchi
978602e83f bfd: add AMDGCN architecture
Add support for the AMDGCN architecture to BFD.

This is the bare minimum to get

  $ ./configure --target=amdgcn-hsa-amdhsa --disable-gas
  $ make all-binutils

working later in this series.

The specific AMDGCN models added here are a bit arbitrary, based on
what we intend to initially support in GDB.  This list will need to be
updated in the future anyway.  The complete up-to-date list of existing
AMDGPU models can be found here:

  https://llvm.org/docs/AMDGPUUsage.html#processors

The ELF format for this architecture is documented here:

  https://llvm.org/docs/AMDGPUUsage.html#elf-code-object

The flags for the "HSA" OS ABI are properly versioned and documented on
that page.  But the NONE, PAL and MESA3D OS ABIs are not well documented
nor versioned.  Taking a peek at the LLVM source code, we see that they
encode their flags the same way as HSA v3.  For example, for PAL:

  c8b614cd74/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp (L601)

So at least, we know that all AMDGPU objects (of which AMDGCN objects
are a subset of) at the time of writing encode the specific GPU model in
the EF_AMDGPU_MACH field of e_flags.

bfd/ChangeLog:

	* Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES):
	Add cpu-amdgcn.c.
	(BFD64_BACKENDS): Add elf64-amdgcn.lo.
	(BFD64_BACKENDS_CFILES): Add elf64-amdgcn.c.
	* Makefile.in: Re-generate.
	* cpu-amdgcn.c: New.
	* elf64-amdgcn.c: New.
	* archures.c (bfd_architecture): Add bfd_arch_amdgcn and related
	mach defines.
	(bfd_amdgcn_arch): New.
	(bfd_archures_list): Add bfd_amdgcn_arch.
	* bfd-in2.h: Re-generate.
	* config.bfd: Handle amdgcn* target.
	* configure.ac: Handle amdgcn_elf64_le_vec.
	* configure: Re-generate.
	* elf-bfd.h (elf_target_id): Add AMDGCN_ELF_DATA.
	* targets.c (amdgcn_elf64_le_vec): New.
	(_bfd_target_vector): Add amdgcn_elf64_le_vec.

include/ChangeLog:

	* elf/amdgpu.h: New.
	* elf/common.h (ELFOSABI_AMDGPU_HSA): Add.

Change-Id: I969f7b14960797e88891c308749a6e341eece5b2
2022-03-16 09:00:27 -04:00
Alan Modra
dc3ff92676 Delete PowerPC macro insn support
Let's hope this stays dead, but it's here as a patch separate from
those that removed use of powerpc_macros just in case it needs to be
resurrected.

include/
	* opcode/ppc.h (struct powerpc_macro): Delete declaration.
	(powerpc_macros, powerpc_num_macros): Likewise..
opcodes/
	* ppc-opc.c (powerpc_macros, powerpc_num_macros): Delete.
gas/
	* config/tc-ppc.c (ppc_macro): Delete function.
	(ppc_macro_hash): Delete.
	(ppc_setup_opcodes, md_assemble): Delete macro support.
2022-03-16 10:08:46 +10:30
Alan Modra
42952a9605 PowerPC64 extended instructions in powerpc_macros
The extended instructions implemented in powerpc_macros aren't used by
the disassembler.  That means instructions like "sldi r3,r3,2" appear
in disassembly as "rldicr r3,r3,2,61", which is annoying since many
other extended instructions are shown.

Note that some of the instructions moved out of the macro table to the
opcode table won't appear in disassembly, because they are aliases
rather than a subset of the underlying raw instruction.  If enabled,
rotrdi, extrdi, extldi, clrlsldi, and insrdi would replace all
occurrences of rotldi, rldicl, rldicr, rldic and rldimi.  (Or many
occurrences in the case of clrlsldi if n <= b was added to the extract
functions.)

The patch also fixes a small bug in opcode sanity checking.

include/
	* opcode/ppc.h (PPC_OPSHIFT_SH6): Define.
opcodes/
	* ppc-opc.c (insert_erdn, extract_erdn, insert_eldn, extract_eldn),
	(insert_crdn, extract_crdn, insert_rrdn, extract_rrdn),
	(insert_sldn, extract_sldn, insert_srdn, extract_srdn),
	(insert_erdb, extract_erdb, insert_csldn, extract_csldb),
	(insert_irdb, extract_irdn): New functions.
	(ELDn, ERDn, ERDn, RRDn, SRDn, ERDb, CSLDn, CSLDb, IRDn, IRDb):
	Define and add associated powerpc_operands entries.
	(powerpc_opcodes): Add "rotrdi", "srdi", "extrdi", "clrrdi",
	"sldi", "extldi", "clrlsldi", "insrdi" and corresponding record
	(ie. dot suffix) forms.
	(powerpc_macros): Delete same from here.
gas/
	* config/tc-ppc.c (insn_validate): Don't modify value passed
	to operand->insert for PPC_OPERAND_PLUS1 when calculating mask.
	Handle PPC_OPSHIFT_SH6.
	* testsuite/gas/ppc/prefix-reloc.d: Update.
	* testsuite/gas/ppc/simpshft.d: Update.
ld/
	* testsuite/ld-powerpc/elfv2so.d: Update.
	* testsuite/ld-powerpc/notoc.d: Update.
	* testsuite/ld-powerpc/notoc3.d: Update.
	* testsuite/ld-powerpc/tlsdesc2.d: Update.
	* testsuite/ld-powerpc/tlsget.d: Update.
	* testsuite/ld-powerpc/tlsget2.d: Update.
	* testsuite/ld-powerpc/tlsopt5.d: Update.
	* testsuite/ld-powerpc/tlsopt6.d: Update.
2022-03-16 09:59:07 +10:30
Vladimir Mezentsev
bb368aad29 gprofng: a new GNU profiler
top-level
	* Makefile.def: Add gprofng module.
	* configure.ac: Add --enable-gprofng option.
	* src-release.sh: Add gprofng.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* gprofng: New directory.

binutils
	* MAINTAINERS: Add gprofng maintainer.
	* README-how-to-make-a-release: Add gprofng.

include.
	* collectorAPI.h: New file.
	* libcollector.h: New file.
	* libfcollector.h: New file.
2022-03-11 08:58:31 +00:00
Nelson Chu
9cbed90ee6 RISC-V: Updated CSRs to privileged spec v1.12 and debug spec v1.0.
* Removed N extension CSRs,
ustatus, uie, utvec, uscratch, uepc, ucause, utval and uip.

* Removed two supervisor CSRs,
sedeleg and sideleg.

* Changed debug CSR address of scontext from 0x7aa to 0x5a8.  We cannot support
different versions of debug specs for now, so only supporting the latest one is
the only way to move forward.

* Added debug CSRs,
mscontext (0x7aa), mcontrol6 (0x7a1, tdata1) and tmexttrigger ((0x7a1, tdata1).

* Regarded hcontext as a debug CSR.

include/
	* opcode/riscv-opc.h: Updated CSRs to privileged spec v1.12 and
	debug spec v1.0.
gas/
	* testsuite/gas/riscv/csr.s: Updated CSRs to privileged spec v1.12
	and debug spec v1.0.
	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p10.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p11.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p12.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p12.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
2022-02-23 14:54:34 +08:00
Tsukasa OI
f4ce10b14f RISC-V: Add Privileged Architecture 1.12 CSRs
This commit adds,

* Most of CSRs as listed in the Privileged Architecture,
version 1.12 (except scontext and mscontext).

* Testcases for most CSRs added on the Privileged
Architecture, version 1.12 (except moved "scontext" and
new "mscontext").

include/ChangeLog:

	* opcode/riscv-opc.h (CSR_SENVCFG, CSR_MCONFIGPTR, CSR_MENVCFG,
	CSR_MSTATUSH, CSR_MENVCFGH, CSR_MTINST, CSR_MTVAL2, CSR_MSECCFG,
	CSR_MSECCFGH, CSR_PMPCFG4, CSR_PMPCFG5, CSR_PMPCFG6,
	CSR_PMPCFG7, CSR_PMPCFG8, CSR_PMPCFG9, CSR_PMPCFG10,
	CSR_PMPCFG11, CSR_PMPCFG12, CSR_PMPCFG13, CSR_PMPCFG14,
	CSR_PMPCFG15, CSR_PMPADDR16, CSR_PMPADDR17, CSR_PMPADDR18,
	CSR_PMPADDR19, CSR_PMPADDR20, CSR_PMPADDR21, CSR_PMPADDR22,
	CSR_PMPADDR23, CSR_PMPADDR24, CSR_PMPADDR25, CSR_PMPADDR26,
	CSR_PMPADDR27, CSR_PMPADDR28, CSR_PMPADDR29, CSR_PMPADDR30,
	CSR_PMPADDR31, CSR_PMPADDR32, CSR_PMPADDR33, CSR_PMPADDR34,
	CSR_PMPADDR35, CSR_PMPADDR36, CSR_PMPADDR37, CSR_PMPADDR38,
	CSR_PMPADDR39, CSR_PMPADDR40, CSR_PMPADDR41, CSR_PMPADDR42,
	CSR_PMPADDR43, CSR_PMPADDR44, CSR_PMPADDR45, CSR_PMPADDR46,
	CSR_PMPADDR47, CSR_PMPADDR48, CSR_PMPADDR49, CSR_PMPADDR50,
	CSR_PMPADDR51, CSR_PMPADDR52, CSR_PMPADDR53, CSR_PMPADDR54,
	CSR_PMPADDR55, CSR_PMPADDR56, CSR_PMPADDR57, CSR_PMPADDR58,
	CSR_PMPADDR59, CSR_PMPADDR60, CSR_PMPADDR61, CSR_PMPADDR62,
	CSR_PMPADDR63): New CSR macros.

gas/ChangeLog:

	* testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.
	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
	* testsuite/gas/riscv/csr.s: Add new CSRs.
	* testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p10.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p11.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p12.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p12.l: Likewise.
2022-02-23 14:45:44 +08:00
Alan Modra
ccbaaa3617 PR28882, build failure with gcc-4.2 due to use of 0b literals
PR 28882
	* elf/loongarch.h: Replace binary literals with hex.
2022-02-13 14:00:56 +10:30
Bhuvanendra Kumar N
e951225303 gdb/fortran: support ptype and print commands for namelist variables
Gfortran supports namelists (a Fortran feature); it emits
DW_TAG_namelist and DW_TAG_namelist_item dies. But gdb does not
process these dies and does not support 'print' or 'ptype' commands on
namelist variables.

An attempt to print namelist variables results in gdb bailing out with
the error message as shown below.

  (gdb) print nml
  No symbol "nml" in current context.

This commit is to make the print and ptype commands work for namelist
variables and its items. Sample output of these commands is shared
below, with fixed gdb.

  (gdb) ptype nml
  type = Type nml
      integer(kind=4) :: a
      integer(kind=4) :: b
  End Type nml
  (gdb) print nml
  $1 = ( a = 10, b = 20 )
2022-02-11 15:26:25 +00:00
Cary Coutant
dfbcbf85ea Rename EM_56800V4 to EM_56800EF.
include/elf:
	* common.h: Rename EM_56800V4 to EM_56800EF.
2022-02-03 14:50:24 -08:00
Cary Coutant
9d5d41c405 Add new e_machine values.
include/elf:
	* common.h: Add EM_U16_U8CORE, EM_TACHYUM, EM_56800V4.
2022-02-03 08:35:58 -08:00
Klaus Ziegler
b6437be687 Fix a probem building the binutils on SPARC/amd64
PR 28816
	* elf/common.h (AT_SUN_HWCAP): Make definition conditional.
2022-01-25 17:33:03 +00:00
Nick Clifton
a74e1cb344 Add markers for 2.38 branch 2022-01-22 12:08:55 +00:00
Alan Modra
ff66e8c5be PR28751 mbind2a / mbind2b regressions on powerpc*-linux
include/
	* bfdlink.h (struct bfd_link_info): Add commonpagesize_is_set.
ld/
	PR 28751
	* emultempl/elf.em (handle_option): Set commonpagesize_is_set.
	* ldelf.c (ldelf_after_parse): Don't error when only one of
	-z max-page-size or -z common-page-size is given, correct the
	other value to make it sane.
	* testsuite/ld-elf/elf.exp (mbind2a, mbind2b): Do not pass
	-z max-page-size.
2022-01-14 22:02:23 +10:30
Nick Clifton
ce2d3708bc Synchronize binutils libiberty sources with gcc version.
+2021-12-30  Lancelot SIX  <lsix@lancelotsix.com>
+
+	* cp-demangle.c (d_clone_suffix): Support digits in clone tag
+	names.
+	* testsuite/demangle-expected: Check demangling of clone symbols
+	with digits in name.
+
+2021-12-16  H.J. Lu  <hjl.tools@gmail.com>
+
+	Revert:
+	2021-12-16  H.J. Lu  <hjl.tools@gmail.com>
+
+	* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
+	(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
+	(configure_deps): Depend on ../config/gcc-plugin.m4.
+	* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
+	RANLIB_PLUGIN_OPTION.
+	* aclocal.m4: Regenerated.
+	* configure: Likewise.
+
+2021-12-15  H.J. Lu  <hjl.tools@gmail.com>
+
+	* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
+	(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
+	(configure_deps): Depend on ../config/gcc-plugin.m4.
+	* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
+	RANLIB_PLUGIN_OPTION.
+	* aclocal.m4: Regenerated.
+	* configure: Likewise.
+
+2021-11-29  Eric Gallager  <egallager@gcc.gnu.org>
+
+	PR other/103021
+	* Makefile.in: Use ETAGS variable in TAGS target.
+	* configure: Regenerate.
+	* configure.ac: Allow ETAGS variable to be overridden.
+
+2021-11-29  Andrew Pinski  <apinski@marvell.com>
+
+	* make-temp-file.c (try_dir): Check to see if the dir
+	is actually a directory.
+
+2021-10-22  Eric Gallager  <egallager@gcc.gnu.org>
+
+	PR other/102663
+	* Makefile.in: Allow dvi-formatted documentation
+	to be installed.
+
+2021-10-17  Lu?s Ferreira  <contact@lsferreira.net>
+
+	PR d/102618
+	* d-demangle.c (dlang_parse_qualified): Handle anonymous
+	symbols correctly.
+	* testsuite/d-demangle-expected: New tests to cover anonymous
+	symbols.
+
+2021-10-14  Lu?s Ferreira  <contact@lsferreira.net>
+
+	* testsuite/d-demangle-expected: Add test case for function literals.
+
+2021-10-14  Lu?s Ferreira  <contact@lsferreira.net>
+
+	* testsuite/d-demangle-expected: Add test cases for simple special
+	mangles.
+
+2021-10-12  Lu?s Ferreira  <contact@lsferreira.net>
+
+	* d-demangle.c (dlang_parse_qualified): Remove redudant parenthesis
+	around lhs and rhs of assignments.
+
+2021-10-01  Lu?s Ferreira  <contact@lsferreira.net>
+
+	* testsuite/d-demangle-expected: Add missing format for new test
+
+2021-09-23  Lu?s Ferreira  <contact@lsferreira.net>
+
+	* d-demangle.c (dlang_Type): Validate MANGLED is nonnull.
+	* testsuite/d-demangle-expected: New test.
+
+2021-09-23  Lu?s Ferreira  <contact@lsferreira.net>
+
+	* d-demangle.c (dlang_symbol_backref): Ensure strlen of
+	string is less than length computed by dlang_number.
+
+2021-09-01  Iain Sandoe  <iain@sandoe.co.uk>

 	* configure: Regenerate.
+	* configure.ac: Do not search for sbrk on Darwin.
+	* xmalloc.c: Do not declare sbrk unless it has been found
+	by configure.
+
+2021-08-29  Iain Buclaw  <ibuclaw@gdcproject.org>
+
+	* d-demangle.c (dlang_identifier): Skip over fake parent manglings.
+	* testsuite/d-demangle-expected: Add tests.
+
+2021-08-29  Iain Buclaw  <ibuclaw@gdcproject.org>
+
+	* d-demangle.c (dlang_parse_arrayliteral): Add 'info' parameter.
+	(dlang_parse_assocarray): Likewise.
+	(dlang_parse_structlit): Likewise.
+	(dlang_value): Likewise.  Handle function literal symbols.
+	(dlang_template_args): Pass 'info' to dlang_value.
+	* testsuite/d-demangle-expected: Add new test.
+
+2021-08-29  Iain Buclaw  <ibuclaw@gdcproject.org>
+
+	* d-demangle.c (dlang_attributes): Handle typeof(*null).
+	(dlang_type): Likewise.  Demangle 'n' as typeof(null).
+	* testsuite/d-demangle-expected: Update tests.
+
+2021-08-23  Iain Sandoe  <iain@sandoe.co.uk>
+
+	* simple-object-mach-o.c (simple_object_mach_o_write_segment):
+	Cast the first argument to set_32 as needed.

-2021-07-03  Nick Clifton  <nickc@redhat.com>
+2021-08-18  Iain Sandoe  <iain@sandoe.co.uk>

+	* simple-object-mach-o.c (simple_object_mach_o_write_segment):
+	Arrange to swap the LTO index tables where needed.
 # Please enter the commit message for your changes. Lines starting
2022-01-13 12:25:34 +00:00
H.J. Lu
6a91be8666 ld: Initial DT_RELR support
Add a -z pack-relative-relocs option to enable DT_RELR and create a
relr.dyn section for DT_RELR.  DT_RELR is implemented with the linker
relaxation infrastructure, but it doesn't require the --relax option
enabled.  -z pack-relative-relocs implies -z combreloc.  -z nocombreloc
implies -z nopack-relative-relocs.

-z pack-relative-relocs is chosen over the similar option in lld,
--pack-dyn-relocs=relr, to implement a glibc binary lockout mechanism
with a special glibc version symbol, to avoid random crashes of DT_RELR
binaries with the existing glibc binaries.

bfd/

	* elf-bfd.h (elf_link_hash_table): Add srelrdyn.
	* elflink.c (_bfd_elf_link_create_dynamic_sections): Create a
	.relr.dyn section for DT_RELR.

include/

	* bfdlink.h (bfd_link_info): Add enable_dt_relr.

ld/

	* News: Mention -z pack-relative-relocs and
	-z nopack-relative-relocs.
	* ld.texi: Document -z pack-relative-relocs and
	-z nopack-relative-relocs.
	* ldelf.c (ldelf_after_parse): Disable DT_RELR if not building
	PIE nor shared library.  Add 3 spare dynamic tags for DT_RELR,
	DT_RELRSZ and DT_RELRENT.
	* ldlang.c (lang_relax_sections): Also enable relaxation if
	DT_RELR is enabled.
	* emulparams/elf32_x86_64.sh: Source dt-relr.sh.
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/dt-relr.sh: New file.
	* scripttempl/elf.sc: Support .relr.dyn.
2022-01-12 06:04:29 -08:00
Clément Chigot
add588a8ef gas: add visibility support for XCOFF
XCOFF assembly defines the visibility using an additional argument
on several pseudo-ops: .globl, .weak, .extern and .comm.
This implies that .globl and .weak syntax is different than the
usual GNU syntax. But we want to provide compatibility with AIX
assembler, especially because GCC is generating the visibility
using this XCOFF syntax.

PR 22085

bfd/ChangeLog:

        * coffcode.h (coff_write_object_contents): Change XCOFF header
        vstamp field to 2.
        * coffgen.c (coff_print_symbol): Increase the size for n_type.

gas/ChangeLog:

        * config/tc-ppc.c (ppc_xcoff_get_visibility): New function.
        (ppc_globl): New function.
        (ppc_weak): New function.
        (ppc_comm): Add visibility field support.
        (ppc_extern): Likewise.
        * testsuite/gas/all/cofftag.d: Adjust to new n_type size
        providing by objdump.
        * testsuite/gas/ppc/test1xcoff32.d: Likewise.
        * testsuite/gas/ppc/aix.exp: Add new tests.
        * testsuite/gas/ppc/xcoff-visibility-1-32.d: New test.
        * testsuite/gas/ppc/xcoff-visibility-1-64.d: New test.
        * testsuite/gas/ppc/xcoff-visibility-1.s: New test.

include/ChangeLog:

        * coff/internal.h (SYM_V_INTERNAL, SYM_V_HIDDEN,
        SYM_V_PROTECTED, SYM_V_EXPORTED, SYM_V_MASK): New defines.
        * coff/xcoff.h (struct xcoff_link_hash_entry): Add visibility
        field.

ld/ChangeLog:

        * testsuite/ld-pe/pr19803.d: Adjust to new n_type size
        providing by objdump.
2022-01-12 09:08:11 +01:00
H.J. Lu
74e315dbfe elf: Set p_align to the minimum page size if possible
Currently, on 32-bit and 64-bit ARM, it seems that ld generates p_align
values of 0x10000 even if no section alignment is greater than 0x1000.
The issue is more general and probably affects other targets with multiple
page sizes.

While file layout absolutely must take 64K page size into account, that
does not have to be reflected in the p_align value.  If running on a 64K
kernel, the file will be loaded at a 64K page boundary by necessity. On
a 4K kernel, 64K alignment is not needed.

The glibc loader has been fixed to honor p_align:

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

similar to kernel:

commit ce81bb256a224259ab686742a6284930cbe4f1fa
Author: Chris Kennelly <ckennelly@google.com>
Date:   Thu Oct 15 20:12:32 2020 -0700

    fs/binfmt_elf: use PT_LOAD p_align values for suitable start address

This means that on 4K kernels, we will start to do extra work for 64K
p_align, but this pointless for pretty much all binaries (whose section
alignment rarely exceeds 16).

The minimum page size is used, instead of the maximum section alignment
due to this glibc bug:

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

It has been fixed in glibc 2.35.  But linker output must work on existing
glibc binaries.

1. Set p_align to the minimum page size while laying out segments aligning
to the maximum page size or section alignment.  The run-time loader can
align segments to the minimum page size or above, depending on system page
size.
2. If -z max-page-size=NNN is used, p_align will be set to the maximum
page size or the largest section alignment.
3. If a section requires alignment higher than the minimum page size,
don't set p_align to the minimum page size.
4. If a section requires alignment higher than the maximum page size,
set p_align to the section alignment.
5. For objcopy, when the minimum page size != the maximum page size,
p_align may be set to the minimum page size while segments are aligned
to the maximum page size.  In this case, the input p_align will be
ignored and the maximum page size will be used to align the ouput
segments.
6. Update linker to disallow the common page size > the maximum page size.
7. Update linker to avoid the common page size > the maximum page size.
8. Adjust pru_irq_map-1.d to expect p_align == sh_addralign:

Section Headers:
  [Nr] Name   Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]        NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text  PROGBITS        20000000 00007c 000004 00  AX  0   0  4
...
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000074 0x00000000 0x00000000 0x00008 0x00008 RW  0x1
  LOAD           0x00007c 0x20000000 0x20000000 0x00004 0x00004 R E 0x4

vs.

Section Headers:
  [Nr] Name   Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]        NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text  PROGBITS        20000000 00007c 000004 00  AX  0   0  4
...
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000074 0x00000000 0x00000000 0x00008 0x00008 RW  0x1
  LOAD           0x00007c 0x20000000 0x20000000 0x00004 0x00004 R E 0x1

To enable this linker optimization, the backend should define ELF_P_ALIGN
to ELF_MINPAGESIZE.

bfd/

	PR ld/28689
	PR ld/28695
	* elf-bfd.h (elf_backend_data): Add p_align.
	* elf.c (assign_file_positions_for_load_sections): Set p_align
	to the default p_align value while laying out segments aligning
	to maximum page size or section alignment.
	(elf_is_p_align_valid): New function.
	(copy_elf_program_header): Call elf_is_p_align_valid to determine
	if p_align is valid.
	* elfxx-target.h (ELF_P_ALIGN): New.  Default to 0.
	(elfNN_bed): Add ELF_P_ALIGN.
	* elfxx-x86.h (ELF_P_ALIGN): New.  Set to ELF_MINPAGESIZE.

include/

	PR ld/28689
	PR ld/28695
	* bfdlink.h (bfd_link_info): Add maxpagesize_is_set.

ld/

	PR ld/28689
	PR ld/28695
	* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Set
	link_info.maxpagesize_is_set for -z max-page-size=NNN.
	* ldelf.c (ldelf_after_parse): Disallow link_info.commonpagesize
	> link_info.maxpagesize.
	* testsuite/ld-elf/elf.exp: Pass -z max-page-size=0x4000 to
	linker to build mbind2a and mbind2b.
	* testsuite/ld-elf/header.d: Add -z common-page-size=0x100.
	* testsuite/ld-elf/linux-x86.exp: Add PR ld/28689 tests.
	* testsuite/ld-elf/p_align-1.c: New file.
	* testsuite/ld-elf/page-size-1.d: New test.
	* testsuite/ld-elf/pr26936.d: Add -z common-page-size=0x1000.
	* testsuite/ld-elf/seg.d: Likewise.
	* testsuite/ld-scripts/rgn-at5.d: Likewise.
	* testsuite/ld-pru/pru_irq_map-1.d: Append 1 to name.  Adjust
	expected PT_LOAD segment alignment.
	* testsuite/ld-pru/pru_irq_map-2.d: Append 2 to name.
	* testsuite/ld-scripts/pr23571.d: Add -z max-page-size=0x1000.
2022-01-05 05:06:18 -08:00
Alan Modra
a2c5833233 Update year range in copyright notice of binutils files
The result of running etc/update-copyright.py --this-year, fixing all
the files whose mode is changed by the script, plus a build with
--enable-maintainer-mode --enable-cgen-maint=yes, then checking
out */po/*.pot which we don't update frequently.

The copy of cgen was with commit d1dd5fcc38ead reverted as that commit
breaks building of bfp opcodes files.
2022-01-02 12:04:28 +10:30
Joel Brobecker
4a94e36819 Automatic Copyright Year update after running gdb/copyright.py
This commit brings all the changes made by running gdb/copyright.py
as per GDB's Start of New Year Procedure.

For the avoidance of doubt, all changes in this commits were
performed by the script.
2022-01-01 19:13:23 +04:00
Vineet Gupta
a63375ac33 RISC-V: Hypervisor ext: support Privileged Spec 1.12
This is the Hypervisor Extension 1.0

 - Hypervisor Memory-Management Instructions
   HFENCE.VVMA, HFENCE.GVMA,

 - Hypervisor Virtual Machine Load and Store Instructions
   HLV.B, HLV.BU,          HSV.B,
   HLV.H, HLV.HU, HLVX.HU, HSB.H,
   HLV.W, HLV.WU, HLVX.WU, HSV.W,
   HLV.D,                  HSV.D

 - Hypervisor CSRs (some new, some address changed)
   hstatus, hedeleg, hideleg, hie, hcounteren, hgeie, htval, hip, hvip,
   htinst, hgeip, henvcfg, henvcfgh, hgatp, hcontext, htimedelta, htimedeltah,
   vsstatus, vsie, vstvec, vsscratch, vsepc, vscause, vstval, vsip, vsatp,

Note that following were added already as part of svinval extension
support:
   HINVAL.GVMA, HINVAL.VVMA

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Reviewed-by: Nelson Chu <nelson.chu@sifive.com>

bfd/
	* cpu-riscv.c (riscv_priv_specs): Added entry for 1.12.
	* cpu-riscv.h (enum riscv_spec_class): Added PRIV_SPEC_CLASS_1P12.
gas/
	* config/tc-riscv.c (abort_version): Updated comment.
	(validate_riscv_insn): Annotate switch-break.
	* testsuite/gas/riscv/h-ext-32.d: New testcase for hypervisor.
	* testsuite/gas/riscv/h-ext-32.s: Likewise.
	* testsuite/gas/riscv/h-ext-64.d: Likewise.
	* testsuite/gas/riscv/h-ext-64.s: Likewise.
include/
	* opcode/riscv-opc.h: Added encodings for hypervisor csrs and
	instrcutions.
opcodes/
	* riscv-opc.c (riscv_opcodes): Added hypervisor instrcutions.
2021-12-24 15:17:52 +08:00
Vineet Gupta
5c3ffbc4dd RISC-V: Hypervisor ext: drop Privileged Spec 1.9.1 implementation/tests
This makes way for a clean 1.12 based Hypervisor Ext support.

There are no known implementors of 1.9.1 H-ext. (Per Jim, kendryte k210
is based on priv spec 1.9.1, but it seems unlikely that they implemented
H-ext).

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Reviewed-by: Nelson Chu <nelson.chu@sifive.com>

gas/
	* testsuite/gas/riscv/csr-dw-regnums.d: Drop the hypervisor csrs
	defined in the privileged spec 1.9.1.
	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-01.s: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-version-1p10.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-version-1p11.l: Likewise.
	* testsuite/gas/riscv/priv-reg-version-1p10.d: Likewise.
	* testsuite/gas/riscv/priv-reg-version-1p11.d: Likewise.
	* testsuite/gas/riscv/priv-reg-version-1p9p1.d: Likewise.
	* testsuite/gas/riscv/priv-reg.s: Likewise.
include/
	* opcode/riscv-opc.h: Drop the hypervisor csrs defined in the
	privileged spec 1.9.1.
2021-12-24 15:17:45 +08:00
Richard Sandiford
a2b1ea81ba arm: Add support for Armv9.1-A to Armv9.3-A
This patch adds AArch32 support for -march=armv9.[123]-a.
The behaviour of the new options can be expressed using a
combination of existing feature flags and tables.

The cpu_arch_ver entries for ARM_ARCH_V9_2A and ARM_ARCH_V9_3A
are technically redundant but it seemed less surprising to include
them anyway.

include/
	* opcode/arm.h (ARM_ARCH_V9_1A, ARM_ARCH_V9_2A): New macros.
	(ARM_ARCH_V9_3A): Likewise.

gas/
	* doc/c-arm.texi: Add armv9.1-a, armv9.2-a and armv9.3-a.
	* config/tc-arm.c (armv91a_ext_table, armv92a_ext_table): New macros.
	(armv93a_ext_table): Likewise.
	(arm_archs): Add armv9.1-a, armv9.2-a and armv9.3-a.
	(cpu_arch_ver): Add ARM_ARCH_V9_1A, ARM_ARCH_V9_2A and ARM_ARCH_V9_3A.
	* NEWS: Mention the above.
	* testsuite/gas/arm/attr-march-armv9_1-a.d: New test.
	* testsuite/gas/arm/attr-march-armv9_2-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv9_3-a.d: Likewise.
	* testsuite/gas/arm/bfloat16-armv9.1-a.d: Likewise.
	* testsuite/gas/arm/bfloat16-armv9.2-a.d: Likewise.
	* testsuite/gas/arm/bfloat16-armv9.3-a.d: Likewise.
	* testsuite/gas/arm/i8mm-armv9.1-a.d: Likewise.
	* testsuite/gas/arm/i8mm-armv9.2-a.d: Likewise.
	* testsuite/gas/arm/i8mm-armv9.3-a.d: Likewise.
2021-12-16 09:32:00 +00:00
Richard Sandiford
b3e4d9326f arm: Add support for Armv8.7-A and Armv8.8-A
This patch adds AArch32 support for -march=armv8.[78]-a.
The behaviour of the new options can be expressed using a
combination of existing feature flags and tables.

The cpu_arch_ver entries are technically redundant but
it seemed less surprising to include them anyway.

include/
	* opcode/arm.h (ARM_ARCH_V8_7A, ARM_ARCH_V8_8A): New macros.

gas/
	* doc/c-arm.texi: Add armv8.7-a and armv8.8-a.
	* config/tc-arm.c (armv87a_ext_table, armv88a_ext_table): New macros.
	(arm_archs): Add armv8.7-a and armv8.8-a.
	(cpu_arch_ver): Add ARM_ARCH_V8_7A and ARM_ARCH_V8_8A.
	* NEWS: Mention the above.
	* testsuite/gas/arm/attr-march-armv8_7-a.d: New test.
	* testsuite/gas/arm/attr-march-armv8_8-a.d: Likewise.
	* testsuite/gas/arm/bfloat16-armv8.7-a.d: Likewise.
	* testsuite/gas/arm/bfloat16-armv8.8-a.d: Likewise.
	* testsuite/gas/arm/i8mm-armv8.7-a.d: Likewise.
	* testsuite/gas/arm/i8mm-armv8.8-a.d: Likewise.
2021-12-16 09:32:00 +00:00
Richard Sandiford
3518022233 aarch64: Add support for Armv9.1-A to Armv9.3-A
This patch adds AArch64 support for -march=armv9.[123]-a.
The behaviour of the new options can be expressed using a
combination of existing feature flags, so we don't need to
eat into the vanishing number of spare AARCH64_FEATURE_* bits.
Hoewver, it was more convenient to separate out the |s of
feature flags so that Armv9.1-A could reuse the set for
Armv8.6-A, and so on.

include/
	* opcode/aarch64.h (AARCH64_ARCH_V8_FEATURES): New macro,
	split out from...
	(AARCH64_ARCH_V8): ...here.
	(AARCH64_ARCH_V8_1_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_1): ...here.
	(AARCH64_ARCH_V8_2_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_2): ...here.
	(AARCH64_ARCH_V8_3_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_3): ...here.
	(AARCH64_ARCH_V8_4_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_4): ...here.
	(AARCH64_ARCH_V8_5_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_5): ...here.
	(AARCH64_ARCH_V8_6_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_6): ...here.
	(AARCH64_ARCH_V8_7_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_7): ...here.
	(AARCH64_ARCH_V8_8_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V8_8): ...here.
	(AARCH64_ARCH_V9_FEATURES): New macro, split out from...
	(AARCH64_ARCH_V9): ...here.
	(AARCH64_ARCH_V9_1_FEATURES, AARCH64_ARCH_V9_1): New macros.
	(AARCH64_ARCH_V9_2_FEATURES, AARCH64_ARCH_V9_2): New macros.
	(AARCH64_ARCH_V9_3_FEATURES, AARCH64_ARCH_V9_3): New macros.

gas/
	* doc/c-aarch64.texi: Add armv9.1-a, armv9-2-a and armv9.3-a.
	* config/tc-aarch64.c (aarch64_archs): Likewise.
	* NEWS: Mention the above.
	* testsuite/gas/aarch64/armv9_invalid.d,
	testsuite/gas/aarch64/armv9_invalid.s,
	testsuite/gas/aarch64/armv9_invalid.l: New test.
	* testsuite/gas/aarch64/armv9_1.d,
	testsuite/gas/aarch64/armv9_1.s: Likewise.
	* testsuite/gas/aarch64/armv9_1_invalid.d,
	testsuite/gas/aarch64/armv9_1_invalid.s,
	testsuite/gas/aarch64/armv9_1_invalid.l: Likewise.
	* testsuite/gas/aarch64/armv9_2.d,
	testsuite/gas/aarch64/armv9_2.s: Likewise.
	* testsuite/gas/aarch64/armv9_2_invalid.d,
	testsuite/gas/aarch64/armv9_2_invalid.s,
	testsuite/gas/aarch64/armv9_2_invalid.l: Likewise.
	* testsuite/gas/aarch64/armv9_3.d,
	testsuite/gas/aarch64/armv9_3.s: Likewise.
2021-12-16 09:32:00 +00:00
Nelson Chu
23ff54c27d RISC-V: Support svinval extension with frozen version 1.0.
According to the privileged spec, there are five new instructions for
svinval extension.  Two of them (HINVAL.VVMA and HINVAL.GVMA) need to
enable the hypervisor extension.  But there is no implementation of
hypervisor extension in mainline for now, so let's consider the related
issues later.

                31..25  24..20 19..15 14..12 11...7 6..2  1..0
sinval.vma      0001011 rs2    rs1    000    00000  11100 11
sfence.w.inval  0001100 00000  00000  000    00000  11100 11
sfence.inval.ir 0001100 00001  00000  000    00000  11100 11
hinval.vvma     0010011 rs2    rs1    000    00000  11100 11
hinval.gvma     0110011 rs2    rs1    000    00000  11100 11

This patch is cherry-picked from the riscv integration branch since the
svinval extension is frozen for now.  Besides, we fix the funct7 encodings
of hinval.vvma and hinval.gvma, from 0x0011011 and 0x0111011 to 0x0010011
and 0x0110011.

bfd/
	* elfxx-riscv.c (riscv_supported_std_s_ext): Added svinval.
	(riscv_multi_subset_supports): Handle INSN_CLASS_SVINVAL.
gas/
	* testsuite/gas/riscv/svinval.d: New testcase.
	* testsuite/gas/riscv/svinval.s: Likewise.
include/
	* opcode/riscv-opc.h: Added encodings for svinval.
	* opcode/riscv.h (enum riscv_insn_class): Added INSN_CLASS_SVINVAL.
opcodes/
	* riscv-opc.c (riscv_opcodes): Added svinval instructions.
2021-12-16 16:04:53 +08:00
John Baldwin
b4992e9990 Support AT_FXRNG and AT_KPRELOAD on FreeBSD.
FreeBSD's kernel has recently added two new ELF auxiliary vector
entries.  AT_FXRNG points to a root seed version for the kernel's
PRNG.  Userland can use this to reseed a userland PRNG after the
kernel's PRNG has reseeded.  AT_KPRELOAD is the base address of a
kernel-provided vDSO.

This change displays the proper name and description of these entries
in 'info auxv'.

include/ChangeLog:

	* elf/common.h (AT_FREEBSD_FXRNG, AT_FREEBSD_KPRELOAD): Define.
2021-12-07 10:29:01 -08:00
Mike Frysinger
20a8e078cc sim: reorder header includes
We're including system headers after local headers in a bunch of
places, but this leads to conflicts when our local headers happen
to define symbols that show up in the system headers.

Use the more standard order of:
* config.h (via defs.h)
* system headers
* local library headers (e.g. bfd & libiberty)
* sim specific headers
2021-12-04 22:09:26 -05:00
Richard Sandiford
bcca550b3d aarch64: Add BC instruction
This patch adds support for the Armv8.8-A BC instruction.
[https://developer.arm.com/documentation/ddi0596/2021-09/Base-Instructions/BC-cond--Branch-Consistent-conditionally-?lang=en]

include/
	* opcode/aarch64.h (AARCH64_FEATURE_HBC): New macro.
	(AARCH64_ARCH_V8_8): Make armv8.8-a imply AARCH64_FEATURE_HBC.

opcodes/
	* aarch64-tbl.h (aarch64_feature_hbc): New variable.
	(HBC, HBC_INSN): New macros.
	(aarch64_opcode_table): Add BC.C.
	* aarch64-dis-2.c: Regenerate.

gas/
	* doc/c-aarch64.texi: Document +hbc.
	* config/tc-aarch64.c (aarch64_features): Add "hbc".
	* testsuite/gas/aarch64/hbc.s, testsuite/gas/aarch64/hbc.d: New test.
	* testsuite/gas/aarch64/hbc-invalid.s,
	testsuite/gas/aarch64/hbc-invalid.l,
	testsuite/gas/aarch64/hbc-invalid.d: New test.
2021-12-02 15:00:57 +00:00
Richard Sandiford
63eff94751 aarch64: Enforce P/M/E order for MOPS instructions
The MOPS instructions should be used as a triple, such as:

       cpyfp [x0]!, [x1]!, x2!
       cpyfm [x0]!, [x1]!, x2!
       cpyfe [x0]!, [x1]!, x2!

The registers should also be the same for each writeback operand.
This patch adds a warning for code that doesn't follow this rule,
along similar lines to the warning that we already emit for
invalid uses of MOVPRFX.

include/
	* opcode/aarch64.h (C_SCAN_MOPS_P, C_SCAN_MOPS_M, C_SCAN_MOPS_E)
	(C_SCAN_MOPS_PME): New macros.
	(AARCH64_OPDE_A_SHOULD_FOLLOW_B): New aarch64_operand_error_kind.
	(AARCH64_OPDE_EXPECTED_A_AFTER_B): Likewise.
	(aarch64_operand_error): Make each data value a union between
	an int and a string.

opcodes/
	* aarch64-tbl.h (MOPS_CPY_OP1_OP2_INSN): Add scan flags.
	(MOPS_SET_OP1_OP2_INSN): Likewise.
	* aarch64-opc.c (set_out_of_range_error): Update after change to
	aarch64_operand_error.
	(set_unaligned_error, set_reg_list_error): Likewise.
	(init_insn_sequence): Use a 3-instruction sequence for
	MOPS P instructions.
	(verify_mops_pme_sequence): New function.
	(verify_constraints): Call it.
	* aarch64-dis.c (print_verifier_notes): Handle
	AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B.

gas/
	* config/tc-aarch64.c (operand_mismatch_kind_names): Add entries
	for AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B.
	(operand_error_higher_severity_p): Check that
	AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B
	come between AARCH64_OPDE_RECOVERABLE and AARCH64_OPDE_SYNTAX_ERROR;
	their relative order is not significant.
	(record_operand_error_with_data): Update after change to
	aarch64_operand_error.
	(output_operand_error_record): Likewise.  Handle
	AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B.
	* testsuite/gas/aarch64/mops_invalid_2.s,
	testsuite/gas/aarch64/mops_invalid_2.d,
	testsuite/gas/aarch64/mops_invalid_2.l: New test.
2021-12-02 15:00:57 +00:00
Richard Sandiford
6327658ee7 aarch64: Add support for +mops
This patch adds support for FEAT_MOPS, an Armv8.8-A extension
that provides memcpy and memset acceleration instructions.

I took the perhaps controversial decision to generate the individual
instruction forms using macros rather than list them out individually.
This becomes useful with a follow-on patch to check that code follows
the correct P/M/E sequence.
[https://developer.arm.com/documentation/ddi0596/2021-09/Base-Instructions?lang=en]

include/
	* opcode/aarch64.h (AARCH64_FEATURE_MOPS): New macro.
	(AARCH64_ARCH_V8_8): Make armv8.8-a imply AARCH64_FEATURE_MOPS.
	(AARCH64_OPND_MOPS_ADDR_Rd): New aarch64_opnd.
	(AARCH64_OPND_MOPS_ADDR_Rs): Likewise.
	(AARCH64_OPND_MOPS_WB_Rn): Likewise.

opcodes/
	* aarch64-asm.h (ins_x0_to_x30): New inserter.
	* aarch64-asm.c (aarch64_ins_x0_to_x30): New function.
	* aarch64-dis.h (ext_x0_to_x30): New extractor.
	* aarch64-dis.c (aarch64_ext_x0_to_x30): New function.
	* aarch64-tbl.h (aarch64_feature_mops): New feature set.
	(aarch64_feature_mops_memtag): Likewise.
	(MOPS, MOPS_MEMTAG, MOPS_INSN, MOPS_MEMTAG_INSN)
	(MOPS_CPY_OP1_OP2_PME_INSN, MOPS_CPY_OP1_OP2_INSN, MOPS_CPY_OP1_INSN)
	(MOPS_CPY_INSN, MOPS_SET_OP1_OP2_PME_INSN, MOPS_SET_OP1_OP2_INSN)
	(MOPS_SET_INSN): New macros.
	(aarch64_opcode_table): Add MOPS instructions.
	(aarch64_opcode_table): Add entries for AARCH64_OPND_MOPS_ADDR_Rd,
	AARCH64_OPND_MOPS_ADDR_Rs and AARCH64_OPND_MOPS_WB_Rn.
	* aarch64-opc.c (aarch64_print_operand): Handle
	AARCH64_OPND_MOPS_ADDR_Rd, AARCH64_OPND_MOPS_ADDR_Rs and
	AARCH64_OPND_MOPS_WB_Rn.
	(verify_three_different_regs): New function.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Likewise.
	* aarch64-opc-2.c: Likewise.

gas/
	* doc/c-aarch64.texi: Document +mops.
	* config/tc-aarch64.c (parse_x0_to_x30): New function.
	(parse_operands): Handle AARCH64_OPND_MOPS_ADDR_Rd,
	AARCH64_OPND_MOPS_ADDR_Rs and AARCH64_OPND_MOPS_WB_Rn.
	(aarch64_features): Add "mops".
	* testsuite/gas/aarch64/mops.s, testsuite/gas/aarch64/mops.d: New test.
	* testsuite/gas/aarch64/mops_invalid.s,
	* testsuite/gas/aarch64/mops_invalid.d,
	* testsuite/gas/aarch64/mops_invalid.l: Likewise.
2021-12-02 15:00:57 +00:00
Richard Sandiford
175eafaf37 aarch64: Add support for Armv8.8-A
This patch adds skeleton support for -march=armv8.8-a, testing only
that it correctly inherits from armv8.7-a.

include/
	* opcode/aarch64.h (AARCH64_FEATURE_V8_8): New macro.
	(AARCH64_ARCH_V8_8): Likewise.

gas/
	* doc/c-aarch64.texi: Document armv8.8-a.
	* config/tc-aarch64.c (aarch64_archs): Add armv8-8-a
	* testsuite/gas/aarch64/v8-8-a.s,
	* testsuite/gas/aarch64/v8-8-a.d: New test.
2021-12-02 15:00:56 +00:00
Richard Sandiford
b3e59f8873 aarch64: Tweak insn sequence code
libopcodes has some code to check constraints across sequences
of consecutive instructions.  It was added to support MOVPRFX
sequences but is going to be useful for the Armv8.8-A MOPS
feature as well.

Currently the structure has one field to record the instruction
that started a sequence and another to record the remaining
instructions in the sequence.  It's more convenient for the
MOPS code if we put the instructions into a single array instead.

No functional change intended.

include/
	* opcode/aarch64.h (aarch64_instr_sequence): Replace num_insns
	and current_insns with num_added_insns and num_allocated_insns.

opcodes/
	* aarch64-opc.c (add_insn_to_sequence): New function.
	(init_insn_sequence): Update for new aarch64_instr_sequence layout.
	Add the first instruction to the inst array.
	(verify_constraints): Update for new aarch64_instr_sequence layout.
	Don't add the last instruction to the array.
2021-12-02 15:00:56 +00:00
Simon Marchi
6cade9185c gdb, include: replace pragmas with DIAGNOSTIC macros, fix build with g++ 4.8
When introducing this code, I forgot that we had some macros for this.
Replace some "manual" pragma diagnostic with some DIAGNOSTIC_* macros,
provided by include/diagnostics.h.

In diagnostics.h:

 - Add DIAGNOSTIC_ERROR, to enable a diagnostic at error level.
 - Add DIAGNOSTIC_ERROR_SWITCH, to enable -Wswitch at error level, for
   both gcc and clang.

Additionally, using DIAGNOSTIC_PUSH, DIAGNOSTIC_ERROR_SWITCH and
DIAGNOSTIC_POP seems to misbehave with g++ 4.8, where we see these
errors:

      CXX    ada-tasks.o
    /home/smarchi/src/binutils-gdb/gdb/ada-tasks.c: In function void read_known_tasks():
    /home/smarchi/src/binutils-gdb/gdb/ada-tasks.c:998:10: error: enumeration value ADA_TASKS_UNKNOWN not handled in switch [-Werror=switch]
       switch (data->known_tasks_kind)
              ^

Because of the POP, the diagnostic should go back to being disabled,
since it was disabled in the beginning, but that's not what we see
here.  Versions of GCC >= 5 compile correctly.

Work around this by making DIAGNOSTIC_ERROR_SWITCH a no-op for GCC < 5.

Note that this code (already as it exists in master today) enables
-Wswitch at the error level even if --disable-werror is passed.  It
shouldn't be a problem, as it's not like a new enumerator will appear
out of nowhere and cause a build error if building with future
compilers.  Still, for correctness, we would ideally want to ask the
compiler to enable -Wswitch at its default level (as if the user had
passed -Wswitch on the command-line).  There doesn't seem to be a way to
do this.

Change-Id: Id33ebec3de39bd449409ea0bab59831289ffe82d
2021-12-02 08:24:25 -05:00
Luca Boccassi
e5382207cd readelf: recognize FDO Packaging Metadata ELF note
As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
this note will be used starting from Fedora 36. Allow
readelf --notes to pretty print it:

Displaying notes found in: .note.package
  Owner                Data size 	Description
  FDO                  0x00000039	FDO_PACKAGING_METADATA
    Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-12-01 14:44:25 +00:00
Nick Clifton
92fc129e2b Fix the fields in the x_n union inside the the x_file structure so that pointers can be stored.
PR 28630
	* coff/internal.h (x_n): Use bfd_hostptr_t for the fields in this
	structure.
2021-12-01 11:29:34 +00:00
Nelson Chu
abfdb09f01 RISC-V: The vtype immediate with more than the defined 8 bits are preserved.
According the rvv spec,
https://github.com/riscv/riscv-v-spec/blob/master/vtype-format.adoc

The bits of vtype immediate from 8 to (xlen - 1) should be reserved.
Therefore, we should also dump the vtype immediate as numbers, when
they are set over 8-bits.  I think this is a bug that we used to support
vediv extension and use the bit 8 and 9 of vtype, but forgot to update
the behavior when removing the vediv.

Consider the testcases,

vsetvli  a0, a1,  0x700    # the reserved bit 10, 9 and 8 are used.
vsetvli  a0, a1,  0x400    # the reserved bit 10 is used.
vsetvli  a0, a1,  0x300    # the reserved bit 9 and 8 are used.
vsetvli  a0, a1,  0x100    # the reserved bit 8 is used.
vsetivli a0, 0xb, 0x300    # the reserved bit 9 and 8 are used.
vsetivli a0, 0xb, 0x100    # the reserved bit 8 is used.

The original objdump shows the following result,

0000000000000000 <.text>:
   0:   7005f557                vsetvli a0,a1,1792
   4:   4005f557                vsetvli a0,a1,1024
   8:   3005f557                vsetvli a0,a1,e8,m1,tu,mu
   c:   1005f557                vsetvli a0,a1,e8,m1,tu,mu
  10:   f005f557                vsetivli        a0,11,e8,m1,tu,mu
  14:   d005f557                vsetivli        a0,11,e8,m1,tu,mu

But in fact the correct result should be,

0000000000000000 <.text>:
   0:   7005f557                vsetvli a0,a1,1792
   4:   4005f557                vsetvli a0,a1,1024
   8:   3005f557                vsetvli a0,a1,768
   c:   1005f557                vsetvli a0,a1,256
  10:   f005f557                vsetivli        a0,11,768
  14:   d005f557                vsetivli        a0,11,256

gas/
	* testsuite/gas/riscv/vector-insns.d: Added testcases to
	test the reserved bit 8 to (xlen-1) of vtype.
	* testsuite/gas/riscv/vector-insns.s: Likewise.
include/
	* opcode/riscv.h: Removed OP_MASK_VTYPE_RES and OP_SH_VTYPE_RES,
	since they are different for operand Vc and Vb.
opcodes/
	* riscv-dis.c (print_insn_args): Updated imm_vtype_res to
	extract the reserved immediate of vtype correctly.
2021-11-30 19:03:48 +08:00
Andrew Burgess
3a337a86d9 opcodes/riscv: add disassembler options support to libopcodes
In preparation for the next commit, which will add GDB support for
RISC-V disassembler options, this commit restructures how the
disassembler options are managed within libopcodes.

The implementation provided here is based on this mailing list patch
which was never committed:

  https://sourceware.org/pipermail/binutils/2021-January/114944.html

which in turn took inspiration from the MIPS implementation of the
same feature.

The biggest changes from the original mailing list post are:

  1. The GDB changes have been split into a separate patch, and

  2. The `riscv_option_args_privspec` variable, which held the valid
  priv-spec values is now gone, instead we use the `riscv_priv_specs`
  array from bfd/cpu-riscv.c instead.

Co-authored-by: Simon Cook <simon.cook@embecosm.com>

include/ChangeLog:

	* dis-asm.h (disassembler_options_riscv): Declare.

opcodes/ChangeLog:

	* riscv-dis.c (enum riscv_option_arg_t): New enum typedef.
	(riscv_options): New static global.
	(disassembler_options_riscv): New function.
	(print_riscv_disassembler_options): Rewrite to use
	disassembler_options_riscv.
2021-11-26 10:18:35 +00:00
Tamar Christina
b69c9d41e8 AArch64: Add support for AArch64 EFI (efi-*-aarch64).
This adds support for efi-*-aarch64 by virtue of adding a new PEI target
pei-aarch64-little.  This is not a full target and only exists to support EFI
at this time.

This means that this target does not support relocation processing and is mostly
a container format.  This format has been added to elf based aarch64 targets
such that efi images can be made natively on Linux.

However this target is not valid for use with gas but only with objcopy.

With these changes the resulting file is recognized as an efi image by
third party tools:

>  pecli info hello.efi

Metadata
================================================================================
MD5:            598c32a778b0f0deebe977fef8578c4e
SHA1:           4580121edd5cb4dc40f51b28f171fd15250df84c
SHA256:         3154bd7cf42433d1c957f6bf55a17ad8c57ed41b29df2d485703349fd6ff1d5c
Imphash:
Size:           47561 bytes
Type:           PE32+ executable (EFI application) (stripped to external PDB), for MS Windows
Compile Time:   1970-01-01 00:00:00 (UTC - 0x0       )
Entry point:    0x2000 (section .text)

Sections
================================================================================
Name      RWX  VirtSize   VirtAddr   RawAddr   RawSize   Entropy  md5
.text     R-X  0x5bb0     0x2000     0x400     0x5c00      6.39 551fbc264256a3f387de8a891500ae0d
.reloc    R--  0xc        0x8000     0x6000    0x200       0.02 0c45f6d812d079821c1d54c09ab89e1d
.data     RW-  0x1d88     0x9000     0x6200    0x1e00      4.18 5d1137c09f01289dc62bf754f7290db3
.dynamic  RW-  0xf0       0xb000     0x8000    0x200       0.34 5c94ed3206f05a277e6f04fbf131f131
.rela     R--  0xe58      0xc000     0x8200    0x1000      1.87 8b5c6bc30f3acb7ca7bf2e6789d68519
.dynsym   R--  0x138      0xd000     0x9200    0x200       0.96 bdcf5101da51aadc663ca8859f88138c

Imports
================================================================================

Any magic number is based on the Microsoft PE specification [1].

[1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format

bfd/ChangeLog:

2021-10-21  Tamar Christina  <tamar.christina@arm.com>

	PR binutils/26206
	* .gitignore (pe-aarch64igen.c): New.
	* Makefile.am (pei-aarch64.lo, pe-aarch64igen.lo, pei-aarch64.c,
	pe-aarch64igen.c): Add support.
	* Makefile.in: Likewise.
	* bfd.c (bfd_get_sign_extend_vma): Add pei-aarch64-little.
	* coff-aarch64.c: New file.
	* coffcode.h (coff_set_arch_mach_hook, coff_set_flags,
	coff_write_object_contents) Add aarch64 (aarch64_pei_vec) support.
	* config.bfd: Likewise.
	* configure: Likewise.
	* configure.ac: Likewise.
	* libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE,
	GET_OPTHDR_SIZE_OF_STACK_RESERVE, PUT_OPTHDR_SIZE_OF_STACK_RESERVE,
	GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT,
	GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE,
	GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT,
	GET_PDATA_ENTRY, _bfd_peAArch64_bfd_copy_private_bfd_data_common,
	_bfd_peAArch64_bfd_copy_private_section_data,
	_bfd_peAArch64_get_symbol_info, _bfd_peAArch64_only_swap_filehdr_out,
	_bfd_peAArch64_print_private_bfd_data_common,
	_bfd_peAArch64i_final_link_postscript,
	_bfd_peAArch64i_only_swap_filehdr_out, _bfd_peAArch64i_swap_aouthdr_in,
	_bfd_peAArch64i_swap_aouthdr_out, _bfd_peAArch64i_swap_aux_in,
	_bfd_peAArch64i_swap_aux_out, _bfd_peAArch64i_swap_lineno_in,
	_bfd_peAArch64i_swap_lineno_out, _bfd_peAArch64i_swap_scnhdr_out,
	_bfd_peAArch64i_swap_sym_in, _bfd_peAArch64i_swap_sym_out,
	_bfd_peAArch64i_swap_debugdir_in, _bfd_peAArch64i_swap_debugdir_out,
	_bfd_peAArch64i_write_codeview_record,
	_bfd_peAArch64i_slurp_codeview_record,
	_bfd_peAArch64_print_ce_compressed_pdata): New.
	* peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out,
	pe_print_pdata, _bfd_XX_print_private_bfd_data_common,
	_bfd_XX_bfd_copy_private_section_data, _bfd_XXi_final_link_postscript):
	Support COFF_WITH_peAArch64,
	* pei-aarch64.c: New file.
	* peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd, pe_ILF_object_p):
	Support COFF_WITH_peAArch64.
	(jtab): Add dummy entry that traps.
	* targets.c (aarch64_pei_vec): New.

binutils/ChangeLog:

2021-10-21  Tamar Christina  <tamar.christina@arm.com>

	PR binutils/26206
	* NEWS: Add new support.
	* objcopy.c (convert_efi_target): Add efi-*-aarch64 support.
	* testsuite/binutils-all/aarch64/pei-aarch64-little.d: New test.
	* testsuite/binutils-all/aarch64/pei-aarch64-little.s: New test.

include/ChangeLog:

2021-10-21  Tamar Christina  <tamar.christina@arm.com>

	PR binutils/26206
	* coff/aarch64.h: New file.
	* coff/pe.h (IMAGE_FILE_MACHINE_ARM64): New.
2021-11-23 09:36:39 +00:00
Nelson Chu
8155b8539b RISC-V: Support STO_RISCV_VARIANT_CC and DT_RISCV_VARIANT_CC.
This is the original discussion,
https://github.com/riscv/riscv-elf-psabi-doc/pull/190

And here is the glibc part,
https://sourceware.org/pipermail/libc-alpha/2021-August/129931.html

For binutils part, we need to support a new direcitve: .variant_cc.
The function symbol marked by .variant_cc means it need to be resolved
directly without resolver for dynamic linker.  We also add a new dynamic
entry, STO_RISCV_VARIANT_CC, to indicate there are symbols with the
special attribute in the dynamic symbol table of the object.

I heard that llvm already have supported this in their mainline, so
I think it's time to commit this.

bfd/
	* elfnn-riscv.c (riscv_elf_link_hash_table): Added variant_cc
	flag. It is used to check if relocations for variant CC symbols
	may be present.
	(allocate_dynrelocs): If the symbol has STO_RISCV_VARIANT_CC
	flag, then raise the variant_cc flag of riscv_elf_link_hash_table.
	(riscv_elf_size_dynamic_sections): Added dynamic entry for
	variant_cc.
	(riscv_elf_merge_symbol_attribute): New function, used to merge
	non-visibility st_other attributes, including STO_RISCV_VARIANT_CC.
binutils/
	* readelf.c (get_riscv_dynamic_type): New function.
	(get_dynamic_type): Called get_riscv_dynamic_type for riscv targets.
	(get_riscv_symbol_other): New function.
	(get_symbol_other): Called get_riscv_symbol_other for riscv targets.
gas/
	* config/tc-riscv.c (s_variant_cc): Marked symbol that it follows a
	variant CC convention.
	(riscv_elf_copy_symbol_attributes): Same as elf_copy_symbol_attributes,
	but without copying st_other.  If a function symbol has special st_other
	value set via directives, then attaching an IFUNC resolver to that symbol
	should not override the st_other setting.
	(riscv_pseudo_table): Support variant_cc diretive.
	* config/tc-riscv.h (OBJ_COPY_SYMBOL_ATTRIBUTES): Defined.
	* testsuite/gas/riscv/variant_cc-set.d: New testcase.
	* testsuite/gas/riscv/variant_cc-set.s: Likewise.
	* testsuite/gas/riscv/variant_cc.d: Likewise.
	* testsuite/gas/riscv/variant_cc.s: Likewise.
include/
	* elf/riscv.h (DT_RISCV_VARIANT_CC): Defined to (DT_LOPROC + 1).
	(STO_RISCV_VARIANT_CC): Defined to 0x80.
ld/
	* testsuite/ld-riscv-elf/variant_cc-1.s: New testcase.
	* testsuite/ld-riscv-elf/variant_cc-2.s: Likewise.
	* testsuite/ld-riscv-elf/variant_cc-now.d: Likewise.
	* testsuite/ld-riscv-elf/variant_cc-r.d: Likewise.
	* testsuite/ld-riscv-elf/variant_cc-shared.d: Likewise.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
2021-11-19 09:32:19 +08:00
jiawei
de83e5142d RISC-V: Add instructions and operand set for z[fdq]inx
Reuse float instructions in INSN_CLASS_F/D/Q, use riscv_subset_supports to
verify if z*inx enabled and use gpr instead of fpr when z*inx is enable.

bfd/ChangeLog:

* elfxx-riscv.c (riscv_multi_subset_supports): Added support for
  z*inx extension.

gas/ChangeLog:

* config/tc-riscv.c (riscv_ip): Added register choice for z*inx.

include/ChangeLog:

* opcode/riscv.h (enum riscv_insn_class): Reused INSN_CLASS_* for z*inx.

opcodes/ChangeLog:

* riscv-dis.c (riscv_disassemble_insn): Added disassemble check for
  z*inx.
* riscv-opc.c: Reused INSN_CLASS_* for z*inx.

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
2021-11-18 14:43:23 +08:00
Przemyslaw Wirkus
d3de086010 aarch64: [SME] SVE2 instructions added to support SME
This patch is adding new SVE2 instructions added to support SME extension.
The following SVE2 instructions are added by the SME architecture:
* PSEL,
* REVD, SCLAMP and UCLAMP.

gas/ChangeLog:

	* config/tc-aarch64.c (parse_sme_pred_reg_with_index):
	New parser.
	(parse_operands): New parser.
	* testsuite/gas/aarch64/sme-9-illegal.d: New test.
	* testsuite/gas/aarch64/sme-9-illegal.l: New test.
	* testsuite/gas/aarch64/sme-9-illegal.s: New test.
	* testsuite/gas/aarch64/sme-9.d: New test.
	* testsuite/gas/aarch64/sme-9.s: New test.

include/ChangeLog:

	* opcode/aarch64.h (enum aarch64_opnd): New operand
	AARCH64_OPND_SME_PnT_Wm_imm.

opcodes/ChangeLog:

	* aarch64-asm.c (aarch64_ins_sme_pred_reg_with_index):
	New inserter.
	* aarch64-dis.c (aarch64_ext_sme_pred_reg_with_index):
	New extractor.
	* aarch64-opc.c (aarch64_print_operand): Printout of
	OPND_SME_PnT_Wm_imm.
	* aarch64-opc.h (enum aarch64_field_kind): New bitfields
	FLD_SME_Rm, FLD_SME_i1, FLD_SME_tszh, FLD_SME_tszl.
	* aarch64-tbl.h (OP_SVE_NN_BHSD): New qualifier.
	(OP_SVE_QMQ): New qualifier.
	(struct aarch64_opcode): New instructions PSEL, REVD,
	SCLAMP and UCLAMP.
	aarch64-asm-2.c: Regenerate.
	aarch64-dis-2.c: Regenerate.
	aarch64-opc-2.c: Regenerate.
2021-11-17 20:27:42 +00:00
Przemyslaw Wirkus
3dd032c5fb aarch64: [SME] Add SME mode selection and state access instructions
This patch is adding new SME mode selection and state access instructions:
* Add SMSTART and SMSTOP instructions.
* Add SVCR system register.

gas/ChangeLog:

	* config/tc-aarch64.c (parse_sme_sm_za): New parser.
	(parse_operands): New parser.
	* testsuite/gas/aarch64/sme-8-illegal.d: New test.
	* testsuite/gas/aarch64/sme-8-illegal.l: New test.
	* testsuite/gas/aarch64/sme-8-illegal.s: New test.
	* testsuite/gas/aarch64/sme-8.d: New test.
	* testsuite/gas/aarch64/sme-8.s: New test.

include/ChangeLog:

	* opcode/aarch64.h (enum aarch64_opnd): New operand
	AARCH64_OPND_SME_SM_ZA.
	(enum aarch64_insn_class): New instruction classes
	sme_start and sme_stop.

opcodes/ChangeLog:

	* aarch64-asm.c (aarch64_ins_pstatefield): New inserter.
	(aarch64_ins_sme_sm_za): New inserter.
	* aarch64-dis.c (aarch64_ext_imm): New extractor.
	(aarch64_ext_pstatefield): New extractor.
	(aarch64_ext_sme_sm_za): New extractor.
	* aarch64-opc.c (operand_general_constraint_met_p):
	New pstatefield value for SME instructions.
	(aarch64_print_operand): Printout for OPND_SME_SM_ZA.
	(SR_SME): New register SVCR.
	* aarch64-opc.h (F_REG_IN_CRM): New register endcoding.
	* aarch64-opc.h (F_IMM_IN_CRM): New immediate endcoding.
	(PSTATE_ENCODE_CRM): Encode CRm field.
	(PSTATE_DECODE_CRM): Decode CRm field.
	(PSTATE_ENCODE_CRM_IMM): Encode CRm immediate field.
	(PSTATE_DECODE_CRM_IMM): Decode CRm immediate field.
	(PSTATE_ENCODE_CRM_AND_IMM): Encode CRm and immediate
	field.
	* aarch64-tbl.h (struct aarch64_opcode): New SMSTART
	and SMSTOP instructions.
	aarch64-asm-2.c: Regenerate.
	aarch64-dis-2.c: Regenerate.
	aarch64-opc-2.c: Regenerate.
2021-11-17 20:15:37 +00:00
Przemyslaw Wirkus
01a4d08220 aarch64: [SME] Add LD1x, ST1x, LDR and STR instructions
This patch is adding new loads and stores defined by SME instructions.

gas/ChangeLog:

	* config/tc-aarch64.c (parse_sme_address): New parser.
	(parse_sme_za_hv_tiles_operand_with_braces): New parser.
	(parse_sme_za_array): New parser.
	(output_operand_error_record): Print error details if
	present.
	(parse_operands): Support new operands.
	* testsuite/gas/aarch64/sme-5-illegal.d: New test.
	* testsuite/gas/aarch64/sme-5-illegal.l: New test.
	* testsuite/gas/aarch64/sme-5-illegal.s: New test.
	* testsuite/gas/aarch64/sme-5.d: New test.
	* testsuite/gas/aarch64/sme-5.s: New test.
	* testsuite/gas/aarch64/sme-6-illegal.d: New test.
	* testsuite/gas/aarch64/sme-6-illegal.l: New test.
	* testsuite/gas/aarch64/sme-6-illegal.s: New test.
	* testsuite/gas/aarch64/sme-6.d: New test.
	* testsuite/gas/aarch64/sme-6.s: New test.
	* testsuite/gas/aarch64/sme-7-illegal.d: New test.
	* testsuite/gas/aarch64/sme-7-illegal.l: New test.
	* testsuite/gas/aarch64/sme-7-illegal.s: New test.
	* testsuite/gas/aarch64/sme-7.d: New test.
	* testsuite/gas/aarch64/sme-7.s: New test.

include/ChangeLog:

	* opcode/aarch64.h (enum aarch64_opnd): New operands.
	(enum aarch64_insn_class): Added sme_ldr and sme_str.
	(AARCH64_OPDE_UNTIED_IMMS): New operand error kind.

opcodes/ChangeLog:

	* aarch64-asm.c (aarch64_ins_sme_za_hv_tiles): New inserter.
	(aarch64_ins_sme_za_list): New inserter.
	(aarch64_ins_sme_za_array): New inserter.
	(aarch64_ins_sme_addr_ri_u4xvl): New inserter.
	* aarch64-asm.h (AARCH64_DECL_OPD_INSERTER): Added
	ins_sme_za_list, ins_sme_za_array and ins_sme_addr_ri_u4xvl.
	* aarch64-dis.c (aarch64_ext_sme_za_hv_tiles): New extractor.
	(aarch64_ext_sme_za_list): New extractor.
	(aarch64_ext_sme_za_array): New extractor.
	(aarch64_ext_sme_addr_ri_u4xvl): New extractor.
	* aarch64-dis.h (AARCH64_DECL_OPD_EXTRACTOR): Added
	ext_sme_za_list, ext_sme_za_array and ext_sme_addr_ri_u4xvl.
	* aarch64-opc.c (operand_general_constraint_met_p):
	(aarch64_match_operands_constraint): Handle sme_ldr, sme_str
	and sme_misc.
	(aarch64_print_operand): New operands supported.
	* aarch64-tbl.h (OP_SVE_QUU): New qualifier.
	(OP_SVE_QZU): New qualifier.
	aarch64-asm-2.c: Regenerate.
	aarch64-dis-2.c: Regenerate.
	aarch64-opc-2.c: Regenerate.
2021-11-17 20:02:24 +00:00
Przemyslaw Wirkus
1cad938de5 aarch64: [SME] Add ZERO instruction
This patch is adding ZERO (a list of 64-bit element ZA tiles)
instruction.

gas/ChangeLog:

	* config/tc-aarch64.c (parse_sme_list_of_64bit_tiles):
	New parser.
	(parse_operands): Handle OPND_SME_list_of_64bit_tiles.
	* testsuite/gas/aarch64/sme-4-illegal.d: New test.
	* testsuite/gas/aarch64/sme-4-illegal.l: New test.
	* testsuite/gas/aarch64/sme-4-illegal.s: New test.
	* testsuite/gas/aarch64/sme-4.d: New test.
	* testsuite/gas/aarch64/sme-4.s: New test.

include/ChangeLog:

	* opcode/aarch64.h (enum aarch64_opnd): New operand
	AARCH64_OPND_SME_list_of_64bit_tiles.

opcodes/ChangeLog:

	* aarch64-opc.c (print_sme_za_list): New printing function.
	(aarch64_print_operand): Handle OPND_SME_list_of_64bit_tiles.
	* aarch64-opc.h (enum aarch64_field_kind): New bitfield
	FLD_SME_zero_mask.
	* aarch64-tbl.h (struct aarch64_opcode): New ZERO instruction.
	aarch64-asm-2.c: Regenerate.
	aarch64-dis-2.c: Regenerate.
	aarch64-opc-2.c: Regenerate.
2021-11-17 19:56:42 +00:00