aboutsummaryrefslogtreecommitdiff
path: root/gas/gen-sframe.c
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2022-12-22 09:57:16 -0800
committerIndu Bhagat <indu.bhagat@oracle.com>2022-12-22 09:57:16 -0800
commit3369de90b81592b44ba34360642a74a68afbdf7a (patch)
tree621de1cc0c59ca7c0ed50464a6cbc2c3c4d44693 /gas/gen-sframe.c
parent41eed6e1878d93753ff82913d4577616c4778fa7 (diff)
downloadgdb-3369de90b81592b44ba34360642a74a68afbdf7a.zip
gdb-3369de90b81592b44ba34360642a74a68afbdf7a.tar.gz
gdb-3369de90b81592b44ba34360642a74a68afbdf7a.tar.bz2
gas: sframe: add support for .cfi_b_key_frame
Gather the information from the DWARF FDE on whether frame's return addresses are signed using the B key or A key. Reflect the information in the SFrame counterpart data structure, the SFrame FDE. ChangeLog: * gas/gen-sframe.c (get_dw_fde_pauth_b_key_p): New definition. (sframe_v1_set_func_info): Add new argument for pauth_key. (sframe_set_func_info): Likewise. (output_sframe_funcdesc): Likewise. * gas/gen-sframe.h (struct sframe_version_ops): Add new argument to the function pointer declaration. * gas/sframe-opt.c (sframe_convert_frag): Handle pauth_key.
Diffstat (limited to 'gas/gen-sframe.c')
-rw-r--r--gas/gen-sframe.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index 9baf20b..76f8529 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -106,6 +106,17 @@ get_dw_fde_end_addrS (const struct fde_entry *dw_fde)
return dw_fde->end_address;
}
+/* Get whether PAUTH B key is used. */
+static bool
+get_dw_fde_pauth_b_key_p (const struct fde_entry *dw_fde ATTRIBUTE_UNUSED)
+{
+#ifdef tc_fde_entry_extras
+ return (dw_fde->pauth_key == AARCH64_PAUTH_KEY_B);
+#else
+ return false;
+#endif
+}
+
/* SFrame Frame Row Entry (FRE) related functions. */
static void
@@ -253,10 +264,12 @@ sframe_v1_set_fre_info (unsigned int base_reg, unsigned int num_offsets,
/* SFrame (SFRAME_VERSION_1) set function info. */
static unsigned char
-sframe_v1_set_func_info (unsigned int fde_type, unsigned int fre_type)
+sframe_v1_set_func_info (unsigned int fde_type, unsigned int fre_type,
+ unsigned int pauth_key)
{
unsigned char func_info;
func_info = SFRAME_V1_FUNC_INFO (fde_type, fre_type);
+ func_info = SFRAME_V1_FUNC_INFO_UPDATE_PAUTH_KEY (pauth_key, func_info);
return func_info;
}
@@ -285,9 +298,10 @@ sframe_set_fre_info (unsigned int base_reg, unsigned int num_offsets,
/* SFrame set func info. */
ATTRIBUTE_UNUSED static unsigned char
-sframe_set_func_info (unsigned int fde_type, unsigned int fre_type)
+sframe_set_func_info (unsigned int fde_type, unsigned int fre_type,
+ unsigned int pauth_key)
{
- return sframe_ver_ops.set_func_info (fde_type, fre_type);
+ return sframe_ver_ops.set_func_info (fde_type, fre_type, pauth_key);
}
/* Get the number of SFrame FDEs for the current file. */
@@ -544,6 +558,7 @@ output_sframe_funcdesc (symbolS *start_of_fre_section,
expressionS exp;
unsigned int addr_size;
symbolS *dw_fde_start_addrS, *dw_fde_end_addrS;
+ unsigned int pauth_key;
addr_size = SFRAME_RELOC_SIZE;
dw_fde_start_addrS = get_dw_fde_start_addrS (sframe_fde->dw_fde);
@@ -575,8 +590,11 @@ output_sframe_funcdesc (symbolS *start_of_fre_section,
/* SFrame FDE function info. */
unsigned char func_info;
+ pauth_key = (get_dw_fde_pauth_b_key_p (sframe_fde->dw_fde)
+ ? SFRAME_AARCH64_PAUTH_KEY_B : SFRAME_AARCH64_PAUTH_KEY_A);
func_info = sframe_set_func_info (SFRAME_FDE_TYPE_PCINC,
- SFRAME_FRE_TYPE_ADDR4);
+ SFRAME_FRE_TYPE_ADDR4,
+ pauth_key);
#if SFRAME_FRE_TYPE_SELECTION_OPT
expressionS cexp;
create_func_info_exp (&cexp, dw_fde_end_addrS, dw_fde_start_addrS,