[PATCH] Remove md_reg_eh_frame_to_debug_frame on PPC (Re: [RFC] Wrong register numbers in .dwarf_frame on Linux/PowerPC)

Ulrich Weigand uweigand@de.ibm.com
Thu Dec 11 20:27:00 GMT 2014


Two years ago I wrote:

> So I'm wondering where to go from here.  I guess we could:
> 
> 1. Bring GCC (and gas) behaviour in compliance with the documented ABI
>    by removing the #undef DBX_REGISTER_NUMBER and changing gas's
>    md_reg_eh_frame_to_debug_frame to the original implementation from
>    Jakub's patch.  That would make GDB work well on new files, but
>    there are a large number of binaries out there where we continue
>    to have the same behaviour as today ...
> 
> 2. Leave GCC and gas as-is and modify GDB to expect GCC numbering in
>    .dwarf_frame, except for the condition code register.  This would
>    break debugging of files built with GCC 4.0 and 4.1 unless we
>    want to add a special hack for that.
> 
> 3. Like 2., but remove the condition code hack: simply use identical
>    numbers in .eh_frame and .dwarf_frame.  This would make PowerPC
>    like other Linux platforms in that respect.

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.  Tested on powerpc64-linux.
Would this be OK for mainline (and possibly 2.25 branch)?

Bye,
Ulrich

ChangeLog:

	* config/tc-ppc.h (md_reg_eh_frame_to_debug_frame): Do not define.

diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index 3cd9bf1..3aecafa 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -267,12 +267,6 @@ extern int ppc_parse_name (const char *, struct expressionS *);
 #define md_cleanup() ppc_cleanup ()
 extern void ppc_cleanup (void);
 
-/* 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 TARGET_USE_CFIPOP 1
 
 #define tc_cfi_frame_initial_instructions ppc_cfi_frame_initial_instructions

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com



More information about the Binutils mailing list