public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] aarch64: Decode dwarf2 register numbers
  2014-08-07  0:09 [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn Richard Henderson
@ 2014-08-07  0:09 ` Richard Henderson
  2014-09-03 10:25   ` Marcus Shawcroft
  2014-09-02 17:38 ` [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn Marcus Shawcroft
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2014-08-07  0:09 UTC (permalink / raw)
  To: binutils

Similar to the parsing side in gas.  But here I'm less
certain about only printing dN, since these are also used
for uses within .debug_info which could rightly use vN.
---
 binutils/dwarf.c   | 27 +++++++++++++++++++++++++++
 binutils/dwarf.h   |  1 +
 binutils/objdump.c |  4 ++++
 3 files changed, 32 insertions(+)

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index a6986ad..fc44f38 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -5093,6 +5093,29 @@ init_dwarf_regnames_x86_64 (void)
   dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_x86_64);
 }
 
+static const char *const dwarf_regnames_aarch64[] =
+{
+   "x0",  "x1",  "x2",  "x3",  "x4",  "x5",  "x6",  "x7", 
+   "x8",  "x9", "x10", "x11", "x12", "x13", "x14", "x15", 
+  "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
+  "x24", "x25", "x26", "x27", "x28", "x29", "x30", "sp",
+   NULL, "elr",  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,
+   NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,
+   NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,
+   NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,
+   "d0",  "d1",  "d2",  "d3",  "d4",  "d5",  "d6",  "d7", 
+   "d8",  "d9", "d10", "d11", "d12", "d13", "d14", "d15", 
+  "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
+  "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
+};
+
+void
+init_dwarf_regnames_aarch64 (void)
+{
+  dwarf_regnames = dwarf_regnames_aarch64;
+  dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_aarch64);
+}
+
 void
 init_dwarf_regnames (unsigned int e_machine)
 {
@@ -5109,6 +5132,10 @@ init_dwarf_regnames (unsigned int e_machine)
       init_dwarf_regnames_x86_64 ();
       break;
 
+    case EM_AARCH64:
+      init_dwarf_regnames_aarch64 ();
+      break;
+
     default:
       break;
     }
diff --git a/binutils/dwarf.h b/binutils/dwarf.h
index db235a9..124d9d6 100644
--- a/binutils/dwarf.h
+++ b/binutils/dwarf.h
@@ -235,6 +235,7 @@ extern int dwarf_check;
 extern void init_dwarf_regnames (unsigned int);
 extern void init_dwarf_regnames_i386 (void);
 extern void init_dwarf_regnames_x86_64 (void);
+extern void init_dwarf_regnames_aarch64 (void);
 
 extern int load_debug_section (enum dwarf_section_display_enum, void *);
 extern void free_debug_section (enum dwarf_section_display_enum);
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 5086a15..413de56 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -2407,6 +2407,10 @@ dump_dwarf (bfd *abfd)
 	}
       break;
 
+    case bfd_arch_aarch64:
+      init_dwarf_regnames_aarch64();
+      break;
+
     default:
       break;
     }
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn
@ 2014-08-07  0:09 Richard Henderson
  2014-08-07  0:09 ` [PATCH 2/2] aarch64: Decode dwarf2 register numbers Richard Henderson
  2014-09-02 17:38 ` [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn Marcus Shawcroft
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Henderson @ 2014-08-07  0:09 UTC (permalink / raw)
  To: binutils

My argument for not accepting [bhsv]N is that unwind info
is specifically 64-bits, i.e. the dN values.

Not handled here is "esr" == 33.

---
 gas/config/tc-aarch64.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 0a65b9d..09ea8a6 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -5962,16 +5962,20 @@ tc_aarch64_regname_to_dw2regnum (char *regname)
 
   switch (reg->type)
     {
-    case REG_TYPE_SP_32:
     case REG_TYPE_SP_64:
-    case REG_TYPE_R_32:
     case REG_TYPE_R_64:
+      return reg->number;
+
+    case REG_TYPE_FP_D:
+      return reg->number + 64;
+
+    case REG_TYPE_SP_32:
+    case REG_TYPE_R_32:
     case REG_TYPE_FP_B:
     case REG_TYPE_FP_H:
     case REG_TYPE_FP_S:
-    case REG_TYPE_FP_D:
     case REG_TYPE_FP_Q:
-      return reg->number;
+      /* Do not allow register names of width other than 64-bit.  */
     default:
       break;
     }
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn
  2014-08-07  0:09 [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn Richard Henderson
  2014-08-07  0:09 ` [PATCH 2/2] aarch64: Decode dwarf2 register numbers Richard Henderson
@ 2014-09-02 17:38 ` Marcus Shawcroft
  1 sibling, 0 replies; 5+ messages in thread
From: Marcus Shawcroft @ 2014-09-02 17:38 UTC (permalink / raw)
  To: Richard Henderson; +Cc: binutils

On 7 August 2014 01:11, Richard Henderson <rth@twiddle.net> wrote:
> My argument for not accepting [bhsv]N is that unwind info
> is specifically 64-bits, i.e. the dN values.
>
> Not handled here is "esr" == 33.
>
> ---
>  gas/config/tc-aarch64.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
> index 0a65b9d..09ea8a6 100644
> --- a/gas/config/tc-aarch64.c
> +++ b/gas/config/tc-aarch64.c
> @@ -5962,16 +5962,20 @@ tc_aarch64_regname_to_dw2regnum (char *regname)
>
>    switch (reg->type)
>      {
> -    case REG_TYPE_SP_32:
>      case REG_TYPE_SP_64:
> -    case REG_TYPE_R_32:
>      case REG_TYPE_R_64:
> +      return reg->number;
> +
> +    case REG_TYPE_FP_D:
> +      return reg->number + 64;
> +
> +    case REG_TYPE_SP_32:
> +    case REG_TYPE_R_32:
>      case REG_TYPE_FP_B:
>      case REG_TYPE_FP_H:
>      case REG_TYPE_FP_S:
> -    case REG_TYPE_FP_D:
>      case REG_TYPE_FP_Q:
> -      return reg->number;
> +      /* Do not allow register names of width other than 64-bit.  */
>      default:
>        break;

Hi, Sorry, I've been out for a month.  I think this change will break
the assembly of any existing code that uses cfi_offset for one of
these dropped register names?  There is code over in glibc
dl-trampoline.S and possibly other places that would need to be fixed
first.

/Marcus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] aarch64: Decode dwarf2 register numbers
  2014-08-07  0:09 ` [PATCH 2/2] aarch64: Decode dwarf2 register numbers Richard Henderson
@ 2014-09-03 10:25   ` Marcus Shawcroft
  2014-09-03 10:27     ` Marcus Shawcroft
  0 siblings, 1 reply; 5+ messages in thread
From: Marcus Shawcroft @ 2014-09-03 10:25 UTC (permalink / raw)
  To: Richard Henderson; +Cc: binutils

On 7 August 2014 01:11, Richard Henderson <rth@twiddle.net> wrote:
> Similar to the parsing side in gas.  But here I'm less
> certain about only printing dN, since these are also used
> for uses within .debug_info which could rightly use vN.

> +   "d0",  "d1",  "d2",  "d3",  "d4",  "d5",  "d6",  "d7",
> +   "d8",  "d9", "d10", "d11", "d12", "d13", "d14", "d15",
> +  "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
> +  "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",


I think these should be Vn rather than dN.

/Marcus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] aarch64: Decode dwarf2 register numbers
  2014-09-03 10:25   ` Marcus Shawcroft
@ 2014-09-03 10:27     ` Marcus Shawcroft
  0 siblings, 0 replies; 5+ messages in thread
