aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2022-12-16 22:01:40 -0800
committerIndu Bhagat <indu.bhagat@oracle.com>2022-12-16 22:01:40 -0800
commit4604c7294166199f89a0122ee35095d7e0cd2d07 (patch)
treef45f3b7040d11693c15c3c153018ba23a3f06af8 /include
parent1c57b841ac1f06db523db720affc9f056a4ee76c (diff)
downloadbinutils-4604c7294166199f89a0122ee35095d7e0cd2d07.zip
binutils-4604c7294166199f89a0122ee35095d7e0cd2d07.tar.gz
binutils-4604c7294166199f89a0122ee35095d7e0cd2d07.tar.bz2
sframe.h: add support for .cfi_negate_ra_state
Use the last remaining bit in the 'SFrame FRE info' word to store whether the RA is signed/unsigned with PAC authorization code: this bit is named as the "mangled RA" bit. This bit is still unused for x86-64. The behaviour of the mangled-RA info bit in SFrame format closely follows the behaviour of DW_CFA_AARCH64_negate_ra_state in DWARF. During unwinding, whenever an SFrame FRE with non-zero "mangled RA" bit is encountered, it means the upper bits of the return address contain Pointer Authentication code. The unwinder, hence, must use appropriate means to restore LR correctly in such cases. include/ChangeLog: * sframe.h (SFRAME_V1_FRE_INFO_UPDATE_MANGLED_RA_P): New macro. (SFRAME_V1_FRE_MANGLED_RA_P): Likewise.
Diffstat (limited to 'include')
-rw-r--r--include/sframe.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/sframe.h b/include/sframe.h
index 03a2d75..b2bd41a 100644
--- a/include/sframe.h
+++ b/include/sframe.h
@@ -227,11 +227,12 @@ typedef struct sframe_fre_info
- 2 bits: information about size of the offsets (S) in bytes.
Valid values are SFRAME_FRE_OFFSET_1B, SFRAME_FRE_OFFSET_2B,
SFRAME_FRE_OFFSET_4B
- - 1 bit: Unused.
- -----------------------------------------------------------------------
- | Unused | Size of offsets | Number of offsets | base_reg |
- -----------------------------------------------------------------------
- 8 7 5 1 0
+ - 1 bit: Mangled RA state bit (aarch64 only).
+ ----------------------------------------------------------------------------------
+ | Mangled-RA (aarch64) | Size of offsets | Number of offsets | base_reg |
+ | Unused (amd64) | | | |
+ ----------------------------------------------------------------------------------
+ 8 7 5 1 0
*/
uint8_t fre_info;
@@ -239,13 +240,19 @@ typedef struct sframe_fre_info
/* Macros to compose and decompose FRE info. */
+/* Note: Set mangled_ra_p to zero by default. */
#define SFRAME_V1_FRE_INFO(base_reg_id, offset_num, offset_size) \
- ((((offset_size) & 0x3) << 5) | (((offset_num) & 0xf) << 1) | \
- ((base_reg_id) & 0x1))
+ (((0 & 0x1) << 7) | (((offset_size) & 0x3) << 5) | \
+ (((offset_num) & 0xf) << 1) | ((base_reg_id) & 0x1))
+
+/* Set the mangled_ra_p bit as indicated. */
+#define SFRAME_V1_FRE_INFO_UPDATE_MANGLED_RA_P(mangled_ra_p, fre_info) \
+ ((((mangled_ra_p) & 0x1) << 7) | ((fre_info) & 0x7f))
#define SFRAME_V1_FRE_CFA_BASE_REG_ID(data) ((data) & 0x1)
#define SFRAME_V1_FRE_OFFSET_COUNT(data) (((data) >> 1) & 0xf)
-#define SFRAME_V1_FRE_OFFSET_SIZE(data) (((data) >> 5) & 0x3)
+#define SFRAME_V1_FRE_OFFSET_SIZE(data) (((data) >> 5) & 0x3)
+#define SFRAME_V1_FRE_MANGLED_RA_P(data) (((data) >> 7) & 0x1)
/* SFrame Frame Row Entry definitions.