Commit Graph

19494 Commits

Author SHA1 Message Date
GDB Administrator
d73b6fc032 Automatic date update in version.in 2024-11-26 00:00:42 +00:00
GDB Administrator
66df4f72b6 Automatic date update in version.in 2024-11-25 00:00:46 +00:00
GDB Administrator
3198eb6627 Automatic date update in version.in 2024-11-24 00:00:57 +00:00
GDB Administrator
63eedf3b09 Automatic date update in version.in 2024-11-23 00:00:36 +00:00
Nelson Chu
595e49a4b7 RISC-V: Support SiFive extensions: xsfvqmaccdod, xsfvqmaccqoq and xsfvfnrclipxfqf
Those SiFive extensions have been published on the web for a while, and we plan
to implement intrinsics in GCC for those instructions soon.

NOTE: The original patch was written by Nelson when he was still working at
SiFive, and Kito rebased it to the trunk. Therefore, I kept the author as Nelson
with his SiFive email.

Document links:
xsfvqmaccdod: https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification
xsfvqmaccqoq: https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification
xsfvfnrclipxfqf: https://www.sifive.com/document-file/fp32-to-int8-ranged-clip-instructions

Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
2024-11-22 09:56:54 +08:00
GDB Administrator
87480dcfb6 Automatic date update in version.in 2024-11-22 00:00:17 +00:00
GDB Administrator
25f0170973 Automatic date update in version.in 2024-11-21 00:00:23 +00:00
Jiawei
00ef37e860 RISC-V: Add Zcmt instructions and csr.
This patch supports Zcmt[1] instruction 'cm.jt' and 'cm.jalt'.
Add new CSR jvt for tablejump using. Since 'cm.jt' and 'cm.jalt'
have the same instructiong encoding, use 'match_cm_jt' and 'match_cm_jalt'
check the 'zcmt_index' field to distinguish them.

[1] https://github.com/riscvarchive/riscv-code-size-reduction/releases

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_multi_subset_supports): New extension.
	(riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

	* config/tc-riscv.c (enum riscv_csr_class): New CSR.
	(riscv_csr_address): Ditto.
	(validate_riscv_insn): New operand.
	(riscv_ip): Ditto.
	* testsuite/gas/riscv/csr-version-1p10.d: New CSR.
	* 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 extension.
	* testsuite/gas/riscv/zcmt-fail.d: New test.
	* testsuite/gas/riscv/zcmt-fail.l: New test.
	* testsuite/gas/riscv/zcmt-fail.s: New test.
	* testsuite/gas/riscv/zcmt.d: New test.
	* testsuite/gas/riscv/zcmt.s: New test.

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_CM_JT): New opcode.
	(MASK_CM_JT): New mask.
	(MATCH_CM_JALT): New opcode.
	(MASK_CM_JALT): New mask.
	(CSR_JVT): New CSR.
	(DECLARE_INSN): New declaration.
	(DECLARE_CSR): Ditto.
	* opcode/riscv.h (EXTRACT_ZCMT_INDEX): New marco.
	(ENCODE_ZCMT_INDEX): Ditto.
	(enum riscv_insn_class): New class.

opcodes/ChangeLog:

	* riscv-dis.c (print_insn_args): New operand.
	* riscv-opc.c (match_cm_jt): New function.
	(match_cm_jalt): Ditto.
2024-11-20 08:26:39 +08:00
GDB Administrator
46e64f7387 Automatic date update in version.in 2024-11-20 00:00:15 +00:00
Nelson Chu
cb45bd5948 RISC-V: Don't report warnings when linking different privileged spec objects.
Since only the abandoned privileged spec v1.9.1 will have conflict csrs, to
keep the compatible we still report warnings when linking privileged spec
v1.9.1 objects with others.  But don't report warnings for other compatible
cases because it is actually a bit noisy and useless...

bfd/
	* elfnn-riscv.c (riscv_merge_attributes): Only report warnings when
	linking the abandoned privileged spec v1.9.1 object with others.
ld/
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Removed.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Removed.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Removed.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Removed.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Removed.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Removed.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
2024-11-19 13:44:49 +08:00
Lulu Cai
77bcfb741c LoongArch: Do not relax pcalau12i+ld.d when there is overflow
There is no overflow check for the relaxation of pcalau12i+ld.d =>
pcalau12i+addi.d. For instruction sequences that can be relaxed,
they are directly relaxed to pcalau12i+addi.d. However, when the
relative distance between the symbol and the pc exceeds the 32-bit
range, the symbol value cannot be obtained correctly.

