Commit Graph

19331 Commits

Author SHA1 Message Date
GDB Administrator
218bb9dcdb Automatic date update in version.in 2024-06-25 00:00:33 +00:00
Nick Clifton
e13c4e5890 Updated Spanish translations for the bfd and binutils sub-directories 2024-06-24 15:03:22 +01:00
GDB Administrator
18b13d11d3 Automatic date update in version.in 2024-06-24 00:00:29 +00:00
GDB Administrator
b43cf8d3d8 Automatic date update in version.in 2024-06-23 00:00:27 +00:00
GDB Administrator
4c8d6351cc Automatic date update in version.in 2024-06-22 00:00:24 +00:00
Feng Wang
da16a23481 RISC-V: Remove implicit enablement of Zvknha from Zvkn.
Accroding to the Crypto spec, the Zvkned,Zvknhb,Zvkb and Zvkt are
included in the Zvkn.  So the Zvknha should be removed from Zvkn.

bfd/ChangeLog:

	* elfxx-riscv.c: Remove zvknha from zvkn.
2024-06-21 12:56:43 +08:00
GDB Administrator
154960342c Automatic date update in version.in 2024-06-21 00:00:42 +00:00
Alan Modra
56f3903369 Revert "Remove LIBINTL_DEP"
This reverts commit e874cbd387.
The patch was wrong.  LIBINTL_DEP is needed with an in-tree gettext.
2024-06-20 21:15:27 +09:30
Alan Modra
e874cbd387 Remove LIBINTL_DEP
The intl directory in the source no longer exists.  LIBINTL_DEP is
thus always empty.  Remove references to it.

config/
	* gettext-sister.m4: Don't AC_SUBST LIBINTL_DEP.
