This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

assertify unwinding runtime


This patch assertifies the runtime unwinding support.

I freely admit I might have been overzealous about these checks.  One could
consider walking the unwind tables to be a case of verifying user input
-- in which case there should probably be a load more asserts -- and
we should call them something else.  I took the view that they are compiler
generated, and checking them makes almost as much sense as verifying the
assembly code itself :)

I changed unwind-pe.h to not define __gxx_abort, but rely on
its #includer to have already defined gcc_unreachable.  When included
from libgcc, that is already defined.  When included from libsupc++, we need
to create a suitable #define.  When included from libjava, we can replace
the hack there concerning std::abort with a suitable #define.

unwind-dw2-fde-glibc.c had a call of gxx_abort, but it also had a call to
plain abort.  The gxx_abort use appears to be an error.  Both are replaced
with gcc_unreachable.

booted & tested on i686-pc-linux-gnu, ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-04-24  Nathan Sidwell  <nathan@codesourcery.com>

	* gcc/unwind-dw2-fde-glibc.c (base_from_cb_data,
	_Unwind_IteratePhdrCallback): Use gcc_assert and gcc_unreachable as
	appropriate.
	* gcc/unwind-dw2-fde.c (__deregister_frame_info_bases,
	base_from_object, fde_split, end_fde_sort): Likewise.
	* gcc/unwind-dw2.c (_Unwind_GetGR, _Unwind_SetGR, execute_stack_op, 
	execute_cfa_program, _Unwind_SetSpColumn, uw_update_context_1,
	uw_init_context_1): Likewise.
	* gcc/unwind.inc (_Unwind_RaiseException_Phase2, _Unwind_Resume,
	_Unwind_Resume_or_Rethrow): Likewise.
	* gcc/unwind-pe.h (__gxx_abort): Do not define.
	(size_of_encoded_value, base_of_encoded_value,
	read_encoded_value_with_base): Use gcc_unreachable.
	* gcc/unwind.h (_Unwind_GetTextRelBase): Likewise.
	* libstdc++-v3/libsupc++/eh_personality.cc (gcc_unreachable): Define.
	* libjava/exception.cc (abort): Remove std::abort hack.
	(gcc_unreacheable): Define.

Index: gcc/unwind-dw2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 unwind-dw2.c
*** gcc/unwind-dw2.c	27 Jan 2005 07:26:49 -0000	1.51
--- gcc/unwind-dw2.c	24 Apr 2005 13:36:44 -0000
*************** _Unwind_GetGR (struct _Unwind_Context *c
*** 131,149 ****
  #endif
  
    index = DWARF_REG_TO_UNWIND_COLUMN (index);
!   if (index >= (int) sizeof(dwarf_reg_size_table))
!     abort ();
    size = dwarf_reg_size_table[index];
    ptr = context->reg[index];
  
    /* This will segfault if the register hasn't been saved.  */
    if (size == sizeof(_Unwind_Ptr))
      return * (_Unwind_Ptr *) ptr;
! 
!   if (size == sizeof(_Unwind_Word))
!     return * (_Unwind_Word *) ptr;
! 
!   abort ();
  }
  
  static inline void *
--- 131,148 ----
  #endif
  
    index = DWARF_REG_TO_UNWIND_COLUMN (index);
!   gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
    size = dwarf_reg_size_table[index];
    ptr = context->reg[index];
  
    /* This will segfault if the register hasn't been saved.  */
    if (size == sizeof(_Unwind_Ptr))
      return * (_Unwind_Ptr *) ptr;
!   else
!     {
!       gcc_assert (size == sizeof(_Unwind_Word));
!       return * (_Unwind_Word *) ptr;
!     }
  }
  
  static inline void *
*************** _Unwind_SetGR (struct _Unwind_Context *c
*** 169,185 ****
    void *ptr;
  
    index = DWARF_REG_TO_UNWIND_COLUMN (index);
!   if (index >= (int) sizeof(dwarf_reg_size_table))
!     abort ();
    size = dwarf_reg_size_table[index];
    ptr = context->reg[index];
  
    if (size == sizeof(_Unwind_Ptr))
      * (_Unwind_Ptr *) ptr = val;
-   else if (size == sizeof(_Unwind_Word))
-     * (_Unwind_Word *) ptr = val;
    else
!     abort ();
  }
  
  /* Get the pointer to a register INDEX as saved in CONTEXT.  */