Adds an overflow check for the relaxation of pcalau12i+ld.d.
If it is found that the relaxation will overflow, it will not
be relaxed.
2024-11-19 09:42:23 +08:00
GDB Administrator
0073bda210 Automatic date update in version.in 2024-11-19 00:00:29 +00:00
Matthieu Longo
493993718e aarch64: remove annoying white spaces in bfd/elfnn-aarch64.c 2024-11-18 18:03:56 +00:00
Jan Beulich
af3394d97a ELF: SHF_STRINGS isn't really tied to SHF_MERGE
It's not overly useful without it, but the spec doesn't name any
dependency between the two. People may want to use it for purely
informational purposes, for example. Adjust, in particular, entity size
processing to be engaged if either flag is set, as mandated by the spec.
2024-11-18 11:36:57 +01:00
Jan Beulich
70ab7e0acf ELF: SHF_MERGE vs SHT_NOBITS
bfd/merge.c puts in quite some effort to track mergable sections. That's
all wasted for sections which don't have contents, as for them
_bfd_write_merged_section() will never be called.

With the combination not having any useful effect, also warn about this
in gas.
2024-11-18 11:36:30 +01:00
Sam James
931e4f9b09
bfd: fix -std=gnu23 compatibility wrt _Bool
GCC trunk now defaults to -std=gnu23. We return false in a few places
which can't work when true/false are a proper type (_Bool). Return NULL
where appropriate instead of false. All callers handle this appropriately.

ChangeLog:
	PR ld/32372

	* elf32-ppc.c (ppc_elf_tls_setup): Return NULL.
        * elf32-xtensa.c (translate_reloc_bfd_fix): Ditto.
        (translate_reloc): Ditto.
        * elf64-ppc.c (update_local_sym_info): Ditto.
        * mach-o.c (bfd_mach_o_lookup_uuid_command): Ditto.
        * xsym.c (bfd_sym_read_name_table): Ditto.
2024-11-18 03:09:14 +00:00
GDB Administrator
5b61986ac1 Automatic date update in version.in 2024-11-18 00:00:30 +00:00
H.J. Lu
c0e7f91064 x86-64: Always check IBT PLT before BND PLT
Since BND PLT has been deprecated and the same IBT PLT is used for both
x86-64 and x32, always check IBT PLT before BND PLT when synthesizing
PLT symtab.

	* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Always check
	elf_x86_64_lazy_ibt_plt and elf_x86_64_non_lazy_ibt_plt first.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-11-17 09:21:47 +08:00
H.J. Lu
231a8ab70f x86-64: Drop x32 references in PLT entry variables
e9c11d58b9 x86-64: Remove BND from 64-bit IBT PLT

removed the BND prefix from 64-bit IBT PLT by using x32 IBT PLT.

Drop x32 references in PLT entry variables.

	* elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): Renamed to ...
	(elf_x86_64_lazy_bnd_ibt_plt_entry): This.
	(elf_x32_lazy_ibt_plt_entry): Renamed to ...
	(elf_x86_64_lazy_ibt_plt_entry): This.
	(elf_x86_64_non_lazy_ibt_plt_entry): Renamed to ...
	(elf_x86_64_non_lazy_bnd_ibt_plt_entry): This.
	(elf_x32_non_lazy_ibt_plt_entry): Renamed to ...
	(elf_x86_64_non_lazy_ibt_plt_entry): This.
	(elf_x86_64_eh_frame_lazy_ibt_plt): Renamed to ...
	(elf_x86_64_eh_frame_lazy_bnd_ibt_plt): This.
	(elf_x32_eh_frame_lazy_ibt_plt): Renamed to ...
	(elf_x86_64_eh_frame_lazy_ibt_plt): This.
	(elf_x86_64_lazy_ibt_plt): Renamed to ...
	(elf_x86_64_lazy_bnd_ibt_plt): This.  Updated.
	(elf_x32_lazy_ibt_plt): Renamed to ...
	(elf_x86_64_lazy_ibt_plt): This.  Updated.
	(elf_x86_64_non_lazy_ibt_plt): Renamed to ...
	(elf_x86_64_non_lazy_bnd_ibt_plt): This.  Updated.
	(elf_x32_non_lazy_ibt_plt): Renamed to ...
	(elf_x86_64_non_lazy_ibt_plt): This.  Updated.
	(elf_x86_64_get_synthetic_symtab): Updated.
	(elf_x86_64_link_setup_gnu_properties): Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-11-17 08:48:28 +08:00
