Commit Graph

119303 Commits

Author SHA1 Message Date
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
Jens Remus
42e6e6904b gas: Don't skip SFrame FDE if .cfi_register specifies SP register
Neither ".cfi_offset SP, <offset>", ".cfi_register SP, <regno>", nor
".cfi_val_offset SP, <offset>" alter the tracking information to recover
the stack pointer (SP). Doing so would need an explicit .cfi_def_cfa,
which SFrame tracks.

The stack pointer (SP) register contents on entry can be reconstructed
from the SFrame CFA tracking information using information from the
current and initial SFrame FREs of the SFrame FDE:

1. Compute CFA from the current CFA base register (SP or FP) and CFA
   offset from the SFrame CFA tracking information from the SFrame FRE
   for the current instruction address:

     CFA = <current_base_reg> + <current_cfa_offset>

2. Compute SP from the current CFA and the CFA offset from the SFrame
   CFA tracking information from the initial SFrame FRE of the FDE:

     SP = CFA - <initial_cfa_offset>

While at it add comments to the processing of .cfi_offset and
.cfi_val_offset that the SP can be reconstructed from the CFA tracking
information.

gas/
	* gen-sframe.c (sframe_xlate_do_register): Do not skip SFrame
	FDE if .cfi_register specifies SP register.
	(sframe_xlate_do_offset,sframe_xlate_do_val_offset): Add comment
	that this is likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
df174a6b76 gas: Don't skip SFrame FDE if .cfi_register specifies RA w/o tracking
Do not skip SFrame FDE if .cfi_register specifies RA register without
RA tracking being actually used. Without RA tracking the register
contents can always be restored from the stack using the fixed
RA offset from CFA.

gas/
	* gen-sframe.c (sframe_xlate_do_register): Do not skip SFrame
	FDE if .cfi_register specifies RA register without RA tracking
	being used.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
541d3b6458 gas: Skip SFrame FDE if .cfi_window_save
CFI opcode DW_CFA_AARCH64_negate_ra_state is multiplexed with
DW_CFA_GNU_window_save. Process DW_CFA_AARCH64_negate_ra_state on
AArch64. Skip generation of SFrame FDE otherwise with the following
warning message:

  skipping SFrame FDE; .cfi_window_save

gas/
	* gen-sframe.c: Skip SFrame FDE if .cfi_window_save.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
c6024caf0c gas: Skip SFrame FDE if FP without RA on stack
The SFrame format cannot represent the frame pointer (FP) being saved
on the stack without the return address (RA) also being saved on the
stack, if RA tracking is used.

A SFrame FDE is followed by 1-3 offsets with the following information:

Without RA tracking:
1. Offset from base pointer (SP or FP) to locate the CFA
2. Optional: Offset to CFA to restore the frame pointer (FP)

With RA tracking:
1. Offset from base pointer (SP or FP) to locate the CFA
2. Optional: Offset to CFA to restore the return address (RA)
3. Optional: Offset to CFA to restore the frame pointer (FP)

When RA tracking is used and a FDE is followed by two offsets the
SFrame format does not provide any information to distinguish whether
the second offset is the RA or FP offset. SFrame assumes the offset to
be the RA offset, which may be wrong.

Therefore skip generation of SFrame FDE information and print the
following warning, if RA tracking is used and the FP is saved on the
stack without the RA being saved as well:

  skipping SFrame FDE; FP without RA on stack

gas/
	* gen-sframe.c (sframe_do_fde): Skip SFrame FDE if FP without RA
	on stack, as the SFrame format cannot represent this case.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
536119a44c gas: User readable warnings if SFrame FDE is not generated
The following generic warning message, which is printed whenever the
assembler skips generation of SFrame FDE, is not very helpful for the
user:

  skipping SFrame FDE; CFI insn <name> (0x<hexval>)

Whenever possible print meaningful warning messages, when the assembler
skips generation of SFrame FDE:

