]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[SFrame-V3] gas: bfd: include: libsframe: fixup terminology 'PC Type' vs 'FDE Type'
authorIndu Bhagat <indu.bhagat@oracle.com>
Fri, 16 Jan 2026 00:42:25 +0000 (16:42 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Fri, 16 Jan 2026 01:02:25 +0000 (17:02 -0800)
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.

12 files changed:
bfd/elf64-s390.c
bfd/elfxx-x86.c
gas/gen-sframe.c
gas/sframe-opt.c
include/sframe.h
libsframe/sframe-dump.c
libsframe/sframe.c
libsframe/testsuite/libsframe.encode/encode-1.c
libsframe/testsuite/libsframe.find/findfre-1.c
libsframe/testsuite/libsframe.find/findfunc-1.c
libsframe/testsuite/libsframe.find/plt-findfre-1.c
libsframe/testsuite/libsframe.find/plt-findfre-2.c

index c172b9b52875def8f844653c9e6b9628616496bf..012457827e0aae215aa190900538597433de1452 100644 (file)
@@ -1604,7 +1604,7 @@ _bfd_s390_elf_create_sframe_plt (struct bfd_link_info *info)
 
   /* FRE type is dependent on the size of the function.  */
   fre_type = sframe_calc_fre_type (dpltsec->size);
-  func_info = sframe_fde_create_func_info (fre_type, SFRAME_FDE_TYPE_PCINC);
+  func_info = sframe_fde_create_func_info (fre_type, SFRAME_V3_FDE_PCTYPE_INC);
 
   /* Add SFrame FDE and the associated FREs for PLT0 if PLT0 has been
      generated.  */
@@ -1631,12 +1631,12 @@ _bfd_s390_elf_create_sframe_plt (struct bfd_link_info *info)
   if (num_pltn_entries)
     {
       /* PLTn entries use an SFrame FDE of type
-        SFRAME_FDE_TYPE_PCMASK to exploit the repetitive
+        SFRAME_V3_FDE_PCTYPE_MASK to exploit the repetitive
         pattern of the instructions in these entries.  Using this SFrame FDE
         type helps in keeping the SFrame stack trace info for PLTn entries
         compact.  */
-      func_info        = sframe_fde_create_func_info (fre_type,
-                                              SFRAME_FDE_TYPE_PCMASK);
+      func_info = sframe_fde_create_func_info (fre_type,
+                                              SFRAME_V3_FDE_PCTYPE_MASK);
       /* Add the SFrame FDE for all PCs starting at the first PLTn entry (hence,
         function start address = plt0_entry_size.  As usual, this will be
         updated later at _bfd_elf_merge_section_sframe, by when the
@@ -1651,7 +1651,7 @@ _bfd_s390_elf_create_sframe_plt (struct bfd_link_info *info)
 
       sframe_frame_row_entry pltn_fre;
       /* Now add the FREs for PLTn.  Simply adding the FREs suffices due
-        to the usage of SFRAME_FDE_TYPE_PCMASK above.  */
+        to the usage of SFRAME_V3_FDE_PCTYPE_MASK above.  */
       for (unsigned int j = 0; j < num_pltn_fres; j++)
        {
          unsigned int func_idx = plt0_entry_size ? 1 : 0;
index 58b12e2b372060bba18c516f8e28e025bc00b672..0348da9f0a151673e9011d3fdf70fe5d1f8e569a 100644 (file)
@@ -1905,7 +1905,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd,
 
   /* FRE type is dependent on the size of the function.  */
   fre_type = sframe_calc_fre_type (dpltsec->size);
-  func_info = sframe_fde_create_func_info (fre_type, SFRAME_FDE_TYPE_PCINC);
+  func_info = sframe_fde_create_func_info (fre_type, SFRAME_V3_FDE_PCTYPE_INC);
 
   /* Add SFrame FDE and the associated FREs for plt0 if plt0 has been
      generated.  */
@@ -1933,12 +1933,12 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd,
   if (num_pltn_entries)
     {
       /* pltn entries use an SFrame FDE of type
-        SFRAME_FDE_TYPE_PCMASK to exploit the repetitive
+        SFRAME_V3_FDE_PCTYPE_MASK to exploit the repetitive
         pattern of the instructions in these entries.  Using this SFrame FDE
         type helps in keeping the SFrame stack trace info for pltn entries
         compact.  */
       func_info        = sframe_fde_create_func_info (fre_type,
-                                              SFRAME_FDE_TYPE_PCMASK);
+                                              SFRAME_V3_FDE_PCTYPE_MASK);
       /* Add the SFrame FDE for all PCs starting at the first pltn entry (hence,
         function start address = plt0_entry_size.  As usual, this will be
         updated later at _bfd_elf_merge_section_sframe, by when the
@@ -1953,7 +1953,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd,
 
       sframe_frame_row_entry pltn_fre;
       /* Now add the FREs for pltn.  Simply adding the FREs suffices due
-        to the usage of SFRAME_FDE_TYPE_PCMASK above.  */
+        to the usage of SFRAME_V3_FDE_PCTYPE_MASK above.  */
       for (unsigned int j = 0; j < num_pltn_fres; j++)
        {
          unsigned int func_idx = plt0_entry_size ? 1 : 0;
index 132cb2ff33e7369ea59d960e880ec12c19a4f17b..ee002584ef95b332a7b393ca11d28a7f9f26d12a 100644 (file)
@@ -740,7 +740,7 @@ output_sframe_funcdesc (symbolS *start_of_fre_section,
   pauth_key = (get_dw_fde_pauth_b_key_p (sframe_fde->dw_fde)
               ? SFRAME_AARCH64_PAUTH_KEY_B : SFRAME_AARCH64_PAUTH_KEY_A);
   signal_p = get_dw_fde_signal_p (sframe_fde->dw_fde);
-  func_info = sframe_set_func_info (SFRAME_FDE_TYPE_PCINC,
+  func_info = sframe_set_func_info (SFRAME_V3_FDE_PCTYPE_INC,
                                    SFRAME_FRE_TYPE_ADDR4,
                                    pauth_key, signal_p);
   if (SFRAME_FRE_TYPE_SELECTION_OPT)
index e13726d4bc6089768101e9caf0e6440eefae2686..d6ea6d512daf2b41ee8745b365050f9a652b1e58 100644 (file)
@@ -132,7 +132,7 @@ sframe_convert_frag (fragS *frag)
       fde_pc_type = SFRAME_V3_FDE_PC_TYPE (rest_of_data);
       pauth_key = SFRAME_V3_AARCH64_FDE_PAUTH_KEY (rest_of_data);
       signal_p = SFRAME_V3_FDE_SIGNAL_P (rest_of_data);
-      gas_assert (fde_pc_type == SFRAME_FDE_TYPE_PCINC);
+      gas_assert (fde_pc_type == SFRAME_V3_FDE_PCTYPE_INC);
 
       /* Calculate the applicable fre_type.  */
       fsizeS = exp->X_op_symbol;
index cc439e5215444b008389f876cd87147b790bdb99..e79892e6b49142f3bf9e7bcdb18010edefb10188 100644 (file)
@@ -117,27 +117,20 @@ extern "C"
 #define SFRAME_FRE_TYPE_ADDR2  1
 #define SFRAME_FRE_TYPE_ADDR4  2
 
-/* SFrame Function Descriptor Entry types.
+/* SFrame Function Descriptor Entry PC types.
 
-   The SFrame format has two possible representations for functions.  The
-   choice of which type to use is made according to the instruction patterns
-   in the relevant program stub.
+   The SFrame format has two possible representations for functions' PC Type.
+   The choice of which PC type to use is made according to the instruction
+   patterns in the relevant program stub.
 
-   An SFrame FDE of type SFRAME_FDE_TYPE_PCINC is an indication
-   that the PCs in the FREs should be treated as increments in bytes.  This is
-   used for a bulk of the executable code of a program, which contains
-   instructions with no specific pattern.
+   For more details, see the (renamed to) entries SFRAME_V3_FDE_PCTYPE_INC and
+   SFRAME_V3_FDE_PCTYPE_MASK for SFrame V3.  */
 
-   An SFrame FDE of type SFRAME_FDE_TYPE_PCMASK is an indication
-   that the PCs in the FREs should be treated as masks.  This type is useful
-   for the cases when a small pattern of instructions in a program stub is
-   repeatedly to cover a specific functionality.  Typical usescases are pltN
-   entries, trampolines etc.  */
-
-/* Unwinders perform a (PC >= FRE_START_ADDR) to look up a matching FRE.  */
+/* Unwinders perform a (PC >= FRE_START_ADDR) to look up a matching FRE.
+   NB: Use SFRAME_V3_FDE_PCTYPE_INC in SFrame V3 instead.  */
 #define SFRAME_FDE_TYPE_PCINC   0
 /* Unwinders perform a (PC % REP_BLOCK_SIZE >= FRE_START_ADDR) to look up a
-   matching FRE.  */
+   matching FRE.  NB: Use SFRAME_V3_FDE_PCTYPE_MASK in SFrame V3 instead.  */
 #define SFRAME_FDE_TYPE_PCMASK  1
 
 /* SFrame FDE types.  */
@@ -258,6 +251,32 @@ typedef struct sframe_func_desc_entry_v2
 #define SFRAME_V2_FUNC_INFO_UPDATE_PAUTH_KEY(pauth_key, fde_info) \
   SFRAME_V1_FUNC_INFO_UPDATE_PAUTH_KEY (pauth_key, fde_info)
 
+/* SFrame Function Descriptor Entry PC types.
+
+   The SFrame format has two possible representations for functions' PC Type.
+   The choice of which PC type to use is made according to the instruction
+   patterns in the relevant program stub.
+
+   The PC type SFRAME_V3_FDE_PCTYPE_INC is an indication that the PCs in the
+   FREs should be treated as increments in bytes.  This is used for a bulk of
+   the executable code of a program, which contains instructions with no
+   specific pattern.
+
+   The PC type SFRAME_V3_FDE_PCTYPE_MASK is an indication that the PCs in the
+   FREs should be treated as masks.  This type is useful for the cases when a
+   small pattern of instructions in a program stub is repeatedly to cover a
+   specific functionality.  Typical usescases are pltN entries, trampolines
+   etc.
+
+   NB: In SFrame version 2 or lower, the names SFRAME_FDE_TYPE_PCINC and
+   SFRAME_FDE_TYPE_PCMASK were used.  */
+
+/* Unwinders perform a (PC >= FRE_START_ADDR) to look up a matching FRE.  */
+#define SFRAME_V3_FDE_PCTYPE_INC   SFRAME_FDE_TYPE_PCINC
+/* Unwinders perform a (PC % REP_BLOCK_SIZE >= FRE_START_ADDR) to look up a
+   matching FRE.  */
+#define SFRAME_V3_FDE_PCTYPE_MASK  SFRAME_FDE_TYPE_PCMASK
+
 typedef struct sframe_func_desc_entry_v3
 {
   /* Offset to the function start address.  Encoded as a signed offset,
@@ -292,7 +311,7 @@ typedef struct sframe_func_desc_entry_v3
      8                7             6             5             0     */
   uint8_t sfde_func_info2;
   /* Size of the block of repeating insns.  Used for SFrame FDEs of type
-     SFRAME_FDE_TYPE_PCMASK.  */
+     SFRAME_V3_FDE_PCTYPE_MASK.  */
   uint8_t sfde_func_rep_size;
 } ATTRIBUTE_PACKED sframe_func_desc_entry_v3;
 
index d36731728fa0ac32a10f6b425d514987edc5d21e..5d7c4ceb271a746b1f132308b12e2bed748f6925 100644 (file)
@@ -190,7 +190,7 @@ dump_sframe_func_with_fres (const sframe_decoder_ctx *sfd_ctx,
   /* Mark FDEs with [m] where the FRE start address is interpreted as a
      mask.  */
   int pc_mask_p
-    = (SFRAME_V2_FUNC_PC_TYPE (func_info) == SFRAME_FDE_TYPE_PCMASK);
+    = (SFRAME_V2_FUNC_PC_TYPE (func_info) == SFRAME_V3_FDE_PCTYPE_MASK);
   const char *pc_mask_marker = (pc_mask_p ? "[m]" : "   ");
   printf ("\n    %-7s%-8s %-10s%-10s%-13s",
          "STARTPC", pc_mask_marker, "CFA", "FP", "RA");
index e8f499bd7f364fb738200d32ea3c34f75b758643..178e65c59f96eba84e196b39a476c3a7ce8bd2ea 100644 (file)
@@ -557,7 +557,7 @@ sframe_fre_check_range_p (const sframe_decoder_ctx *dctx, uint32_t func_idx,
   func_start_pc_offset = sframe_decoder_get_secrel_func_start_addr (dctx,
                                                                    func_idx);
   pc_type = sframe_get_fde_pc_type (fdep);
-  mask_p = (pc_type == SFRAME_FDE_TYPE_PCMASK);
+  mask_p = (pc_type == SFRAME_V3_FDE_PCTYPE_MASK);
   rep_block_size = fdep->func_rep_size;
 
   if (func_start_pc_offset > pc)
@@ -909,8 +909,8 @@ sframe_fde_create_func_info (uint32_t fre_type,
   sframe_assert (fre_type == SFRAME_FRE_TYPE_ADDR1
                   || fre_type == SFRAME_FRE_TYPE_ADDR2
                   || fre_type == SFRAME_FRE_TYPE_ADDR4);
-  sframe_assert (fde_type == SFRAME_FDE_TYPE_PCINC
-                   || fde_type == SFRAME_FDE_TYPE_PCMASK);
+  sframe_assert (fde_type == SFRAME_V3_FDE_PCTYPE_INC
+                || fde_type == SFRAME_V3_FDE_PCTYPE_MASK);
   func_info = SFRAME_V2_FUNC_INFO (fde_type, fre_type);
   return func_info;
 }
index 53f15e68bac6cc54971d4ad026484713e0fd979c..7f52d35dbdf5c9f2b508028e6b648dfbeb72b756 100644 (file)
@@ -38,7 +38,7 @@ add_fde1 (sframe_encoder_ctx *encode, int64_t start_pc_vaddr,
   int64_t func1_start_addr = (start_pc_vaddr
                              - (sframe_vaddr + offsetof_fde_in_sec));
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   int err = sframe_encoder_add_funcdesc_v3 (encode, func1_start_addr,
                                            *func_size, finfo, 0, 0,
                                            FDE1_NUM_FRES);
@@ -74,7 +74,7 @@ add_fde2 (sframe_encoder_ctx *encode, int64_t start_pc_vaddr,
   int64_t func1_start_addr = (start_pc_vaddr
                              - (sframe_vaddr + offsetof_fde_in_sec));
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   int err = sframe_encoder_add_funcdesc_v3 (encode, func1_start_addr,
                                            *func_size, finfo, 0, 0,
                                            FDE1_NUM_FRES);
index b63c3651a87585b5a6e55cdfcd2742a913fb245a..2c1abc68ae15d725de2ad71fba602011fe441c9b 100644 (file)
@@ -38,7 +38,7 @@ add_fde1 (sframe_encoder_ctx *encode, int64_t start_pc_vaddr,
   int64_t func1_start_addr = (start_pc_vaddr
                              - (sframe_vaddr + offsetof_fde_in_sec));
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   int err = sframe_encoder_add_funcdesc_v3 (encode, func1_start_addr,
                                            *func_size, finfo, 0, 0,
                                            FDE1_NUM_FRES);
@@ -73,7 +73,7 @@ add_fde2 (sframe_encoder_ctx *encode, int64_t start_pc_vaddr,
   int64_t func2_start_addr = (start_pc_vaddr
                              - (sframe_vaddr + offsetof_fde_in_sec));
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   int err = sframe_encoder_add_funcdesc_v3 (encode, func2_start_addr,
                                            *func_size, finfo, 0, 0,
                                            FDE2_NUM_FRES);
index 7d2c46b8b51ea2754975a419581ac0915215ef92..ba9cb2b92383aa74ee30159f8d755a617c1acde6 100644 (file)
@@ -45,7 +45,7 @@ add_fde1 (sframe_encoder_ctx *encode, int64_t start_pc_vaddr,
   int64_t func1_start_addr = (start_pc_vaddr
                              - (sframe_vaddr + offsetof_fde_in_sec));
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   int err = sframe_encoder_add_funcdesc_v3 (encode, func1_start_addr,
                                            *func_size, finfo, 0, 0,
                                            FDE1_NUM_FRES);
@@ -80,7 +80,7 @@ add_fde2 (sframe_encoder_ctx *encode, int64_t start_pc_vaddr,
   int64_t func2_start_addr = (start_pc_vaddr
                              - (sframe_vaddr + offsetof_fde_in_sec));
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   int err = sframe_encoder_add_funcdesc_v3 (encode, func2_start_addr,
                                            *func_size, finfo, 0, 0,
                                            FDE2_NUM_FRES);
@@ -115,7 +115,7 @@ add_fde3 (sframe_encoder_ctx *encode, int64_t start_pc_vaddr,
   int64_t func3_start_addr = (start_pc_vaddr
                              - (sframe_vaddr + offsetof_fde_in_sec));
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   int err = sframe_encoder_add_funcdesc_v3 (encode, func3_start_addr,
                                            *func_size, finfo, 0, 0,
                                            FDE3_NUM_FRES);
index 7368cc61fcbf5946b03178af03ab18000f1cc8d4..9ede7f5ba1cd2d80e20d6df787cb5d4035bea7c8 100644 (file)
@@ -1,4 +1,4 @@
-/* plt-findfre-1.c -- Test for sframe_find_fre for SFRAME_FDE_TYPE_PCMASK.
+/* plt-findfre-1.c -- Test for sframe_find_fre for SFRAME_V3_FDE_PCTYPE_MASK.
 
    Copyright (C) 2023-2026 Free Software Foundation, Inc.
 
@@ -31,7 +31,7 @@ add_plt_fde1 (sframe_encoder_ctx *ectx, int64_t plt_vaddr,
       };
 
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCMASK);
+                                                    SFRAME_V3_FDE_PCTYPE_MASK);
   uint32_t offsetof_fde_in_sec
     = sframe_encoder_get_offsetof_fde_start_addr (ectx, idx, NULL);
   int64_t func_start_addr = (plt_vaddr
index e6f317a757df6372dabcc830a2c3c0fc80b0843f..5044f8daef5cb9a197a349923c094f0ea7bc09b7 100644 (file)
@@ -37,7 +37,7 @@ add_plt0_fde (sframe_encoder_ctx *ectx, int64_t plt_vaddr,
        SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B) };
 
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCINC);
+                                                    SFRAME_V3_FDE_PCTYPE_INC);
   uint32_t offsetof_fde_in_sec
     = sframe_encoder_get_offsetof_fde_start_addr (ectx, idx, NULL);
 
@@ -71,7 +71,7 @@ add_pltn_fde (sframe_encoder_ctx *ectx, int64_t plt_vaddr,
        SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B) };
 
   unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
-                                                    SFRAME_FDE_TYPE_PCMASK);
+                                                    SFRAME_V3_FDE_PCTYPE_MASK);
   uint32_t offsetof_fde_in_sec
     = sframe_encoder_get_offsetof_fde_start_addr (ectx, idx, NULL);