/* 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. */
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
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;
/* 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. */
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
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;
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)
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;
#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. */
#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,
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;
/* 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");
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)
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;
}
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);
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);
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);
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);
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);
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);
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);
-/* 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.
};
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
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);
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);