bfd/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
binutils/
	* Makefile.am (*_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
gas/
	* Makefile.am (as_new_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
gdb/
	* Makefile.in (INTL_DEPS): Don't set or reference.
	* configure: Regenerate.
gdbserver/
	* Makefile.in (INTL_DEPS): Don't set or reference.
gdbsupport/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
gold/
	* Makefile.am (deps_var): Remove LIBINTL_DEP.
	(incremental_dump_DEPENDENCIES, dwp_DEPENDENCIES): Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.am (DEPENDENCIES): Remove LIBINTL_DEP.
	* testsuite/Makefile.in: Regenerate.
gprof/
	* Makefile.am (gprof_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
ld/
	* Makefile.am (ld_new_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
libctf/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
opcodes/
	* configure.ac (BUILD_LIBS): Remove LIBINTL.
	(BUILD_LIB_DEPS): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2024-06-20 18:33:28 +09:30
Xi Ruoyao
b5b05a6e65 LoongArch: TLS IE needs only one dynamic reloc
As the comment in the code says, TLS_IE needs only one dynamic reloc.
But commit b67a17aa7c ("LoongArch: Fix the issue of excessive
relocation generated by GD and IE") has incorrectly allocated the space
for two dynamic relocs, causing libc.so to contain 8 R_LARCH_NONE.

Adjust tlsdesc-dso.d for the offset changes and add two tests to ensure
there are no R_LARCH_NONE with TLS.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-06-20 16:55:24 +08:00
GDB Administrator
b5929e7aa0 Automatic date update in version.in 2024-06-20 00:00:22 +00:00
GDB Administrator
9c39329d1c Automatic date update in version.in 2024-06-19 00:00:24 +00:00
Nelson Chu
c2db2b8a37 RISC-V: Fixed typo from smscrind to smcsrind in riscv_implicit_subsets.
bfd/
	* elfxx-riscv.c (riscv_implicit_subsets): Fixed type from smscrind to
	smcsrind.
gas/
	* testsuite/gas/riscv/march-imply-smcsrind.d: New testcase.  It fails
	without applying this patch.
2024-06-18 16:22:30 +08:00
Hau Hsu
7003edc383 RISC-V: Add SiFive cease extension v1.0
Add SiFive cease extension,
https://sifive.cdn.prismic.io/sifive/767804da-53b2-4893-97d5-b7c030ae0a94_s76mc_core_complex_manual_21G3.pdf

This aligns LLVM:
* https://llvm.org/docs/RISCVUsage.html
* https://github.com/llvm/llvm-project/pull/83896

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_supported_vendor_x_ext): Add support for
	'xsfcease'.
	(riscv_multi_subset_supports): Handle INSN_CLASS_XSFCEASE.
	(riscv_multi_subset_supports_ext): Handle INSN_CLASS_XSFCEASE.

gas/ChangeLog:

	* doc/c-riscv.texi: Updated.
	* testsuite/gas/riscv/march-help.l: Updated.
	* testsuite/gas/riscv/sifive-insns.d: Add test case for 'sf.cease'.
	* testsuite/gas/riscv/sifive-insns.s: Likewise.

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_SF_CEASE, MASK_SF_CEASE): Define match and
	mask encoding for 'sf.cease'.
	* opcode/riscv.h (INSN_CLASS_XSFCEASE): Add new instruction class for
	'xsfcease'.

opcodes/ChangeLog:

    * riscv-opc.c (riscv_opcodes): Add opcode entry for 'sf.cease'.
2024-06-18 15:06:34 +08:00
Gianluca Guida
88729e9616 RISC-V: Support Zacas extension.
https://github.com/riscvarchive/riscv-zacas/releases/tag/v1.0

The Zacas extension introduce compare-and-swap instructions to operate
on 32-bit, 64-bit and 128-bit (RV64 only) data values.

It introduces three new instructions:
  - amocas.w (32-bit CAS)
  - amocas.d (64-bit CAS)
  - amocas.q (128-bit CAS, RV64 only)

Like other AMOs in the A extension, Zacas instructions have '.aq',
'.rl' and '.aqrl' variations.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_implicit_subsets): 'A' implied by 'Zacas'.
	(riscv_supported_std_z_ext): Add 'Zacas' extension.
	(riscv_multi_subset_supports, riscv_multi_subset_supports_ext):
	Handle INSN_CLASS_ZACAS case.

gas/ChangeLog:

	* NEWS: Updated.
	* testsuite/gas/riscv/march-help.l: Updated.
	* testsuite/gas/riscv/zacas-32.d: New test (RV32).
        * testsuite/gas/riscv/zacas-fail-32.d: Likewise.
	* testsuite/gas/riscv/zacas-64.d: New test (RV64).
        * testsuite/gas/riscv/zacas-fail-64.d: Likewise.
	* testsuite/gas/riscv/zacas.s: New test source.
	* testsuite/gas/riscv/zacas-fail.s: Likewise.
	* testsuite/gas/riscv/zacas-fail-32.l: New file.
	* testsuite/gas/riscv/zacas-fail-64.l: Likewise.

include/ChangeLog:

	* include/opcode/riscv.h (INSN_CLASS_ZACAS): New definition.
	* include/opcode/riscv-opc.h (MATCH_AMOCAS_W, MASK_AMOCAS_W)
	(MATCH_AMOCAS_D, MASK_AMOCAS_D, MATCH_AMOCAS_Q, MASK_AMOCAS_Q):
	Likewise.
	(amocas_w, amocas_d, amocas_q): Declare instructions.

opcodes/ChangeLog:

	* riscv-opc.c (match_rs2_rd_even): New function.
	(amocas_w, amocas_d, amocas_q, amocas_w.aq)
	(amocas_d.aq, amocas_q.aq, amocas_w.rl, amocas_d.rl, amocas_q.rl)
	(amocas_w.aqrl, amocas_d.aqrl, amocas_q.aqrl): Add instructions.
2024-06-18 14:35:50 +08:00
GDB Administrator
6a4f078b5b Automatic date update in version.in 2024-06-18 00:00:13 +00:00
Alan Modra
2df6e96709 Error messages emitted during bfd_check_format_matches
Error/warning messages are only printed for the target that
successfully matched, which makes sense for warnings, but not so much
for errors where the errors cause no target to match.  I noticed this
when looking at the pr20520 testcase again with objdump, which just
reports "file format not recognized" omitting the five "SHT_GROUP
section [index n] has no SHF_GROUP sections" messages.  They are
omitted because multiple ELF targets match the object file.  This is
going to be true for all ELF objects due to at least the proper ELF
target and the generic ELF target matching.

	* format.c (print_and_clear_messages): Print messages if all
	targets with messages have exactly the same set of messages.
2024-06-17 15:57:50 +09:30
GDB Administrator
c3d23f753d Automatic date update in version.in 2024-06-17 00:00:33 +00:00
GDB Administrator
28775f62b9 Automatic date update in version.in 2024-06-16 00:00:16 +00:00
GDB Administrator
f2869f51b2 Automatic date update in version.in 2024-06-15 00:00:22 +00:00
H.J. Lu
93548ee191 x86: Add -z isa-level-report=[none|all|needed|used]
Add -z isa-level-report=[none|all|needed|used] to the x86 ELF linker to
report needed and used x86-64 ISA levels.

bfd/

	PR ld/31868
	* elf-linker-x86.h (elf_x86_isa_level_report): New.
	(elf_linker_x86_params): Add isa_level_report.
	* elfxx-x86.c (report_isa_level): New.
	(_bfd_x86_elf_link_setup_gnu_properties): Check
	-z isa-level-report=[none|all|needed|used] to report needed and
	used x86-64 ISA level.

ld/

	PR ld/31868
	* NEWS: Mention -z isa-level-report=[none|all|needed|used].
	* ld.texi: Document -z isa-level-report=[none|all|needed|used].
	* emulparams/elf32_x86_64.sh: Source x86-64-level-report.sh.
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/x86-64-level-report.sh: New file.
	* testsuite/ld-i386/pr31868a.d: Likewise.
	* testsuite/ld-i386/pr31868b.d: Likewise.
	* testsuite/ld-i386/pr31868c.d: Likewise.
	* testsuite/ld-x86-64/pr31868a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr31868a.d: Likewise.
	* testsuite/ld-x86-64/pr31868a.l: Likewise.
	* testsuite/ld-x86-64/pr31868a.s: Likewise.
	* testsuite/ld-x86-64/pr31868b-x32.d: Likewise.
	* testsuite/ld-x86-64/pr31868b.d: Likewise.
	* testsuite/ld-x86-64/pr31868b.l: Likewise.
	* testsuite/ld-x86-64/pr31868b.s: Likewise.
	* testsuite/ld-x86-64/pr31868c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr31868c.d: Likewise.
	* testsuite/ld-x86-64/pr31868c.l: Likewise.
	* testsuite/ld-i386/i386.exp: Run PR ld/31868 tests.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-06-14 13:38:19 -07:00
GDB Administrator
6b19a26ee1 Automatic date update in version.in 2024-06-14 00:00:26 +00:00
Nick Clifton
e8e10743f7 Add --rosegment option to BFD linker to stop the '-z separate-code' from generating two read-only segments.
PR 30907
2024-06-13 15:10:15 +01:00
GDB Administrator
5a011d5b86 Automatic date update in version.in 2024-06-13 00:00:22 +00:00
Jiawei
b7641ae1af RISC-V: Support S[sm]csrind extension csrs.
This patch supports RISC-V Smcsrind/Sscsrind privilege extension csrs.
Reuse csr 'smselect/siselect', 'mireg/sireg' and 'vsiselect,vsireg' csrs
in Smaia/Ssaia extension.

bfd/ChangeLog:

	* elfxx-riscv.c: New extensions.

gas/ChangeLog:

	* NEWS: Updated.
	* config/tc-riscv.c (enum riscv_csr_class): New extensions.
	(riscv_csr_address): Ditto.
	* testsuite/gas/riscv/csr-version-1p10.d: New csrs.
	* testsuite/gas/riscv/csr-version-1p10.l: Ditto.
	* testsuite/gas/riscv/csr-version-1p11.d: Ditto.
	* testsuite/gas/riscv/csr-version-1p11.l: Ditto.
	* testsuite/gas/riscv/csr-version-1p12.d: Ditto.
	* testsuite/gas/riscv/csr-version-1p12.l: Ditto.
	* testsuite/gas/riscv/csr.s: Ditto.
	* testsuite/gas/riscv/march-help.l: New extensions.

include/ChangeLog:

	* opcode/riscv-opc.h (CSR_MIREG2): New csr.
	(CSR_MIREG3): Ditto.
	(CSR_MIREG4): Ditto.
	(CSR_MIREG5): Ditto.
	(CSR_MIREG6): Ditto.
	(CSR_SIREG2): Ditto.
	(CSR_SIREG3): Ditto.
	(CSR_SIREG4): Ditto.
	(CSR_SIREG5): Ditto.
	(CSR_SIREG6): Ditto.
	(CSR_VSIREG2): Ditto.
	(CSR_VSIREG3): Ditto.
	(CSR_VSIREG4): Ditto.
	(CSR_VSIREG5): Ditto.
	(CSR_VSIREG6): Ditto.
	(DECLARE_CSR): Ditto.
2024-06-12 08:47:19 +08:00
GDB Administrator
a3d147a454 Automatic date update in version.in 2024-06-12 00:00:37 +00:00
Alan Modra
b20ab53f81 PR31872, Segfault in objdump (elf_slurp_reloc_table_from_section)
This one was triggered by trying to dump an AMDGPU object.
elf64-amdgcn.c lacks support for objdump relocation handling.

	PR 31872
	* elfcode.h (elf_slurp_reloc_table_from_section): Don't segfault
	on NULL elf_info_to_howto_rel.
2024-06-11 12:43:06 +09:30
GDB Administrator
39071d57ab Automatic date update in version.in 2024-06-11 00:00:10 +00:00
Ilya Leoshkevich
48e63b8753 IBM zSystems: Rewrite l(g)rl @GOTENT to larl for --no-pie
Regtested on s390x-redhat-linux.

Rewriting l(g)rl @GOTENT to larl is unnecessarily guarded by
bfd_link_pic().  There were no use cases for this in the past, but
since recently the Linux Kernel on s390x is compiled with -fPIE
and linked with --no-pie.  Remove the unnecessary bfd_link_pic()
check.

bfd/ChangeLog:

        * elf32-s390.c (elf_s390_relocate_section): Don't check for
	bfd_link_pic() when rewriting lrl@GOTENT to larl.
	(elf_s390_finish_dynamic_symbol): Emit a relative reloc for
	the above case.
        * elf64-s390.c (elf_s390_relocate_section): Don't check for
	bfd_link_pic() when rewriting lgrl@GOTENT to larl.
	(elf_s390_finish_dynamic_symbol): Emit a relative reloc for
	the above case.

ld/ChangeLog:

* testsuite/ld-s390/s390.exp: Hook up the new tests.
        * testsuite/ld-s390/gotreloc_31-no-pie-1.dd: New test.
        * testsuite/ld-s390/gotreloc_64-no-pie-1.dd: New test.
2024-06-10 22:37:06 +02:00
Alan Modra
539c3962fa PR31873, buffer overflow in evax_bfd_print_dst
PR 31873
	* vms-alpha.c (evax_bfd_print_dst): Sanity check len against
	dst_size.
2024-06-10 22:53:11 +09:30
GDB Administrator
4186bc40b6 Automatic date update in version.in 2024-06-10 00:00:23 +00:00
Matthieu Longo
e83746f535 autoupdate: regen after replacing obsolete macros 2024-06-10 08:25:56 +09:30
Matthieu Longo
3dee0baea2 autoupdate: add square brackets around arguments of AC_INIT
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fINIT-2
2024-06-10 08:25:56 +09:30
Matthieu Longo
2cac47f5ba autoupdate: replace obsolete macros AC_AIX, AC_MINIX, and AC_GNU_SOURCE
- AC_AIX, AC_MINIX, and AC_GNU_SOURCE by AC_USE_SYSTEM_EXTENSIONS
  https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fAIX
  https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fMINIX-1
  https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fGNU_005fSOURCE-1
2024-06-10 08:25:55 +09:30
GDB Administrator
2b05f93448 Automatic date update in version.in 2024-06-09 00:00:35 +00:00
GDB Administrator
b56d975cc8 Automatic date update in version.in 2024-06-08 00:00:20 +00:00
Alan Modra
d89cd643c5 Re: Yet another ecoff fuzzed object fix
In commit 6fc018e9e5 I replaced the fdr_ptr csym check against the
header isymMax count with a check against bfd symcount.  In fact, both
checks are needed.  The isymMax check sanity checks accesses against
the external sym array, the symcount one against the internal array.

	* ecoff.c (_bfd_ecoff_slurp_symbol_table): Reinstate fdr_ptr
	csym check against isymMax.
2024-06-07 20:35:12 +09:30
Szabolcs Nagy
961befd693 aarch64: Fix DT_RELR support with discarded sections
In case of discarded sections, via /DISCARD/ or .gnu.linkonce,
relr relocation accounting was wrong.  This broke building linux.

The issue was that the *_relocate_section logic was copied to
record_relr_non_got_relocs to find the relative relocs that can
be packed, however *_relocate_section is not called on sections
that are discarded, while record_relr_non_got_relocs is called
for all input sections. The fix is to filter out the discarded
sections with the same logic that is used to count non-GOT
relocs in *_late_size_sections for local symbols earlier.
Use the discarded_section helper in both cases to clarify the
intent and handle all corner-cases consistently.

GOT relocations are affected too if all sections are discarded
that reference the GOT entry of a particular symbol, however
this can cause unused GOT entries independently of DT_RELR, and
the only difference with DT_RELR is that a relative reloc may be
emitted instead of a R_AARCH64_NONE for the unused GOT entry
which is acceptable. A proper fix would require redoing the GOT
refcounting after we know the discarded sections, see bug 31850.
2024-06-07 08:23:23 +01:00
GDB Administrator
a5631e3da1 Automatic date update in version.in 2024-06-07 00:00:43 +00:00
Nick Clifton
6ba0721931 Updated Spanish translation for the bfd/ directory 2024-06-06 12:10:29 +01:00
Xiao Zeng
0b4595be3f RISC-V: Add support for Zvfbfwma extension
This implements the Zvfbfwma extension, as of version 1.0.
View detailed information in:
<https://github.com/riscv/riscv-isa-manual/blob/main/src/bfloat16.adoc#zvfbfwma---vector-bf16-widening-mul-add>

1 In spec: "Zvfbfwma requires the Zvfbfmin extension and the Zfbfmin extension."
  1.1 In Embedded    Processor: Zvfbfwma -> Zvfbfmin -> Zve32f
  1.2 In Application Processor: Zvfbfwma -> Zvfbfmin -> V
  1.3 In both scenarios, there are: Zvfbfwma -> Zfbfmin

2 Depending on different usage scenarios, the Zvfbfwma extension may
depend on 'V' or 'Zve32f'. This patch only implements dependencies in
scenario of Embedded Processor. This is consistent with the processing
strategy in Zvfbfmin. In scenario of Application Processor, it is
necessary to explicitly indicate the dependent 'V' extension.

For relevant information in gcc, please refer to:
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=38dd4e26e07c6be7cf4d169141ee4f3a03f3a09d>

bfd/ChangeLog:

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

gas/ChangeLog:

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

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_VFWMACCBF16_VF): Define.
	(MASK_VFWMACCBF16_VF): Ditto.
	(MATCH_VFWMACCBF16_VV): Ditto.
	(MASK_VFWMACCBF16_VV): Ditto.
	(DECLARE_INSN): New declarations for Zvfbfwma.
	* opcode/riscv.h (enum riscv_insn_class): Add
	INSN_CLASS_ZVFBFWMA

opcodes/ChangeLog:

	* riscv-opc.c: Add Zvfbfwma instructions.
2024-06-06 16:10:53 +08:00
Xiao Zeng
d9c14a8744 RISC-V: Add support for Zvfbfmin extension
This implements the Zvfbfmin extension, as of version 1.0.
View detailed information in:
<https://github.com/riscv/riscv-isa-manual/blob/main/src/bfloat16.adoc#zvfbfmin---vector-bf16-converts>

Depending on different usage scenarios, the Zvfbfmin extension may
depend on 'V' or 'Zve32f'. This patch only implements dependencies
in scenario of Embedded Processor. In scenario of Application
Processor, it is necessary to explicitly indicate the dependent
'V' extension.

For relevant information in gcc, please refer to:
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1ddf65c5fc6ba7cf5826e1c02c569c923a541c09>

bfd/ChangeLog:

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

gas/ChangeLog:

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

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_VFNCVTBF16_F_F_W): Define.
	(MASK_VFNCVTBF16_F_F_W): Ditto.
	(MATCH_VFWCVTBF16_F_F_V): Ditto.
	(MASK_VFWCVTBF16_F_F_V): Ditto.
	(DECLARE_INSN): New declarations for Zvfbfmin.
	* opcode/riscv.h (enum riscv_insn_class): Add
	INSN_CLASS_ZVFBFMIN