- skipping SFrame FDE; non-SP/FP register <regno> in .cfi_def_cfa
- skipping SFrame FDE; non-SP/FP register <regno> in
  .cfi_def_cfa_register
- skipping SFrame FDE; .cfi_def_cfa_offset without CFA base register
  in effect
- skipping SFrame FDE; {FP|RA} register <regno> in .cfi_val_offset
- skipping SFrame FDE; {SP|FP|RA} register <regno> in in .cfi_register
- skipping SFrame FDE; .cfi_remember_state without prior SFrame FRE
  state
- skipping SFrame FDE; non-default RA register <regno>

gas/
	* gen-sframe.h (SFRAME_FRE_BASE_REG_INVAL): New macro for
	invalid SFrame FRE CFA base register value of -1.
	* gen-sframe.c: User readable warnings if SFrame FDE is not
	generated.

gas/testsuite/
	* gas/cfi-sframe/common-empty-1.d: Update generic SFrame test
	case to updated warning message texts.
	* gas/cfi-sframe/common-empty-2.d: Likewise.
	* gas/cfi-sframe/common-empty-3.d: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
397582abe7 gas: Refactor SFrame CFI opcode DW_CFA_register processing
Refactor SFrame processing of CFI opcode DW_CFA_register into a separate
function. This harmonizes the CFI opcode processing.

While at it reword the comment on CFI opcodes that are not processed.

This is a purely mechanical change.

gas/
	* gen-sframe.c (sframe_do_cfi_insn, sframe_xlate_do_register):
	Refactor SFrame CFI opcode DW_CFA_register processing.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
541b0fbbf2 gas: Warn if SFrame FDE is skipped due to non-default return column
Print a warning message if SFrame FDE is skipped due to a non-default
DWARF return column (i.e. return address (RA) register number). This
may be caused by the use of CFI directive .cfi_return_column with a
non-default return address (RA) register number in the processed
assembler source code.

  Warning: skipping SFrame FDE due to non-default DWARF return column

gas/
	* gen-sframe.c: Warn if SFrame FDE is skipped due to non-default
	DWARF return column.

gas/testsuite/
	* gas/cfi-sframe/common-empty-3.d: Update test case to expect
	for new warning message when SFrame FDE is skipped due to
	a non-default DWARF return column.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
e24992c334 gas: Skip SFrame FDE if CFI specifies non-FP/SP base register
Do not generate SFrame FDE if DWARF CFI directives .cfi_def_cfa or
.cfi_def_cfa_register specify a CFA base register number other than
the architecture-specific stack-pointer (SP) or frame-pointer (FP)
register numbers.

This also causes the assembler to print a warning message, so that
skipping of the SFrame FDE does not occur silently.

Update the generic ld SFrame test case to be architecture independent.
Do not use CFI directive .cfi_def_cfa, as the specified CFA base
register number is not a valid SP/FP register number on all
architectures. An invalid SP/FP register number will now cause the
assembler to print a warning message and skip SFrame FDE generation.
Remove the offending CFI directive, that cannot be coded architecture-
independent, as the test case requires SFrame information to be
generated. This was reported by the Linaro-TCWG-CI for AArch64.

gas/
	* gen-sframe.c: Skip SFrame generation if CFI specifies
	non-FP/SP base register.

ld/testsuite/
	* ld-sframe/discard.s: Update generic SFrame test case to be
	architecture independent.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
bdde1b34c4 gas: Print DWARF call frame insn name in SFrame warning message
SFrame generation prints the DWARF call frame instruction opcode in
hexadecimal. Leverage get_DW_CFA_name to additionally print the
DWARF call frame instruction name in human readable form, while also
respecting fake CFI types. Use "(unknown)", if the DWARF call frame
instruction name is not known.

While at it use the terminology "instruction" for these DW_CFA_*, as
suggested by Indu.

This changes the following assembler SFrame generation warning message
as follows:

Old:
Warning: skipping SFrame FDE due to DWARF CFI op 0x<hexval>