--- 168,184 ----
    void *ptr;
  
    index = DWARF_REG_TO_UNWIND_COLUMN (index);
!   gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
    size = dwarf_reg_size_table[index];
    ptr = context->reg[index];
  
    if (size == sizeof(_Unwind_Ptr))
      * (_Unwind_Ptr *) ptr = val;
    else
!     {
!       gcc_assert (size == sizeof(_Unwind_Word));
!       * (_Unwind_Word *) ptr = val;
!     }
  }
  
  /* Get the pointer to a register INDEX as saved in CONTEXT.  */
*************** execute_stack_op (const unsigned char *o
*** 518,543 ****
  	  break;
  
  	case DW_OP_dup:
! 	  if (stack_elt < 1)
! 	    abort ();
  	  result = stack[stack_elt - 1];
  	  break;
  
  	case DW_OP_drop:
! 	  if (--stack_elt < 0)
! 	    abort ();
  	  goto no_push;
  
  	case DW_OP_pick:
  	  offset = *op_ptr++;
! 	  if (offset >= stack_elt - 1)
! 	    abort ();
  	  result = stack[stack_elt - 1 - offset];
  	  break;
  
  	case DW_OP_over:
! 	  if (stack_elt < 2)
! 	    abort ();
  	  result = stack[stack_elt - 2];
  	  break;
  
--- 517,539 ----
  	  break;
  
  	case DW_OP_dup:
! 	  gcc_assert (stack_elt);
  	  result = stack[stack_elt - 1];
  	  break;
  
  	case DW_OP_drop:
! 	  gcc_assert (stack_elt);
! 	  stack_elt -= 1;
  	  goto no_push;
  
  	case DW_OP_pick:
  	  offset = *op_ptr++;
! 	  gcc_assert (offset < stack_elt - 1);
  	  result = stack[stack_elt - 1 - offset];
  	  break;
  
  	case DW_OP_over:
! 	  gcc_assert (stack_elt >= 2);
  	  result = stack[stack_elt - 2];
  	  break;
  
*************** execute_stack_op (const unsigned char *o
*** 545,552 ****
  	  {
  	    _Unwind_Word t1, t2, t3;
  
! 	    if (stack_elt < 3)
! 	      abort ();
  	    t1 = stack[stack_elt - 1];
  	    t2 = stack[stack_elt - 2];
  	    t3 = stack[stack_elt - 3];
--- 541,547 ----
  	  {
  	    _Unwind_Word t1, t2, t3;
  
! 	    gcc_assert (stack_elt >= 3);
  	    t1 = stack[stack_elt - 1];
  	    t2 = stack[stack_elt - 2];
  	    t3 = stack[stack_elt - 3];
*************** execute_stack_op (const unsigned char *o
*** 563,570 ****
  	case DW_OP_not:
  	case DW_OP_plus_uconst:
  	  /* Unary operations.  */
! 	  if (--stack_elt < 0)
! 	    abort ();
  	  result = stack[stack_elt];
  
  	  switch (op)
--- 558,566 ----
  	case DW_OP_not:
  	case DW_OP_plus_uconst:
  	  /* Unary operations.  */
! 	  gcc_assert (stack_elt);
! 	  stack_elt -= 1;
! 	  
  	  result = stack[stack_elt];
  
  	  switch (op)
*************** execute_stack_op (const unsigned char *o
*** 594,600 ****
  		    result = read_8u (ptr);
  		    break;
  		  default:
! 		    abort ();
  		  }
  	      }
  	      break;
--- 590,596 ----
  		    result = read_8u (ptr);
  		    break;
  		  default:
! 		    gcc_unreachable ();
  		  }
  	      }
  	      break;
*************** execute_stack_op (const unsigned char *o
*** 615,621 ****
  	      break;
  
  	    default:
! 	      abort ();
  	    }
  	  break;
  
--- 611,617 ----
  	      break;
  
  	    default:
! 	      gcc_unreachable ();
  	    }
  	  break;
  
*************** execute_stack_op (const unsigned char *o
*** 639,646 ****
  	  {
  	    /* Binary operations.  */
  	    _Unwind_Word first, second;
! 	    if ((stack_elt -= 2) < 0)
! 	      abort ();
  	    second = stack[stack_elt];
  	    first = stack[stack_elt + 1];
  
--- 635,643 ----
  	  {
  	    /* Binary operations.  */
  	    _Unwind_Word first, second;
! 	    gcc_assert (stack_elt >= 2);
! 	    stack_elt -= 2;
! 	    
  	    second = stack[stack_elt];
  	    first = stack[stack_elt + 1];
  
*************** execute_stack_op (const unsigned char *o
*** 699,705 ****
  		break;
  
  	      default:
! 		abort ();
  	      }
  	  }
  	  break;
--- 696,702 ----
  		break;
  
  	      default:
! 		gcc_unreachable ();
  	      }
  	  }
  	  break;
*************** execute_stack_op (const unsigned char *o
*** 711,718 ****
  	  goto no_push;
  
  	case DW_OP_bra:
! 	  if (--stack_elt < 0)
! 	    abort ();
  	  offset = read_2s (op_ptr);
  	  op_ptr += 2;
  	  if (stack[stack_elt] != 0)
--- 708,716 ----
  	  goto no_push;
  
  	case DW_OP_bra:
! 	  gcc_assert (stack_elt);
! 	  stack_elt -= 1;
! 	  
  	  offset = read_2s (op_ptr);
  	  op_ptr += 2;
  	  if (stack[stack_elt] != 0)
*************** execute_stack_op (const unsigned char *o
*** 723,742 ****
  	  goto no_push;
  
  	default:
! 	  abort ();
  	}
  
        /* Most things push a result value.  */
!       if ((size_t) stack_elt >= sizeof(stack)/sizeof(*stack))
! 	abort ();
        stack[stack_elt++] = result;
      no_push:;
      }
  
    /* We were executing this program to get a value.  It should be
       at top of stack.  */
!   if (--stack_elt < 0)
!     abort ();
    return stack[stack_elt];
  }
  