opcodes/ChangeLog:

	* riscv-opc.c: Add Zvfbfmin instructions.
2024-06-06 16:10:51 +08:00
Xiao Zeng
af38c6367f RISC-V: Add support for Zfbfmin extension
This implements the Zfbfmin extension, as of version 1.0.

View detailed information in:
<https://github.com/riscv/riscv-isa-manual/blob/main/src/bfloat16.adoc#zfbfmin---scalar-bf16-converts>

1 The Zfbfmin extension depend on 'F', and the FLH, FSH, FMV.X.H, and
  FMV.H.X instructions as defined in the Zfh extension.

2 The Zfhmin extension includes the following instructions from the Zfh
  extension: FLH, FSH, FMV.X.H, FMV.H.X... View detailed information in:
  <https://github.com/riscv/riscv-isa-manual/blob/main/src/zfh.adoc>

3 Zfhmin extension depend on 'F'.

4 Simply put, just make Zfbfmin dependent on Zfhmin.

Perhaps in the future, we could propose making the FLH, FSH, FMV.X.H, and
FMV.H.X instructions an independent extension to achieve precise dependency
relationships for the Zfbfmin.

5 For relevant information in gcc, please refer to:
  <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=35224ead63732a3550ba4b1332c06e9dc7999c31>

bfd/ChangeLog:

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

gas/ChangeLog:

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

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_FCVT_BF16_S): Define.
	(MASK_FCVT_BF16_S): Ditto.
	(MATCH_FCVT_S_BF16): Ditto.
	(MASK_FCVT_S_BF16): Ditto.
	(DECLARE_INSN): New declarations for Zfbfmin.
	* opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZFBFMIN.

opcodes/ChangeLog:

	* riscv-opc.c: Add Zfbfmin instructions.
2024-06-06 16:10:48 +08:00
GDB Administrator
761ed07709 Automatic date update in version.in 2024-06-06 00:00:27 +00:00
Nick Clifton
2db414c36b Fix illegal memory access when bfd_get_section_contents is called with a NULL section pointer.
PR 31843
2024-06-05 13:30:27 +01:00
Mary Bennett
29de80758f RISC-V: Add support for XCVmem 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 `xcvmem`
	instruction class.
	(riscv_multi_subset_supports_ext): Likewise.

gas/ChangeLog:
	* doc/c-riscv.texi: Note XCVmem as an additional ISA extension
	for CORE-V.
	* testsuite/gas/riscv/cv-mem-fail-march.d: New test.
	* testsuite/gas/riscv/cv-mem-fail-march.l: New test.
	* testsuite/gas/riscv/cv-mem-fail-march.s: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-01.d: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-01.l: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-01.s: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-02.d: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-02.l: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-02.s: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-03.d: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-03.l: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-03.s: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-04.d: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-04.l: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-04.s: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-05.d: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-05.l: New test.
	* testsuite/gas/riscv/cv-mem-fail-operand-05.s: New test.
	* testsuite/gas/riscv/cv-mem-lbpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lbpost.s: New test.
	* testsuite/gas/riscv/cv-mem-lbrr.d: New test.
	* testsuite/gas/riscv/cv-mem-lbrr.s: New test.
	* testsuite/gas/riscv/cv-mem-lbrrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lbrrpost.s: New test.
	* testsuite/gas/riscv/cv-mem-lbupost.d: New test.
	* testsuite/gas/riscv/cv-mem-lbupost.s: New test.
	* testsuite/gas/riscv/cv-mem-lburr.d: New test.
	* testsuite/gas/riscv/cv-mem-lburr.s: New test.
	* testsuite/gas/riscv/cv-mem-lburrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lburrpost.s: New test.
	* testsuite/gas/riscv/cv-mem-lhpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lhpost.s: New test.
	* testsuite/gas/riscv/cv-mem-lhrr.d: New test.
	* testsuite/gas/riscv/cv-mem-lhrr.s: New test.
	* testsuite/gas/riscv/cv-mem-lhrrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lhrrpost.s: New test.
	* testsuite/gas/riscv/cv-mem-lhupost.d: New test.
	* testsuite/gas/riscv/cv-mem-lhupost.s: New test.
	* testsuite/gas/riscv/cv-mem-lhurr.d: New test.
	* testsuite/gas/riscv/cv-mem-lhurr.s: New test.
	* testsuite/gas/riscv/cv-mem-lhurrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lhurrpost.s: New test.
	* testsuite/gas/riscv/cv-mem-lwpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lwpost.s: New test.
	* testsuite/gas/riscv/cv-mem-lwrr.d: New test.
	* testsuite/gas/riscv/cv-mem-lwrr.s: New test.
	* testsuite/gas/riscv/cv-mem-lwrrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-lwrrpost.s: New test.
	* testsuite/gas/riscv/cv-mem-sbpost.d: New test.
	* testsuite/gas/riscv/cv-mem-sbpost.s: New test.
	* testsuite/gas/riscv/cv-mem-sbrr.d: New test.
	* testsuite/gas/riscv/cv-mem-sbrr.s: New test.
	* testsuite/gas/riscv/cv-mem-sbrrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-sbrrpost.s: New test.
	* testsuite/gas/riscv/cv-mem-shpost.d: New test.
	* testsuite/gas/riscv/cv-mem-shpost.s: New test.
	* testsuite/gas/riscv/cv-mem-shrr.d: New test.
	* testsuite/gas/riscv/cv-mem-shrr.s: New test.
	* testsuite/gas/riscv/cv-mem-shrrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-shrrpost.s: New test.
	* testsuite/gas/riscv/cv-mem-swpost.d: New test.
	* testsuite/gas/riscv/cv-mem-swpost.s: New test.
	* testsuite/gas/riscv/cv-mem-swrr.d: New test.
	* testsuite/gas/riscv/cv-mem-swrr.s: New test.
	* testsuite/gas/riscv/cv-mem-swrrpost.d: New test.
	* testsuite/gas/riscv/cv-mem-swrrpost.s: New test.
	* testsuite/gas/riscv/march-help.l: Add xcvmem string.