GDB Administrator
ece531604d Automatic date update in version.in 2024-11-17 00:00:53 +00:00
GDB Administrator
63a8afc8e9 Automatic date update in version.in 2024-11-16 00:00:41 +00:00
GDB Administrator
75e1141293 Automatic date update in version.in 2024-11-15 00:00:26 +00:00
GDB Administrator
768f23b94f Automatic date update in version.in 2024-11-14 00:00:31 +00:00
GDB Administrator
2e7d431af8 Automatic date update in version.in 2024-11-13 00:00:15 +00:00
Mark Wielaard
14bc3b1b83 bfd: Add WARN_CFLAGS_FOR_BUILD to doc/chew.c build, fix warnings
doc/chew.c was compiled without any warning flags set. Adding the
common warnings for build showed various issues with non-static
functions missing prototypes and globals with common names (ptr and
idx) that shadowed local arguments or variables.

     * doc/local.mk (doc/chew.stamp): Add WARN_CFLAGS_FOR_BUILD.
     * Makefile.in: Regenerate.
     * doc/chew.c (idx): Rename to pos_idx.
     (ptr): Rename to buf_ptr.
     (xmalloc): Make static.
     (xrealloc): Likewise.
     (xstrdup): Likewise.
     (nextword): Likewise.
     (newentry): Likewise.
     (add_to_definition): Likewise.
     (add_intrinsic): Likewise.
     (compile): Likewise.
     (icopy_past_newline): Rename idx to pos_idx, ptr to buf_ptr.
     (get_stuff_in_command): Likewise.
     (skip_past_newline): Likewise.
     (perform): Likewise.
     (main): Likewise.
2024-11-12 22:39:33 +01:00
Alan Modra
510fa4aadb Remove redundant section merge hash table field
sec_merge_hash.size duplicates sec_merge_hash.table.count, albeit using
bfd_size_type rather than unsigned int.  The only reason to have the
duplicate field is to catch unsigned int overflows, and that can be
done easily enough when and if required.  Overflow isn't possible at
the moment.  See the needs_resize comment.

	* merge.c (sec_merge_hash): Remove "size" field.
	(NEEDS_RESIZE): Delete macro, replacing with..
	(needs_resize): ..this inline function.
	(sec_merge_resize): Rename from sec_merge_maybe_resize,
	removing redundant check.
	(sec_merge_hash_insert, sec_merge_hash_lookup): Adjust to suit.
	(sec_merge_init, merge_strings): Likewise.
2024-11-12 17:06:35 +10:30
Alan Modra
e032307191 Re: tekhex object file output fixes
Commit 8b5a212495 supported *ABS* symbols by allowing "section" to be
bfd_abs_section, but bfd_abs_section needs to be treated specially.
In particular, bfd_get_next_section_by_name (.., bfd_abs_section_ptr)
is invalid.

	PR 32347
	* tekhex.c (first_phase): Guard against modification of
	_bfd_std_section[] entries.
2024-11-12 17:06:35 +10:30
GDB Administrator
912f10fba9 Automatic date update in version.in 2024-11-12 00:00:36 +00:00
Xin Wang
599df6e2db ld, LoongArch: print error about linking without -fPIC or -fPIE flag in more detail 2024-11-11 12:02:35 +08:00
GDB Administrator
9f4d8151ee Automatic date update in version.in 2024-11-11 00:00:58 +00:00
GDB Administrator
3da8ce337c Automatic date update in version.in 2024-11-10 00:00:12 +00:00
GDB Administrator
2500edfc27 Automatic date update in version.in 2024-11-09 00:01:04 +00:00
Mark Wielaard
328f42d85b bfd: Remove unused static find function from doc/chew.c
After commit 2e60790cf7 "Remove the
paramstuff word" there is no caller left of the static find function
in doc/chew.c, so it should be removed.

* doc/chew.c (find): Remove.
2024-11-08 11:08:56 +01:00
GDB Administrator
01086f8a21 Automatic date update in version.in 2024-11-08 00:00:33 +00:00
GDB Administrator
8adee4d2ce Automatic date update in version.in 2024-11-07 00:00:53 +00:00
GDB Administrator
52a8387dfd Automatic date update in version.in 2024-11-06 00:00:43 +00:00
GDB Administrator
e1e4078ac5 Automatic date update in version.in 2024-11-05 00:00:32 +00:00
GDB Administrator
55e32b3c68 Automatic date update in version.in 2024-11-04 00:00:32 +00:00
GDB Administrator
69a9577358 Automatic date update in version.in 2024-11-03 00:00:17 +00:00
GDB Administrator
22d7506fb9 Automatic date update in version.in 2024-11-02 00:00:22 +00:00
Indu Bhagat
47c88752f9 ld: generate SFrame stack trace info for .plt.got
PR/32298 sframe: no SFrame stack trace info generated for .plt.got

Add support to generate SFrame stack trace info for .plt.got section.
Enhance the current definition of struct elf_x86_sframe_plt to include
initialized SFrame FDE/FREs applicable for .plt.got section.  There are
two variants of .plt.got entries: 16 byte and 8 byte.

8 byte:
    ff 25 00 00 00 00     jmpq  *name@GOTPCREL(%rip)
    66 90                 xchg  %ax,%ax