New:
Warning: skipping SFrame FDE; CFI insn <name> (0x<hexval>)

gas/
	* gen-sframe.c (sframe_get_cfi_name): New function to get the
	DWARF call frame instruction name for a DWARF call frame
	instruction opcode.
	(sframe_do_cfi_insn): Use sframe_get_cfi_name to print the
	DWARF call frame instruction name for the DWARF call frame
	instruction opcode in the warning message.

gas/testsuite/
	* gas/cfi-sframe/common-empty-1.d: Update expected SFrame
	warning message text for DWARF call frame insn name.
	* gas/cfi-sframe/common-empty-2.d: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
5c7f6da432 readelf/objdump: Display SFrame fixed RA offset as 'f' in dump
For the SFrame FRE frame-pointer (FP) offset from CFA a 'u' is displayed
if it is unavailable.

For the SFrame FRE return-address (RA) offset from CFA a 'u' was
displayed if the ABI uses a fixed RA offset from CFA. By chance a
'u' was also displayed if the RA offset is unavailable, as the string
buffer was not initialized after formatting the FP offset. Note that it
could not occur that the FP offset was erroneously displayed as RA
offset, as the SFrame format cannot have a FRE with FP offset without
RA offset.

For the FRE RA offset display 'f' if the ABI uses a fixed RA offset
from CFA. Display a 'u' if it is unavailable.

libsframe/
	* sframe-dump.c: Display SFrame fixed RA offset as 'f' in dump.

gas/testsuite/
	* gas/cfi-sframe/cfi-sframe-common-4.d: Test for RA displayed
	either as 'u' (if RA tracking) or as 'f' (fixed RA offset if no
	RA tracking).
	* gas/cfi-sframe/cfi-sframe-common-5.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-6.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-7.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-8.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-x86_64-1.d: Test for RA displayed
	as 'f' (fixed RA offset), as x86-64 does not use RA tracking.
	* gas/scfi/x86_64/scfi-cfi-sections-1.d: Likewise.
	* gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise.

ld/testsuite/
	* ld-x86-64/sframe-plt-1.d: Test for RA displayed as 'f' (fixed
	RA offset), as x86-64 does not use RA tracking.
	* ld-x86-64/sframe-simple-1.d: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
76f05e1dfb readelf/objdump: Dump SFrame CFA fixed FP and RA offsets
The SFrame format allows architectures to specify fixed offsets from the
CFA, if any, from which the frame pointer (FP) and/or return address
(RA) may be recovered. These offsets are stored in the SFrame header.

For instance the SFrame generation in the assembler for x86 AMD64
specifies a fixed offset from the CFA, from which the return address
(RA) may be recovered.

When dumping the SFrame header, for instance in readelf/objdump with
option --sframe, do also dump the specified fixed offsets from the CFA,
if any, from which the frame pointer (FP) and return address (RA) may
be recovered.

Update the common SFrame test case verification patterns to allow for
the optional dumping of the CFA fixed FP/RA offsets. Update the x86-
specific SFrame and SCFI test case verification patterns to require a
CFA fixed RA offset of -8.

libsframe/
	* sframe-dump.c: Dump CFA fixed FP and RA offsets.

gas/testsuite/
	* gas/cfi-sframe/cfi-sframe-common-1.d: Test for optional fixed
	FP and RA offsets.
	* gas/cfi-sframe/cfi-sframe-common-2.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-3.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-4.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-5.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-6.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-7.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-common-8.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-x86_64-1.d: Test for fixed
	RA offset.
	* gas/cfi-sframe/common-empty-1.d: Test for optional fixed
	FP and RA offsets.
	* gas/cfi-sframe/common-empty-2.d: Likewise.
	* gas/cfi-sframe/common-empty-3.d: Likewise.
	* gas/scfi/x86_64/scfi-cfi-sections-1.d: Test for SFrame fixed
	RA offset.
	* gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise.