include/ChangeLog:

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

opcodes/ChangeLog:

	* riscv-opc.c: Add XCVmem instructions.
2024-06-05 18:09:27 +08:00
Mary Bennett
b0f266f38b RISC-V: Add support for XCVbi 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>
  Nazareno Bruschi <nazareno.bruschi@embecosm.com>
  Lin Sinan

include/ChangeLog:

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

gas/ChangeLog:

	* config/tc-riscv.c (validate_riscv_insn): Add the necessary
	operands for the extension.
	(riscv_ip): Likewise.
	* doc/c-riscv.texi: Note XCVbi as an additional ISA extension
	for CORE-V.
	* testsuite/gas/riscv/cv-bi-beqimm.d: New test.
	* testsuite/gas/riscv/cv-bi-beqimm.s: New test.
	* testsuite/gas/riscv/cv-bi-bneimm.d: New test.
	* testsuite/gas/riscv/cv-bi-bneimm.s: New test.
	* testsuite/gas/riscv/cv-bi-fail-march.d: New test.
	* testsuite/gas/riscv/cv-bi-fail-march.l: New test.
	* testsuite/gas/riscv/cv-bi-fail-march.s: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-01.d: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-01.l: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-01.s: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-02.d: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-02.l: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-02.s: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-03.d: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-03.l: New test.
	* testsuite/gas/riscv/cv-bi-fail-operand-03.s: New test.
	* testsuite/gas/riscv/march-help.l: Add xcvbi string.

include/ChangeLog:

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

opcodes/ChangeLog:

	* riscv-dis.c (print_insn_args): Add disassembly for new operand.
	* riscv-opc.c: Add XCVbi instructions.
2024-06-05 18:09:22 +08:00
Mary Bennett
940da069b4 RISC-V: Add support for XCVelw 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 `xcvelw` instruction
	class.
	(riscv_multi_subset_supports_ext): Likewise.

gas/ChangeLog:

	* doc/c-riscv.texi: Note XCVelw as an additional ISA extension
	for CORE-V.
	* testsuite/gas/riscv/cv-elw-fail.d: New test.
	* testsuite/gas/riscv/cv-elw-fail.l: New test.
	* testsuite/gas/riscv/cv-elw-fail.s: New test.
	* testsuite/gas/riscv/cv-elw-fail-march.d: New test.
	* testsuite/gas/riscv/cv-elw-fail-march.l: New test.
	* testsuite/gas/riscv/cv-elw-fail-march.s: New test.
	* testsuite/gas/riscv/cv-elw-pass.d: New test.
	* testsuite/gas/riscv/cv-elw-pass.s: New test.
	* testsuite/gas/riscv/march-help.l: Add xcvelw string.

opcodes/ChangeLog:

	* riscv-opc.c: (riscv_opcode) Add event load instructions.

include/ChangeLog:

	* opcode/riscv-opc.h: Add corresponding MATCH and MASK
	instruction opcode macros.
	* opcode/riscv.h (riscv_insn_class): Add INSN_CLASS_XCVELW.
2024-06-05 18:09:09 +08:00
GDB Administrator
7b9cfd7f3d Automatic date update in version.in 2024-06-05 00:00:21 +00:00
mengqinggang
5f4fa40e4d LoongArch: Make align symbol be in same section with alignment directive
R_LARCH_ALIGN (psABI v2.30) requires a symbol index. The symbol is only
created at the first time to handle alignment directive. This means that
all other sections may use this symbol. If the section of this symbol is
discarded, there may be problems. Search it in its own section.

Remove elf_backend_data.is_rela_normal() function added at commit daeda14191.

Co-authored-by: Jinyang He <hejinyang@loongson.cn>
Reported-by: WANG Xuerui <git@xen0n.name>
Link: https://lore.kernel.org/loongarch/2abbb633-a10e-71cc-a5e1-4d9e39074066@loongson.cn/T/#t
2024-06-04 19:47:20 +08:00
GDB Administrator
d806bf43d0 Automatic date update in version.in 2024-06-04 00:00:27 +00:00
GDB Administrator
ad280e8ef7 Automatic date update in version.in 2024-06-03 00:00:18 +00:00
GDB Administrator
89bd22ef5b Automatic date update in version.in 2024-06-02 00:00:12 +00:00
GDB Administrator
4635b42ac7 Automatic date update in version.in 2024-06-01 00:00:17 +00:00
Szabolcs Nagy
a71d876801 aarch64: Add DT_RELR support
The logic to decide if an input relocation for a symbol becomes a
particular kind of output relocation is one of the hard to maintain
parts of the bfd ld backend, since it is partially repeated across

 elfNN_aarch64_check_relocs (where dynamic relocations are counted per
 symbol and input section),

 elfNN_aarch64_late_size_sections (where relocation sections are sized
 and GOT offsets assigned),

 elfNN_aarch64_relocate_section (where most relocations are applied and
 output to a relocation section),

 elfNN_aarch64_finish_dynamic_symbol (where some of the GOT
 relocations are applied and output).

The DT_RELR support adds another layer to this complexity: after the
output relocation sections are sized, so all dynamic relocations are
accounted (in elfNN_aarch64_late_size_sections), we scan the symbols
and input relocations again to decide which ones become relative
relocations that can be packed. The sizes of the relocation sections
are updated accordingly. This logic must be consistent with the code
that applies the relocs later so each relative relocation is emitted
exactly once: either in .rela.* or packed in .relr.dyn.

Sizing of .relr.dyn is done via elfNN_aarch64_size_relative_relocs that
may be called repeatedly whenever the layout changes since an address
change can affect the size of the packed format. Then the final content
is emitted in elfNN_aarch64_finish_relative_relocs, that is called
after the layout is final and before relocations are applied and
emitted. These hooks are only called if DT_RELR is enabled.

We only pack relative relocs that are known to be aligned in the output
during .relr.dyn sizing, the potentially unaligned relative relocs are
emitted normally (in .rela.*, not packed), because the format requires
aligned addresses.
2024-05-31 09:47:50 +01:00
GDB Administrator
6f69575237 Automatic date update in version.in 2024-05-31 00:00:23 +00:00
GDB Administrator
2c37ce86c1 Automatic date update in version.in 2024-05-30 00:00:14 +00:00
GDB Administrator
5a44fd84de Automatic date update in version.in 2024-05-29 00:00:15 +00:00
Nick Clifton
8406f84253 Updated Spanish translation for the BFD sub-directory. 2024-05-28 14:48:08 +01:00
GDB Administrator
78ba903374 Automatic date update in version.in 2024-05-28 00:00:20 +00:00
Nelson Chu
e8c2682572 RISC-V: Fixed overwritten IRELATIVE relocs in the .rel.iplt for data reloc.
This was originally reported by Hau Hsu <hau.hsu@sifive.com>.

Similar to commit 51a8a7c2e3

We shouldn't use riscv_elf_append_rela to add dynamic relocs into .rela.iplt
in the riscv_elf_relocate_section when handling ifunc data reloc R_RISCV_32/64.
This just like what did in the riscv_elf_finish_dynamic_symbol.

