On 2024-08-06 15:28, Jakub Jelinek wrote:
On Tue, Aug 06, 2024 at 03:07:44PM +0100, Matthieu Longo wrote:
On AArch64, the RA state informs the unwinder whether the return address
is mangled and how, or not. This information is encoded in a boolean in
the CFI row. This binary approach prevents from expressing more complex
configuration, as it is the case with PAuth_LR introduced in Armv9.5-A.

This patch addresses this limitation by replacing the boolean by an enum.

Formatting nits.

gcc/ChangeLog:

         * dwarf2cfi.cc
         (struct dw_cfi_row): Declare a new enum type to replace ra_mangled.
         (cfi_row_equal_p): Use ra_state instead of ra_mangled.
         (dwarf2out_frame_debug_cfa_negate_ra_state): Same.
         (change_cfi_row): Same.
---
  gcc/dwarf2cfi.cc | 24 ++++++++++++++++++------
  1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/gcc/dwarf2cfi.cc b/gcc/dwarf2cfi.cc
index 6c80e0b17bd..023f61fb712 100644
--- a/gcc/dwarf2cfi.cc
+++ b/gcc/dwarf2cfi.cc
@@ -57,6 +57,15 @@ along with GCC; see the file COPYING3.  If not see
  #define DEFAULT_INCOMING_FRAME_SP_OFFSET INCOMING_FRAME_SP_OFFSET
  #endif
  
+
+/* Signing method used for return address authentication.
+   (AArch64 extension)*/

Dot and two spaces missing before */

+typedef enum
+{
+  RA_no_signing = 0x0,
+  RA_signing_SP = 0x1,
+} RA_signing_method_t;

I think it should be ra_* and *_sp
@@ -1556,8 +1565,11 @@ dwarf2out_frame_debug_cfa_negate_ra_state (void)
  {
    dw_cfi_ref cfi = new_cfi ();
    cfi->dw_cfi_opc = DW_CFA_AARCH64_negate_ra_state;
+  cur_row->ra_state =
+         (cur_row->ra_state == RA_no_signing)
+         ? RA_signing_SP
+         : RA_no_signing;

This is wrongly formatted.  = shouldn't be at the end of line.
Better
   cur_row->ra_state
     = (cur_row->ra_state == ra_no_signing
        ? ra_signing_sp : ra_no_signing);

        Jakub


The comments are addressed in the next revision.

Thanks,
Matthieu.

Reply via email to