Commit graph

17462 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
GDB Administrator
9ef0cc6c3a Automatic date update in version.in 2022-03-18 00:00:08 +00:00
Alan Modra
c9178f285a ubsan: Null dereference in parse_module
* vms-alpha.c (parse_module): Sanity check that DST__K_RTNBEG
	has set module->func_table for DST__K_RTNEND.  Check return
	of bfd_zalloc.
2022-03-17 21:32:44 +10:30
Alan Modra
98c445c0b9 asan: Buffer overflow in evax_bfd_print_dst
With "name" a char*, the length at name[0] might be negative, escaping
buffer limit checks.

	* vms-alpha.c (evax_bfd_print_dst): Make name an unsigned char*.
	(evax_bfd_print_emh): Likewise.
2022-03-17 21:32:44 +10:30
Alan Modra
0c6a3cd135 asan: Buffer overflow in som_set_reloc_info
* som.c (som_set_reloc_info): Add symcount parameter.  Don't
	access symbols past symcount.  Don't access fixup past end_fixups.
	(som_slurp_reloc_table): Adjust som_set_reloc_info calls.
2022-03-17 21:32:44 +10:30
Alan Modra
c55f2b9c61 Re: asan: buffer overflow in peXXigen.c
In the process of fixing a buffer overflow in commit fe69d4fcf0,
I managed to introduce a fairly obvious NULL pointer dereference..

	* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Don't
	segfault on not finding section.  Wrap overlong lines.
2022-03-17 21:32:44 +10:30
Alan Modra
df573325cb Re: bfd: add AMDGCN architecture
* po/SRC-POTFILES.in: Regenerate.
2022-03-17 21:32:43 +10:30
GDB Administrator
4417601f70 Automatic date update in version.in 2022-03-17 00:00:16 +00: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
GDB Administrator
22546800ad Automatic date update in version.in 2022-03-16 00:00:23 +00:00
GDB Administrator
bf573a0cc6 Automatic date update in version.in 2022-03-15 00:00:27 +00:00
GDB Administrator
d4661bf0e9 Automatic date update in version.in 2022-03-14 00:00:15 +00:00
GDB Administrator
4f4a30bee6 Automatic date update in version.in 2022-03-13 00:00:23 +00:00
GDB Administrator
9fb67c2345 Automatic date update in version.in 2022-03-12 00:00:14 +00:00
GDB Administrator
a655f19af9 Automatic date update in version.in 2022-03-11 00:00:26 +00:00
H.J. Lu
320fdefef1 ld: Add a before_plugin_all_symbols_read hook
Add a before_plugin_all_symbols_read hook to load symbol references from
DT_NEEDED entries, included from --copy-dt-needed-entries, before reading
plugin symbols to properly resolve plugin symbol references.

bfd/

	PR ld/28849
	* elf-bfd.h (elf_link_hash_table): Add handling_dt_needed.
	* elflink.c (_bfd_elf_merge_symbol): Don't set non_ir_ref_dynamic
	before plugin 'all symbols read' hook is called.

ld/

	PR ld/28849
	* ldelf.c (ldelf_handle_dt_needed): New function.
	(ldelf_before_plugin_all_symbols_read): Likewise.
	(ldelf_after_open): Call ldelf_handle_dt_needed.
	* ldelf.h (ldelf_before_plugin_all_symbols_read): New.
	* ldemul.c (ldemul_before_plugin_all_symbols_read): Likewise.
	* ldemul.h (ldemul_before_plugin_all_symbols_read): Likewise.
	(ld_emulation_xfer_struct): Add before_plugin_all_symbols_read.
	* ldlang.c (lang_process): Call
	ldemul_before_plugin_all_symbols_read before calling
	plugin_call_all_symbols_read.
	* emultempl/elf.em
	(gld${EMULATION_NAME}_before_plugin_all_symbols_read): New.
	(LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ): New.
	* emultempl/emulation.em (ld_${EMULATION_NAME}_emulation):
	Initialize the before_plugin_all_symbols_read field.
	* testsuite/ld-plugin/lto.exp: Run PR ld/28849 tests.
	* testsuite/ld-plugin/pr28849.d: New file.
	* testsuite/ld-plugin/pr28849a.c: Likewise.
	* testsuite/ld-plugin/pr28849b.c: Likewise.