bfd/
	* elfnn-riscv.c (riscv_elf_relocate_section): We shouldn't use
	riscv_elf_append_rela to add dynamic relocs into .rela.iplt in the
	riscv_elf_relocate_section when handling ifunc data reloc.
ld/
	* testsuite/ld-riscv-elf/ifunc-overwrite.s: Updated and renamed.
	* testsuite/ld-riscv-elf/ifunc-overwrite-exe.rd: Likewise.
	* testsuite/ld-riscv-elf/ifunc-overwrite-pic.rd: Likewise.
	* testsuite/ld-riscv-elf/ifunc-overwrite-pie.rd: Likewise.
	* testsuite/ld-riscv-elf/ifunc-overwrite.d: Renamed.
2024-05-28 01:38:26 +08:00
Nelson Chu
1d7a877a0f RISC-V: Segment fault for kernel purgatory when linking.
This was originally reported by Ard Biesheuvel <ardb@kernel.org>.

The followings are reproduce steps,
https://lore.kernel.org/all/202404260640.9GQVTmrw-lkp@intel.com/T/#u

The segment fault happens in the riscv_elf_finish_dynamic_sections when the
output got section is an ABS.  Refer to MIPS code, they added an extra
bfd_is_abs_section check to avoid ABS got, so this seems the right and easier
way to go in the short-term.

bfd/
	* elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Set sh_entsize
	and fill the got entries only when the got isn't an ABS section, and
	the size of got is larger than zero.  The similar goes for gotplt,
	except we already reported error when the gotplt is an ABS.
2024-05-28 01:38:17 +08:00
mengqinggang
6f779908fd LoongArch: Fix relaxation overflow caused by ld -z separate-code
ld -z separate-code let .text and .rodata in two different but read only
segment. If the symbol and pc in two segment, the offset from pc to
symbol need to consider segment alignment.

Add a function 'loongarch_two_sections_in_same_segment' to determine
whether two sections are in the same segment.
2024-05-27 17:41:04 +08:00
GDB Administrator
4250085217 Automatic date update in version.in 2024-05-27 00:00:07 +00:00
GDB Administrator
3a624d9f1c Automatic date update in version.in 2024-05-26 00:00:21 +00:00
GDB Administrator
7870026f97 Automatic date update in version.in 2024-05-25 00:00:20 +00:00
GDB Administrator
78726a8b7c Automatic date update in version.in 2024-05-24 00:00:23 +00:00
GDB Administrator
fc12b44ec0 Automatic date update in version.in 2024-05-23 00:00:19 +00:00
GDB Administrator
92f59183ab Automatic date update in version.in 2024-05-22 00:00:12 +00:00
GDB Administrator
05887e360a Automatic date update in version.in 2024-05-21 00:00:25 +00:00
GDB Administrator
fe9f9ff5a0 Automatic date update in version.in 2024-05-20 00:00:26 +00:00
GDB Administrator
84f7f89407 Automatic date update in version.in 2024-05-19 00:00:15 +00:00
GDB Administrator
f74ba96bb0 Automatic date update in version.in 2024-05-18 00:00:20 +00:00
Indu Bhagat
7922c42688 bfd: sframe: minor code adjustments and fix typos
bfd/
	* elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Use local
	variable.
	(_bfd_x86_elf_size_dynamic_sections): Fix typos.
2024-05-17 11:24:28 -07:00
GDB Administrator
d7218dbb20 Automatic date update in version.in 2024-05-17 00:00:26 +00:00
GDB Administrator
52cad89678 Automatic date update in version.in 2024-05-16 00:00:19 +00:00
GDB Administrator
27f4c4bd19 Automatic date update in version.in 2024-05-15 00:00:19 +00:00
Pali Roh?r
4ac16d6607 Improve objdump -p output of PE Import and Export Tables
PR 31738
2024-05-14 16:50:32 +01:00
Richard Earnshaw
71afdf2e26 arm: remove Maverick support from BFD.
Remove the handling of Maverick from BFD.  Where appropriate we handle
legacy code by mapping ep9312 onto Armv4t.
2024-05-14 10:56:58 +01:00
GDB Administrator
a2db92ea31 Automatic date update in version.in 2024-05-14 00:00:14 +00:00
GDB Administrator
7143ed1205 Automatic date update in version.in 2024-05-13 00:00:15 +00:00
GDB Administrator
52b38954b2 Automatic date update in version.in 2024-05-12 00:00:10 +00:00
GDB Administrator
353f6a9bd1 Automatic date update in version.in 2024-05-11 00:00:07 +00:00
GDB Administrator
65924bda46 Automatic date update in version.in 2024-05-10 00:00:16 +00:00
GDB Administrator
46b6ba96d0 Automatic date update in version.in 2024-05-09 00:00:16 +00:00
Nick Clifton
43bb6c0e08 Fix RELOC_FOR_GLOBAL_SYMBOLS macro so that it can cope with user defined symbols that start with __wrap_.
PR 31710
2024-05-08 13:42:22 +01:00
Nelson Chu
c144f63833 RISC-V: Support B, Zaamo and Zalrsc extensions.
* https://github.com/riscv/riscv-b/tags
Added standard B extension back, which implies Zba, Zbb and Zbs extensions.

* https://github.com/riscv/riscv-zaamo-zalrsc/tags
Splited standard A extension into two new extensions, Zaamo and Zalrsc.
The A extension implies Zaamo and Zalrsc extensions.

Not sure if we need to do the similar check as i and zicsr/zifencei.

Passed riscv[32|64]-[elf/linux] binutils testcases.

bfd/
	* elfxx-riscv.c (riscv_implicit_subsets): Added imply rules
	for A and B extensions.  The A implies Zaamo and Zalrsc, the
	B implies Zba, Zbb and Zbs.
	(riscv_supported_std_ext): Supported B extension with v1.0.
	(riscv_supported_std_z_ext): Supported Zaamo and Zalrsc with v1.0.
	(riscv_multi_subset_supports, riscv_multi_subset_supports_ext): Updated.
include/
	* opcode/riscv.h (riscv_insn_class): Removed INSN_CLASS_A, Added
	INSN_CLASS_ZAAMO and INSN_CLASS_ZALRSC.
opcodes/
	* riscv-opc.c (riscv_opcodes): Splited standard A extension into two
	new extensions, Zaamo and Zalrsc.
gas/
	* testsuite/gas/riscv/march-imply-a.d: New testcase.
	* testsuite/gas/riscv/march-imply-b.d: New testcase.
	* testsuite/gas/riscv/attribute-01.d: Updated.
	* testsuite/gas/riscv/attribute-02.d: Updated.
	* testsuite/gas/riscv/attribute-03.d: Updated.
	* testsuite/gas/riscv/attribute-04.d: Updated.
	* testsuite/gas/riscv/attribute-05.d: Updated.
	* testsuite/gas/riscv/attribute-10.d: Updated.
	* testsuite/gas/riscv/mapping-symbols.d: Updated.
	* testsuite/gas/riscv/march-imply-g.d: Updated.
	* testsuite/gas/riscv/march-imply-unsupported.d: Updated.
	* testsuite/gas/riscv/march-ok-reorder.d: Updated.
ld/
	* testsuite/ld-riscv-elf/attr-merge-arch-01.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-arch-03.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: Updated.
2024-05-08 12:34:58 +08:00
GDB Administrator
f0dbbf5401 Automatic date update in version.in 2024-05-08 00:00:17 +00:00
GDB Administrator
cdf5362f56 Automatic date update in version.in 2024-05-07 00:00:21 +00:00
GDB Administrator
f4c1c984bf Automatic date update in version.in 2024-05-06 00:00:15 +00:00
GDB Administrator
bf79d8caea Automatic date update in version.in 2024-05-05 00:00:13 +00:00
Alan Modra
c7a1fe2286 bus error with fuzzed archive element
* libbfd.c (bfd_mmap_local): Sanity check rsize against actual
	file offset and size, not an archive element offset and size.
2024-05-04 19:20:24 +09:30
GDB Administrator
f4b228ee68 Automatic date update in version.in 2024-05-04 00:00:12 +00:00
GDB Administrator
84a069db67 Automatic date update in version.in 2024-05-03 00:00:18 +00:00
GDB Administrator
75d933919d Automatic date update in version.in 2024-05-02 00:00:10 +00:00
GDB Administrator
7320840f19 Automatic date update in version.in 2024-05-01 00:00:19 +00:00
Nelson Chu
7bd696ef49 RISC-V: PR29823, defined the missing elf_backend_obj_attrs_handle_unknown.
bfd/
	PR 29823
	* elfnn-riscv.c (riscv_elf_obj_attrs_handle_unknown): New function.
	(elf_backend_obj_attrs_handle_unknown): Defined to
	riscv_elf_obj_attrs_handle_unknown.
