Commit Graph

119288 Commits

Author SHA1 Message Date
Kévin Le Gouguec
5e07665d4c gdb: add testcase for invalid record display
More of a DWARF-generation non-regression test; fixed on the GCC side
with 2024-06-03 "Implement wrap-around arithmetics in DWARF
expressions" (f3d6d60d2ae).

Approved-By: Tom Tromey <tom@tromey.com>
2024-07-11 11:48:29 +02:00
Cui, Lili
cef946b6f4 X86: Update gas/NEWS for Intel APX.
gas/ChangeLog:

        * NEWS: Update gas/NEWS for Intel APX.
2024-07-11 14:35:24 +08:00
Tsukasa OI
25f05199bb RISC-V: Add platform property/capability extensions
RISC-V Profiles document defines number of "extensions" that indicate
certain platform properties/capabilities just like 'Zkt' extension from the
RISC-V cryptography extensions.

This commit defines 20 platform property/capability extensions as defined
in the RISC-V Profiles documentation.

The only exception: 'Ssstateen' extension is defined separately because it
defines a subset (supervisor/hypervisor view) of the 'Smstateen' extension.

This is based on the ratified version of RISC-V Profiles:
<https://github.com/riscv/riscv-profiles/releases/tag/v1.0>

[Definition]

"Main memory regions":
    Main memory regions (in contrast to I/O or vacant memory regions) with
    both the cacheability and coherence PMAs.

[New Unprivileged Extensions]

1.  'Ziccif'
    "Main memory regions" support instruction fetch and any instruction
    fetches of naturally aligned power-of-2 sizes up to min(ILEN, XLEN)
    are atomic.
2.  'Ziccrse'
    "Main memory regions" provide the eventual success guarantee for
    LR/SC sequence (RsrvEventual).
3.  'Ziccamoa'
    "Main memory regions" support all currently-defined AMO operations
    including swap, logical and arithmetic operations (AMOArithmetic).
4.  'Za64rs'
    For LR/SC instructions, reservation sets are contiguous, naturally
    aligned and at most 64-bytes in size.
5.  'Za128rs'
    Likewise, but reservation sets are at most 128-bytes in size.
6.  'Zicclsm'
    Misaligned loads / stores to "main memory regions" are supported.
    Those include both regular scalar and vector accesses but does not
    include AMOs and other specialized forms of memory accesses.
7.  'Zic64b'
    Cache blocks are (exactly) 64-bytes in size and naturally aligned.

[New Privileged Extensions]

1.  'Svbare'
    "satp" mode Bare is supported.
2.  'Svade'
    Page-fault exceptions are raised when a page is accessed when A bit is
    clear, or written when D bit is clear.
3.  'Ssccptr'
    "Main memory regions" support hardware page-table reads.
4.  'Sstvecd'
    "stvec" mode Direct is supported.  When "stvec" mode is Direct,
    "stvec.BASE" is capable of holding any valid 4-byte aligned address.
5.  'Sstvala'
    "stval" is always written with a nonzero value whenever possible as
    specified in the Privileged Architecture documentation
    (version 20211203: see section 4.1.9).
6.  'Sscounterenw'
    For any "hpmcounter" that is not read-only zero, the corresponding bit
    in "scounteren" is writable.
7.  'Ssu64xl'
    "sstatus.UXL" is capable of holding the value 0b10
    (UXLEN==64 is supported).
8.  'Shcounterenw'
    Similar to 'Sscounterenw' but the same rule applies to "hcounteren".
9.  'Shvstvala'
    Similar to 'Sstvala' but the same rule applies to "vstval".
10. 'Shtvala'
    "htval" is written with the faulting guest physical address as long as
    permitted by the ISA (a bit similar to 'Sstvala' and 'Shvstvala').
11. 'Shvstvecd'
    Similar to 'Sstvecd' but the same rule applies to "vstvec".
12. 'Shvsatpa'
    All translation modes supported in "satp" are also supported in "vsatp".
13. 'Shgatpa'
    For each supported virtual memory scheme SvNN supported in "satp", the
    corresponding "hgatp" SvNNx4 mode is supported.  The "hgatp" mode Bare
    is also supported.

[Implications]

(Due to reservation set size constraints)
-   'Za64rs' -> 'Za128rs'