--- 721,739 ----
  	  goto no_push;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        /* Most things push a result value.  */
!       gcc_assert ((size_t) stack_elt < sizeof(stack)/sizeof(*stack));
        stack[stack_elt++] = result;
      no_push:;
      }
  
    /* We were executing this program to get a value.  It should be
       at top of stack.  */
!   gcc_assert (stack_elt);
!   stack_elt -= 1;
    return stack[stack_elt];
  }
  
*************** execute_cfa_program (const unsigned char
*** 944,950 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
      }
  }
--- 941,947 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
      }
  }
*************** _Unwind_SetSpColumn (struct _Unwind_Cont
*** 1088,1097 ****
    
    if (size == sizeof(_Unwind_Ptr))
      tmp_sp->ptr = (_Unwind_Ptr) cfa;
-   else if (size == sizeof(_Unwind_Word))
-     tmp_sp->word = (_Unwind_Ptr) cfa;
    else
!     abort ();
    _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), tmp_sp);
  }
  
--- 1085,1095 ----
    
    if (size == sizeof(_Unwind_Ptr))
      tmp_sp->ptr = (_Unwind_Ptr) cfa;
    else
!     {
!       gcc_assert (size == sizeof(_Unwind_Word));
!       tmp_sp->word = (_Unwind_Ptr) cfa;
!     }
    _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), tmp_sp);
  }
  
*************** uw_update_context_1 (struct _Unwind_Cont
*** 1145,1151 ****
        }
  
      default:
!       abort ();
      }
    context->cfa = cfa;
  
--- 1143,1149 ----
        }
  
      default:
!       gcc_unreachable ();
      }
    context->cfa = cfa;
  
