This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Remove md_reg_eh_frame_to_debug_frame on PPC (Re: [RFC] Wrong register numbers in .dwarf_frame on Linux/PowerPC)
- From: Alan Modra <amodra at gmail dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: binutils at sourceware dot org, dje dot gcc at gmail dot com, jakub at redhat dot com
- Date: Fri, 12 Dec 2014 13:28:01 +1030
- Subject: Re: [PATCH] Remove md_reg_eh_frame_to_debug_frame on PPC (Re: [RFC] Wrong register numbers in .dwarf_frame on Linux/PowerPC)
- Authentication-results: sourceware.org; auth=none
- References: <201211261910 dot qAQJA63I009670 at d06av02 dot portsmouth dot uk dot ibm dot com> <201412112027 dot sBBKRZCg003799 at d03av02 dot boulder dot ibm dot com>
On Thu, Dec 11, 2014 at 09:27:30PM +0100, Ulrich Weigand wrote:
> GCC has now been changed to implement suggestion 3 here:
> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00685.html
>
> So I think we should also change GAS to match the new GCC behavior.
> This simply means removing the PPC-specific definition of the macro
> md_reg_eh_frame_to_debug_frame.
>
> The attached patch implements this.
If I understand the gcc code correctly, it seems to me that the patch
doesn't make gas match the new gcc behaviour. :-(
To be consistent with gcc, shouldn't this instead be something like
the following? (It also needs another emulation file defining TE_AIX
to support aix < 5.)
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index 3cd9bf1..8c80e8a 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -267,11 +267,24 @@ extern int ppc_parse_name (const char *, struct expressionS *);
#define md_cleanup() ppc_cleanup ()
extern void ppc_cleanup (void);
+#if (defined TE_AIX5 || defined TE_AIX \
+ || defined TE_FreeBSD || defined TE_NetBSD || defined TE_LYNX)
/* ppc uses different register numbers between .eh_frame and .debug_frame.
This macro translates the .eh_frame register numbers to .debug_frame
register numbers. */
-#define md_reg_eh_frame_to_debug_frame(regno) \
- ((regno) == 70 ? 64 /* cr2 */ : (regno))
+#define md_reg_eh_frame_to_debug_frame(regno) \
+ ((regno) == 70 ? 64 /* cr2 */ \
+ : (regno) == 65 ? 108 /* lr */ \
+ : (regno) == 66 ? 109 /* ctr */ \
+ : (regno) >= 68 && (regno) <= 75 ? (regno) + 86 - 68 /* crN */ \
+ : (regno) == 76 ? 101 /* xer */ \
+ : (regno) >= 77 && (regno) <= 108 ? (regno) + 1124 - 77 /* vrN */ \
+ : (regno) == 109 ? 356 /* vrsave */ \
+ : (regno) == 110 ? 67 /* vscr */ \
+ : (regno) == 111 ? 99 /* spe_acc */ \
+ : (regno) == 112 ? 612 /* spefscr */ \
+ : (regno))
+#endif
#define TARGET_USE_CFIPOP 1
--
Alan Modra
Australia Development Lab, IBM