(Due to the fact that a privileged "extension" directly refers a CSR)
-   'Svbare'       -> 'Zicsr'
-   'Sstvecd'      -> 'Zicsr'
-   'Sstvala'      -> 'Zicsr'
-   'Sscounterenw' -> 'Zicsr'
-   'Ssu64xl'      -> 'Zicsr'

(Due to the fact that a privileged "extension" indirectly depends on CSRs)
-   'Svade' -> 'Zicsr'

(Due to the fact that a privileged "extension" is a hypervisor property)
-   'Shcounterenw' -> 'H'
-   'Shvstvala'    -> 'H'
-   'Shtvala'      -> 'H'
-   'Shvstvecd'    -> 'H'
-   'Shvsatpa'     -> 'H'
-   'Shgatpa'      -> 'H'

bfd/
	* elfxx-riscv.c (riscv_implicit_subsets): Updated for property
	and capability extensions.
	(riscv_supported_std_z_ext): Added zic64b, ziccamoa, ziccif, zicclsm,
	ziccrse, za64rs and za128rs extensions.
	(riscv_supported_std_s_ext): Added shcounterenw, shgatpa, shtvala,
	shvsatpa, shvstvala, shvstvecd, ssccptr, sscounterenw, sstvala,
	sstvecd, ssu64xlm svade and svbare extensions.
gas/
	* testsuite/gas/riscv/imply.d: Updated for property and capability
	extensions.
	* testsuite/gas/riscv/imply.s: Likewise.
	* testsuite/gas/riscv/march-help.l: Likewse.
2024-07-11 12:58:27 +08:00
Alan Modra
4cf957e7ac Re: Add support for a .base64 pseudo-op to gas
Fixes a failure on rx-elf where the standard data section isn't .data.
run_dump_test has machinery to translate .data in both options and
expected results for objdump, but not for readelf -x.

	PR 31964
	* testsuite/gas/all/base64.d: Dump .data with objdump.  Run on
	all targets.
2024-07-11 11:13:15 +09:30
Jinyang He
b357aca749 LoongArch: Not alloc dynamic relocs if symbol is absolute
The absolute symbol should be resolved to const when link to dso or exe.
Alloc dynamic relocs will cause extra space and R_LARCH_NONE finally.
2024-07-11 09:27:22 +08:00
GDB Administrator
82ed416538 Automatic date update in version.in 2024-07-11 00:00:15 +00:00
H.J. Lu
aa047105e0 x86-64: Skip -z mark-plt tests on MUSL
Skip -z mark-plt tests, which are specific to glibc, on MUSL.

	PR ld/31970
	* ld/testsuite/ld-x86-64/x86-64.exp: Skip -z mark-plt tests on
	MUSL.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-10 16:50:52 -07:00
Yixuan Chen
762c38d552 RISC-V:[gprofng] Minimal support gprofng for riscv.
ChangeLog: Add target riscv to --enable-gprofng.

2024-07-04  Yixuan Chen  <chenyixuan@iscas.ac.cn>

        * configure: Add riscv.
        * configure.ac: Add riscv.

gprofng/ChangeLog: Minimal support gprofng for riscv.

2024-07-04  Yixuan Chen  <chenyixuan@iscas.ac.cn>

        * gprofng/common/core_pcbe.c (core_pcbe_init): Add RISC-V vendor conditon.
        (defined): Add riscv.
        * gprofng/common/cpuid.c (defined): Add risc-v hwprobe.
        * gprofng/common/gp-defs.h (TOK_A_RISCV): Add riscv.
        (defined): Add riscv.
        (ARCH_RISCV): Add riscv.
        * gprofng/common/hwc_cpus.h: Add RISC-V vendor.
        * gprofng/common/hwcfuncs.h (HW_INTERVAL_TYPE): Remove useless defination.
        * gprofng/configure: Add riscv.
        * gprofng/configure.ac: Add riscv.
        * gprofng/libcollector/hwprofile.h (ARCH): Add RISC-V register.
        (CONTEXT_PC): Add RISC-V register.
        (CONTEXT_FP): Add RISC-V register.
        (CONTEXT_SP): Add RISC-V register.
        (SETFUNCTIONCONTEXT):
        * gprofng/libcollector/libcol_util.c (__collector_util_init): Fix libc open condition.
        * gprofng/libcollector/libcol_util.h (ARCH): Add RISC-V.
        * gprofng/libcollector/unwind.c (ARCH): Add RISC-V register.
        (GET_PC): Add RISC-V register.
        (GET_SP): Add RISC-V register.
        (GET_FP): Add RISC-V register.
        (FILL_CONTEXT):
        * gprofng/src/DbeSession.cc (ARCH): Add RISC-V.
        * gprofng/src/Disasm.cc (Disasm::disasm_open): Add RISC-V.
        * gprofng/src/Experiment.cc (Experiment::ExperimentHandler::startElement): Add RISC-V.
        * gprofng/src/checks.cc (ARCH): Add RISC-V.
        * gprofng/src/collctrl.cc (defined): Set risc-v cpu frequency to 1000MHz as default for now, will fix when I find a better method to get cpu frequency.
        (read_cpuinfo): Add "mvendorid" condition according to risc-v /proc/cpuinfo file content.
        * gprofng/src/dbe_types.h (enum Platform_t): Add RISC-V.
