[ColdFire 50/63] Save the PIC register for __builtin_eh_return

Roman Zippel zippel@linux-m68k.org
Mon Jan 22 17:52:00 GMT 2007


Hi,

On Wed, 10 Jan 2007, Richard Sandiford wrote:

> g++.dg/eh/registers1.C showed that we weren't restoring %a5 on EH return.
> This is because _Unwind_RaiseException was compiled as PIC, and we didn't
> think it needed to save and restore the PIC register.  There was therefore
> no stack slot in which to set up the value of %a5 on EH return.
> 
> Richard
> 
> 
> gcc/
> 	* config/m68k/m68k.c (m68k_save_reg): Save the PIC register in
> 	functions that call eh_return.
> 
> Index: gcc/config/m68k/m68k.c
> ===================================================================
> --- gcc/config/m68k/m68k.c	2007-01-09 15:02:23.000000000 +0000
> +++ gcc/config/m68k/m68k.c	2007-01-09 15:02:23.000000000 +0000
> @@ -744,6 +744,9 @@ m68k_save_reg (unsigned int regno, bool 
>  {
>    if (flag_pic && regno == PIC_OFFSET_TABLE_REGNUM)
>      {
> +      /* We need to restore the PIC register on exceptional returns.  */
> +      if (current_function_calls_eh_return)
> +	return true;
>        if (current_function_uses_pic_offset_table)
>  	return true;
>        /* Reload may introduce constant pool references into a function

I know that i386 does the same, but I think it would be more correct to 
use current_function_has_nonlocal_label instead. This is set by 
expand_builtin_unwind_init() to save all registers and reload() skips the 
pic register because it's fixed.

bye, Roman



More information about the Gcc-patches mailing list