2024-04-30 13:45:04 +08:00
GDB Administrator
a75d04db22 Automatic date update in version.in 2024-04-30 00:00:23 +00:00
Nick Clifton
d1765f5db3 Fix initiali state of DWARF v5 line number table in BFD library
PR 30783
2024-04-29 10:04:53 +01:00
Nick Clifton
679ad6e126 Fix building Loongarch BFD with a 32-bit compiler 2024-04-29 09:02:43 +01:00
GDB Administrator
e5d6ff3812 Automatic date update in version.in 2024-04-29 00:00:13 +00:00
GDB Administrator
3f3014cb00 Automatic date update in version.in 2024-04-28 00:00:07 +00:00
GDB Administrator
94f7532ed2 Automatic date update in version.in 2024-04-27 00:00:09 +00:00
GDB Administrator
cd0dbe7677 Automatic date update in version.in 2024-04-26 00:00:23 +00:00
Lulu Cai
66156bae7a LoongArch: Add bad static relocation check and output more information to user
Absolute address symbols cannot be used with -shared.
We output more information to the user than just BFD_ASSETR.
2024-04-25 09:21:26 +08:00
Lulu Cai
b221bff7c7 LoongArch: The symbol got type can only be obtained after initialization
When scanning relocations and determining whether TLS type transition is
possible, it will try to obtain the symbol got type. If the symbol got
type record has not yet been allocated space and initialized, it will
cause ld to crash. So when uninitialized, the symbol is set to GOT_UNKNOWN.
2024-04-25 09:21:19 +08:00
GDB Administrator
59462de443 Automatic date update in version.in 2024-04-25 00:00:13 +00:00
GDB Administrator
d65decae83 Automatic date update in version.in 2024-04-24 00:00:07 +00:00
Olivier Hainque
9b441c415c bfd: Remove duplicate word in elf-vxworks.c
PR ld/31652
	* elf-vxworks.c  (elf_vxworks_emit_relocs): Drop duplicate word.
2024-04-23 08:53:42 -07:00
Alan Modra
e79ee36b5a PR31667, objcopy/strip corrupts solaris binaries
Using want_p_paddr_set_to_zero in commit 45d92439ae was wrong.  Even
solaris targets don't have want_p_paddr_set_to_zero, but we should
handle them at least somewhat reasonably.

	PR 31667
	* elf.c (IS_SECTION_IN_INPUT_SEGMENT): Remove bed arg, add
	paddr_valid.  Don't use bed->want_p_paddr_set_to_zero.
	(INCLUDE_SECTION_IN_SEGMENT): Likewise.
	(rewrite_elf_program_header): Adjust to suit.
2024-04-23 22:07:04 +09:30
Alan Modra
ef1c830f00 ignore some symbols in elf.c:swap_out_syms
The reason behind this patch was noticing that generic ELF targets
fail to remove "bar" in the recently committed ld-elf/undefweak-1
test.  (Despite that, those targets pass the test due to it being too
strict when matching symbols.  "bar" gets turned into a local weak
defined absolute symbol.)

swap_out_syms currently drops local section syms that are defined in
discarded sections.  Extend that to also drop other symbols in
discarded sections too, even global symbols.  The linker goes to quite
a lot of effort to ensure globals in discarded section take a
definition from the kept linkonce or comdat group section.  So the
global sym change should only affect cases where something is quite
wrong about the set of linkonce or comdat group sections.  However
that change to elf_map_symbols meant we dropped _DYNAMIC_LINK /
_DYNAMIC_LINKING for mips, a global absolute symbol given STT_SECTION
type for some reason.  That problem is fixed by reverting the pr14493
change which is no longer needed due to a) BSF_SECTION_SYM_USED on
x86, and b) fixing objcopy to use copy_private_symbol_data.

bfd/
	PR 14493
	* elf.c (ignore_sym): Rename from ignore_section_sym.  Return
	true for any symbol without a section or in a discarded section.
	Revert pr14493 change.
	(elf_map_symbols): Tidy.  Use ignore_sym on all symbols.
	(swap_out_syms): Tidy.
ld/
	* testsuite/ld-elf/undefweak-1.rd: Match any "bar".
2024-04-23 22:07:00 +09:30
Alan Modra
6705e14a99 copy_private_symbol_data
bfd_copy_private_symbol_data is a bfd function that appeared in
commit 89665c8562 a long time ago, but seemingly wasn't used
anywhere until Jan added it to gas/symbols.c in commit 6a2b6326c2.

The function is used to modify ELF symbol st_shndx for symbols defined
in odd sections like .symtab, so that they get the corresponding
section st_shndx in an output file.  This patch fixes some bitrot in
the function.  After commit c03551323c which introduced
output_elf_obj_tdata, elf_strtab_sec and elf_shstrtab_sec will
segfault if used on an input bfd.

	PR 14493
	* elf.c (_bfd_elf_copy_private_symbol_data): Don't use
	elf_strtab_sec and elf_shstrtab_sec.
2024-04-23 11:19:35 +09:30
GDB Administrator
5b4c41267f Automatic date update in version.in 2024-04-23 00:00:13 +00:00
GDB Administrator
80fa407f9f Automatic date update in version.in 2024-04-22 00:00:10 +00:00
GDB Administrator
7e9ef24e4a Automatic date update in version.in 2024-04-21 00:00:08 +00:00
GDB Administrator
3716307682 Automatic date update in version.in 2024-04-20 00:00:13 +00:00
Alan Modra
9cf3c87e16 Re: elf: Strip unreferenced weak undefined symbols
PR ld/31652
	* elflink.c (_bfd_elf_link_output_relocs): Don't segfault
	on NULL rel_hash.
2024-04-19 16:48:03 +09:30
H.J. Lu
eebad48efe elf: Strip unreferenced weak undefined symbols
Linker will resolve an undefined symbol only if it is referenced by
relocation.  Unreferenced weak undefined symbols serve no purpose.
Weak undefined symbols appear in the dynamic symbol table only when they
are referenced by dynamic relocation.  Mark symbols with relocation and
strip undefined weak symbols if they don't have relocation and aren't
in the dynamic symbol table.

bfd/

	PR ld/31652
	* elf-bfd.h (elf_link_hash_entry): Add has_reloc.
	* elf-vxworks.c (elf_vxworks_emit_relocs): Set has_reloc.
	* elflink.c (_bfd_elf_link_output_relocs): Likewise.
	(elf_link_output_extsym): Strip undefined weak symbols if they
	don't have relocation and aren't in the dynamic symbol table.

ld/

	PR ld/31652
	* testsuite/ld-elf/elf.exp: Run undefweak tests.
	* testsuite/ld-elf/undefweak-1.rd: New file.
	* testsuite/ld-elf/undefweak-1a.s: Likewise.
	* testsuite/ld-elf/undefweak-1b.s: Likewise.
	* testsuite/ld-x86-64/weakundef-1.nd: Likewise.
	* testsuite/ld-x86-64/weakundef-1a.s: Likewise.
	* testsuite/ld-x86-64/weakundef-1b.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run undefweak tests.
2024-04-18 19:17:17 -07:00
Alan Modra
2304772225 memory leak in bfd/dwarf2.c
* dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free
	dwarf_addr_buffer and dwarf_str_offsets_buffer.
2024-04-19 10:00:57 +09:30
GDB Administrator
eae4098321 Automatic date update in version.in 2024-04-19 00:00:11 +00:00
Nick Clifton
31d5afc19d HPPA64 linker: Do not force the generation of DT_FLAGS for Linux targets.
PR 30743
2024-04-18 13:24:42 +01:00
Alan Modra
ebf1867135 Re: Fix address violations when reading corrupt VMS records
Fixes error reports about the length of EEOM records produced by gas.

	PR 21618
	* vms-alpha.c (evax_bfd_print_emh): Don't read subtyp if short
	record.  Consolidate error messages.
	(evax_bfd_print_eeom): Allow length 10 record.
2024-04-18 10:31:59 +09:30
Alan Modra
ee19a4725c alpha_vms_get_section_contents vs. fuzzed files
This patch is in response to an oss-fuzz report regarding
use-of-uninitialized-value in bfd_is_section_compressed_info from
section contents provided by alpha_vms_get_section_contents.  That
hole is covered by using bfd_zalloc rather than bfd_alloc.