2024-07-10 15:16:03 -07:00
Nick Clifton
479edf0a6a Add support for a .base64 pseudo-op to gas
PR 31964
2024-07-10 15:01:39 +01:00
Clément Chigot
1ca8994049 libsframe: remove runstatedir in Makefile.in
The regeneration was made with Ubuntu automake which has this runstatedir
additional variable, compared to the usual automake.
2024-07-10 10:24:45 +02:00
Clément Chigot
db79be6121 libsframe: accept --target configure option
Libsframe was missing AC_CANONICAL_TARGET, meaning that --target was
ignored. This could prevent libsframe.a to be installed in some cases,
the host fetching its canonical value while the target isn't. Both
having a different value, INSTALL_LIBBFD would be false.
2024-07-10 10:13:45 +02:00
GDB Administrator
a4a220f266 Automatic date update in version.in 2024-07-10 00:00:36 +00:00
H.J. Lu
7757f66fdb elf: Add glibc version dependency only if needed
There is no need to add a needed glibc version if the glibc base version
includes the needed glibc version.

	PR ld/31966
	* elflink.c (elf_link_add_glibc_verneed): Add glibc_minor_base.
	Skip if the glibc base version includes the needed glibc version.
	(_bfd_elf_link_add_glibc_version_dependency): Initialize
	glibc_minor_base to INT_MAX and pass it to
	elf_link_add_glibc_verneed.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-09 14:34:54 -07:00
Vladimir Mezentsev
971ae1844e gprofng: add hardware counters for Intel Ice Lake processor
gprofng/ChangeLog
2024-07-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* common/hwc_cpus.h: New constant for Intel Ice Lake processor.
	* common/hwcdrv.c: Add a new argument to hwcfuncs_get_x86_eventsel.
	Set config1 in perf_event_attr. Remove the use of memset.
	* common/core_pcbe.c (core_pcbe_get_eventnum): Return 0.
	* common/hwcentry.h: Add config1.
	* src/collctrl.cc (Coll_Ctrl::build_data_desc):Set config1.
	* common/hwcfuncs.c (process_data_descriptor): Set config1.
	* common/hwctable.c: Add the hwc table for Intel Ice Lake processor.
	* src/hwc_intel_icelake.h: New file.
2024-07-09 10:50:05 -07:00
Indu Bhagat
604b972e61 doc: sframe: add appendix for generating stack traces
Add an appendix to provide a rough outline to show how to generate stack
traces using the SFrame format.  Such content should hopefully aid the
reader assimmilate the information in the specification.

libsframe/
	* doc/sframe-spec.texi: Add new appendix.
2024-07-09 10:23:31 -07:00
Indu Bhagat
4de9a5ccd6 include: sframe: update code comments around SFrame FRE stack offsets
This also amends the incorrect comment:
    offset3 (intrepreted as FP = CFA + offset2)

If RA tracking is enabled,  the offset to recover FP is at the third
index.  The SFrame format (V2) has assumption that if FP is saved on
stack, RA must have been saved as well.  This is true for the currently
supported arch Aarch64.  For AMD64, RA tracking per SFrame FRE is not
necessary.

In future, when extending support for more architectures, this will
likely need to be revisited.

include/
	* sframe.h: Make the comments clearer by enumerating what
	happens per-ABI.
2024-07-09 10:23:31 -07:00
Indu Bhagat
6dacff8a2f doc: sframe: segregate the ABI/arch-specific components
The recipe to interpret the SFrame FRE stack offsets is
ABI/arch-specific.

Although, there is other information in the specification that is
ABI-specific (like pauth_key usage in AArch64), those pieces of
information are now assimmilated in the SFrame specification in a way
that it is fairly difficult to carve then out into a ABI/arch-specific
section without confusing the readers.

