PATCH: Restore i386 binary compat for EH info

Chip Salzenberg chip@valinux.com
Fri Dec 31 16:38:00 GMT 1999


Would someone please approve or turn down this patch?

According to Chip Salzenberg:
> When the i386 target increased FIRST_PSEUDO_REGISTER, it broke binary
> compatibility in libgcc's exception handling.  I've tested the below
> patch from Martin; it fixes the problem.  THANKS MARTIN!  (I've taken
> the liberty of renaming the new macro, Martin; I hope that's OK.)
> 
> What additional documentation, if any, do we need to write for this?
> 
> 
> 1999-12-23  "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>
> 
> 	Restore i386 binary compatibility in EH info.
> 	* config/i386/i386.h (EH_REGISTERS): Define as 17, the *old*
> 	value of FIRST_PSEUDO_REGISTER.
> 	* frame.h (EH_REGISTERS): Define, with FIRST_PSEUDO_REGISTER as
> 	default.
> 	(struct frame_state): Use EH_REGISTERS for array sizes.
> 	* dwarfout.c (output_reg_number): Use EH_REGISTERS.
> 	* dwarf2out.c (DWARF_FRAME_RETURN_COLUMN): Default to EH_REGISTERS.
> 	(reg_number, expand_builtin_init_dwarf_reg_sizes): Use EH_REGISTERS.
> 
> Index: gcc/config/i386/i386.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
> retrieving revision 1.84
> diff -u -2 -r1.84 i386.h
> --- i386.h	1999/12/17 00:45:03	1.84
> +++ i386.h	1999/12/24 06:22:09
> @@ -613,4 +613,9 @@
>  #define FIRST_PSEUDO_REGISTER 19
>  
> +/* Number of hardware registers that go into the DWARF-2 unwind info.
> +   If not defined, equals FIRST_PSEUDO_REGISTER.  */
> +
> +#define EH_REGISTERS 17
> +
>  /* 1 for registers that have pervasive standard uses
>     and are not available for the register allocator.
> Index: gcc/frame.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/frame.h,v
> retrieving revision 1.8
> diff -u -2 -r1.8 frame.h
> --- frame.h	1999/02/27 22:21:56	1.8
> +++ frame.h	1999/12/24 06:22:09
> @@ -1,5 +1,5 @@
>  /* Header file for unwinding stack frames for exception handling.  */
>  /* Compile this one with gcc.  */
> -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
> +/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
>     Contributed by Jason Merrill <jason@cygnus.com>.
>  
> @@ -22,4 +22,8 @@
>  
>  
> +#ifndef EH_REGISTERS
> +#define EH_REGISTERS FIRST_PSEUDO_REGISTER
> +#endif
> +
>  typedef struct frame_state
>  {
> @@ -28,8 +32,8 @@
>    long cfa_offset;
>    long args_size;
> -  long reg_or_offset[FIRST_PSEUDO_REGISTER+1];
> +  long reg_or_offset[EH_REGISTERS+1];
>    unsigned short cfa_reg;
>    unsigned short retaddr_column;
> -  char saved[FIRST_PSEUDO_REGISTER+1];
> +  char saved[EH_REGISTERS+1];
>  } frame_state;
>  
> Index: gcc/dwarfout.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/dwarfout.c,v
> retrieving revision 1.45
> diff -u -2 -r1.45 dwarfout.c
> --- dwarfout.c	1999/12/15 09:37:48	1.45
> +++ dwarfout.c	1999/12/24 06:22:13
> @@ -1680,5 +1680,5 @@
>    register unsigned regno = REGNO (rtl);
>  
> -  if (regno >= FIRST_PSEUDO_REGISTER)
> +  if (regno >= EH_REGISTERS)
>      {
>        warning_with_decl (dwarf_last_decl, "internal regno botch: regno = %d\n",
> Index: gcc/dwarf2out.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
> retrieving revision 1.135
> diff -u -2 -r1.135 dwarf2out.c
> --- dwarf2out.c	1999/12/23 05:26:55	1.135
> +++ dwarf2out.c	1999/12/24 06:22:21
> @@ -516,5 +516,5 @@
>  #define DWARF_FRAME_RETURN_COLUMN 	DWARF_FRAME_REGNUM (PC_REGNUM)
>  #else
> -#define DWARF_FRAME_RETURN_COLUMN 	FIRST_PSEUDO_REGISTER
> +#define DWARF_FRAME_RETURN_COLUMN 	EH_REGISTERS
>  #endif
>  #endif
> @@ -567,5 +567,5 @@
>    register unsigned regno = REGNO (rtl);
>  
> -  if (regno >= FIRST_PSEUDO_REGISTER)
> +  if (regno >= EH_REGISTERS)
>      {
>        warning ("internal regno botch: regno = %d\n", regno);
> @@ -588,5 +588,5 @@
>    rtx mem = gen_rtx_MEM (mode, addr);
>  
> -  for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
> +  for (i = 0; i < EH_REGISTERS; ++i)
>      {
>        int offset = i * GET_MODE_SIZE (mode);
> 
> -- 
> Chip Salzenberg             - a.k.a. -              <chip@valinux.com>
>      "Fleagal.  Bingo.  Drooper.  Snork.  They're cops."   //MST3K
> 

-- 
Chip Salzenberg             - a.k.a. -              <chip@valinux.com>
     "Fleagal.  Bingo.  Drooper.  Snork.  They're cops."   //MST3K



More information about the Gcc-patches mailing list