The rest of the patch is mostly a tidy.  In a function returning
section contents, I tend to prefer a test on the section properties
over a test on file properties.  That's why I've changed the file
flags test to one on section filepos and flags before calling
_bfd_generic_get_section_contents.  Also, fuzzed objects can easily
have sections with file backing in relocatable objects, or sections
without file backing in images.  Possible confusion is avoided by
testing each section.

Note that we are always going to run into out-of-memory with fuzzed
alpha-vms object files due to sections with contents via ETIR records.
eg. ETIR__C_STO_IMMR stores a number of bytes repeatedly, with a
32-bit repeat count.  So section contents can be very large from a
relatively small file.  I'm inclined to think that an out-of-memory
error is fine for such files.

	* vms-alpha.c (alpha_vms_get_section_contents): Handle sections
	with non-zero filepos or without SEC_HAS_CONTENTS via
	_bfd_generic_get_section_contents.  Zero memory allocated for
	sections filled by ETIR records.
2024-04-18 10:31:59 +09:30
GDB Administrator
1c8102d17f Automatic date update in version.in 2024-04-18 00:00:32 +00:00
H.J. Lu
c2fbf57864 elf: Skip the archive if the symbol isn't referenced
Also skip the archive if the symbol isn't referenced by a regular object.

bfd/

	PR ld/31644
	* elflink.c (elf_link_add_archive_symbols): Also skip the archive
	if the symbol isn't referenced by a regular object.

ld/

	PR ld/31644
	* testsuite/ld-plugin/lto.exp: Run PR ld/31644 tests.
	* testsuite/ld-plugin/pr31644a.c: New test.
	* testsuite/ld-plugin/pr31644b.c: Likewise.
	* testsuite/ld-plugin/pr31644c.c: Likewise.
2024-04-16 17:45:23 -07:00
GDB Administrator
79484e9566 Automatic date update in version.in 2024-04-17 00:00:23 +00:00
Alan Modra
f6a18d1f55 ARC e_flags vs. objcopy
While the patch that Nick reverted in commit 3f6a060c75 was in the
source, "FAIL: objcopy executable (pr25662)" was seen on ARC.  The
failure was triggered by the .ARC.attributes section being removed by
the linker script.  When a file lacking this section is copied by
objcopy, e_flags from the input is copied to the output (in this case
the value 0x406), but arc_elf_final_write_processing then logical-ors
in 0x300 when Tag_ARC_ABI_osver is not found.

	* elf32-arc.c (arc_elf_final_write_processing): Don't ignore
	existing e_flags for objcopy.
2024-04-17 09:25:15 +09:30
Tom Tromey
20bf7711bc Avoid cache race in bfd_check_format_matches
Running the gdb test suite with the thread sanitizer enabled shows a
race when bfd_check_format_matches and bfd_cache_close_all are called
simultaneously on different threads.

This patch fixes this race by having bfd_check_format_matches
temporarily remove the BFD from the file descriptor cache -- leaving
it open while format-checking proceeds.

In this setup, the BFD client is responsible for closing the BFD again
on the "checking" thread, should that be desired.  gdb does this by
calling bfd_cache_close in the relevant worker thread.

An earlier version of this patch omitted the "possibly_cached" helper
function.  However, this ran into crashes in the binutils test suite
involving the archive-checking abort in bfd_cache_lookup_worker.  I do
not understand the purpose of this check, so I've simply had the new
function work around it.  I couldn't find any comments explaining this
situation, either.  I suspect that there may still be races related to
this case, but I don't think I have access to the platforms where gdb
deals with archives.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31264
2024-04-16 14:02:15 -06:00
Tom Tromey
bacc61fd3e Thread-safety improvements for bfd_check_format_matches
A gdb bug found that bfd_check_format_matches has some data races when
called from multiple threads.

In particular, it changes the BFD error handler, which is a global.
It also has a local static variable ("in_check_format") that is used
for recursion detection.  And, finally, it may emit warnings to the
per-xvec warning array, which is a global.

This patch removes all the races here.

The first part of patch is to change _bfd_error_handler to directly
handle the needs of bfd_check_format_matches.  This way, the error
handler does not need to be changed.

This change lets us use the new per-thread global
(error_handler_messages, replacing error_handler_bfd) to also remove
the need for in_check_format -- a single variable suffices.

Finally, the global per-xvec array is replaced with a new type that
holds the error messages.  The outermost such type is stack-allocated
in bfd_check_format_matches.

I tested this using the binutils test suite.  I also built gdb with
thread sanitizer and ran the test case that was noted as failing.
Finally, Alan sent me the test file that caused the addition of the
xvec warning code in the first place, and I confirmed that "nm-new"
has the same behavior on this file both before and after this patch.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31264
Co-Authored-By: Alan Modra <amodra@gmail.com>
2024-04-16 14:01:43 -06:00
Nick Clifton
b6fc194038 Fix test for sections with different VMA<->LMA relationships so that it only applies to allocated sections, and only sections in the same segment are checked.
PR 31450
2024-04-16 17:54:13 +01:00
Simon Cook
ab0a395b54 Remove debug printout from 9dd9181427 2024-04-16 11:59:41 +01:00
GDB Administrator
bc69768ab6 Automatic date update in version.in 2024-04-16 00:00:13 +00:00
Nick Clifton
9dd9181427 Remove dependency upon shlwapi library when building BFD for Windows/MinGW environments.
PR 31527
2024-04-15 16:42:15 +01:00
Vijay Shankar
ccbf42ec88 When mapping sections to segments ensure that we do not add sections whose VMA->LMA relationship does not match the relationship of earlier sections in the segment.
PR 31540
2024-04-15 16:27:21 +01:00
Lulu Cai
5966e2eb3f LoongArch: ld:Report an error when seeing an unrecognized relocation
If we generate an object file using an assembler with the new
relocations added, and then linking those files with an older
linker, the link will still complete and the linked file will
be generated.
In this case we should report an error instead of continuing
the linking process.
2024-04-15 09:54:06 +08:00
GDB Administrator
31a1b19e6c Automatic date update in version.in 2024-04-15 00:00:11 +00:00
GDB Administrator
d96ca68465 Automatic date update in version.in 2024-04-14 00:00:07 +00:00
GDB Administrator
4ad25f3bed Automatic date update in version.in 2024-04-13 00:00:09 +00:00
GDB Administrator
8bad8d5133 Automatic date update in version.in 2024-04-12 00:00:08 +00:00
Alan Modra
af92590521 Remove bfdwin.c
In commit b86d3af60f and 0ab0435fe6 I fixed SIGBUS errors found by
oss-fuzz now that --with-mmap defaults to enabled.  It turns out there
are further problems with the aout mmap code: aout_read_minisymbols
returns the external symbol array, which is later freed by nm.c.  If
the array is mmaped you can't free it.  Now this could be fixed by
making aout minisymbols an array of pointers, but I figure there's not
much point in expending effort on that.  So delete the aout mmap
support along with bfdwin.c and get_section_contents_in_window.
2024-04-11 17:05:16 +09:30
Alan Modra
de9dc65bd4 asan: heap buffer overflow elf_link_add_to_first_hash
Seen on mmix.
mmix  +FAIL: ld-misc/defsym1
mmix  +FAIL: sysroot-prefix common plain -Lpath, quoted
mmix  +FAIL: sysroot-prefix common plain -Lpath, unquoted
mmix  +FAIL: sysroot-prefix common full-path, quoted
mmix  +FAIL: sysroot-prefix common full-path, unquoted
mmix  +FAIL: sysroot-prefix common plain =-prefixed with empty, quoted
mmix  +FAIL: sysroot-prefix common plain =-prefixed with empty, unquoted
mmix  +FAIL: sysroot-prefix common plain $SYSROOT-prefixed with empty, quoted
mmix  +FAIL: sysroot-prefix common plain $SYSROOT-prefixed with empty, unquoted
mmix  +FAIL: sysroot-prefix common plain =-prefixed -Lpath, quoted
mmix  +FAIL: sysroot-prefix common plain =-prefixed -Lpath, unquoted
mmix  +FAIL: sysroot-prefix common plain $SYSROOT-prefixed -Lpath, quoted
mmix  +FAIL: sysroot-prefix common plain $SYSROOT-prefixed -Lpath, unquoted
mmix  +FAIL: sysroot-prefix common full-path =-prefixed without, quoted
mmix  +FAIL: sysroot-prefix common full-path =-prefixed without, unquoted
mmix  +FAIL: sysroot-prefix common full-path $SYSROOT-prefixed without, quoted
mmix  +FAIL: sysroot-prefix common full-path $SYSROOT-prefixed without, unquoted