For future though, the specification must strive to keep the generic
parts and ABI/arch-specific parts clearly laid out in separate sections.

libsframe/
	* doc/sframe-spec.texi: Reorder and adapt the contents.
2024-07-09 10:23:31 -07:00
H.J. Lu
eb7892c401 LTO: Properly check wrapper symbol
Add wrapper_symbol to bfd_link_hash_entry and set it to true for wrapper
symbol. Set wrap_status to wrapper if wrapper_symbol is true in LTO.

Note: Calling unwrap_hash_lookup to check for the wrapper symbol works
only when there is a definition for the wrapped symbol since references
to the wrapped symbol have been redirected to the wrapper symbol.

bfd/

	PR ld/31956
	* linker.c (bfd_wrapped_link_hash_lookup): Set wrapper_symbol
	for wrapper symbol.

include/

	PR ld/31956
	* bfdlink.h (bfd_link_hash_entry): Add wrapper_symbol.

ld/

	PR ld/31956
	* plugin.c (get_symbols): Set wrap_status to wrapper if
	wrapper_symbol is set.
	* testsuite/ld-plugin/lto.exp: Run PR ld/31956 tests.
	* testsuite/ld-plugin/pr31956a.c: New file.
	* testsuite/ld-plugin/pr31956b.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-09 01:37:35 -07:00
GDB Administrator
de9dfbb385 Automatic date update in version.in 2024-07-09 00:00:08 +00:00
srinath
de7a30ceaa aarch64: Add support for sve2p1 pmov instruction.
This patch adds support for followign SVE2p1 instruction, spec is available here [1].

1. PMOV (to vector)
2. PMOV (to predicate)

Both pmov (to vector) and pmov (to predicate) have destination scalable vector
register and source scalable vector register respectively as an operand with no
suffix and optional index. To handle this case we have added 8 new operands in
this patch.

AARCH64_OPND_SVE_Zn0_INDEX,      /* Zn[index], bits [9:5].  */
AARCH64_OPND_SVE_Zn1_17_INDEX,    /* Zn[index], bits [9:5,17].  */
AARCH64_OPND_SVE_Zn2_18_INDEX,    /* Zn[index], bits [9:5,18:17].  */
AARCH64_OPND_SVE_Zn3_22_INDEX,    /* Zn[index], bits [9:5,18:17,22].  */
AARCH64_OPND_SVE_Zd0_INDEX,      /* Zn[index], bits [4:0].  */
AARCH64_OPND_SVE_Zd1_17_INDEX,    /* Zn[index], bits [4:0,17].  */
AARCH64_OPND_SVE_Zd2_18_INDEX,    /* Zn[index], bits [4:0,18:17].  */
AARCH64_OPND_SVE_Zd3_22_INDEX,    /* Zn[index], bits [4:0,18:17,22].  */

Since the index of the <Zd> operand is optional, the index part is
dropped in disassembly in both the cases of "no index" or "zero index".

As per spec: PMOV <Zd>{[<imm>]}, <Pn>.D
             PMOV <Pn>.D, <Zd>{[<imm>]}

Example1:
	Assembly: pmov z5[0], p6.d
	Disassembly: pmov z5, p6.d

        Assembly: pmov z5, p6.d
        Disassembly: pmov z5, p6.d

Example2:
	Assembly: pmov p4.b, z5[0]
	Disassembly: pmov p4.b, z5

        Assembly: pmov p4.b, z5
        Disassembly: pmov p4.b, z5
