aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
6 daysinclude: libsframe: rename SFrame V3 Flexible FDE macros to CTRLWORDIndu Bhagat1-4/+7
The existing SFrame V3 macros for Flexible FDEs used the term 'OFFSET' to refer to the data word encoding control/register data word. This can be confusing, as the control data word (register ID, dereference flags) is distinct from a stack offset. This patch renames these macros to use 'CTRLWORD' to better reflect their purpose. It also updates the assembler and libsframe dumper to use the new nomenclature. No functional change. Reviewed-by: Jens Remus <jremus@linux.ibm.com> gas/ * gen-sframe.c (sframe_get_fre_dataword_size): Use SFRAME_V3_FLEX_FDE_CTRLWORD_ENCODE. (output_sframe_row_entry_datawords): Likewise. include/ * sframe.h (SFRAME_V3_FLEX_FDE_REG_ENCODE): Rename from .. (SFRAME_V3_FLEX_FDE_CTRLWORD_ENCODE): .. to. (SFRAME_V3_FLEX_FDE_CTRLWORD_REGNUM): Rename from SFRAME_V3_FLEX_FDE_OFFSET_REG_NUM to this. (SFRAME_V3_FLEX_FDE_CTRLWORD_DEREF_P): Rename from SFRAME_V3_FLEX_FDE_OFFSET_REG_DEREF_P to this. (SFRAME_V3_FLEX_FDE_CTRLWORD_REG_P): Rename from SFRAME_V3_FLEX_FDE_OFFSET_REG_P to this. (SFRAME_V3_FRE_RA_UNDEFINED_P): Add new V3 macro. libsframe/ * sframe-dump.c (dump_sframe_func_fres_flex): Update all callers to use the new CTRLWORD macros. libsframe/testsuite/ * libsframe.decode/be-flipping-v3.c: Use renamed macros.
11 daysaarch64: Add -march=armv9.7-a optionAlice Carlotti1-0/+7
11 daysaarch64: Enable TLBIP instructions with tlbid optionSrinath Parvathaneni1-0/+2
TLBI Domains feature changes TLBI and TLBIP system instructions. For all TLBIP *E1IS*, TLBIP *E1OS*, TLBIP *E2IS* and TLBIP *E2OS* instructions that are currently dependent on FEAT_D128 (+d128), will also be available with FEAT_TLBID (+tlbid).
11 daysaarch64: Add support for FEAT_TLBID featureSrinath Parvathaneni1-0/+3
TLBI Domains feature changes TLBI and TLBIP system instructions. For the TLBI instruction with optional register argument <Rt> == 0b1111, with FEAT_TLBID enabled they are permitted to have an Rt value which is not 0b11111 and this is allowed for all the TLBI instructions with a <type> of ALLE1*, ALLE2*, VMALL*, VMALLS12* or VMALLWS2* and a <shareability> of IS or OS. This patch add support for FEAT_TLBID feature, which is enabled by new +tlbid option.
12 dayslibsframe: rename offset in user-facing sframe_frame_row_entry structIndu Bhagat1-4/+4
This patch is the first patch to align libsframe with the terminology change of moving from 'offset' to 'data word'. With the introduction of flexible FDE type SFRAME_FDE_TYPE_FLEX, the variable-length data following an SFrame FRE header can now represent signed offsets or unsigned control data. Consequently, 'data word' is adopted as the more generic term. This change updates the names used in the user-facing sframe_frame_row_entry structure. While some API function names remain unchanged to preserve existing contracts, the underlying data buffers and size macros now reflect the data word' terminology. libsframe is a tricky spot for such a terminology change: some of APIs are still used to read (may be followed by endian swap) for dumping SFrame V2 sections in textual format. Some classic examples are sframe_decode_fre, and flip_fre (both are static functions). But moving forward, using the term 'data word' for such APIs and their internal too may be better. Subsequent commits will achieve just that. include/ * sframe-api.h (MAX_NUM_DATAWORDS): Rename from MAX_NUM_STACK_OFFSETS. (MAX_DATAWORD_BYTES): Rename from MAX_OFFSET_BYTES. (struct sframe_frame_row_entry): Rename fre_offsets to fre_datawords. libsframe/ * sframe.c (sframe_fre_sanity_check_p): Use MAX_NUM_DATAWORDS. (sframe_get_fre_offset): Update internal pointers to use 'offsets' and access fre_datawords. (sframe_get_fre_udata): Rename local variables to dataword_cnt/dataword_size and update to use SFRAME_FRE_DATAWORD_* constants. (sframe_decode_fre): Use fre_datawords and MAX_DATAWORD_BYTES. (sframe_encoder_add_fre): Use fre_datawords. (sframe_encoder_write_fre): Use fre_datawords.
12 daysinclude: gas: sframe: fix terminology from offset to data wordIndu Bhagat1-6/+26
In SFrame V3, with the addition of flexible FDE type, the variable-length array of bytes trailing the SFrame FRE header are no longer exclusively interpreted as signed offsets. This data can now include unsigned control data, unsigned padding word data or signed offset data. Consequently, using the term "offsets" to describe this trailing data is inaccurate and can be confusing. This patch switches the terminology to 'Data Word' across the assembler and the SFrame header file. Note that, the term 'Word' is used colloquially here, the actual size (1, 2, or 4 bytes) remains determined by the applicable bits in the FRE info byte. gas/ * gen-sframe.c: Rename SFrame FRE 'offset' to 'data word'. include/ * sframe.h (SFRAME_FRE_DATAWORD_1B, SFRAME_FRE_DATAWORD_2B, SFRAME_FRE_DATAWORD_4B): New constants. (struct sframe_fre_info): Update bitfield documentation. (SFRAME_V3_FRE_DATAWORD_COUNT): New macro. (SFRAME_V3_FRE_DATAWORD_SIZE): New macro.
13 daysgas: implement parsing of object attributes v2Richard Ball1-0/+17
This patch adds the parsing logic for Object Attributes v2 (OAv2), enabling Gas to interpret and process these attributes correctly. It also updates the AArch64 backend to utilize the new parsing capabilities, and handle the new AArch64-specific directives. This patch relies on the abstractions introduced in the previous patch to store the data. Its scope is limited to parsing the new assembly directives, checking the inputs, and storing the data into the relevant OAv2 abstractions. Note that, for now, the new parsing capabilities are only available for AArch64. Even if the implementation was splitted into a generic part available in gas/config/obj-elf.c, and an AArch64-specific one in gas/config/tc-aarch64.c, the lack of GNU generic directives to handle OAv2 prevented the capability from being exposed to others backends. ** GNU assembler interface for aeabi subsections OAv2 introduced two new directives for AArch64: - .aeabi_subsection name, comprehension, encoding Create or switch the current subsection to 'name'. Comprehension values can be 'required' or 'optional'. Encoding values are limited for now to 'ULEB128', and 'NTBS' The comprehension and encoding are mandatory arguments on the first declaration of the subsection, but become optional for subsequent ones. - .aeabi_attribute tag, value Set 'tag' to 'value' in the current subsection. Tag can either be an integer, or one of the defined symbols in the backend. The usage of those directives will error if the following requirements are breached: - If the subsection X has been previously declared, the comprehension and encoding parameters of the current .aeabi_subsection that redeclares X have to match with the previous declaration. If those parameters are omited, no check is performed. - The type of the value set via .aeabi_attribute has to align with the current subsection. - If the tag N has already been declared for the current subsection, a later assignment to tag N is tolerated only if the newly set value is equal to the former one. This check is stricter than needed. Ideally, the tag N's values should be merged together, and an error should be raised only if an incompatibility is detected. Because the attributes are set in one chunk by GCC, there is no real use case for such a merge. The new parsing code is enabled/disabled via the TC_OBJ_ATTR_v1 and TC_OBJ_ATTR_v2 defines, and supports the following configurations: - enable both OAv1 and OAv2 parsing. This is currently used by no target, but is useful for migration from OAv1 to OAv2. - enable OAv1 parsing only. This is used by all targets supporting OAs except for AArch64. - enable OAv2 parsing only. This is only used by AArch64. ** Regarding the implementation The logic of OAv1 does not always keep separated the different data processing steps: parsing, convertion to internal abstractions, error checking and further processing (if any) on those abstractions, and their serialization into the object files. This patch takes into account the specifities of syntax for OAv1 and OAv2, but mutualize as much as possible the common behavior so that the same methods can be used for parsing the OAv1 and OAv2 directives. However, the mutualization of the code is limited by a different internal model for OAv1 and OAv2. Even if it is technically feaseable to have only one middle -end for OAv1, OAv2 and even GNU properties, sharing the same data model to perform the merge logic with the same code, it is a significant amount of work. This extra work was not considered as a part of this new feature, so this patch series will stick with the minimum of mutualization as possible. Co-Authored-By: Matthieu Longo <matthieu.longo@arm.com>
2026-01-16aarch64: Add support for FEAT_MTETCRichard Ball1-0/+2
This patch adds two new DC operations: *gbva *zgbva
2026-01-16[include] Add AT_HWCAP3/AT_HWCAP4 in elf/common.hTom de Vries1-0/+2
Since glibc 2.39, containing commit 3ab9b88 ("powerpc: Add HWCAP3/HWCAP4 data to TCB for Power Architecture."), glibc's elf/elf.h contains constants AT_HWCAP3/AT_HWCAP4. Add these in elf/common.h. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2026-01-16aarch64: Add support for FEAT_CMHRichard Ball1-0/+3
This patch adds the new instructions from FEAT_CMH These new instructions are hints, STCPH and SHUH. SHUH can have an operand PH or no operand.
2026-01-16aarch64: Add support for MLBI system instructionsRichard Ball1-0/+2
This patch adds support for MLB invalidate (MLBI) instruction. Syntax: MLBI <mlbi_op>{, <Xt>} This instruction is an alias to "SYS #4, C7, C0, #<op2>{, <Xt>}" and MLBI being the preferred disassembly. The following list of MLBI operations are supported in this patch for the MLBI instructions enabled by "+mpamv2" * alle1 * vmalle1 * vpide1 * vpmge1
2026-01-16aarch64: Add FEAT_MPAMv2 system registersEzra Sitorus1-0/+2
2026-01-15[SFrame-V3] sframe: s390: gas: testsuite: enable flex FDE for s390xIndu Bhagat1-3/+4
This commit amalgamates a patch set proposed by Jens Remus to enable the SFrame Version 3 Flexible FDE Type (SFRAME_FDE_TYPE_FLEX) generation for the s390x ABI. Previously, s390x relied on architecture-specific encoding (shifting register numbers into offset fields) to represent register recovery rules. This limited the complexity of CFI that could be supported. With Flex FDE enabled: - s390x can now represent .cfi_def_cfa using non-SP/FP registers. - The architecture-specific function s390_sframe_xlate_do_register () in GAS is replaced by the generic Flex FDE generation path. - The SFrame V3 specific macros for s390x register encoding are removed from libsframe/include, as the generic Flex FDE format handles explicit register columns natively. The testsuite is updated to replace negative tests (which asserted warnings or empty SFrame generation for these patterns) with positive tests verifying valid Flex FDE generation. Co-authored-by: Jens Remus <jremus@linux.ibm.com> gas/ * config/tc-s390.c (s390_support_flex_fde_p): Return true to enable Flex FDE generation. * gen-sframe.c (s390_sframe_xlate_do_register): Disable s390x specific implementation. (sframe_xlate_do_register): Invoke generic Flex FDE path now that flex FDE generation is supported. gas/testsuite/ * gas/cfi-sframe/cfi-sframe-s390x-err-1.d: Removed. * gas/cfi-sframe/cfi-sframe-s390x-err-1.s: Moved to... * gas/cfi-sframe/cfi-sframe-s390x-non-spfp-cfa-1.s: ...here. * gas/cfi-sframe/cfi-sframe-s390x-err-2.d: Removed. * gas/cfi-sframe/cfi-sframe-s390x-err-2.s: Moved to... * gas/cfi-sframe/cfi-sframe-s390x-non-spfp-cfa-2.s: ...here. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-1.d: Update to expect Flex FDE output. * gas/cfi-sframe/cfi-sframe-s390x-fpra-register-2.d: Likewise. * gas/cfi-sframe/cfi-sframe.exp: Run renamed tests. include/ * sframe.h (SFRAME_V3_S390X_OFFSET_IS_REGNUM): Remove. (SFRAME_V3_S390X_OFFSET_ENCODE_REGNUM): Remove. (SFRAME_V3_S390X_OFFSET_DECODE_REGNUM): Remove. libsframe/ * sframe-dump.c (sframe_s390x_offset_regnum_p): Return false for SFrame V3. (sframe_s390x_offset_decode_regnum): Remove V3 support.
2026-01-15[SFrame-V3] include: libsframe: remove SFRAME_F_FRAME_POINTER flagIndu Bhagat1-2/+1
SFrame V3 has 8 precious flag bits, two of which are being used. More flag byte (s) can be added to the auxiliary header when it comes to that. But for now, it may be worthwhile to use the 8-bits frugally. SFRAME_F_FRAME_POINTER flag bit was added with the intention of marking binaries built with frame-pointer preserved. A stack tracer could then use this information, to unambiguously ascertain whether frame-pointer based stack traces will be precise. But such a marking of binary will ideally be done by the linker, and at the moment adding such a framework is not justified for such small gain. The outcome of this is that SFRAME_F_FRAME_POINTER is never set in SFrame V2 binaries. Remove the definition SFRAME_F_FRAME_POINTER for SFrame V3. The relinquished bit can be used (in future format incarnations) when reading/dumping SFrame V2 sections are no longer supported by consumers. Changing the values of existing flags, e.g., SFRAME_F_FDE_FUNC_START_PCREL, is not being done for V3, to avoid version-specific flag bit reading (albeit doable) in consumers. Related changes to the specification are done in a subsequent commit. include/ * sframe.h (SFRAME_V3_F_ALL_FLAGS): Remove SFRAME_F_FRAME_POINTER from the set of V3 flags. libsframe/ * sframe-dump.c (dump_sframe_header_flags): Add a comment for clarity.
2026-01-15[SFrame-V3] ld: add --discard-sframe command line optionIndu Bhagat1-0/+4
Add a new command line option --discard-sframe to the linker. This option allows users to prevent the linker from generating an output .sframe section. The rationale for this option is: Consider the case when say, the distro is shipped with SFrame sections in the installed binaries/libraries. A user application using these installed libraries, but not enabling .sframe for itself just yet, will see an output .sframe corresponding to the pulled in libraries. This is "partial" .sframe information for the application. Adding such an option to the linker, gives user a way to turn off the .sframe section completely without relying on a linker script. Previously, the existing --no-ld-generated-unwind-info option controlled whether (not just .eh_frame for PLT entries, but also) SFrame for PLT entries. The new command line option, --discard-sframe now decouples SFrame from other unwind formats (like .eh_frame), allowing for more control over the output binary's SFrame data. The option is added for architectures that currently support SFrame: AArch64, s390x, and x86_64. bfd/ * elf-sframe.c (_bfd_elf_parse_sframe): Mark with SEC_EXCLUDE if --discard-sframe is in effect. * elf64-s390.c (elf_s390_create_dynamic_sections): Use discard_sframe to guard .sframe section creation. * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise. include/ * bfdlink.h (struct bfd_link_info): Add discard_sframe bitfield. ld/ * ldlex.h (enum option_values): Add OPTION_NO_LD_SFRAME_INFO. * lexsup.c (elf_sframe_list_options): New function. (ld_list_options): Add sframe_info argument. Update callers. * ld.texi: Update documentation. * emulparams/sframe-info.sh: New file. * emultempl/aarch64elf.em: Add --discard-sframe option listing and handling. * emulparams/elf64_s390.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * Makefile.am: Update to handle sframe-info.sh and new list options. * configure.ac: Handle SFRAME_INFO target variable. * Makefile.in: Regenerate. * configure: Regenerate. ld/testsuite/ * ld-x86-64/x86-64.exp: New test. * ld-x86-64/sframe-command-line-1.d: New test. * ld-aarch64/aarch64-elf.exp: New test. * ld-s390/s390.exp: New test. * ld-x86-64/x86-64.exp: New test. * ld-aarch64/sframe-command-line-1.d: New test. * ld-s390/sframe-command-line-1.d: New test. * ld-x86-64/sframe-command-line-1.d: New test.
2026-01-15[SFrame-V3] include: gas: libsframe: split FDE into idx and attrIndu Bhagat1-9/+13
This patch introduces a structural change to the SFrame V3 format. It shifts the SFrame Function Descriptor Entry (FDE) (a physical entity in SFrame V2) into a conceptual one in SFrame V3, such that an FDE is now split into two distinct parts to optimize the binary search table and data organization: - FDE Index (sframe_func_desc_idx_v3): This structure contains the essential indexing information: the function start address offset, function size in bytes, and the offset to the SFrame FDE attribute/Frame Row Entries (FREs) area for the function. - FDE Attributes (sframe_func_desc_attr_v3): The metadata regarding the function (number and size of FREs, FDE type, and repetition block size etc.) is moved to a new structure. On-Disk Layout: In V3, the "Attributes" are now stored immediately preceding the SFrame FREs for that function. The sfde_func_start_fre_off now points to the attr structure, and the actual FREs follow immediately after. IOW, the "Attributes" are now moved to the FRE sub-section, located immediately preceding the FREs for the respective function. The above layout has the advantage that: a) its cleaner with separation between the index elements vs other data b) the index has better cache locality (by virtue of it being smaller than the layout in SFrame V2). c) As the format evolves, the guarantees of alignment for FDE index are easier to maintain. FDE attr, being in the SFrame FRE sub-section, carry no guarantees of alignment. This had been previously suggested and communicated in an earlier discussion on binutils mailling list https://inbox.sourceware.org/binutils/29b1f7b0-61ea-410c-8aca-d5dd6115e668@oracle.com/ The read/write paths in sframe.c are updated to account for this split. sframe_fde_tbl_init now requires access to the FRE buffer to populate the internal FDE table, as the attributes are no longer resident in the FDE section. flip_sframe is refactored into version-specific handlers (_v2 and _v3) because the endian-swapping logic now differs significantly. In V3, the iterator must jump from the FDE table to the FRE section to swap the attributes. Lastly, the two entities generating SFrame sections (GAS and GNU ld) both now must _not_ set the sfde_func_start_fre_off to zero, when the number of FREs is zero. This is because now there will be some valid attr data at that location. Backward Compatibility: Due to the need to support readelf/objdump for SFrame V2 sections, the patch explicitly maintains V2 support via separate code paths (e.g., flip_sframe_fdes_with_fres_v2) Note about alignment: Now that the sframe_func_desc_idx_v3 is refactored out of the conceptual SFrame FDE, SFrame FDE index member elements are at aligned boundaries again. The alignment property for SFrame FDE was broken from an ealier patch "[08/36] sframe: gas: libsframe: use uint16_t for num_fres of FDE" up until this one. include/ * sframe.h (sframe_func_desc_entry_v3): Remove sfde_func_num_fres, sfde_func_info, sfde_func_info2, and sfde_func_rep_size. Rename to sframe_func_desc_idx_v3. (sframe_func_desc_attr_v3): New SFrame FDE attribute structure. libsframe/ * sframe.c (sframe_fde_tbl_init): Add argument for FRE buffer. Read attributes from the FRE section for V3. (flip_fde_desc): Rename from flip_fde. Check size against sframe_func_desc_entry_v3. (flip_fde_attr_v3): New function. (sframe_decode_fde_desc_v2): New function extracted from sframe_decode_fde. (sframe_decode_fde_desc_v3): New function. (sframe_decode_fde_attr_v3): New function. (flip_sframe_fdes_with_fres_v2): New function for V2 flipping. (flip_sframe_fdes_with_fres_v3): New function for V3 flipping. (flip_sframe): Dispatch to version-specific flip functions. (sframe_decode): Pass FRE buffer to sframe_fde_tbl_init. (sframe_decoder_get_offsetof_fde_start_addr): Adjust for subset of sframe_func_desc_entry_v3 restructured into sframe_func_desc_idx_v3. (sframe_encoder_get_offsetof_fde_start_addr): Likewise. (sframe_find_fre): Skip attribute size to find FREs in V3. (sframe_decoder_get_fre): Likewise. (sframe_decoder_get_fres_buf): Likewise. (sframe_encoder_add_fre): Add attribute size to byte count. (sframe_encoder_add_fres_buf): Read attributes from buffer. (sframe_encoder_write_fde): Write only FDE index fields. (sframe_encoder_write_func_attr): New function. (sframe_encoder_write_sframe): Write FDE attributes before FREs. gas/ * gen-sframe.c (output_sframe_funcdesc): Do not reset sfde_func_start_fre_off to zero when zero num FREs. (output_sframe_func_desc_attr): New refactored out function. (output_sframe_internal): Invoke output_sframe_func_desc_attr. libsframe/testsuite/ * libsframe.decode/DATA2: Regenerate data file.
2026-01-15[SFrame-V3] bfd: ld: sframe: avoid unnecessary decoding of SFrame FREs at ↵Indu Bhagat1-0/+23
link time At link time, in _bfd_elf_merge_section_sframe (), it suffices to bring over the all per-function stack trace metadata (all FREs) as a blob into the SFrame encoder object. There is no need to "decode" each SFrame FRE, only to add them in a serial fashion. This is an optimization, and not directly related to any SFrame V3 related changes to the specification. This should also bring us a step closer to supporting SFrame for targets which use linker relaxations. Removing the need to decode the input FREs can allow the linker to simply use the available set of FREs from (relocated) contents. To support targets using linker relaxations in SFrame, other changes in the SFrame parse functionality time may also be necessary, but this brings us just a step closer. Add two new APIs to accomplish this: - sframe_decoder_get_fres_buf, and - sframe_encoder_add_fres_buf bfd/ * elf-sframe.c (_bfd_elf_merge_section_sframe): Get all FRE data and add it all in bulk. libsframe/ * libsframe.ver: Add new APIs. * sframe.c (sframe_buf_fre_entry_size): New internal API to get size of one SFrame FRE at the indicated buffer location, without fully "decoding" the SFrame FRE. (sframe_decoder_get_fres_buf): New definition. (sframe_encoder_add_fres_buf): New definition. include/ * sframe-api.h (sframe_decoder_get_fres_buf): New declaration. (sframe_encoder_add_fres_buf): New declaration.
2026-01-15[SFrame-V3] libsframe: testsuite: add new argument to offset access APIsIndu Bhagat1-4/+14
For FDE type SFRAME_FDE_TYPE_FLEX, the offsets are not only laid out differently, they also have different encoding: - first data item is of unsigned type, it indicates the "Control Word" - second data item is of signed type, it indicates the "Offset Word" (The usage of "Word" above is colloquial, does not indicate a machine word of a specific size.) Adjust the APIs in libsframe to get stack frame offsets by adding a new argument type. Also add a new API to read the data items as unsigned types of the specified size: sframe_get_fre_udata. At the moment, like the generation routines in GAS, the textual dump routines in sframe-dump.c are also unaware of the FDE type SFRAME_FDE_TYPE_FLEX. In the next commits, these capabilities will be added. include/ * sframe-api.h (MAX_NUM_STACK_OFFSETS): Increase the number of stack offsets to 6 to accommodate the FDE type SFRAME_FDE_TYPE_FLEX. (sframe_get_fre_udata): New declaration. (sframe_fre_get_cfa_offset): Add new arg. (sframe_fre_get_fp_offset): Likewise. (sframe_fre_get_ra_offset): Likewise. libsframe/ * libsframe/sframe-dump.c (dump_sframe_func_with_fres): Pass SFRAME_FDE_TYPE_DEFAULT for FDE type. * sframe.c (sframe_fre_get_cfa_offset): Handle FDE type. (sframe_fre_get_fp_offset): Likewise. (sframe_fre_get_ra_offset): Likewise. * libsframe/libsframe.ver: Add new API sframe_get_fre_udata. libsframe/testsuite/ * libsframe.find/findfre-1.c: Pass SFRAME_FDE_TYPE_DEFAULT for FDE type. * libsframe.find/findfunc-1.c: Likewise. * libsframe.find/plt-findfre-1.c: Likewise. * libsframe.find/plt-findfre-2.c: Likewise.
2026-01-15[SFrame-V3] gas: bfd: include: libsframe: fixup terminology 'PC Type' vs ↵Indu Bhagat1-17/+36
'FDE Type' In SFrame V2, we did use the the term 'FDE Type' for the two designated 'PC Type' for the SFrame FDEs (SFRAME_FDE_TYPE_PCINC, SFRAME_FDE_TYPE_PCMASK). In hindsight, 'FDE Type' was an inappropriate term for the said intent. Fix this terminology by defining two new constants: - SFRAME_V3_FDE_PCTYPE_MASK - SFRAME_V3_FDE_PCTYPE_INC The old constants from V2 (SFRAME_FDE_TYPE_PCINC, SFRAME_FDE_TYPE_PCMASK) remain, but are now unused in the codebase. The term 'FDE Type' should be used for the actual FDE Types. In a subsequent commit, we will add SFRAME_FDE_TYPE_FLEX FDE Type for SFrame V3. bfd/ * elf64-s390.c (_bfd_s390_elf_create_sframe_plt): Rename inappropriate SFRAME_FDE_TYPE_PCINC to SFRAME_V3_FDE_PCTYPE_INC. * elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Likewise. Also rename inappropriate SFRAME_FDE_TYPE_PCMASK to SFRAME_V3_FDE_PCTYPE_MASK. gas/ * gen-sframe.c (output_sframe_funcdesc): Likewise. * sframe-opt.c (sframe_convert_frag): Likewise. libsframe/ * sframe-dump.c (dump_sframe_func_with_fres): Likewise. * sframe.c (sframe_fre_check_range_p): Likewise. (sframe_fde_create_func_info): Likewise. libsframe/testsuite/ * libsframe.encode/encode-1.c: Likewise. * libsframe.find/findfre-1.c: Likewise. * libsframe.find/findfunc-1.c: Likewise. * libsframe.find/plt-findfre-1.c: Likewise. * libsframe.find/plt-findfre-2.c: Likewise.
2026-01-15[SFrame-V3] include: sframe: reserve 5 bits for new FDE typesIndu Bhagat1-5/+37
In SFrame V2, the FDE representation caters to the most common cases of stack trace metadata: - CFA is SP/FP based, - FP/RA offsets, if present are CFA based (except some cases in s390x where reg can be encoded). Introduce an additional FDE type SFRAME_FDE_TYPE_FLEX, which can encode a more flexible set of CFA, FP and RA recovery rules. Some of the patterns supported include: - CFA may be non-SP/FP based. - CFA, FP may encode dereferencing of register after offset adjustment - RA may be in a non-default register. The important bit here is that since SFrame does not track all callee-saved registers, the above-mentioned recovery rules must only be done for topmost frames (by the stack tracer). Adding a new FDE type does have implications for a stack tracer in that it needs to: - Check the FDE type before interpreting the variable length bytes trailing the SFrame FRE header as stack offsets. - If the FDE type is SFRAME_FDE_TYPE_FLEX, and the recovery rules employ the use of any non-SP/FP based register, the stack tracer must proceed only if it is the topmost frame on stack. For CFA, RA, and FP, up to two "offsets" may be used. The two offsets represent the information as follows: - (minimum 8-bit) offset1 to encode register like: (regnum << 3) | unused << 2 | deref << 1 | reg_p (=1) - offset2 to encode offset: offset reg_p = 1 indicates a register, reg_p = 0 indicates CFA. The offsets are in the usual order: CFA, RA, FP if present. For example, for FP/RA tracking, a) If the reg is REG1 for FP/RA tracking, - Encoding: + offset1 to encode register: (REG1 << 3) | unused << 2 | deref << 1 | reg_p (=1) + offset2 to encode offset: offset - Action: + if deref, FP/RA = \*(REG1 + offset) (e.g., seen for FP recovery with certain DRAP patterns on x86_64) + if no deref, FP/RA = REG1 + offset b) If the reg is CFA for FP/RA tracking, - Encoding: + [=Effectively Padding] offset1 to encode register: (( 0 << 3 ) | unused << 2 | 0 << 1 | reg_p (=0)) + offset2 to encode offset: offset - Action: + if deref, FP/RA = *(CFA + offset) + if no deref, FP/RA = CFA + offset (pattern shouldnt be seen for RA) Next for CFA tracking, - Action: + if deref, CFA = *(reg + offset) (e.g., seen for CFA recovery in some stack realignment patterns on AMD64) + if no deref, CFA = reg + offset (e.g., for .cfi_def_cfa 2, 8, or .cfi_def_cfa 10, 0) Expected usage of this FDE type is quite low (DRAP on x86_64). NB: In SFrame V2, we did use the the term 'FDE Type' for the two designated 'PC Type' for the SFrame FDEs (SFRAME_FDE_TYPE_PCINC, SFRAME_FDE_TYPE_PCMASK). In hindsight, 'FDE Type' was inappropriate term. In a subsequent commit, we will fix this terminology for SFrame V3. include/ * sframe.h (SFRAME_FDE_TYPE_FLEX): New SFrame FDE type. (SFRAME_V3_FDE_TYPE_MASK): New constant definition. (SFRAME_V3_FDE_TYPE): New macro definition. (SFRAME_V3_SET_FDE_TYPE): Likewise. (SFRAME_V3_FLEX_FDE_REG_ENCODE): Macro to encode register in the SFrame offset data. (SFRAME_V3_FLEX_FDE_OFFSET_REG_NUM): New definition. (SFRAME_V3_FLEX_FDE_OFFSET_REG_DEREF_P): Likewise. (SFRAME_V3_FLEX_FDE_OFFSET_REG_P): Likewise.
2026-01-15[SFrame-V3] include: gas: libsframe: add 8-bits of func_info2 for ↵Indu Bhagat2-3/+12
extensibility in FDE The existing field func_info (in the SFrame FDE) is used to convey important information around the encoding and interpretation of the rest of the stack trace data for the respective SFrame FDE: the SFrame FRE type, SFrame FDE PC type, etc. Currently there is 1 bit left for AArch64, and 2 bits for AMD64, s390x (and other future ABIs to be supported). Provision some additional space now (specifically an additional 8-bits) for future needs for V3 and beyond. Compared to V2, this now increases the size of SFrame FDE by 1 byte in V3. In this patch, the additional func_info2 byte is not used functionally yet. Hence, rather mechanical changes in libsframe, bfd and libsframe/testsuite accompany. We will put func_info2 into use in a later patch by reserving 5 of these bits for SFrame FDE types. With the addition of a new byte for additional func info (func_info2), add a new arg to allow usecases like textual dumper to get all data members in one API: sframe_decoder_get_funcdesc_v3. To keep the APIs symmetric looking, add new arg to sframe_encoder_add_funcdesc_v3 too. Since bfd uses these APIs, carry out the mechanical change in the respective APIs too. And of course, the testsuite which exercises these APIs. bfd/ * elf-sframe.c (_bfd_elf_merge_section_sframe): Get and set func_info2. * elf64-s390.c (_bfd_s390_elf_create_sframe_plt): Pass 0 for func_info2 for SFrame FDE for PLT. * elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Likewise. gas/ * gen-sframe.c (output_sframe_funcdesc): Emit the uint8_t for func_info2. libsframe/ * sframe-dump.c (dump_sframe_func_with_fres): * sframe.c (sframe_fde_tbl_init): Handle the new additional member. (sframe_encoder_write_fde): Likewise. * sframe.c (sframe_decoder_get_funcdesc_v3): Update func_info2. libsframe/testsuite/ * libsframe.decode/DATA2: Update data file with SFrame section data. * libsframe.encode/encode-1.c: Pass 0 for func_info2 arg. * libsframe.find/findfre-1.c: Likewise. * libsframe.find/findfunc-1.c: Likewise. * libsframe.find/plt-findfre-1.c: Likewise. * libsframe.find/plt-findfre-2.c: Likewise. include/ * sframe.h: Add new uint8_t sfde_func_info2 to sframe_func_desc_entry_v3. * sframe-api.h (sframe_decoder_get_funcdesc_v3): New arg. (sframe_encoder_add_funcdesc_v3): Likewise.
2026-01-15[SFrame-V3] sframe: gas: bfd: add support for signal framesIndu Bhagat1-6/+11
Reserve a bit in function info byte in the SFrame FDE to designate signal frames. Also update the SFrame opt code in GAS and dumping routines in libsframe to handle signal frame bit. include/ * sframe.h (SFRAME_V3_FDE_SIGNAL_P): Extract signal frame bit. (SFRAME_V3_FDE_UPDATE_SIGNAL_P): Set signal frame bit. gas/ * gen-sframe.c (get_dw_fde_signal_p): New function to retrieve signal frame state from DWARF FDE. (sframe_v3_set_func_info): Renamed from sframe_v1_set_func_info. Accept signal_p argument and encode it. (sframe_set_version): Update ops to use sframe_v3_set_func_info. (sframe_set_func_info): Pass signal_p to the ops hook. (output_sframe_funcdesc): Retrieve signal frame marker and pass to sframe_set_func_info. * gen-sframe.h (struct sframe_version_ops): Update set_func_info signature. * sframe-opt.c (sframe_convert_frag): Preserve signal_p bit during fragment conversion. While at it, use SFRAME_V3_* macros where applicable. libsframe/testsuite/ * gas/cfi-sframe/cfi-sframe-common-13.d: New test. * gas/cfi-sframe/cfi-sframe-common-13.s: New test. * gas/cfi-sframe/cfi-sframe.exp: Run new test. libsframe/ * sframe-dump.c (dump_sframe_func_with_fres): Decode signal frame bit and print "S" attribute in the dump output.
2026-01-15[SFrame-V3] include: libsframe: bfd: gas: testsuite: support for signed ↵Indu Bhagat2-5/+5
64-bit offset in SFrame FDE This change enables support text > 2 GiB in SFrame format. Each SFrame FDE needs to hold information about the start PC of the function it pertains to. Currently, the field 'sfde_func_start_address' in SFrame FDE is encoded as a 32-bit offset to the start PC of the function from the field itself. In SFrame V2, this offset was a signed 32-bit offset. The signedness gives the flexibility of having .sframe ELF section before or after the .text* sections. But the size of 32-bit puts the limitation that .sframe togther with the .text* sections must fit the 2 GiB range. Currently, if the linker sees the offset not representable as 32-bit signed offset, it issues an error (not seen in the wild, simulated by forcing a function to align via an '.align 2147483648' directive): test.o:(.sframe+0x1c): relocation truncated to fit: R_X86_64_PC32 against `.text' make: *** [Makefile:7: all] Error 1 ATM, EH Frame also suffers with the same issue. Moving forward, some cloud applications have been shown to be nearing 1.5 GiB threshold. Extending the offset to int64_t now seems to be good choice to make now for future-proof'ing the sections. The use of int64_t offset is done for all SFrame V3 sections. This bump from int32_t to int64_t should not lead to an increase in the size of SFrame sections, because of the following additional changes to the SFrame FDE specification: - Reduce the type of sfde_func_num_fres (from uint32_t to uint16_t) - Remove the 2 bytes of padding (sfde_func_padding2). These served the two-fold purpose of keeping FDE data aligned _and_ unused space for future needs. Now that the offset is int64_t, start using the sframe_decoder_get_funcdesc_v3 () instead of sframe_decoder_get_funcdesc_v2 () in GNU ld. This patch changes the offset type in the SFrame FDE definition to an int64_t. No further changes in gas are necessary because the code already accounts for writing out as per the size of the member of the struct: emit_expr (&exp, sizeof_member (sframe_func_desc_entry, sfde_func_start_offset)); bfd/ * elf-sframe.c (sframe_read_value): Signed offset for start PC is 8-bytes now. (_bfd_elf_merge_section_sframe): Likewise. * elf64-s390.c (_bfd_s390_elf_create_sframe_plt): Use V3 API. (elf_s390_finish_dynamic_sections): Signed offset for start PC is 8-bytes now. * elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Use V3 API. (_bfd_x86_elf_finish_dynamic_sections): Signed offset for start PC is 8-bytes now. gas/ * sframe.c (output_sframe_funcdesc): Rename to sfde_func_start_offset. libsframe/ * libsframe/sframe.c (sframe_fde_tbl_init): Rename to sfde_func_start_offset. (flip_fde): Likewise. (sframe_decoder_get_secrel_func_start_addr): Use int64_t. (sframe_fre_check_range_p): Likewise. (sframe_decoder_get_offsetof_fde_start_addr): Rename to sfde_func_start_offset. (sframe_get_funcdesc_with_addr_internal): Use int64_t. (sframe_find_fre): Likewise. (sframe_encoder_get_offsetof_fde_start_addr): Rename to sfde_func_start_offset. (sframe_encoder_add_funcdesc_internal): Use int64_t. (sframe_encoder_add_funcdesc): Likewise. And rename to sfde_func_start_offset. (sframe_encoder_write_fde): Rename to sfde_func_start_offset. libsframe/testsuite/ * libsframe.decode/DATA2: Regenerate the data file. * libsframe.encode/encode-1.c: Use int64_t for start pc offset. * libsframe.find/findfre-1.c: Likewise. * libsframe.find/findfunc-1.c: Likewise. * libsframe.find/plt-findfre-1.c: Likewise. * libsframe.find/plt-findfre-2.c: Likewise. include/ * sframe-api.h (sframe_find_fre): Update arg type to int64_t. (sframe_encoder_add_funcdesc): Likewise. * sframe.h: Change data type to int64_t.
2026-01-15[SFrame-V3] sframe: gas: libsframe: remove padding field from FDEIndu Bhagat1-1/+0
Remove the unused sfde_func_padding2 member from the sframe_func_desc_entry_v3 structure. A later patch in this series reorganizes the members of the FDE structure in a way explicit padding is no longer necessary to keep natural alignment. So remove the explicit padding now. Reviewed-by: Jens Remus <jremus@linux.ibm.com> include/ * sframe.h: Remove sfde_func_padding2 from sframe_func_desc_entry_v3. gas/ * gen-sframe.c (output_sframe_funcdesc): Stop writing sfde_func_padding2. libsframe/ * sframe.c (sframe_encoder_write_fde): Stop writing sfde_func_padding2. * testsuite/libsframe.decode/DATA2: Regenerate binary test data.
2026-01-15[SFrame-V3] sframe: gas: libsframe: use uint16_t for num_fres of FDEIndu Bhagat1-1/+1
Reduce the size of the num_fres field in the Function Descriptor Entry (FDE) from 32 bits to 16 bits. The number of Frame Row Entries (FREs) for a single function is extremely unlikely to exceed 65,535 in real-world scenarios. Reducing this field saves 2 bytes per FDE, contributing to a smaller overall SFrame section size. (BTW, these savings will be eaten up by a later commit which adds support for text > 2 GiB by increasing an offset from int32_t to int64_t). Safety checks are added to the assembler to warn and skip SFrame FDE generation if a function's FRE count exceeds UINT16_MAX. Note regarding alignment: With the current patch, the members of sframe_func_desc_entry_v3 are not at aligned boundaries anymore. Recall that all sframe_func_desc_entry_v3 entries are stored together in the "SFrame FDE sub-section" forming an index. Only after a later patch in the series "[29/36] [SFrame-V3] include: gas: libsframe: split FDE into desc and attr" will the alignment properties of SFrame index will be restored. include/ * sframe.h (sframe_func_desc_entry_v3): Change sfde_func_num_fres type to uint16_t. gas/ * gen-sframe.c (output_sframe_funcdesc): Write 2 bytes for num_fres and assert it fits in uint16_t. (sframe_do_fde): Add check to skip FDE emission if num_fres exceeds UINT16_MAX. libsframe/ * sframe.c (sframe_encoder_write_fde): Cast num_fres to uint16_t to ensure correctly written out data. * testsuite/libsframe.decode/DATA2: Update binary test data.
2026-01-15[SFrame-V3] libsframe: add V3 APIs for adding and getting SFrame FDEIndu Bhagat1-0/+23
(Similar to V2) Add two new APIs for adding and getting SFrame FDE: - sframe_encoder_add_funcdesc_v3 - sframe_decoder_get_funcdesc_v3 Note the argument for the function start address is int64_t instead of int32_t (the latter is used in sframe_encoder_add_funcdesc_v2 and sframe_encoder_get_funcdesc_v2). The new V3 APIs will be used in a subsequent commit to extend SFrame V3 to support text > 2 GiB by allowing int64_t offsets by default. Similar to the analogous V2 APIs, they return 0 on success and SFRAME_ERR (in case of sframe_decoder_get_funcdesc_v3) or error code (in case of sframe_encoder_add_funcdesc_v3) on failure. Reviewed-by: Jens Remus <jremus@linux.ibm.com> include/ * sframe-api.h (sframe_decoder_get_funcdesc_v3): New declaration. (sframe_encoder_add_funcdesc_v3): Likewise. libsframe/ * libsframe.ver: Add the new APIs. * sframe.c (sframe_decoder_get_funcdesc_v3): New definition. (sframe_encoder_add_funcdesc_v3): Likewise.
2026-01-15[SFrame-V3] sframe: gas: bfd: ld: format bump to version 3Indu Bhagat1-1/+46
Bump version to SFRAME_VERSION_3. Introduce a new definition of SFrame FDE for version 3, which is a duplicate of SFrame FDE in V2, for now. In other words, no changes to the format specification yet. GNU as emits SFrame V3 by default. SFrame encoder (ld) emits SFrame V3 sections. In a later commit, we will add a new command line option to gas: --gsframe-3 which will bind the implementation in gas to emit SFrame V3. Also, adjust the testcases for the new version string "SFRAME_VERSION_3". bfd/ * elf-sframe.c (_bfd_elf_merge_section_sframe): Linker emits the latest version by default. * elf64-s390.c (_bfd_s390_elf_create_sframe_plt): Linker emitted PLT sections are also SFRAME_VERSION_3. * elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Likewise. gas/ * gen-sframe.c (sframe_set_version): GAS emits SFrame V3 by default. (output_sframe): Likewise. libsframe/ * sframe-dump.c (dump_sframe): Enable dumping for both SFRAME_VERSION_2 and SFRAME_VERSION_3. include/ChangeLog: * sframe.h (SFRAME_VERSION_3): New definition. (SFRAME_VERSION): Current version is now SFRAME_VERSION_3. (SFRAME_V3_FDE_FUNC_INFO): New definition. (SFRAME_V3_FDE_FRE_TYPE): Likewise. (SFRAME_V3_FDE_PC_TYPE): Likewise. (SFRAME_V3_AARCH64_FDE_PAUTH_KEY): Likewise. (SFRAME_V3_FDE_UPDATE_PAUTH_KEY): Likewise. binutils/testsuite/ * all affected tests: Replace SFRAME_VERSION_2 with SFRAME_VERSION_3. gas/testsuite/ * all affected tests: Likewise. ld/testsuite/ * all affected tests: Likewise. libsframe/testsuite/ * all affected tests: Likewise.
2026-01-15[SFrame-V3] sframe: use const for sframe_decoder_ctx object argIndu Bhagat1-21/+21
As the library version will be bumped soon, include this change now. Note the arg names in sframe-dump.c APIs have 'sfd_ctx' instead of the usual 'dctx'. We can address this cosmetic change at a later time. Other cosmetic changes, e.g. to make fixing function-level comments more consistent, are left out of the patch for now. Additionally, constify the return type of static function sframe_decoder_get_header, now that the call sites consistently use a const object. Reviewed-by: Jens Remus <jremus@linux.ibm.com>
2026-01-15[SFrame-V3] libsframe: remove old sframe_decoder_get_funcdesc APIIndu Bhagat1-11/+0
sframe_decoder_get_funcdesc () was added for SFRAME_VERSION_1. This has since been obsoleted by introduction of SFRAME_VERSION_2 and its corresponding sframe_decoder_get_funcdesc_v2 API. Remove from the version script file as well. We will bump the version of the library to 3.0.0 in a subsequent patch (closer to release) and consolidate the entries into a new LIBSFRAME_3.0 node. Reviewed-by: Jens Remus <jremus@linux.ibm.com> include/ * sframe-api.h (sframe_decoder_get_funcdesc): Remove. libsframe/ * libsframe.ver: Likewise. * sframe.c (sframe_decoder_get_funcdesc): Remove definition.
2026-01-15RISC-V: Add second-pass relaxation for JAL to C.J/C.JALKito Cheng1-6/+7
When linker relaxation converts CALL (auipc+jalr, 8 bytes) to JAL (4 bytes), further relaxation to C.J or C.JAL (2 bytes) may become possible as code shrinks and jump distances decrease. This patch adds _bfd_riscv_relax_jal to perform this second-pass relaxation. To enable this, we introduce R_RISCV_DELETE_AND_RELAX, a new internal relocation that combines piecewise deletion with preservation of relaxation capability. When _bfd_riscv_relax_call relaxes CALL to JAL, it marks the deletion as R_RISCV_DELETE_AND_RELAX instead of R_RISCV_DELETE. After the piecewise deletion is resolved, R_RISCV_DELETE_AND_RELAX is converted back to R_RISCV_RELAX at the JAL instruction offset, allowing _bfd_riscv_relax_jal to further relax JAL to C.J/C.JAL. C.JAL is only available on RV32 (rd=ra), while C.J is available on both RV32 and RV64 (rd=x0). Changes since v1: - Use R_RISCV_DELETE_AND_RELAX with piecewise deletion instead of calling _riscv_relax_delete_immediate directly, to maintain relaxation performance. - Add preserve_relax parameter to riscv_relax_delete_bytes to simplify the logic in _bfd_riscv_relax_call.
2026-01-07Sync libiberty sources with gcc master versionNick Clifton2-8/+10
2026-01-05aarch64: Add support for POE2 PLBI instructionSrinath Parvathaneni1-0/+2
This patch adds support for PLB invalidate operation (PLBI) instruction and the corresponding system registers as operand (<plbi_op>). Syntax: PLBI <plbi_op>{, <Xt>} This instruction is an alias to "SYS #<op1>, C10, <Cm>, #<op2>{, <Xt>}" and PLBI being the preferred disassembly. The following list of system registers are supported in this patch for the PLBI instructions enabled by "+poe2" flag and also the "nxs" variants of these system registers are enabled by "+poe2+xs" flag. * alle1 * alle1is * alle1os * alle2 * alle2is * alle2os * alle3 * alle3is * alle3os * aside1 * aside1is * aside1os * permae1 * permae1is * permae1os * perme1 * perme1is * perme1os * perme2 * perme2is * perme2os * perme3 * perme3is * perme3os * vmalle1 * vmalle1is * vmalle1os
2026-01-05aarch64: Add support for TEV instructionsSrinath Parvathaneni1-0/+3
This patch adds support for FEAT_TEV feature enabled by "+tev" flag along with support for following instructions. * TENTER * TEXIT TENTER instruction uses the existing AARCH64_OPND_NOT_BALANCED_17 operand to handle the not_balanced (NB) argument , where as a new operand AARCH64_OPND_NOT_BALANCED_10 is added to support the NB (not_balanced) argument in TEXIT instruction.
2026-01-05aarch64: Add support for POE2 instructionsSrinath Parvathaneni1-0/+3
This patch adds support for FEAT_S1POE2 feature enabled by "+poe2" flag along with support for following instructions. * TCHANGEB (immediate) * TCHANGEB (register) * TCHANGEF (immediate) * TCHANGEF (register) A new operand AARCH64_OPND_NOT_BALANCED_17 is added to the code in this patch to support the new optional argument "NB" (not_balanced) which is a 1-bit field in the encoding for all the above mentioned instructions. Co-authored-by: Matthew Malcomson <matthew.malcomson@arm.com>
2026-01-01Update year range in copyright notice of binutils filesAlan Modra319-319/+319
Avoid warnings about invalid escapes in etc/update-copyright.py by using raw strings, add BinutilsFilter to skip psql.rc and add "Kalray SA." as another copyright holder.
2025-12-29aarch64: Remove sme2_movaz instruction classAlice Carlotti1-1/+0
The behaviour of sme2_movaz was identical to sme_misc, so use that instead.
2025-12-27AArch64 v9.7 extensions: FEAT_SVE_B16MMSivan Shani1-0/+2
This patch includes: - Feature flag for FEAT_SVE_B16MM - Instruction: - BFMMLA (non-widening) BFloat16 matrix multiply-accumulate.
2025-12-27AArch64 v9.7 extensions: FEAT_F16MMSivan Shani1-0/+2
This patch includes: - Feature flag for FEAT_F16MM - Instructions: - FMMLA (non-widening) Half-precision matrix multiply-accumulate - FMMLA (non-widening) Floating-point matrix multiply-accumulate
2025-12-27AArch64: Add FEAT_F16F32MMSivan Shani1-0/+2
This patch includes: - The feature flag for the FEAT_F16F32MM feature. - Instruction FMMLA Half-precision matrix multiply-accumulate to single-precision.
2025-12-27AArch64: Add FEAT_F16F32DOT instructionsSivan Shani1-0/+2
This includes the instructions for the F16F32DOT feature: - FDOT half-precision to single-precision, by element - FDOT half-precision to single-precision, vector
2025-12-27AArch64: Add FEAT_SVE2p3 and FEAT_SME2p3 instructions.Sivan Shani1-0/+9
This patch includes: - Flags for the FEAT_SVE2p3 and FEAT_SME2p3 features. - Instructions: - ADDQP - ADDSUBP - FCVTZSN - FCVTZUN - LUTI6 16-bit - LUTI6 8-bit - SABAL - SCVTF - SCVTFLT - SDOT vectors - SDOT indexed - SQRSHRN - SQRSHRUN - SQSHRN - SQSHRUN - SUBP - UABAL - UCVTF - UCVTFLT - UDOT vectors - UDOT indexed - UQRSHRN - UQSHRN - LUTI6 vector - LUTI6 table, four registers - LUTI6 table, single, 8-bit In addition, new operands: - OPND_SME_Zmx2_INDEX_22: an operand represents a list of vector registers with an index. - OPND_SME_Zn7xN_UNTYPED: an operand represents an untyped list of vector registers.
2025-12-27aarch64: Add FEAT_MOPS_GO instructionsYury Khrustalev1-0/+2
Also add +mops-go feature flag and make the mops-go feature depend on the memtag and mops features.
2025-12-26PR 33726, symbols in excluded sectionsAlan Modra1-5/+6
This improves "nearby" section choice when memory regions are active, preferring a section in the same region as the excluded section over other sections. PR 33726 include/ * bfdlink.h (struct bfd_link_callbacks): Add nearby_section. (_bfd_nearby_section): Delete. (bfd_fix_excluded_sec_syms): Rename and remove bfd param from _bfd_fix_excluded_sec_syms. bfd/ * linker.c (_bfd_nearby_section): Delete. (fix_syms): Use linker callback. * elflink.c (elf_link_input_bfd): Likewise. (_bfd_elf_final_link): Update. ld/ * ldemul.c (finish_default): Update. * ldlang.c (lang_output_section_get): Delete. (ldlang_nearby_section): New function. * ldlang.h (ldlang_nearby_section): Declare. (lang_output_section_get): New static inline. * ldmain.c (link_callbacks): Add ldlang_nearby_section.
2025-12-24libsframe: refactor sframe_decoder_add_funcdesc for internal useIndu Bhagat1-5/+3
sframe_encoder_add_funcdesc () was added for SFRAME_VERSION_1. This has since been obsoleted by introduction of SFRAME_VERSION_2 and its corresponding sframe_decoder_add_funcdesc_v2 API. Refactor the functionality into an internal-only API: sframe_encoder_add_funcdesc_internal (). Ensure it returns the error code for the caller to take necessary action or pass to user. Keep only two args for sframe_encoder_add_funcdesc: function size and function start addr. This simple barebone API will be used in a subsequent commit to adjust the link-time behaviour of SFrame sections. Reviewed-by: Jens Remus <jremus@linux.ibm.com> include/ * sframe-api.h (sframe_encoder_add_funcdesc): Remove args to create the barebone API. libsframe/ * sframe.c (sframe_encoder_add_funcdesc): Refactor out into sframe_encoder_add_funcdesc_internal. Change args. (sframe_encoder_add_funcdesc_v2): Use the new internal API. * libsframe.ver: Move sframe_encoder_add_funcdesc to 2.1 node.
2025-12-24include: sframe: add SFRAME_V2_ prefixed macro names for FDEIndu Bhagat1-0/+12
Such a change for readability only. SFrame V1 is now obsolete, and with newer versions like V3 or later, its likely better to have macro names reflect the applicable version. Add new macro names for FDE information related macros. Reviewed-by: Jens Remus <jremus@linux.ibm.com> include/ * sframe.h (SFRAME_V2_FUNC_INFO): New definition. (SFRAME_V2_FUNC_FRE_TYPE): Likewise. (SFRAME_V2_FUNC_PC_TYPE): Likewise. (SFRAME_V2_FUNC_PAUTH_KEY): Likewise. (SFRAME_V2_FUNC_INFO_UPDATE_PAUTH_KEY): Likewise.
2025-12-23include: gas: bfd: sframe: clean the abstractionIndu Bhagat1-2/+0
... between specification and implmentation. Move to definition in the implementation (gas/ld/libsframe) and not the specification (include/sframe.h). At this time the implementation in gas and ld generate the sections in the latest SFrame version only. Reviewed-by: Jens Remus <jremus@linux.ibm.com> bfd/ * elf-sframe.c: Add definition here. gas/ * gen-sframe.c: Likewise. libsframe/ * sframe.c: Likewise. include/ * sframe.h: Remove the definition.
2025-12-19bfd: include: sframe: fix PR ld/32789Indu Bhagat1-4/+4
Currently, when SFrame sections are emitted after linking the input SFrame sections, the SFrame FDEs are sorted on start PC. Doing so for relocatable links has no effect (SFrame FDEs remain in place), because the start PC is unrelocated data. For relocatable links, then, the emitted SFrame FDEs in the output section remain in the same order as that in the respective input BFD. The assembler does not guarantee the emission of SFrame FDEs in the same order as the placement of the associated .text* sections, (SFRAME_F_FDE_SORTED is not set in the ET_REL objs generated by GAS). This means setting SFRAME_F_FDE_SORTED by the linker was wrong when: - doing relocatable link, and - the input bfds contain multiple .text sections, say .text.hot, .text.init, .text.unlikely etc. For relocatable links, skip sorting the SFrame FDEs. Do not set SFRAME_F_FDE_SORTED for relocatable links. This is achieved by adding an explicit argument (bool sort_fde_p) to the sframe_encoder_write API. Move the API from 2.0 to the 2.1 node as this is an ABI-incompatible change. Skip bumping the "current" in libsframe/libtool-version ATM, we will do so closer to release. When writing of SFrame data for PLT entries, indicate sort_fde_p to false: these sections are like the other SFrame sections for any other ET_REL binary. Add a test in ld/testsuite/ld-sframe/sframe.exp, these tests are run for all ABIs supported for SFrame. In this test, for object file generated for pr32789-1a.c: - the emitted SFrame FDEs by GAS are in the order of the .text* in the input assembly (i.e., .text.init, .text, .text.exit) - the emitted .text* sections by GAS are placed in the following order .text, .text.init, .text.exit. - GAS does not set SFRAME_F_FDE_SORTED, as expected. Reviewed-by: Jens Remus <jremus@linux.ibm.com> bfd/ PR ld/32789 * elf-sframe.c (_bfd_elf_write_section_sframe): Skip sorting the SFrame FDEs for relocatable links. * elf64-s390.c (_bfd_s390_elf_write_sframe_plt): Additional argument to sframe_encoder_write. * elfxx-x86.c (_bfd_x86_elf_write_sframe_plt): Likewise. libsframe/ * libsframe.ver: Move from 2.0 node to 2.1. * sframe.c (sframe_encoder_write_sframe): Conditionalize based on argument sort_fde_p. (sframe_encoder_write): New argument to indicate whether SFrame FDEs are to be sorted in output. include/ * sframe-api.h (sframe_encoder_write): New argument. ld/testsuite/ PR ld/32789 * ld/testsuite/ld-sframe/sframe.exp: New test. * ld/testsuite/ld-sframe/pr32789-1.rd: New test. * ld/testsuite/ld-sframe/pr32789-1.sd: New test. * ld/testsuite/ld-sframe/pr32789-1a.c: New test. * ld/testsuite/ld-sframe/pr32789-1b.c: New test. * ld/testsuite/ld-x86-64/sframe-reloc-1.d: Remove SFRAME_F_FDE_SORTED.
2025-12-20LoongArch: Add disassembly support for ud ui5Lulu Cai1-0/+1
ud ui5, also known as amswap.w rd,$r1,rj(rd==rj), is displayed as "ud ui5" by default during disassembly. Alternatively, the original instruction can be printed using the objdump -M no-aliases. To implement this support, a format specifier "ru0:5,ru5:5" for ud is applied exclusively during disassembly. This specifier indicates that registers should be printed using their corresponding numeric values, and when the instruction is identified as ud, only a single parameter is displayed. binutils/ * testsuite/binutils-all/loongarch64/dis-amswap-ud-noaliases.d: New test. * testsuite/binutils-all/loongarch64/dis-amswap-ud.d: New test. * testsuite/binutils-all/loongarch64/dis-amswap-ud.s: New test. gas/ * testsuite/gas/loongarch/macro_ud.d: Update test. include/ * opcode/loongarch.h: New macro. opcodes/ * loongarch-dis.c (get_loongarch_opcode_by_binfmt): Correct match `ud`. (dis_one_arg): Disassemble the `ud` parameter. * loongarch-opc.c: Add opcode for "ud" alias.
2025-12-15aarch64: Add support for new BTI <target> "r"Srinath Parvathaneni1-0/+1
This patch adds support for new BTI <target> "r" (instruction: bti r), which is an alias to "bti" (with no target), for both "bti" and "bti r" the preferred disassembly is "bti r". This "bti r" instruction is by default available from Armv8-A architecture. The HINT_OPD_F_NOPRINT macro has become redundant with these changes and has been removed.
2025-12-15bfd/ELF: fold BFD_RELOC_<arch>_RELATIVEJan Beulich1-1/+1
There's no need to have a separate reloc per arch; just like for other more or less generic ones a single one will (mostly) do. Arm64, C-Sky, and KVX - sadly - are exceptions.