ld/testsuite/
	* ld-x86-64/sframe-plt-1.d: Test for SFrame fixed RA offset.
	* ld-x86-64/sframe-simple-1.d: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
8086fe0b3d gas: Enhance arch-specific SFrame configuration descriptions
Explicitly mention "SFrame" in the descriptions for the architecture-
specific SFrame configuration macros, variables, and functions.

Use the term "frame pointer" (FP) instead of "base pointer". This aligns
with the terminology used in the SFrame specification. Additionally it
helps not to confuse "base-pointer register" with the term "BASE_REG"
used in the specification to denote either the SP or FP register.

Specify what the SFRAME_CFA_*_REG register numbers are used for:
- SP (stack pointer): CFA tracking
- FP (frame pointer): CFA and FP tracking
- RA (return address): RA tracking

Align the descriptions for definitions in the source files to the
declarations in the header files.

gas/
	* config/tc-aarch64.h: Enhance architecture-specific SFrame
	configuration descriptions.
	* config/tc-aarch64.c: Likewise.
	* config/tc-i386.h: Likewise.
	* config/tc-i386.c: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Jens Remus
73b56ef2fd x86: Remove unused SFrame CFI RA register variable
gas/
	* config/tc-i386.c (x86_sframe_cfa_ra_reg): Remove.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-07-04 10:34:12 +02:00
Cui, Lili
b0dd832fa4 Support APX CFCMOV
The CMOVcc instruction proposed by EVEX has four different forms,
corresponding to the four possible combinations of EVEX.ND and EVEX.NF
values.

In the encoder part, when the CFCMOV template supports EVEX_NF, it means that
it requires EVEX.NF to be 1.

In the decoder part, CFCMOV_Fixup is used to reverse source and destination
operands in the 2-operand case.

gas/ChangeLog:

        * config/tc-i386.c (build_apx_evex_prefix): Set NF bit for cfcmov
        when the insn template supports EVEX_NF.
        * testsuite/gas/i386/x86-64-apx-inval.l: Add invalid tests for cfcmov.
        * testsuite/gas/i386/x86-64-apx-inval.s: Ditto.
        * testsuite/gas/i386/x86-64.exp: Add tests for cfcmov and cmov.
        * testsuite/gas/i386/x86-64-apx-cfcmov-intel.d: Ditto.
        * testsuite/gas/i386/x86-64-apx-cfcmov.d: Ditto.
        * testsuite/gas/i386/x86-64-apx-cfcmov.s: Ditto.

opcodes/ChangeLog:

        * i386-dis-evex-prefix.h: Add cfcmov instructions.
        * i386-dis.c (CFCMOV_Fixup): Special handling of cfcmov.
        (putop): Print 'cf' for cfcmov instructions.
        * i386-opc.h (EVEX_NF): New.
        * i386-opc.tbl: Add cfcmov instructions.
        * i386-mnem.h: Regerated.
        * i386-tbl.h: Regerated.
2024-07-04 15:55:00 +08:00
GDB Administrator
026eb0595f Automatic date update in version.in 2024-07-04 00:00:07 +00:00
Nelson Chu
14ea7f9b44 RISC-V: Tidy and complete testing of all architecture imply rules.
gas/
	* testsuite/gas/riscv/imply.s: New testcase for all imply cases.
	* testsuite/gas/riscv/imply.d: Likewise.
	* testsuite/gas/riscv/march-imply-i.s: Renamed to
	imply-zicsr-zifencei.s.
	* testsuite/gas/riscv/march-imply-i2p0-02.d: Renamed to
	imply-zicsr-zifencei-i2p0-misa-spec-2p2.d.
	* testsuite/gas/riscv/march-imply-i2p1-01.d/l: Renamed to
	imply-zicsr-zifencei-i2p1-misa-spec-20191213.d.
	* testsuite/gas/riscv/march-imply-i2p0-01.d: Removed.
	Combined into new imply testcase.
	* testsuite/gas/riscv/march-imply-i2p1-02.d: Likewise.
	* testsuite/gas/riscv/march-imply-a.d: Likewise.
	* testsuite/gas/riscv/march-imply-b.d: Likewise.
	* testsuite/gas/riscv/march-imply-f.d: Likewise.
	* testsuite/gas/riscv/march-imply-g.d: Likewise.
	* testsuite/gas/riscv/march-imply-h.d: Likewise.
	* testsuite/gas/riscv/march-imply-q.d: Likewise.
	* testsuite/gas/riscv/march-imply-smcsrind.d: Likewise.
	* testsuite/gas/riscv/march-imply-smstateen.d: Likewise.
	* testsuite/gas/riscv/march-imply-unsupported.d: Likewise.
	* testsuite/gas/riscv/march-imply-v.d: Likewise.
	* testsuite/gas/riscv/march-imply-zcd.d: Likewise.
	* testsuite/gas/riscv/march-imply-zcf.d: Likewise.
