RFC Patch: Fix bad eh_frame data for MIPS.

David Daney ddaney@avtrex.com
Thu Sep 18 00:43:00 GMT 2003


Richard Henderson wrote:

>On Wed, Sep 17, 2003 at 02:31:30PM -0700, David Daney wrote:
>  
>
>>	* gcc/config/mips/linux.h (MD_FALLBACK_FRAME_STATE_FOR): New,
>>	needed for mips/libgcj signal handling.
>>	* gcc/config/mips/mips.h (DWARF_FRAME_REGNUM_FOR_INITIAL_RETURN_SAVE): New.
>>	* gcc/dwarf2out.c (DWARF_FRAME_REGNUM_FOR_INITIAL_RETURN_SAVE): New.
>>	* gcc/dwarf2out.c (initial_return_save): Use
>>	DWARF_FRAME_REGNUM_FOR_INITIAL_RETURN_SAVE instead of DWARF_FRAME_REGNUM
>>    
>>
>
>This is wrong.
>
>The existing DWARF_FRAME_REGNUM is completely wrong for mips.
>
>After deleting that, you have a choice of:
>
> (1) Leaving DWARF_FRAME_RETURN_COLUMN alone, and adding a 
>     REG_FRAME_RELATED_EXPR to the insn that saves r31 on the stack.
>     The expression would mention (reg DWARF_FRAME_RETURN_COLUMN).
>
I don't quite understand.  The main problem is when r31 is not being 
saved on the stack.  The return address is in r31 and not saved anywhere 
else.  That has to be communicated to eh_frame

>
> (2) Set
>
>	#define DWARF_FRAME_RETURN_COLUMN   GP_REG_FIRST+31
>
>     This will produce smaller CFI output.  I don't know if SGI's
>     debugger can handle overlapping r31 with the return address.
>     Gcc and gdb can.
>  
>
Would this change cause binary compatibility problems with existing 
versions of libgcc_s.so.1 and libstdc++.so ?

In short, my patch although "wrong" seems to work.

If I do #2 and it works for me (unknown at this point), is it an 
acceptable solution and would it be applied to the gcc mainline?

David Daney.



More information about the Gcc-patches mailing list