aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-07-11gdb/record: add support to vinsert and vextract instructionsGuinevere Larsen3-11/+175
This patch adds support for the following instructions: * VEXTRACT[F128|I128|PS] * VINSERT[F128|I128|PS] * VPEXTR[B|W|D|Q] And associated test. For some reason, it seems that the extract instructions deal with the output register as though it was the first source register, so they use ModRM.r/m and VEX.B, instead of the usual ModRM.reg and VEX.R. This meant that the opcode collision with vbroadcastsd wasn't trivial. It can be easily solved by checking the VEX.map_select field, so soslving it was very easy. The VPEXTR instructions had several complicated collisions, and notably, vpextrw to a register works completely different to any other instruction in the family, so the code is messy, but it should be correct.
2025-07-11gdb/record: add support for more AVX broadcast instructionsGuinevere Larsen3-1/+36
This commit adds support for 3 instructions: * VBROADCASTSS * VBROADCASTSD * VBROADCASTF128 and extends the function vpbroadcast_test to include these.
2025-07-11gdb/record: add support for permutation instructionsGuinevere Larsen3-1/+119
This commit adds recording support for the following instructions: * VPERM2[I|F]128 * VPERM[D|Q|PD|PS] * VPERMILP[S|D] And associated tests.
2025-07-11gdb/record: add support for AVX/AVX2 shuffle instructionsGuinevere Larsen3-0/+87
This commit adds support for the following instructions: * VPSHUF[B|D|HW|LW] * VSHUFP[S|D] and the associated test.
2025-07-11gdb/record: Add support for AVX/AVX2 shift instructionsGuinevere Larsen3-0/+155
This commit adds record-full support to the following instructions: * VPSLL[W|D|Q|DQ] * VPSRL[W|D|Q|DQ] * VPSRA[W|D] With both dynamic and constant shifts, and the associated tests. Notably, vpsraq is not available for AVX or AVX2 instruction sets, only AVX512. vpsradq does not seem to be available with any instruction set.
2025-07-11gdb/record: support more AVX arithmetic instructionsGuinevere Larsen3-6/+74
This commit adds support to the following AVX/AVX2 instructions: * VPADD[B|W|D|Q] * VPMUL[LW|LD|HW|HUW|UDQ] * VXORP[S|D] * VPAND[|N] This required some reworking on the loop that processes instruction prefixes, because the opcode for VPMULLD overlapped with a valid instruction prefix. To fix that, rather than using "goto out_prefixes", this commit changes the infinite loop to only run while we don't find another VEX prefix. That should be OK, as the intel manual (page 526 on the March 2024 edition) says that the VEX prefix is always the last one.
2025-07-11aarch64: Support for FEAT_SVE_AES2Ezra Sitorus14-1502/+2035
FEAT_SVE_AES2 implements the SVE multi-vector Advanced Encryption Standard and 128-bit destination element polynomial multiply long instructions, when the PE is not in Streaming SVE mode.
2025-07-11aarch64: Support for FEAT_LSUIEzra Sitorus12-3077/+5234
FEAT_LSUI introduces unprivileged variants of load and store instructions so that clearing PSTATE.PAN is never required in privileged software.
2025-07-11aarch64: Support for FEAT_PCDPHINTEzra Sitorus13-2876/+2949
FEAT_PCDPHINT - Producer-consumer data placement hints - is an optional ISA extension that provides hint instructions to indicate: - a store in the current execution thread is generating data at a specific location, which a thread of execution on one or more other observers is waiting on. - the thread of execution on the current PE will read a location that may not yet have been written with the value to be consumed. This extension introduces: - STSHH, a hint instruction, with operands (policies) keep and strm - PRFM *IR*, a new prefetch memory operand.
2025-07-11s390: Announce s390 64-bit (s390x) SFrame V2 support in binutilsJens Remus2-1/+8
The preceding commits add s390 64-bit (s390x) support in binutils to generate SFrame stack trace information (.sframe section) in the assembler from CFI directives (with option --gsframe), generate .sframe section for linker-generated .plt section in the linker, and dump SFrame information in objdump and readelf (with option --sframe). binutils/ * NEWS: Announce s390 64-bit (s390x) SFrame V2 support in as, ld, objdump, and readelf. gas/ * NEWS: Update s390 64-bit (s390x) SFrame V2 support in assembler. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11s390: sframe: Test handling of .cfi_def_cfa_registerJens Remus3-0/+24
Port x86-64 test for handling of .cfi_def_cfa_register from commit 3602da6fa285 ("gas: sframe: fix handling of .cfi_def_cfa_register") to s390x. gas/testsuite/ PR gas/32879 * gas/cfi-sframe/cfi-sframe.exp: Add new test for handling of .cfi_def_cfa_register on s390x. * gas/cfi-sframe/cfi-sframe-s390x-3.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-3.s: Likewise. Bug: https://sourceware.org/PR32879 Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11s390: Store SFrame CFA offset adjusted and scaled downJens Remus2-12/+22
In SFrame V2 the size of the offsets following an SFrame FRE can be either signed 8-bit, 16-bit, or 32-bit integer, with the largest offset determining their size: 1. CFA offset from CFA base register 2. RA (stack save slot) offset from CFA, usually -48 on s390x if saved 3. FP (stack save slot) offset from CFA, usually -72 on s390x if saved The FP and RA offsets from CFA, when FP/RA saved on the stack, usually have fixed values that fit into signed 8-bit SFrame offsets. Likewise the DWARF register numbers on s390x of general registers (GR; 0-15) and floating-point registers (FPR; 16-31), when FP/RA saved in registers. With that the CFA offset from CFA base register has the greatest impact on the signed SFrame offset size. The s390x ELF ABI defines the stack pointer (SP) to be 8-byte aligned [1] and the CFA as SP at call site + 160 [2]. The CFA offset from CFA base register is therefore always a multiple of 8. On s390x store the SFrame CFA offset from CFA base register scaled down by the s390x-specific CFA alignment factor of 8, in addition to the adjustment by the s390x-specific CFA adjustment of -160, to further improve the use of signed 8-bit SFrame offsets. This is similar to the DWARF data alignment factor getting factored out from certain offsets stored in DWARF CFI. [1]: s390x ELF ABI, sections "Register Roles" and "Stack Frame Allocation", https://github.com/IBM/s390x-abi/releases [2]: s390x ELF ABI, commit 4e38ad9c8a88 ("Document the CFA"), https://github.com/IBM/s390x-abi/commit/4e38ad9c8a88 include/ * sframe.h (SFRAME_S390X_CFA_OFFSET_ALIGNMENT_FACTOR): Define s390x-specific CFA offset alignment factor. (SFRAME_V2_S390X_CFA_OFFSET_ENCODE, SFRAME_V2_S390X_CFA_OFFSET_DECODE): Scale down/up by SFRAME_S390X_CFA_OFFSET_ALIGNMENT_FACTOR. libsframe/ * doc/sframe-spec.texi (s390x, SFRAME_S390X_CFA_OFFSET_ALIGNMENT_FACTOR): Document s390x- specific CFA offset alignment factor. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11s390: Store SFrame CFA offset adjustedJens Remus6-10/+54
In SFrame V2 the size of the offsets following an SFrame FRE can be either signed 8-bit, 16-bit, or 32-bit integer, with the largest offset determining their size: 1. CFA offset from CFA base register 2. RA (stack save slot) offset from CFA, usually -48 on s390x if saved 3. FP (stack save slot) offset from CFA, usually -72 on s390x if saved The FP and RA offsets from CFA, when FP/RA saved on the stack, usually have fixed values that fit into signed 8-bit SFrame offsets. Likewise the DWARF register numbers on s390x of general registers (GR; 0-15) and floating-point registers (FPR; 16-31), when FP/RA saved in registers. With that the CFA offset from CFA base register has the greatest impact on the signed SFrame offset size. The s390x ELF ABI [1] defines the CFA as stack pointer (SP) at call site +160. [2] Therefore the minimum CFA offset from CFA base register on s390x is 160. This does not fit into a signed 8-bit integer and therefore effectively prevents any use of signed 8-bit SFrame offsets on s390x. For s390x store the CFA offset from CFA base register adjusted by -160 to enable the use of signed 8-bit SFrame offsets. [1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases [2]: s390x ELF ABI, commit 4e38ad9c8a88 ("Document the CFA"), https://github.com/IBM/s390x-abi/commit/4e38ad9c8a88 include/ * sframe.h (SFRAME_S390X_CFA_OFFSET_ADJUSTMENT): Define s390x-specific CFA offset adjustment. (SFRAME_V2_S390X_CFA_OFFSET_ENCODE, SFRAME_V2_S390X_CFA_OFFSET_DECODE): New s390x-specific macros. Use SFRAME_S390X_CFA_OFFSET_ADJUSTMENT to en-/decode CFA offset. bfd/ * elf64-s390.c (elf_s390x_sframe_plt_fre): Use SFRAME_V2_S390X_CFA_OFFSET_ENCODE on CFA offset to store it adjusted and switch to 8-bit offsets. gas/ * gen-sframe.c (sframe_fre_set_cfa_offset): For s390x use SFRAME_V2_S390X_CFA_OFFSET_ENCODE on CFA offset to store it adjusted. (sframe_fre_get_cfa_offset): New helper. For s390x use SFRAME_V2_S390X_CFA_OFFSET_DECODE on CFA offset to undo its adjustment. (sframe_xlate_do_def_cfa_register): Use new helper sframe_fre_get_cfa_offset. libsframe/ * sframe.c (sframe_fre_get_cfa_offset): For s390x use SFRAME_V2_S390X_CFA_OFFSET_DECODE on CFA offset to undo its adjustment. * doc/sframe-spec.texi (s390x, SFRAME_S390X_CFA_OFFSET_ADJUSTMENT, SFRAME_V2_S390X_CFA_OFFSET_ENCODE, SFRAME_V2_S390X_CFA_OFFSET_DECODE): Document s390x-specific adjustment of CFA offset. libsframe/testsuite/ * libsframe.find/plt-findfre-2.c (add_plt0_fde, add_pltn_fde): Use SFRAME_V2_S390X_CFA_OFFSET_ENCODE to enable use of 1-byte SFrame offsets. Suggested-by: Indu Bhagat <indu.bhagat@oracle.com> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11libsframe: Add test for PLT0 and PLTN with only one FRE eachJens Remus4-4/+240
On s390x the PLT0 and PLTN entries are described with one SFrame FRE each. Add a test case for this particularity. libsframe/testsuite/ * libsframe.find/find.exp (plt-findfre-2): Add new test. * libsframe.find/plt-findfre-2.c: New test for PLT0 and PLTN with only one FRE each. * libsframe.find/local.mk (plt-findfre-2): Add new test. libsframe/ * Makefile.in: Regenerate.
2025-07-11s390: Add SFrame stack trace information for .plt sectionJens Remus5-4/+298
Enable SFrame stack tracing through PLT entries. Based on x86-64. On s390x both PLT0 and PLTn entries are 32-bytes in size. Their code neither alters the stack pointer (SP), frame pointer (FP), nor return address (RA) registers. Therefore the PLT0 can be represented using a SFrame FDE of type PCINC with a single SFrame FRE and the PLTn can be represented using a SFrame FDE of type PCMASK, with a repetition block size of 32 (PLTn size), and a single SFrame FRE. Note that as both the PLT0 entry and the PLTn entries have equal size and could both be represented using the identical SFrame FRE, the whole .plt section on s390x could be represented using a single SFrame FDE of type PCMASK, with a repetition block size of 32 (PLT0 and PLTn size), and a single SFrame FRE. Keep the x86-64 logic with separate SFrame FDEs for PLT0 and PLTn, to ease potential generalization of the .sframe for .plt generation logic among architectures. bfd/ * elf64-s390.c: Include sframe.h and sframe-api.h. (PLT_SFRAME_FDE_START_OFFSET, SFRAME_PLT0_MAX_NUM_FRES, SFRAME_PLTN_MAX_NUM_FRES, elf_s390x_sframe_plt_fre, elf_s390x_sframe_plt): New .sframe template for .plt section. (elf_s390_link_hash_table): Add plt_cfe_ctx, plt_sframe, and sframe_plt fields. (_bfd_s390_elf_create_sframe_plt): New function. Fill in .sframe section for .plt section. (_bfd_s390_elf_write_sframe_plt): New function. Write .sframe section. (elf_s390_create_dynamic_sections): Create .sframe section for .plt section. (elf_s390_late_size_sections): Call _bfd_s390_elf_create_sframe_plt and _bfd_s390_elf_write_sframe_plt. (elf_s390_finish_dynamic_sections): Write .plt section start into .sframe FDE covering .plt section. Call _bfd_elf_merge_section_sframe on htab->plt_sframe. ld/ * NEWS: Add news entry. ld/testsuite/ * ld-s390/s390.exp: Add new test. * ld-s390/sframe-plt-1.d: New linker-generated .sframe for .plt test. * ld-s390/sframe-simple-1.d: Adjust expected test output due to linker-generated .sframe for .plt. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11s390: Represent FP without RA saved in SFrameJens Remus13-47/+116
If an architecture uses both SFrame RA and FP tracking SFrame assumes that the RA offset is the 2nd offset and the FP offset is the 3rd offset following a SFrame FRE. An architecture does not necessarily need to save both on the stack (or in register) at the same time or even at all. SFrame cannot represent FP without RA saved on stack (or in a register), since it cannot distinguish whether the 2nd offset is the RA or FP offset. For s390x use an invalid SFrame RA offset from CFA value of zero as padding to represent the FP being saved when the RA is not saved. This aligns with the existing invalid SFrame fixed RA offset from CFA value of zero. In a stack tracer this then also naturally falls into place, as it can skip restoring the RA in the topmost frame, if both the fixed RA offset (from SFrame header) and the RA offset (from FDE) are zero, without any need to test architecture-specific flags. include/ * sframe.h (SFRAME_FRE_RA_OFFSET_INVALID): New define. Used as padding offset. * sframe-api.h (sframe_fre_get_ra_offset): Add comment that for s390x an offset value of SFRAME_FRE_RA_OFFSET_INVALID indicates that the RA is not saved. gas/ * gen-sframe.c (get_fre_num_offsets): For s390x account padding RA offset, if FP without RA saved. (sframe_get_fre_offset_size): Likewise. (output_sframe_row_entry): For s390x write a padding RA offset, if FP without RA needs to be represented. (sframe_do_fde): Enable FP without RA saved to be represented on s390x. libsframe/ * sframe.c (sframe_fre_get_ra_offset): Add comment that for s390x an offset value of SFRAME_FRE_RA_OFFSET_INVALID indicates that the RA is not saved. * sframe-dump.c (dump_sframe_func_with_fres): Treat invalid RA offsets as if they were undefined. Display them as "U" to distinguish them. * doc/sframe-spec.texi (s390x): Document s390x-specific use of SFRAME_FRE_RA_OFFSET_INVALID to represent FP without RA saved. gas/testsuite/ * gas/cfi-sframe/cfi-sframe.exp: Rename s390x-specific tests. * gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-err-1.s: Rename to ... * cfi-sframe/cfi-sframe-s390x-fpra-offset-err-1.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-2.s: This. * gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-2.d: Likewise. Update test verification pattern accordingly. * cfi-sframe/cfi-sframe-s390x-fpra-register-err-1.s: Rename to ... * cfi-sframe/cfi-sframe-s390x-fpra-register-err-1.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-2.s: This. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-2.d: Likewise. Update test verification pattern accordingly. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11s390: Represent FP/RA saved in register in SFrameJens Remus11-33/+140
GCC on s390x, when in a leaf function, can be observed to save the frame pointer (FP) and/or return address (RA) register in a floating- point registers (FPR) instead of on the stack. This is declared using the following CFI directive: .cfi_register <fp/ra-regnum>, <fpr-regnum> SFrame cannot represent the FP and/or RA being saved in another register. It does only track the CFA base register (SP/FP), CFA offset from CFA base register, and FP and RA save area offsets from CFA. On s390x the FP and/or RA are only saved in another FPR when in a leaf function. That is a function that does not call any other function. Therefore it can ever only be the topmost function in a call chain. An unwinder by default has access to all registers of the function that is the topmost on the call stack. Therefore no further information is required to restore FP/RA from the FPR. Represent FP/RA saved in another register on s390x, by encoding the DWARF register number shifted by one to the left with the least- significant bit set in the offset as follows: offset = (regnum << 1) | 1 The use of the least-significant bit of the offset as indication is possible, as the stack pointer (SP), the CFA, and any register save area slots are 8-byte aligned according to the s390x ELF ABI: - The stack pointer (SP) "shall maintain an 8-byte alignment". [1] - The CFA is defined as SP at call site +160. [2] - Pointers and 8-byte integers, such as general register values, must be 8-byte aligned. [3] SFrame FP and RA stack offsets must therefore always be a multiple of 8 on s390x. Note that for the same reason the DWARF data alignment factor is -8 on s390x (see DWARF2_CIE_DATA_ALIGNMENT). Add s390x-specific SFrame (error) tests for FP/RA saved in FPRs in leaf function. [1]: s390x ELF ABI, sections "Register Roles" and "Stack Frame Allocation", https://github.com/IBM/s390x-abi/releases [2]: s390x ELF ABI, commit 4e38ad9c8a88 ("Document the CFA"), https://github.com/IBM/s390x-abi/commit/4e38ad9c8a88 [3]: s390x ELF ABI, section "Fundamental Types", table "Scalar types", https://github.com/IBM/s390x-abi/releases include/ * sframe.h (SFRAME_V2_S390X_OFFSET_IS_REGNUM): New s390x- specific macro to test whether an SFrame FP/RA offset is a DWARF register number. (SFRAME_V2_S390X_OFFSET_ENCODE_REGNUM): New s390x-specific macro to encode a DWARF register number into an SFrame FP/RA offset. (SFRAME_V2_S390X_OFFSET_DECODE_REGNUM): New s390x-specific macro to decode an SFrame FP/RA offset into a DWARF register number. * sframe-api.h (sframe_fre_get_fp_offset, sframe_fre_get_fp_offset): Add comment that for s390x the offset may be an encoded register number. gas/ * gen-sframe.c (s390_sframe_xlate_do_register): New S390- specific function. Uses SFRAME_V2_S390X_OFFSET_ENCODE_REGNUM to represent FP/RA saved in another register on s390x. (sframe_xlate_do_register): Invoke s390_sframe_xlate_do_register on s390x. libsframe/ * sframe.c (sframe_fre_get_fp_offset, sframe_fre_get_fp_offset): Add comment that for s390x the offset may be an encoded register number. * sframe-dump.c (is_sframe_abi_arch_s390x): New helper to test whether ABI/arch is s390x. (dump_sframe_func_with_fres): Use SFRAME_V2_S390X_OFFSET_IS_REGNUM and SFRAME_V2_S390X_OFFSET_DECODE_REGNUM to dump FP/RA saved in another register on s390x. * doc/sframe-spec.texi (s390x): Document s390x-specific representation of FP/RA saved in another register. gas/testsuite/ * gas/cfi-sframe/cfi-sframe.exp: Update s390x-specific SFrame (error) tests. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-err-2.s: Rename to ... * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-err-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-1.s: This. Test no longer triggers a warning, as SFrame can represent FP and RA saved in registers. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-1.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-err-1.d: Test now triggers a different warning, as SFrame can represent FP and RA saved in registers, but not FP without RA saved in register. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11s390: Initial support to generate .sframe from CFI directives in assemblerJens Remus30-10/+616
This introduces initial support to generate .sframe from CFI directives in assembler on s390 64-bit (s390x). Due to SFrame V2 format limitations it has the following limitations, some of them getting addressed by subsequent patches, which cause generation of SFrame FDE to be skipped: - SFrame FP/RA tracking only supports register contents being saved on the stack (i.e. .cfi_offset). It does not support FP/RA register contents being saved in other registers (i.e. .cfi_register). GCC on s390x can be observed to save the FP/RA register contents in floating- point registers, but only in leaf functions. This issue is detailed further and resolved in the subsequent commit "s390: Represent FP/RA saved in register in SFrame". - SFrame FP/RA tracking cannot represent FP without RA saved. This is because the format assumes SFrame FDE offset2 to be the RA offset, if there are two offsets, and offset3 to be the FP offset, if there are three offsets. There is no mean to distinguish whether offset2 is the RA or FP offset, if there are only two offsets. This issue is detailed further and resolved in the subsequent commit "s390: Represent FP without RA saved in SFrame". - SFrame assumes a dedicated FP register number. The s390x ELF ABI [1] does only designate register 11 as preferred FP register number. In general GCC and Clang on s390x use register 11 as frame pointer. GCC on s390x can be observed to use register 14 as frame pointer in the stack clash protector in the function prologue. glibc on s390x contains hand-written assembler code that uses register 12 as frame pointer. This s390x support is largely based on the AArch64 support from commit b52c4ee46657 ("gas: generate .sframe from CFI directives"). The SFrame ABI/arch identifier SFRAME_ABI_S390X_ENDIAN_BIG is introduced for s390x and added to the SFrame format specification. The s390x ELF ABI [1] specifies the following C calling conventions for s390x architecture: - Register 15 is the stack pointer (SP). - Register 14 contains the return address (RA) at function entry. - There is no dedicated frame pointer register. Register 11 is the preferred frame pointer (FP). [2] GCC and Clang in general use register 11 as frame pointer. - The CFA is defined as SP at call site +160. [3] The SP at call site can therefore be derived from the CFA using a SP value offset from CFA of -160. The s390x ELF ABI [1] does not assign any standard save slot to each register in the register save area of a stack frame. Neither the return address (RA, r14) nor preferred frame pointer (FP, r11) necessarily need to be saved. Therefore SFrame RA and FP tracking is used. Support for SFrame on s390 is only enabled for the 64-bit s390x ELF ABI (z/Architecture with 64-bit addressing mode). It is disabled for the 32-bit s390 ELF ABI (ESA/390 or z/Architecture with 32-bit addressing mode). s390x-specific SFrame assembler and linker tests are added, including error tests for use of a non-preferred frame pointer (FP) register and specification of a non-default return address (RA) register. [1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases [2]: s390x ELF ABI, commit f00421825979 ("Add information about the frame pointer register"), https://github.com/IBM/s390x-abi/commit/f00421825979 [3]: s390x ELF ABI, commit 4e38ad9c8a88 ("Document the CFA"), https://github.com/IBM/s390x-abi/commit/4e38ad9c8a88 include/ * sframe.h: Add reference to s390x architecture in comments. (SFRAME_ABI_S390X_ENDIAN_BIG): Define SFrame ABI/arch identifier for s390x. (SFRAME_S390X_SP_VAL_OFFSET): Define s390x-specific SP value offset from CFA. libsframe/ * sframe.c (need_swapping): Add SFRAME_ABI_S390X_ENDIAN_BIG. * doc/sframe-spec.texi (SFRAME_ABI_S390X_ENDIAN_BIG, s390x, SFRAME_S390X_SP_VAL_OFFSET): Document SFrame ABI/arch identifier for s390x, add references to s390x architecture, and document s390x-specifics, such as the SP value offset from CFA of -160. gas/ * config/tc-s390.h: s390x support to generate .sframe from CFI directives in assembler. (support_sframe_p): Define. (SFRAME_CFA_SP_REG, SFRAME_CFA_FP_REG, SFRAME_CFA_RA_REG): Define. (sframe_ra_tracking_p): Define. (sframe_cfa_ra_offset): Define. (sframe_get_abi_arch): Define. * config/tc-s390.c: s390x support to generate .sframe from CFI directives in assembler. (s390_sframe_cfa_sp_reg, s390_sframe_cfa_fp_reg, s390_sframe_cfa_ra_reg): New. Initialize to DWARF register numbers of stack pointer (SP, r15), preferred frame pointer (FP, r11), and return address (RA, r14) registers. (s390_support_sframe_p): New function. Return true if s390x. (s390_sframe_ra_tracking_p): New function. Return true. (s390_sframe_cfa_ra_offset): New function. Return SFRAME_CFA_FIXED_RA_INVALID. (s390_sframe_get_abi_arch): New function. Return SFRAME_ABI_S390X_ENDIAN_BIG if s390x, otherwise zero. * gen-sframe.c: Add reference to s390x architecture in comments. (sframe_xlate_do_val_offset): Add support for s390x-specific SFRAME_S390X_SP_VAL_OFFSET. * NEWS: Add news entry. gas/testsuite/ * gas/cfi-sframe/cfi-sframe.exp: Enable common SFrame tests for s390x. Add s390x-specific SFrame (error) tests. * gas/cfi-sframe/cfi-sframe-s390x-1.d: New s390x-specific SFrame test. * gas/cfi-sframe/cfi-sframe-s390x-1.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-2.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-err-1.d: New s390x-specific SFrame error test that uses a non-default frame-pointer register as CFA base register. * gas/cfi-sframe/cfi-sframe-s390x-err-1.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-err-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-err-2.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-err-3.d: New s390x-specific SFrame error test that uses a non-default return address register. * gas/cfi-sframe/cfi-sframe-s390x-err-3.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-1.d: New s390x- specific SFrame test that saves RA and FP individually on the stack. * gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-1.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-err-1.d: New s390x-specific SFrame error test that saves FP and RA individually, to trigger FP without RA saved. * gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-err-1.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-err-1.d: New s390x-specific SFrame error test that saves FP and RA individually in registers. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-err-1.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-err-2.d: New s390x-specific SFrame error test that saves RA and FP individually in registers. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-err-2.s: Likewise. ld/testsuite/ * ld-s390/s390.exp: Add simple SFrame test. * ld-s390/sframe-simple-1.d: New simple SFrame test. * ld-s390/sframe-bar.s: Likewise. * ld-s390/sframe-foo.s: Likewise. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11s390: Explicitly list linker dump testsJens Remus1-9/+6
Generating the linker dump test list using file globbing makes it difficult to exclude specific tests under certain circumstances. List them explicitly instead. This enables to add tests in the future that can be excluded. While at it reorganize how s390 linker tests get run for s390x. ld/testsuite/ * ld-s390/s390.exp: Reorganize and explicitly list linker dump tests. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11sframe: Ignore section padding when converting endiannessJens Remus1-2/+6
The .sframe section may have a trailing padding due to the architecture- specific default section alignment. Do not treat this padding as error when converting between target and host endianness. This can be observed when building Binutils with SFrame s390x support on x86-64 for s390x using configure option "--target=s390x-ibm-linux-gnu" and running the GAS test suite. While at it reuse the determined SFrame section header size. libsframe/ * sframe.c (flip_sframe): Ignore .sframe section padding. Reuse SFrame header size. Reported-by: Indu Bhagat <indu.bhagat@oracle.com> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-07-11Automatic date update in version.inGDB Administrator1-1/+1
2025-07-11AM_PO_SUBDIRSAlan Modra14-2737/+7
Swap AM_PO_SUBDIRS and ZW_GNU_GETTEXT_SISTER_DIR lines in */configure.ac. ZW_GNU_GETTEXT_SISTER_DIR indirectly invokes AC_REQUIRE(AM_PO_SUBDIRS) so results in AM_PO_SUBDIRS being emitted before ZW_GNU_GETTEXT_SISTER_DIR if it hasn't already been invoked.
2025-07-11gas v850 md_convert_fragAlan Modra6-64/+39
The v850 md_convert_frag function oddly calls subseg_change twice (commit 1cd986c58543). Neither call is needed, because that is done in size_seg. Convert the fr_opcode fixup field back (to an opindex, not fx_r_type) using a cast rather than a union, since we used casts when setting up those values. I guess the union was added to silence compiler warnings about wrong-size casts, but unfortunately results in the wrong value being retrieved on big-endian hosts. Change "buffer" to a char* as there is no need to make it an unsigned char*, and that way requires fewer casts. Finally, fix formatting and use uintptr_t when make the rs_machine_dependent frags. Remove subseg_change calls from cr16, crx, mn10200, mn10300, and sh md_convert_frag too.
2025-07-11union alpha_macro_argAlan Modra1-115/+113
Rename the old enum alpha_macro_arg to alpha_macro_argset, and create a union alpha_macro_arg to use in all the alpha_macro.emit functions. This avoids intptr_t casts on retrieving index values and void* casts on storing them in the alpha_macros array.
2025-07-10sim: riscv: Fix build issue due to INSN_CLASS_C was changed to INSN_CLASS_ZCANelson Chu1-1/+1
2025-07-10libiberty: sync with gccMatthieu Longo4-1/+728
Import the following commits from GCC as of r16-2170-g2f2e9bcfb0fd9c: 0fd98b6f9f2 libiberty: add routines to handle type-sensitive doubly linked lists
2025-07-10RISC-V: Fixed wrong imply result for zce when -march=rv32id_zceNelson Chu6-40/+32
The entry of "zce imply zcf" needs check_implicit_for_zcf, so it needs to be placed after the entries of "whatever imply f". Otherwise the implicit zcf may be missed. Also merge the march-implu-zce* testcases into imply testcases.
2025-07-10RISC-V: Clarify the imply rule of cNelson Chu17-228/+231
This also fix the imply result for .option rvc. Imply zcf when c and f and rv32 Imply zcd when c and d Imply zca when c Changed INSN_CLASS_C to INSN_CLASS_ZCA Changed INSN_CLASS_F_AND_C to INSN_CLASS_ZCF Changed INSN_CLASS_D_AND_C to INSN_CLASS_ZCD Changed INSN_CLASS_ZIHINTNTL_AND_C to INSN_CLASS_ZIHINTNTL_AND_ZCA
2025-07-10RISC-V: Deprecate ".option arch, -ext" for users due to its controversial useNelson Chu16-47/+71
Before we figure out the whole remove situations for ".option arch, -ext", and have any RISC-V public spec defines it, we should just deprecate it.
2025-07-10Automatic date update in version.inGDB Administrator1-1/+1
2025-07-09gas: ld: sframe: add new internal headerIndu Bhagat4-12/+38
for SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS. The intention of creating an abstraction like SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS is to address the concern that there should be a central place to enforce harmonious flags between GNU as and ld. At the moment, the only flag that needs to be enforced is SFRAME_F_FDE_FUNC_START_PCREL. sframe.h and sframe-api.h are installed headers by libsframe for the specification and implementation respectively. Adding a definition like SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS does not fit in either. Create a new internal header instead to keep the definition uncoupled from sframe.h and sframe-api.h. Rename the previously added SFRAME_F_LD_MUSTHAVE_FLAGS to define the new SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS. bfd/ * elf-sframe.c (_bfd_elf_merge_section_sframe): Use the new internal header and SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS. gas/ * gen-sframe.c (output_sframe_internal): Likewise. include/ * sframe-api.h (SFRAME_F_LD_MUSTHAVE_FLAGS): Move from.. * sframe-internal.h: ..to here. New file.
2025-07-09Merge init_private_section_data with copy_private_section_dataAlan Modra28-131/+79
init_private_section_data is used by the linker and is a special case of copy_private_section_data that copies a reduced set of section data from input to output. Merge the two functions, adding a link_info param to copy_private_section_data and remove init_private_section_data.
2025-07-09gas remove assorted unnecessary castsAlan Modra44-224/+190
This continues the saga of removing unnecessary casts, and making small code tidies in gas. Hopefully this sees the last of K&R anachronisms.
2025-07-09gas standardise md_section_alignAlan Modra25-25/+25
The point here is that when valueT is 64 bits and int is 32 bits, 1 << align doesn't work for shifts larger than the size of int. (Not that anyone is likely to use such large alignments in real code.)
2025-07-09gas function arg castsAlan Modra32-117/+104
This patch removes more unnecessary arg casts in various function calls.
2025-07-09gas fixupsAlan Modra10-43/+27
Remove unnecessary arg casts in fix_new and similar calls.
2025-07-09gas char/unsigned char castsAlan Modra22-101/+93
This patch removes many unneeded casts to char or unsigned char. It's worth noting that safe-ctype.h macros ISDIGIT and the like cope with either signed or unsigned char. In some cases a cast to unsigned char is replaced by anding with 0xff, which accomplishes the same thing but doesn't rely on char being eight bits. The patch also removes pointer casts, and a few unsigned char pointer variables.
2025-07-09gas alpha sign extension macrosAlan Modra1-25/+5
Use standard sign extend and range checking using unsigned expressions that don't rely on implementation defined right shifts or size of short and int.
2025-07-09gas md_number_to_charsAlan Modra30-187/+159
Calls to md_number_to_chars don't need to cast their value arg (*). Remove those casts. avr_output_property_recode made a call to md_number_to_chars with size of 1. Simplify that. tc-bpf.c md_convert_frag used write_insn_bytes that simply copied input to output. Dispense with that nonsense, and similarly in a couple of other places where md_number_to_chars was called with size 1. *) unless the value arg is an expression that needs a cast, eg. tic54x emit_insn where the shift left could trigger signed overflow UB without a cast.
2025-07-09z8k opcode_entry_typeAlan Modra3-5/+5
z8k opcode_entry_type.func is never used as a function pointer, only as a pointer to a pseudo_typeS. Change it to a void*.
2025-07-09gas various other void* castsAlan Modra20-63/+55
This removes assorted unneeded casts of void* pointers, and casts when passing args to void* parameters or storing to void* pointers. The patch also changes obj-coff.c stack_push to take a void* parameter, and replaces an odd memcpy in tc-metag.c find_insn_templates with a simple assignment.
2025-07-09gas various other const pointer changesAlan Modra16-87/+82
This removes a bunch of casts involving const pointers, in some cases by making variables const pointers so a cast is not needed. In a couple of places the cast hid errors with "&array" written rather than "array", see iq2000_macro_defs and s_pru_align. tc-xgate.c cmp_opcode is changed to be the standard qsort predicate to avoid a function cast.
2025-07-09gas d30v_insn plus other non-const pointersAlan Modra2-14/+14
d30v has a bunch of casts that are only needed due to various types missing a const. Fix that.
2025-07-09gas alloc castsAlan Modra18-39/+31
All of the various memory allocation function return a "void *" pointer, which needs no cast to assign to other pointer types.
2025-07-09gas bfd_put and bfd_get arg castsAlan Modra17-185/+185
bfd_{h_,}put_* and bfd_{h_,}get_* have "void *" pointer params nowadays. We don't need casts on their pointer args. We also don't need to cast values passed to bfd_put.
2025-07-09gas NULL castsAlan Modra69-398/+393
This removes many unnecessary NULL casts. I'm also adding a few arg casts in concat calls, to make the code consistent. Advice from quite a few years ago was that it's better to use the exact type for args corresponding to function ellipses, in case NULL is defined as plain 0. (I think that happened with some early 64-bit systems. Plain NULL ought to be OK nowadays.)
2025-07-09gas s3_FAIL and s7_FAILAlan Modra2-669/+669
s3_FAIL is defined as 0x80000000 which is unsigned, but everywhere it is used it is cast to int. Get rid of that silliness, and likewise for s7_FAIL.
2025-07-09gas more enum castsAlan Modra10-107/+106
Remove more unnecessary enum casts.
2025-07-09gas bfd_reloc_code_real_typeAlan Modra17-91/+78
Enumeration constants are integer types, so there should be no need to cast such constants to int in expressions. (Perhaps some older gccs warned, I checked back to gcc-4.5.) Remove some of those unnecessary casts. Also remove unnecessary casts to bfd_reloc_code_real_type.
2025-07-09gas add_ecoff_symbolAlan Modra1-49/+19
* ecoff.c: Remove unnecessary arg casts in add_ecoff_symbol calls throughout file.