public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tamar Christina <tnfchris@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] arm: Add cfi expression support for ra_auth_code
Date: Tue,  2 Aug 2022 10:35:27 +0000 (GMT)	[thread overview]
Message-ID: <20220802103527.5B88F3856DDA@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e90f28a7a78666ae593fec5cf57c0b5eb4636c22

commit e90f28a7a78666ae593fec5cf57c0b5eb4636c22
Author: Victor Do Nascimento <Victor.DoNascimento@arm.com>
Date:   Tue Aug 2 11:34:42 2022 +0100

    arm: Add cfi expression support for ra_auth_code
    
    This patch extends assembler support for the use of register names to
    allow for pseudo-registers, e.g. ra_auth_code register.
    This is done particularly with CFI directives in mind, allowing for
    expressions of the type:
    
        .cfi_register ra_auth_code, 12
    
    gas/Changelog:
    
            * config/tc-arm.c (tc_arm_regname_to_dw2regnum): Add
            REG_TYPE_PSEUDO handling.
            * testsuite/gas/arm/cfi-pacbti-m-readelf.d: New.
            * testsuite/gas/arm/cfi-pacbti-m.s: New.

Diff:
---
 gas/config/tc-arm.c                          |  4 ++++
 gas/testsuite/gas/arm/cfi-pacbti-m-readelf.d | 31 ++++++++++++++++++++++++++++
 gas/testsuite/gas/arm/cfi-pacbti-m.s         | 22 ++++++++++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index f1dc4eb2d5e..6cdc2db307e 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -27958,6 +27958,10 @@ tc_arm_regname_to_dw2regnum (char *regname)
   if (reg != FAIL)
     return reg + 256;
 
+  reg = arm_reg_parse (&regname, REG_TYPE_PSEUDO);
+  if (reg != FAIL)
+    return reg;
+
   return FAIL;
 }
 
diff --git a/gas/testsuite/gas/arm/cfi-pacbti-m-readelf.d b/gas/testsuite/gas/arm/cfi-pacbti-m-readelf.d
new file mode 100644
index 00000000000..997ea75f179
--- /dev/null
+++ b/gas/testsuite/gas/arm/cfi-pacbti-m-readelf.d
@@ -0,0 +1,31 @@
+#readelf: -wf
+#source: cfi-pacbti-m.s
+#name: Call Frame information for Armv8.1-M.Mainline PACBTI extension
+# This test is only valid on ELF based ports.
+#notarget: *-*-pe *-*-wince
+# VxWorks needs a special variant of this file.
+#skip: *-*-vxworks*
+
+Contents of the .eh_frame section:
+
+
+00000000 00000010 00000000 CIE
+  Version:               1
+  Augmentation:          "zR"
+  Code alignment factor: 2
+  Data alignment factor: -4
+  Return address column: 14
+  Augmentation data:     1b
+  DW_CFA_def_cfa: r13 ofs 0
+
+00000014 00000020 00000018 FDE cie=00000000 pc=00000000..0000000c
+  DW_CFA_advance_loc: 4 to 00000004
+  DW_CFA_register: r143 in r12
+  DW_CFA_advance_loc: 4 to 00000008
+  DW_CFA_def_cfa_offset: 8
+  DW_CFA_offset: r14 at cfa-8
+  DW_CFA_offset: r12 at cfa-4
+  DW_CFA_advance_loc: 4 to 0000000c
+  DW_CFA_restore_extended: r143
+  DW_CFA_restore: r14
+  DW_CFA_def_cfa_offset: 0
diff --git a/gas/testsuite/gas/arm/cfi-pacbti-m.s b/gas/testsuite/gas/arm/cfi-pacbti-m.s
new file mode 100644
index 00000000000..515400d86f5
--- /dev/null
+++ b/gas/testsuite/gas/arm/cfi-pacbti-m.s
@@ -0,0 +1,22 @@
+    .arch armv8.1-m.main
+    .arch_extension pacbti
+    .eabi_attribute Tag_PAC_extension, 2
+    .eabi_attribute Tag_BTI_extension, 2
+    .eabi_attribute Tag_BTI_use, 1
+    .eabi_attribute Tag_PACRET_use, 1
+    .syntax unified
+    .text
+    .thumb
+.Lstart:
+    .cfi_startproc
+    pacbti ip, lr, sp
+    .cfi_register ra_auth_code, ip
+    push {ip, lr}
+    .cfi_def_cfa_offset 8
+    .cfi_offset lr, -8
+    .cfi_offset ip, -4
+    pop {ip, lr}
+    .cfi_restore 143
+    .cfi_restore 14
+    .cfi_def_cfa_offset 0
+    .cfi_endproc


                 reply	other threads:[~2022-08-02 10:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220802103527.5B88F3856DDA@sourceware.org \
    --to=tnfchris@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).