2022-03-09 18:23:43 -08:00
GDB Administrator
399f9ba236 Automatic date update in version.in 2022-03-10 00:00:14 +00:00
GDB Administrator
2c5e3cf816 Automatic date update in version.in 2022-03-09 00:00:15 +00:00
GDB Administrator
30732ea06d Automatic date update in version.in 2022-03-08 00:00:25 +00:00
GDB Administrator
0daa5af85a Automatic date update in version.in 2022-03-07 00:00:11 +00:00
GDB Administrator
7a1550fcec Automatic date update in version.in 2022-03-06 00:00:25 +00:00
GDB Administrator
7c28e7424d Automatic date update in version.in 2022-03-05 00:00:25 +00:00
GDB Administrator
98040b9ebb Automatic date update in version.in 2022-03-04 00:00:19 +00:00
Alan Modra
e26ff4b5a9 comment typo fix 2022-03-03 13:44:16 +10:30
Alan Modra
0aac2413d3 PowerPC64 DT_RELR relative reloc addresses
Section addresses can change between ppc64_elf_size_stubs and
ppc64_elf_build_stubs due to .eh_frame editing.  The idea of stashing
r_offset final addresses calculated in ppc64_elf_size_stubs for use by
ppc64_elf_build_stubs was never a good idea.  Instead, we need to keep
section/offset pairs.

	* elf64-ppc.c (struct ppc_link_hash_table): Delete relr_addr.
	Add relr section/offset array.
	(append_relr_off): Rewrite.  Update all callers.
	(sort_relr): New function.
	(ppc64_elf_size_stubs): Adjust to suit new relative reloc stash.
	(ppc64_elf_build_stubs): Likewise.
2022-03-03 12:47:40 +10:30
GDB Administrator
a8dc389afe Automatic date update in version.in 2022-03-03 00:00:26 +00:00
GDB Administrator
aca6e93ecf Automatic date update in version.in 2022-03-02 00:00:18 +00:00
Nick Clifton
ba0eb22c8b Fix a typo in the previous delta to bfdio.c.
PR 25713
	* bfdio.c (_bfd_real_fopen): Fix typo.
2022-03-01 13:13:42 +00:00
Alan Modra
581c5ba435 Revert "Check thin archive element file size against archive header"
This reverts commit 48e3e6aec8.

	PR 28929
	* archive.c (_bfd_get_elt_at_filepos): Don't check thin archive
	element file size.
2022-03-01 21:56:04 +10:30
Nick Clifton
81c9e0f6c4 Prevent an assertion from being triggered when linking an ARM object file with incorrectly set build attributes.
PR 28848
	PR 28859
	* elf32-arm.c (elf32_arm_merge_eabi_attributes): If the first
	input bfd has a Tag_ABI_HardFP_use set to 3 but does not also have
	TAG_FP_arch set then reset the TAG_ABI_HardFP_use.
2022-03-01 09:51:59 +00:00
GDB Administrator
cb3a9d1b79 Automatic date update in version.in 2022-03-01 00:00:26 +00:00
Torbj?rn Svensson
cb7da2a640 Further correct the handling of long pathnames on Windows hosts.
PR 25713
	* bfdio.c (_bfd_real_fopen): Fix handling of parhs longer than 260
	characters on Windows hosts.
2022-02-28 12:17:33 +00:00
Nick Clifton
eda240cd35 Clarify the wording of the error message when an obsolete configuration is encountered.
PR 28886
	* config.bfd: Update error message for obsolete configurations.