[1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08 17:48:23 +01:00
Srinath Parvathaneni
d6ec64f93d aarch64: Add support for sve2p1 tbxq instruction.
This patch adds support for SVE2p1 "tbxq" instruction, spec is available here [1].
[1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08 17:46:15 +01:00
Srinath Parvathaneni
4d9e3c3f61 aarch64: Add support for sve2p1 zipq[1-2] instructions.
This patch adds support for SVE2p1 "zipq1" and "zipq2" instructions, spec is
available here [1].
[1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08 17:46:10 +01:00
Srinath Parvathaneni
2da3319873 aarch64: Add support for sve2p1 uzpq[1-2] instructions.
This patch adds support for SVE2p1 "uzpq1" and "uzpq2" instructions, spec is
available here [1]
[1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08 17:46:00 +01:00
Srinath Parvathaneni
984f5ebb7b aarch64: Add support for sve2p1 tblq instruction.
This patch adds support for SVE2p1 "tblq" instruction, spec is available here [1].
[1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08 17:45:54 +01:00
Srinath Parvathaneni
166da3c279 aarch64: Add support for sve2p1 orqv instruction.
This patch adds support for SVE2p1 "orqv" instruction, spec available here [1].
[1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08 17:45:42 +01:00
GDB Administrator
49cc32b732 Automatic date update in version.in 2024-07-08 00:00:12 +00:00
GDB Administrator
85a67d0a39 Automatic date update in version.in 2024-07-07 00:00:09 +00:00
Alan Modra
66e545391e Re: LoongArch: Add DT_RELR support
Fix commit d89ecf33ab testsuite breakage.

	* testsuite/lib/binutils-common.exp (supports_dt_relr): Correct.
2024-07-06 18:22:06 +09:30
Alan Modra
428c21e99a objcopy bfd_map_over_sections and global status
This patch started life as a relatively simple change to fix some
unimportant objcopy memory leaks, but expanded into a larger patch
when I was annoyed by the awkwardness of passing data when using
bfd_map_over_sections.  A simple loop over sections is much more
convenient, and we really don't need the abstraction layer.  Sections
in a list isn't going to disappear any time soon.

The patch also removes use of the global "status" variable by all but
the top-level functions called from main.

	* objcopy.c (filter_symbols): Return success as a bool.  Pass
	symcount as a pointer, updated on return.
	(merge_gnu_build_notes): Similarly return a bool and add newsize
	param with updated smaller section size.
	(setup_bfd_headers): Return bool success rather than setting
	"status" on failure.
	(setup_section): Likewise.
	(copy_relocations_in_section, copy_section): Likewise, and adjust
	params.
	(mark_symbols_used_in_relocations): Likewise, and free memory
	on failure path.  Don't call bfd_fatal.
	(get_sections): Delete function.
	(copy_object): Don't use bfd_map_over_sections, instead use a
	loop allowing easy detection of failure status.  Free memory on
	error paths.
	(copy_archive): Return bool success rather than setting "status"
	on failure.
	(copy_file): Set "status" here.
	* testsuite/binutils-all/strip-13.d: Adjust to suit.
2024-07-06 10:41:29 +09:30
GDB Administrator
69c21b8a22 Automatic date update in version.in 2024-07-06 00:00:07 +00:00
Matthieu Longo
aaa064b75c aarch64: add Debug Feature Register 2 (ID_AA64DFR2_EL1)
This patch also adds relevant tests. Regression tested on aarch64-none-elf,
and no regression found.
2024-07-05 15:39:28 +01:00
Matthieu Longo
f83675969b aarch64: add STEP2 feature and its associated registers
AArch64 defines new registers for the feature step2 (Enhanced Software Step
Extension). step2 is an Armv9.5-A feature.

This patch also adds relevant tests. Regression tested on aarch64-none-elf,
and no regression found.
2024-07-05 15:39:28 +01:00
Matthieu Longo
27e411ef5d aarch64: add SPMU2 feature and its associated registers
AArch64 defines new registers for the feature spmu2 (System Performance
Monitors Extension version 2). spmu2 is an Armv9.5-A feature.

This patch also adds relevant tests. Regression tested on aarch64-none-elf,
and no regression found.
2024-07-05 15:39:28 +01:00
Matthieu Longo
a15809c010 aarch64: add E3DSE feature and its associated registers
AArch64 defines new registers for the feature e3dse (Delegated SError
exceptions for EL3): vdisr_el3 and vdisr_el3. e3dse is an Armv9.5-A
feature.

This patch also adds relevant tests. Regression tested on aarch64-none-elf,
and no regression found.
2024-07-05 15:39:28 +01:00
Lingling Kong
97bf50bb61 x86-64: Fix support for APX NF TLS IE with 2 operands
Added the restriction in assemble for APX TLS IE that the destination
can only be a register.

gas/

      * config/tc-i386.c (md_assemble): Added stricter restrictions
      for APX TLS IE.
2024-07-05 18:25:59 +08:00
Jan Beulich
8c1d0aea1d RISC-V: avoid use of match_opcode() in riscv_insn_types[]
As of 27b33966b1 ("RISC-V: disallow x0 with certain macro-insns") the
.match_func field may be NULL for entries used for assembly only, which
is the case for the entire table. With .match and .mask both zero the
function would only ever succeed anyway. Save almost a hundred base
relocations in the final executable by using NULL instead.
2024-07-05 08:39:28 +02:00
Jan Beulich
e6292a4b2c aarch64: fix build with old glibc
As was pointed out several times before, old glibc declares index(),
resulting in warnings from -Wshadow, in turn failing the build due to
-Werror.
2024-07-05 08:38:39 +02:00
Xi Ruoyao
3880820e34 LoongArch: Add DT_RELR tests
Most tests are ported from AArch64.

The relr-addend test is added to make sure the addend (link-time address)
is correctly written into the relocated section.  Doing so is not
strictly needed for RELA, but strictly needed for RELR).

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-07-05 12:11:11 +08:00
Xi Ruoyao
d89ecf33ab LoongArch: Add DT_RELR support
The logic is same as a71d876801 ("aarch64: Add DT_RELR support").

As LoongArch does not have -z dynamic-undefined-weak, we don't need to
consider UNDEFWEAK_NO_DYNAMIC_RELOC.

The linker relaxation adds another layer of complexity.  When we delete
bytes in a section during relaxation, we need to fix up the offset in
the to-be-packed relative relocations against this section.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-07-05 12:11:11 +08:00
Xi Ruoyao
17cae6980b LoongArch: Make protected function symbols local for -shared
On LoongArch there is no reason to treat STV_PROTECTED STT_FUNC symbols
as preemptible.  See the comment above LARCH_REF_LOCAL for detailed
explanation.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-07-05 12:11:11 +08:00
Xi Ruoyao
41ef0bff20 LoongArch: Fix bad reloc with mixed visibility ifunc symbols in shared libraries
With a simple test case:

    .globl  ifunc
    .globl  ifunc_hidden
    .hidden ifunc_hidden
    .type   ifunc, %gnu_indirect_function
    .type   ifunc_hidden, %gnu_indirect_function

    .text
    .align  2
    ifunc:  ret
    ifunc_hidden: ret

    test:
      bl ifunc
      bl ifunc_hidden

"ld -shared" produces a shared object with one R_LARCH_NONE (instead of
R_LARCH_JUMP_SLOT as we expect) to relocate the GOT entry of "ifunc".
It's because the indices in .plt and .rela.plt mismatches for
STV_DEFAULT STT_IFUNC symbols when another PLT entry exists for a
STV_HIDDEN STT_IFUNC symbol, and such a mismatch breaks the logic of
loongarch_elf_finish_dynamic_symbol.  Fix the issue by reordering .plt
so the indices no longer mismatch.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-07-05 12:11:11 +08:00
Xi Ruoyao
1c31db21fe LoongArch: Reject R_LARCH_32 from becoming a runtime reloc in ELFCLASS64
We were converting R_LARCH_32 to R_LARCH_RELATIVE for ELFCLASS64:

    $ cat t.s
    .data
    x:
        .4byte x
	.4byte 0xdeadbeef
    $ as/as-new t.s -o t.o
    $ ld/ld-new -shared t.o
    $ objdump -R
    a.out:     file format elf64-loongarch

    DYNAMIC RELOCATION RECORDS
    OFFSET           TYPE              VALUE
    00000000000001a8 R_LARCH_RELATIVE  *ABS*+0x00000000000001a8

But this is just wrong: at runtime the dynamic linker will run
*(uintptr *)&x += load_address, clobbering the next 4 bytes of data
("0xdeadbeef" in the example).

If we keep the R_LARCH_32 reloc as-is in ELFCLASS64, it'll be rejected
by the Glibc dynamic linker anyway.  And it does not make too much sense
to modify Glibc to support it.  So we can just reject it like x86_64:

    relocation R_X86_64_32 against `.data' can not be used when making a
    shared object; recompile with -fPIC

or RISC-V:

    relocation R_RISCV_32 against non-absolute symbol `a local symbol'
    can not be used in RV64 when making a shared object

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-07-05 12:11:10 +08:00
Cui, Lili
fc111d56dd x86: Correct position of ".s" for CCMPcc in disassembler
Added new macro %SW to CCMPcc to print ".s" after the mnemonic.

Before:
ccmpbl {dfv=}.s %edx,%eax

After:
ccmpbl.s {dfv=} %edx,%eax

gas/ChangeLog:

        * testsuite/gas/i386/x86-64-pseudos-apx.d: Add tests for CCMPcc.
        * testsuite/gas/i386/x86-64-pseudos-apx.s: Ditto.

opcodes/ChangeLog:

        * i386-dis-evex.h: Added %SW for CCMPcc swap operands.
        * i386-dis.c (struct dis386): Added %SW.
        (putop): Handle %SW.
2024-07-05 09:55:41 +08:00
Cui, Lili
f95476cc5e x86: Add {load}/{store} tests for apx instructions.
gas/ChangeLog:

        * testsuite/gas/i386/x86-64.exp: Add {load}/{store} tests for apx
	instructions.
        * testsuite/gas/i386/x86-64-pseudos-apx.d: New test.
        * testsuite/gas/i386/x86-64-pseudos-apx.s: Ditto.
2024-07-05 09:55:41 +08:00
GDB Administrator
db7f6be8ef Automatic date update in version.in 2024-07-05 00:00:23 +00:00
Sun Sunny
c83ea305e2 RISC-V: Fix BFD_RELOC_RISCV_PCREL_LO12_S patch issue
In commit dff565fcca, the fixups
for PCREL_LO12_I and PCREL_LO12_S were mixed, so the "IMM"
field were applied to incorrect position, this caused incorrect
src registers to be encoded.

gas/
	* config/tc-riscv.c (md_apply_fix): Fix PCREL_LO12_S issue.
	* testsuite/gas/riscv/ixup-local.s: Updated for PCREL_LO12_S cases.
	* testsuite/gas/riscv/fixup-local-relax.d: Likewise.
	* testsuite/gas/riscv/fixup-local-norelax.d: Likewise.

Signed-off-by: Jianwei Sun <sunny.sun@corelabtech.com>
2024-07-04 21:36:48 +08:00
Lifang Xia
f9d218de5c RISC-V: hash with segment id and pcrel_hi address while recording pcrel_hi
When the same address across different segments (sections) needs to be
recorded, it will overwrite the slot, leading to a memory leak. To ensure
uniqueness, the segment (section) ID needs to be included in the hash key
calculation.

gas/
	* config/tc-riscv.c (riscv_pcrel_hi_fixup): New "const asection *sec".
	(riscv_pcrel_fixup_hash): make sec->id and e->adrsess as the
	hash key.
	(riscv_pcrel_fixup_eq): Check sec->id at first.
	(riscv_record_pcrel_fixup): New member "sec".
	(md_apply_fix) <case BFD_RELOC_RISCV_PCREL_HI20>: Likewise.
	(md_apply_fix) <case BFD_RELOC_RISCV_PCREL_LO12_I>: Likewise.
2024-07-04 21:36:21 +08:00
Andre Vieira
433e2bef4a mve: Fix encoding for vcvt[bt] single-half float conversion instructions
The encoding was previously not taking into account that the Quad vector
registers were being encoded using their Q-register numbers rather than their
D-register equivalent (multiply by 2).

gas/

	* config/tc-arm.c (do_neon_cvttb_1): Use Q-register vector number
	rather than their D-register equivalent.

gas/testsuite/

	* gas/arm/mve-vcvt-3.d: Correct expected values in test.
2024-07-04 13:48:26 +01:00
Jens Remus
68e549ee54 gas: Validate SFrame RA tracking and fixed RA offset
Verify all architectures participating in SFrame generation do define
the mandatory SFrame return address (RA) tracking predicate function
sframe_ra_tracking_p. Do so by explicitly not testing for the macro
SFRAME_FRE_RA_TRACKING as otherwise required.

Verify that architectures not using SFrame RA tracking specify a valid
fixed RA offset.

gas/
	* gen-sframe.c (output_sframe_internal): Validate SFrame
	RA tracking and fixed RA offset.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
cd1fab1330 gas: Test predicate whether SFrame RA tracking is used
The existence of the macro SFRAME_FRE_RA_TRACKING only ensures the
existence of the macro SFRAME_CFA_RA_REG and the predicate function
sframe_ra_tracking_p. It does not indicate whether SFrame RA tracking
is actually used.

Test the return value of the SFrame RA tracking predicate function
sframe_ra_tracking_p to determine whether RA tracking is used.

This aligns the logic in functions get_fre_num_offsets and
output_sframe_row_entry to the one used in all other places.

gas/
	* gen-sframe.c (get_fre_num_offsets, output_sframe_row_entry):
	Test predicate to determine whether SFrame RA tracking is used.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00