2024-07-03 16:05:59 +08:00
Alan Modra
5b714f5b6d Avoid possible signed overflow in decode_local_label_name
Matches what both fb_label_name and dollar_label_name use.

	* symbols.c (decode_local_label_name): Use unsigned variables.
2024-07-03 15:37:35 +09:30
Nelson Chu
aa8c6e6484 gas/doc/riscv: Fixed typo of `.insn cj' format
gas/
	* doc/c-riscv.texi: Fixed typo of `.insn cj' format.
2024-07-03 11:42:15 +08:00
Lingling Kong
2d5428d8cd x86-64: Support APX NF TLS IE with 2 operands
Support APX NF TLS IE with 2 operands.Verify it with ld and gold.

gas/

	* config/tc-i386.c (md_assemble): Allow APX NF TLS IE with
	2 operands.
	* testsuite/gas/i386/x86-64-gottpoff.d: Updated.
	* testsuite/gas/i386/x86-64-gottpoff.s: Add APX NF TLS IE
	tests with 2 operands.

gold/

	* testsuite/x86_64_ie_to_le.s: Add APX NF TLS IE tests with
	2 operands.
	* testsuite/x86_64_ie_to_le.sh: Updated.

ld/

	* testsuite/ld-x86-64/tlsbindesc.s: Add APX NF TLS IE tests
	with 2 operands.
	* testsuite/ld-x86-64/tlsbindesc.d: Updated.
	* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
2024-07-03 10:18:36 +08:00
Nelson Chu
0c43f0a1bc gas/doc/riscv: Fixed syntax of `.option arch' when reseting whole architecture
gas/
	* doc/c-riscv.texi: Fixed syntax of `.option arc'h when reseting whole
	architecture.  Don't need the `=' before ISA.
2024-07-03 09:52:34 +08:00
GDB Administrator
afa87be0fc Automatic date update in version.in 2024-07-03 00:00:16 +00:00
Tom Tromey
4401c3c098 Accept unnamed array in gdb.ada/limited-length.exp
Some compiler changes I'm working on cause a regression in
gdb.ada/limited-length.exp -- with the changes, the array type is
nameless and so is not mentioned in the max-value-size error message.

Because the array type is nameless in the source code, this seems like
an improvement to me, and so this patch changes the test to accept
either form.
2024-07-02 11:15:31 -06:00
Aditya Vidyadhar Kamath
d59d4e2f3a Use lwp field in ptid for AIX.
Currently in AIX, the private data is used to maintain the kernel thread ID.

This is a patch to trim the need to have another field in the private data of a thread in AIX.

We want to use the lwp field to represent the kernel thread ID to match or
make things similar to the Linux targets.
2024-07-02 17:27:31 +02:00
konglin1
eb5d719dd7 x86-64: Verify that TLS IE works with APX NF
Verify that

{nf} add %reg1, foo@gottpoff(%rip), %reg2
{nf} add foo@gottpoff(%rip), %reg, %reg2

work correctly with ld and gold.