2022-02-28 12:05:30 +00:00
GDB Administrator
85acc25b30 Automatic date update in version.in 2022-02-28 00:00:22 +00:00
GDB Administrator
b275570803 Automatic date update in version.in 2022-02-27 00:00:09 +00:00
GDB Administrator
cc1cf2a604 Automatic date update in version.in 2022-02-26 00:00:07 +00:00
Tsukasa OI
0f94906fba RISC-V: Remove a loop in the ISA parser
Since commit e601909a32 ("RISC-V: Support
to parse the multi-letter prefix in the architecture string.") changed
so that all prefixed extensions are parsed in single
riscv_parse_prefixed_ext call, a "while" loop on riscv_parse_subset
is no longer required.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_parse_subset): Remove unnecessary loop.
2022-02-25 17:05:01 +08:00
GDB Administrator
685c6a8637 Automatic date update in version.in 2022-02-25 00:00:21 +00:00
GDB Administrator
7190ae0d39 Automatic date update in version.in 2022-02-24 00:00:14 +00:00
Patrick O'Neill
e4028336b1 RISC-V: PR28733, add missing extension info to 'unrecognized opcode' error
Currently we report errors as "unrecognized opcode `fence.i'" when the
opcode isn't part of the selected extensions.
This patch expands that error message to include the missing extension
information. For example, now the error message would be "unrecognized
opcode `fence.i', extension `zifencei' required".
If the opcode is not a part of any extension, the error message reverts
to "unrecognized opcode `<op statement>'".

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>

bfd/
	pr 28733
	* elfxx-riscv.c (riscv_multi_subset_supports_ext): New function,
	used to return the extension string for each INSN_CLASS_*.
	* elfxx-riscv.h: Added extern riscv_multi_subset_supports_ext.
gas/
	pr 28733
	* config/tc-riscv.c (struct riscv_ip_error): New structure,
	contains information about errors that occur within the riscv_ip.
	(riscv_ip): Use struct riscv_ip_error to report more detailed errors.
	* testsuite/gas/riscv/c-fld-fsd-fail.l: Updated.
	* testsuite/gas/riscv/march-imply-i2p1-01.: Likewise.
2022-02-23 19:45:52 +08:00
GDB Administrator
b408d7e199 Automatic date update in version.in 2022-02-23 00:00:21 +00:00
Kito Cheng
3a3e333f65 RISC-V: Maintain a string to hold the canonical order
Using dummy entry in riscv_supported_std_ext cause confusing and wrongly
support `b` and `k` extensions.

bfd/
	* elfxx-riscv.c (riscv_supported_std_ext): Drop unsupported
	extensions.
	(riscv_ext_canonical_order): New.
	(riscv_init_ext_order): Use riscv_ext_canonical_order rather
	than riscv_supported_std_ext to compute canonical order.

V2 Changes:

- Use `*ext` rather than `*ext != NULL` for checking is reach end of
  string.
2022-02-22 09:54:09 +08:00
GDB Administrator
fadefdc518 Automatic date update in version.in 2022-02-22 00:00:22 +00:00
Alan Modra
cf53a97bed Re: ld: Support customized output section type
"DO NOT EDIT!" says the comment at the top of bfd-in2.h.  Move the new
type field where it belongs.

	PR ld/28841
	* section.c (struct bfd_section): Add type.  Formatting.
	(BFD_FAKE_SECTION): Formatting.
	* bfd-in2.h: Regenerate.
2022-02-22 09:32:26 +10:30
GDB Administrator
dc5483c989 Automatic date update in version.in 2022-02-21 00:00:19 +00:00
GDB Administrator
d65aab93df Automatic date update in version.in 2022-02-20 00:00:18 +00:00
GDB Administrator
9c192281e2 Automatic date update in version.in 2022-02-19 00:00:25 +00:00
GDB Administrator
c939e96dd6 Automatic date update in version.in 2022-02-18 00:00:23 +00:00
Nick Clifton
36d285b9da Updated Serbian translations for the bfd, gold, ld and opcodes directories 2022-02-17 15:18:59 +00:00