*************** uw_init_context_1 (struct _Unwind_Contex
*** 1229,1240 ****
    void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
    _Unwind_FrameState fs;
    _Unwind_SpTmp sp_slot;
  
    memset (context, 0, sizeof (struct _Unwind_Context));
    context->ra = ra;
  
!   if (uw_frame_state_for (context, &fs) != _URC_NO_REASON)
!     abort ();
  
  #if __GTHREADS
    {
--- 1227,1239 ----
    void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
    _Unwind_FrameState fs;
    _Unwind_SpTmp sp_slot;
+   _Unwind_Reason_Code code;
  
    memset (context, 0, sizeof (struct _Unwind_Context));
    context->ra = ra;
  
!   code = uw_frame_state_for (context, &fs);
!   gcc_assert (code == _URC_NO_REASON);
  
  #if __GTHREADS
    {
Index: gcc/unwind-dw2-fde.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2-fde.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 unwind-dw2-fde.c
*** gcc/unwind-dw2-fde.c	15 Oct 2004 14:47:12 -0000	1.29
--- gcc/unwind-dw2-fde.c	24 Apr 2005 13:36:51 -0000
*************** __register_frame_table (void *begin)
*** 164,170 ****
     from crtbegin (wherein it is declared weak), and this object does
     not get pulled from libgcc.a for other reasons, then the
     invocation of __deregister_frame_info will be resolved from glibc.
!    Since the registration did not happen there, we'll abort.
  
     Therefore, declare a new deregistration entry point that does the
     exact same thing, but will resolve to the same library as
--- 164,170 ----
     from crtbegin (wherein it is declared weak), and this object does
     not get pulled from libgcc.a for other reasons, then the
     invocation of __deregister_frame_info will be resolved from glibc.
!    Since the registration did not happen there, we'll die.
  
     Therefore, declare a new deregistration entry point that does the
     exact same thing, but will resolve to the same library as
*************** __deregister_frame_info_bases (const voi
*** 212,222 ****
  	  }
        }
  
-   __gthread_mutex_unlock (&object_mutex);
-   abort ();
- 
   out:
    __gthread_mutex_unlock (&object_mutex);
    return (void *) ob;
  }
  
--- 212,220 ----
  	  }
        }
  
   out:
    __gthread_mutex_unlock (&object_mutex);
+   gcc_assert (ob);
    return (void *) ob;
  }
  
*************** base_from_object (unsigned char encoding
*** 255,262 ****
        return (_Unwind_Ptr) ob->tbase;
      case DW_EH_PE_datarel:
        return (_Unwind_Ptr) ob->dbase;
      }
-   abort ();
  }
  
  /* Return the FDE pointer encoding from the CIE.  */
--- 253,261 ----
        return (_Unwind_Ptr) ob->tbase;
      case DW_EH_PE_datarel:
        return (_Unwind_Ptr) ob->dbase;
+     default:
+       gcc_unreachable ();
      }
  }
  
  /* Return the FDE pointer encoding from the CIE.  */