gas/

	* testsuite/gas/i386/x86-64-gottpoff.d: Updated.
	* testsuite/gas/i386/x86-64-gottpoff.s: Add tests for
	"{nf} add %reg1, foo@gottpoff(%rip), %reg2" and
	"{nf} add foo@gottpoff(%rip), %reg, %reg2".

gold/

	* testsuite/x86_64_ie_to_le.s: Add tests for
	"{nf} add %reg1, foo@gottpoff(%rip), %reg2" and
	"{nf} add foo@gottpoff(%rip), %reg, %reg2".
	* testsuite/x86_64_ie_to_le.sh: Updated.

ld/

	* testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_6_GOTTPOFF
	for APX NF tests.
	* testsuite/ld-x86-64/tlsbindesc.d: Updated.
	* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-01 23:08:31 -07:00
GDB Administrator
aa0c55a966 Automatic date update in version.in 2024-07-02 00:00:52 +00:00
H.J. Lu
2539602136 ld: Move foo before delete in dl5.cc
* testsuite/ld-elf/dl5.cc (main): Move foo before delete.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-01 02:22:45 -07:00
Claudiu Zissulescu
7fafb57457 MAINTAINERS: Update my e-mail address
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-07-01 10:58:17 +03:00
Xi Ruoyao
d8eca16715 LoongArch: Remove unused code in ld test suite
These seems some left over from MIPS code and they do not make any
sense for LoongArch.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-07-01 10:12:59 +08:00
Alan Modra
79674bfc36 PR31941 objcopy --globalize-symbol
I think FILE symbols are special, and I can't see why anyone would
want them to be made global.  The fact that no one has reported this
bug since commit 7b4a0685e8 in 2005 supports that claim.

	PR 31941
	* objcopy.c (filter_symbols): Don't allow BSF_FILE symbols to
	be made global.
2024-07-01 11:04:31 +09:30
GDB Administrator
d65111ff0a Automatic date update in version.in 2024-07-01 00:00:58 +00:00
H.J. Lu
adf584eb92 ld: Avoid folding new and delete pairs
GCC 15 may fold new and delete pairs, like

  A *bb = new A[10];
  delete [] bb;
  bb = new (std::nothrow) A [10];
  delete [] bb;

as shown in

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115712

Avoid folding new and delete pairs by adding a function call between new
and delete.

	* testsuite/ld-elf/dl5.cc: Include "dl5.h".
	(A): Removed.
	Call foo between new and delete.
	* testsuite/ld-elf/dl5.h: New file.
	* testsuite/ld-elf/new.cc: Include "dl5.h".
	(foo): New function.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-06-30 15:43:58 -07:00
Marcus Nilsson
ebe3f6d0f1 objcopy: Allow making symbol global and weak on same invocation
Previously objcopy had to be run twice in order to make a local symbol
weak, first once to globalize it, and once again to mark it as weak.

	* objcopy.c (filter_symbols): Weaken symbols after making
	local/global changes.
	* testsuite/binutils-all/symbols-5.d,
	* testsuite/binutils-all/symbols-5.s: New test.
2024-07-01 07:19:47 +09:30
Alan Modra
01a8854406 tweak latest vms-alpha.c change
It's that tiny bit nicer to have the "len" expression in order of
the components in the buffer.
2024-06-30 14:41:42 +09:30
Alan Modra
4b8c2aaf2d Assertion `(data) <= (end)' failed in read_bases
* dwarf.c (skip_attribute): Don't increment data past end.
	Use SKIP_{S,U}LEB rather than READ_{S,U}LEB.
2024-06-30 14:41:37 +09:30
Alan Modra
6e46bdf64e Re: Rewrite SHT_GROUP handling
Some more error tweaks.  Report a zero entry as "invalid entry.."
rather than "unknown type..", and allow a section to be mentioned
twice in a group.

	* elf.c (process_sht_group_entries): Tweak error messages, and
	allow a duplicate index in a group without reporting an error.
2024-06-30 14:41:37 +09:30