==3746597==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6070000007a0 at pc 0x56d87b0d1a40 bp 0x7fffb1629bf0 sp 0x7fffb1629be0
READ of size 8 at 0x6070000007a0 thread T0
    #0 0x56d87b0d1a3f in elf_link_add_to_first_hash /home/alan/src/binutils-gdb/bfd/elflink.c:4312

mmix uses bfd_link_generic_hash_table.

	* elflink.c (_bfd_elf_archive_symbol_lookup): Dont use first_hash
	unless the hash table is bfd_link_elf_hash_table.
	(elf_link_add_archive_symbols): Likewise.
2024-04-11 17:05:15 +09:30
H.J. Lu
533da9536e mmap: Fix a memory leak in _bfd_mmap_read_temporary
Return malloced memory in *mmap_base so that _bfd_munmap_readonly_temporary
will free it.

	* libbfd.c (_bfd_mmap_read_temporary): Return malloced memory
	in *mmap_base.
2024-04-10 19:51:29 -07:00
H.J. Lu
c3460201a6 elf: Fix a memory leak in _bfd_elf_add_dynamic_entry
Normally, the section contents is allocated by bfd_alloc which is freed
when the object is closed.  But the .dynamic section contents is allocated
by bfd_realloc, which should be freed by calling free.  Add a dynamic
field to elf_link_hash_table for the .dynamic section and free its
contents in _bfd_elf_link_hash_table_free.

	* elf-bfd.h (elf_link_hash_table): Add dynamic.
	* elflink.c (_bfd_elf_link_create_dynamic_sections): Set the
	dynamic field in elf_link_hash_table.
	(_bfd_elf_add_dynamic_entry): Use hash_table->dynamic.
	(_bfd_elf_strip_zero_sized_dynamic_sections): Likewise.
	(bfd_elf_add_dt_needed_tag): Likewise.
	(elf_finalize_dynstr): Likewise.
	(_bfd_elf_link_hash_table_free): Free htab->dynamic->contents.
	(bfd_elf_final_link): Use htab->dynamic.
	* elfxx-x86.c (_bfd_x86_elf_finish_dynamic_sections): Use
	htab->elf.dynamic.
2024-04-10 19:50:01 -07:00
Alan Modra
ea3002bc4d Segfault in _bfd_delete_bfd with USE_MMAP
Any of the calls to _bfd_delete_bfd in bfd_fopen will hit this.

	* opncls.c (_bfd_delete_bfd): Check for non-NULL xvec before
	accessing flavour.
2024-04-11 09:32:10 +09:30
GDB Administrator
f8e9374ea8 Automatic date update in version.in 2024-04-11 00:00:17 +00:00
H.J. Lu
303da223b1 mmap: Avoid the sanitizer configure check failure
When -fsanitize=address,undefined is used to build, the mmap configure
check failed with

=================================================================
==231796==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x5750c7f6d72b in main /home/alan/build/gas-san/all/bfd/conftest.c:239

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x5750c7f6d2e1 in main /home/alan/build/gas-san/all/bfd/conftest.c:190

SUMMARY: AddressSanitizer: 8192 byte(s) leaked in 2 allocation(s).

Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP to avoid the sanitizer
configure check failure.

bfd/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

binutils/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

ld/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

libctf/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

libsframe/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
2024-04-10 03:57:46 -07:00
GDB Administrator
2c8dd9b1c3 Automatic date update in version.in 2024-04-10 00:00:22 +00:00
H.J. Lu
56756c571e bfd: Define pagesize variables only for mmap
Define _bfd_pagesize, _bfd_pagesize_m1 and _bfd_minimum_mmap_size only
if HAVE_MMAP is defined.

	* libbfd-in.h (_bfd_pagesize): Declare only if HAVE_MMAP is
	defined.
	(_bfd_pagesize_m1): Likewise.
	(_bfd_minimum_mmap_size): Likewise.
	* libbfd.c (_bfd_pagesize): Define only if HAVE_MMAP is defined.
	(_bfd_pagesize_m1): Likewise.
	(_bfd_minimum_mmap_size): Likewise.
	(bfd_init_pagesize): Likewise.
	* lynx-core.c (lynx_core_file_p): Replace _bfd_pagesize with
	getpagesize.
2024-04-09 05:22:41 -07:00
Jiawei
9132c8152b RISC-V: Support Zcmp push/pop instructions.
Support zcmp extension push/pop/popret and popret zero instructions.
The `reg_list' is a list containing 1 to 13 registers, we can use:
"{ra}, {ra, s0}, {ra, s0-s1}, {ra, s0-s2} ... {ra, s0-sN}"
to present this feature.

Passed gcc/binutils regressions of riscv-gnu-toolchain.

Most of work was finished by Sinan Lin.
Co-Authored by: Charlie Keaney <charlie.keaney@embecosm.com>
Co-Authored by: Mary Bennett <mary.bennett@embecosm.com>
Co-Authored by: Nandni Jamnadas <nandni.jamnadas@embecosm.com>
Co-Authored by: Sinan Lin <sinan.lin@linux.alibaba.com>
Co-Authored by: Simon Cook <simon.cook@embecosm.com>
Co-Authored by: Shihua Liao <shihua@iscas.ac.cn>
Co-Authored by: Yulong Shi <yulong@iscas.ac.cn>

bfd/ChangeLog:

        * elfxx-riscv.c (riscv_implicit_subset): Imply zca for zcmp.
	(riscv_supported_std_z_ext): Added zcmp with version 1.0.
	(riscv_parse_check_conflicts): Zcmp conflicts with d/zcd.
        (riscv_multi_subset_supports): Handle zcmp.
        (riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

	* NEWS: Updated.
        * config/tc-riscv.c (regno_to_reg_list): New function, used to map
	register to reg_list number.
        (reglist_lookup): Called reglist_lookup_internal.  Return false if
	reg_list number is zero, which is an invalid value.
	(reglist_lookup_internal): Parse register list, and return the last
	register by regno_to_reg_list.
        (validate_riscv_insn):  New operators.
        (riscv_ip): Ditto.
	* testsuite/gas/riscv/march-help.l: Updated.
        * testsuite/gas/riscv/zcmp-push-pop-fail.d: New test.
        * testsuite/gas/riscv/zcmp-push-pop-fail.l: New test.
        * testsuite/gas/riscv/zcmp-push-pop-fail.s: New test.
        * testsuite/gas/riscv/zcmp-push-pop.d: New test.
        * testsuite/gas/riscv/zcmp-push-pop.s: New test.

include/ChangeLog:

        * opcode/riscv-opc.h (MATCH/MASK_CM_PUSH): New macros for zcmp.
        (MATCH/MASK_CM_POP): Ditto.
        (MATCH/MASK_CM_POPRET): Ditto.
        (MATCH/MASK_CM_POPRETZ): Ditto.
        (DECLARE_INSN): New declarations for zcmp.
        * opcode/riscv.h (EXTRACT/ENCODE/VALID_ZCMP_SPIMM): Handle spimm
	operand for zcmp.
        (OP_MASK_REG_LIST): Handle operand for zcmp register list.
        (OP_SH_REG_LIST): Ditto.
        (ZCMP_SP_ALIGNMENT): New argument, used in riscv_get_sp_base.
        (X_S0, X_S1, X_S2, X_S10, X_S11): New register numbers.
        (enum riscv_insn_class): Added INSN_CLASS_ZCMP.
        (extern riscv_get_sp_base): Added.

opcodes/ChangeLog:

        * riscv-dis.c (print_reg_list): New function, used to get zcmp
	reg_list field.
        (riscv_get_spimm): New function, used to get zcmp sp adjustment
	immediate.
        (print_insn_args): Handle new operands for zcmp.
        * riscv-opc.c (riscv_get_sp_base): New function, used by gas and
	objdump.  Get sp base adjustment.
	(riscv_opcodes): Added zcmp instructions.
2024-04-09 15:56:12 +08:00
mengqinggang
2bf280a827 LoongArch: ld: Move .got .got.plt before .data and protect .got with relro
Move .got .got.plt before .data so .got can be protected with -zrelro.
And the first two entries of .got.plt (_dl_runtime_resolve and link map)
are placed within the relro region.
2024-04-09 14:31:04 +08:00