*************** fde_split (struct object *ob, fde_compar
*** 441,448 ****
    /* This should optimize out, but it is wise to make sure this assumption
       is correct. Should these have different sizes, we cannot cast between
       them and the overlaying onto ERRATIC will not work.  */
!   if (sizeof (const fde *) != sizeof (const fde **))
!     abort ();
  
    for (i = 0; i < count; i++)
      {
--- 440,446 ----
    /* This should optimize out, but it is wise to make sure this assumption
       is correct. Should these have different sizes, we cannot cast between
       them and the overlaying onto ERRATIC will not work.  */
!   gcc_assert (sizeof (const fde *) == sizeof (const fde **));
  
    for (i = 0; i < count; i++)
      {
*************** end_fde_sort (struct object *ob, struct 
*** 566,573 ****
  {
    fde_compare_t fde_compare;
  
!   if (accu->linear && accu->linear->count != count)
!     abort ();
  
    if (ob->s.b.mixed_encoding)
      fde_compare = fde_mixed_encoding_compare;
--- 564,570 ----
  {
    fde_compare_t fde_compare;
  
!   gcc_assert (!accu->linear || accu->linear->count == count);
  
    if (ob->s.b.mixed_encoding)
      fde_compare = fde_mixed_encoding_compare;
*************** end_fde_sort (struct object *ob, struct 
*** 579,586 ****
    if (accu->erratic)
      {
        fde_split (ob, fde_compare, accu->linear, accu->erratic);
!       if (accu->linear->count + accu->erratic->count != count)
! 	abort ();
        frame_heapsort (ob, fde_compare, accu->erratic);
        fde_merge (ob, fde_compare, accu->linear, accu->erratic);
        free (accu->erratic);
--- 576,582 ----
    if (accu->erratic)
      {
        fde_split (ob, fde_compare, accu->linear, accu->erratic);
!       gcc_assert (accu->linear->count + accu->erratic->count == count);
        frame_heapsort (ob, fde_compare, accu->erratic);
        fde_merge (ob, fde_compare, accu->linear, accu->erratic);
        free (accu->erratic);
Index: gcc/unwind-dw2-fde-glibc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2-fde-glibc.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 unwind-dw2-fde-glibc.c
*** gcc/unwind-dw2-fde-glibc.c	5 Mar 2005 14:01:02 -0000	1.17
--- gcc/unwind-dw2-fde-glibc.c	24 Apr 2005 13:36:52 -0000
*************** base_from_cb_data (unsigned char encodin
*** 119,126 ****
        return (_Unwind_Ptr) data->tbase;
      case DW_EH_PE_datarel:
        return (_Unwind_Ptr) data->dbase;
      }
-   abort ();
  }
  
  static int
--- 119,127 ----
        return (_Unwind_Ptr) data->tbase;
      case DW_EH_PE_datarel:
        return (_Unwind_Ptr) data->dbase;
+     default:
+       gcc_unreachable ();
      }
  }
  
  static int
*************** _Unwind_IteratePhdrCallback (struct dl_p
*** 359,366 ****
  		    break;
  		}
  
! 	      if (lo >= hi)
! 		__gxx_abort ();
  	    }
  
  	  f = (fde *) (table[mid].fde + data_base);
--- 360,366 ----
  		    break;
  		}
  
! 	      gcc_assert (lo < hi);
  	    }
  
  	  f = (fde *) (table[mid].fde + data_base);
Index: gcc/unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind.h,v
retrieving revision 1.17
diff -c -3 -p -r1.17 unwind.h
*** gcc/unwind.h	30 Nov 2004 08:15:39 -0000	1.17
--- gcc/unwind.h	24 Apr 2005 13:36:52 -0000
*************** _Unwind_GetDataRelBase (struct _Unwind_C
*** 214,221 ****
  static inline _Unwind_Ptr
  _Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__)))
  {
!   abort ();
!   return 0;
  }
  
  /* @@@ Retrieve the Backing Store Pointer of the given context.  */
--- 214,220 ----
  static inline _Unwind_Ptr
  _Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__)))
  {
!   gcc_unreachable ();
  }
  
  /* @@@ Retrieve the Backing Store Pointer of the given context.  */
Index: gcc/unwind.inc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind.inc,v
retrieving revision 1.10
diff -c -3 -p -r1.10 unwind.inc
*** gcc/unwind.inc	19 Aug 2003 20:53:24 -0000	1.10
--- gcc/unwind.inc	24 Apr 2005 13:36:54 -0000
*************** _Unwind_RaiseException_Phase2(struct _Un
*** 72,79 ****
  	}
  
        /* Don't let us unwind past the handler context.  */
!       if (match_handler)
! 	abort ();
  
        uw_update_context (context, &fs);
      }
--- 72,78 ----
  	}
  
        /* Don't let us unwind past the handler context.  */
!       gcc_assert (!match_handler);
  
        uw_update_context (context, &fs);
      }
*************** _Unwind_RaiseException(struct _Unwind_Ex
*** 144,151 ****
  /* Subroutine of _Unwind_ForcedUnwind also invoked from _Unwind_Resume.  */
  
  static _Unwind_Reason_Code
! _Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc,
! 			    struct _Unwind_Context *context)
  {
    _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) (_Unwind_Ptr) exc->private_1;
    void *stop_argument = (void *) (_Unwind_Ptr) exc->private_2;
--- 143,150 ----
  /* Subroutine of _Unwind_ForcedUnwind also invoked from _Unwind_Resume.  */
  
  static _Unwind_Reason_Code
! _Unwind_ForcedUnwind_Phase2 (struct _Unwind_Exception *exc,
! 			     struct _Unwind_Context *context)
  {
    _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) (_Unwind_Ptr) exc->private_1;
    void *stop_argument = (void *) (_Unwind_Ptr) exc->private_2;
*************** _Unwind_Resume (struct _Unwind_Exception
*** 235,242 ****
    else
      code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
  
!   if (code != _URC_INSTALL_CONTEXT)
!     abort ();
  
    uw_install_context (&this_context, &cur_context);
  }
--- 234,240 ----
    else
      code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
  