From: Marcus Shawcroft @ 2014-09-03 10:27 UTC (permalink / raw)
  To: Richard Henderson; +Cc: binutils

On 3 September 2014 11:24, Marcus Shawcroft <marcus.shawcroft@gmail.com> wrote:
> On 7 August 2014 01:11, Richard Henderson <rth@twiddle.net> wrote:
>> Similar to the parsing side in gas.  But here I'm less
>> certain about only printing dN, since these are also used
>> for uses within .debug_info which could rightly use vN.
>
>> +   "d0",  "d1",  "d2",  "d3",  "d4",  "d5",  "d6",  "d7",
>> +   "d8",  "d9", "d10", "d11", "d12", "d13", "d14", "d15",
>> +  "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
>> +  "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
>
>
> I think these should be Vn rather than dN.

Oops, ignore me, I see you made that change in the version of the
patch you pushed...

/Marcus

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-03 10:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07  0:09 [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn Richard Henderson
2014-08-07  0:09 ` [PATCH 2/2] aarch64: Decode dwarf2 register numbers Richard Henderson
2014-09-03 10:25   ` Marcus Shawcroft
2014-09-03 10:27     ` Marcus Shawcroft
2014-09-02 17:38 ` [PATCH 1/2] aarch64: Fix dwarf2 regnum for Dn Marcus Shawcroft

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).