16 byte:
    f3 0f 1e fa           endbr64
    ff 25 66 2f 00 00     jmpq  *name@GOTPCREL(%rip)
    66 0f 1f 44 00 00     nopw   0x0(%rax,%rax,1)

For the testcase, define some application symbols such that their PLT
entry is placed in .plt.got and ensure SFrame information is generated
with and without -z ibtplt.

ChangeLog:
	PR/32298
	* bfd/elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties):
	PLT GOT entry size is different for IBT vs non IBT PLTs.
	* bfd/elfxx-x86.c (enum dynobj_sframe_plt_type): New enum for
	SFRAME_PLT_GOT.
	(_bfd_x86_elf_create_sframe_plt): Handle SFRAME_PLT_GOT.
	(_bfd_x86_elf_write_sframe_plt): Likewise.
	(_bfd_x86_elf_late_size_sections): Likewise.
	(_bfd_x86_elf_finish_dynamic_sections): Likewise.
	* bfd/elfxx-x86.h (struct elf_x86_sframe_plt): Add new members
	to keep information about PLT GOT entries.
	(struct elf_x86_link_hash_table): Add support for creating
	SFrame section for .plt.got.
	* ld/testsuite/ld-x86-64/x86-64.exp: Add new tests.
	* ld/testsuite/ld-x86-64/sframe-pltgot-1.d: New test.
	* ld/testsuite/ld-x86-64/sframe-pltgot-1.s: New test.
	* ld/testsuite/ld-x86-64/sframe-pltgot-2.d: New test.
2024-11-01 15:36:35 -07:00
Josh Poimboeuf
938fb51218 ld: fix wrong SFrame info for lazy IBT PLT
Fix PR/32296 sframe: wrong SFrame info for pltN and .plt.sec for -z ibtplt

The x86 psABI defines a 2-PLT scheme for IBT which uses .plt and
.plt.sec entries.  It was observed that SFrame information for .plt.sec
section was incorrect.  The erroneous assumption was that SFrame stack
trace information for .plt.sec with lazy binding is the same as SFrame
stack trace information for .plt with lazy binding.  This is corrected
now by initializing a new SFrame PLT helper object
elf_x86_64_sframe_ibt_plt for lazy PLT with IBT.

Add a testcase where linking with -z ibtplt generates .plt.sec entries and
ensure correct SFrame information for it.

Committed by Indu Bhagat.

ChangeLog:
	PR/32296
	* bfd/elf64-x86-64.c (elf_x86_64_sframe_ibt_pltn_fre2): New
	definition elf_x86_64_sframe_ibt_plt.  Use it in
	elf_x86_64_sframe_plt.
	(elf_x86_64_link_setup_gnu_properties): Lazy IBT PLT entries are
	different from lazy PLT.
        * bfd/elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Adjust for
	SFrame for IBT PLT.
        * ld/testsuite/ld-x86-64/x86-64.exp: Add new test.
        * ld/testsuite/ld-x86-64/sframe-ibt-plt-1.d: New test.
2024-11-01 15:36:03 -07:00
Josh Poimboeuf
1785837a25 ld: fix PR/32297
When _creating_ SFrame information for the linker created .plt.sec, the
code correctly checks for presence of .plt.sec.  When _writing_ the
SFrame section for the corresponding .plt.sec, however, the conditionals
were wrongly checking for splt.  This was causing an assertion at link
time.

This issue has been known to affect glibc build with SFrame enabled.

No testcase is added just yet.  A later commit ensures correct SFrame
stack trace information is created for .plt.got. A test case (where only
.plt and .plt.got are created) is added then.

PR/32297 sframe: bfd assertion with empty main on IBT enabled system

Committed by Indu Bhagat.

ChangeLog:
	PR/32297
	* bfd/elfxx-x86.c (_bfd_x86_elf_late_size_sections): Check for
	  plt_second member not for splt.
2024-11-01 15:31:21 -07:00
GDB Administrator
893e4fd623 Automatic date update in version.in 2024-11-01 00:00:55 +00:00
GDB Administrator
4868f6025e Automatic date update in version.in 2024-10-31 00:00:21 +00:00
GDB Administrator
0a81e17f76 Automatic date update in version.in 2024-10-30 00:00:53 +00:00
Lulu Cai
287938873c LoongArch: Corrected to GNU style code 2024-10-29 15:56:52 +08:00
GDB Administrator
ad909bee05 Automatic date update in version.in 2024-10-29 00:00:56 +00:00
GDB Administrator
b391a8b043 Automatic date update in version.in 2024-10-28 00:00:27 +00:00
GDB Administrator
9af55b9568 Automatic date update in version.in 2024-10-27 00:00:22 +00:00