!   gcc_assert (code == _URC_INSTALL_CONTEXT);
  
    uw_install_context (&this_context, &cur_context);
  }
*************** _Unwind_Resume_or_Rethrow (struct _Unwin
*** 261,268 ****
  
    code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
  
!   if (code != _URC_INSTALL_CONTEXT)
!     abort ();
  
    uw_install_context (&this_context, &cur_context);
  }
--- 259,265 ----
  
    code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
  
!   gcc_assert (code == _URC_INSTALL_CONTEXT);
  
    uw_install_context (&this_context, &cur_context);
  }
Index: gcc/unwind-pe.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-pe.h,v
retrieving revision 1.18
diff -c -3 -p -r1.18 unwind-pe.h
*** gcc/unwind-pe.h	21 Jan 2004 20:40:04 -0000	1.18
--- gcc/unwind-pe.h	24 Apr 2005 13:36:55 -0000
***************
*** 34,46 ****
  #ifndef GCC_UNWIND_PE_H
  #define GCC_UNWIND_PE_H
  
- /* If using C++, references to abort have to be qualified with std::.  */
- #if __cplusplus
- #define __gxx_abort std::abort
- #else
- #define __gxx_abort abort
- #endif
- 
  /* Pointer encodings, from dwarf2.h.  */
  #define DW_EH_PE_absptr         0x00
  #define DW_EH_PE_omit           0xff
--- 34,39 ----
*************** size_of_encoded_value (unsigned char enc
*** 86,93 ****
        return 4;
      case DW_EH_PE_udata8:
        return 8;
      }
-   __gxx_abort ();
  }
  
  #endif
--- 79,87 ----
        return 4;
      case DW_EH_PE_udata8:
        return 8;
+     default:
+       gcc_unreachable ();
      }
  }
  
  #endif
*************** base_of_encoded_value (unsigned char enc
*** 118,125 ****
        return _Unwind_GetDataRelBase (context);
      case DW_EH_PE_funcrel:
        return _Unwind_GetRegionStart (context);
      }
-   __gxx_abort ();
  }
  
  #endif
--- 112,120 ----
        return _Unwind_GetDataRelBase (context);
      case DW_EH_PE_funcrel:
        return _Unwind_GetRegionStart (context);
+     default:
+       gcc_unreachable ();
      }
  }
  
  #endif
*************** read_encoded_value_with_base (unsigned c
*** 256,262 ****
  	  break;
  
  	default:
! 	  __gxx_abort ();
  	}
  
        if (result != 0)
--- 251,257 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        if (result != 0)
Index: libjava/exception.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/exception.cc,v
retrieving revision 1.26
diff -c -3 -p -r1.26 exception.cc
*** libjava/exception.cc	11 Mar 2005 04:30:18 -0000	1.26
--- libjava/exception.cc	24 Apr 2005 13:36:56 -0000
*************** details.  */
*** 19,35 ****
  #include <gcj/cni.h>
  #include <jvm.h>
  
! // unwind-pe.h uses std::abort(), but sometimes we compile libjava
! // without libstdc++-v3. The following hack forces it to use
! // stdlib.h's abort().
! namespace std
! {
!   static __attribute__ ((__noreturn__)) void
!   abort ()
!   {
!     ::abort ();
!   }
! }
  #include "unwind.h"
  
  struct alignment_test_struct
--- 19,27 ----
  #include <gcj/cni.h>
  #include <jvm.h>
  
! // Sometimes we compile libjava without libstdc++-v3. Therefore make
! // sure we use stdlib.h's abort().
! #define gcc_unreachable() ::abort ()
  #include "unwind.h"
  
  struct alignment_test_struct
Index: libstdc++-v3/libsupc++/eh_personality.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/eh_personality.cc,v
retrieving revision 1.14
diff -c -3 -p -r1.14 eh_personality.cc
*** libstdc++-v3/libsupc++/eh_personality.cc	9 Feb 2004 21:20:33 -0000	1.14
--- libstdc++-v3/libsupc++/eh_personality.cc	24 Apr 2005 13:36:57 -0000
***************
*** 35,40 ****
--- 35,41 ----
  
  using namespace __cxxabiv1;
  
+ #define gcc_unreachable() std::abort()
  #include "unwind-pe.h"
  
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]