[PATCH 3.0] Dwarf2 EH fix for AIX

David Edelsohn dje@watson.ibm.com
Wed Jan 2 10:50:00 GMT 2002


	I would like to back-port the Dwarf2 EH fixes to the gcc-3.0
branch so that EH will work on AIX in the GCC 3.0 branch. 

Thanks, David


2001-12-29  David Edelsohn  <edelsohn@gnu.org>

        * gcc.c (init_gcc_spec): Do not link with static libgcc.a if
        gcc invoked with -shared.

2001-10-22  Hans-Peter Nilsson  <hp@bitrange.com>

        * unwind-dw2-fde.c (fde_unencoded_compare): Derefer pc_begin
        fields when comparing.

2001-10-10  Richard Henderson  <rth@redhat.com>

        * unwind-dw2-fde.c (fde_compare_t): Change return type to int.
        (fde_unencoded_compare): Likewise.  Don't use subtraction to get
        a tristate comparison value.
        (fde_single_encoding_compare, fde_mixed_encoding_compare): Likewise.

Index: gcc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcc.c,v
retrieving revision 1.205.2.24
diff -c -p -r1.205.2.24 gcc.c
*** gcc.c	2001/12/05 07:19:34	1.205.2.24
--- gcc.c	2002/01/02 18:47:55
*************** init_gcc_specs (obstack, shared_name, st
*** 1285,1292 ****
    obstack_grow (obstack, buffer, strlen (buffer));
    /* Otherwise, if we see -shared, then use the shared version.  */
    sprintf (buffer,
! 	   "%%{!shared-libgcc:%%{!static-libgcc:%%{shared:%s %s}}}", 
! 	   shared_name, static_name);
    obstack_grow (obstack, buffer, strlen (buffer));
    /* Otherwise, use the static version.  */
    sprintf (buffer, 
--- 1285,1292 ----
    obstack_grow (obstack, buffer, strlen (buffer));
    /* Otherwise, if we see -shared, then use the shared version.  */
    sprintf (buffer,
! 	   "%%{!shared-libgcc:%%{!static-libgcc:%%{shared:%s}}}", 
! 	   shared_name);
    obstack_grow (obstack, buffer, strlen (buffer));
    /* Otherwise, use the static version.  */
    sprintf (buffer, 
Index: unwind-dw2-fde.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/unwind-dw2-fde.c,v
retrieving revision 1.2.2.7
diff -c -p -r1.2.2.7 unwind-dw2-fde.c
*** unwind-dw2-fde.c	2001/08/01 19:19:29	1.2.2.7
--- unwind-dw2-fde.c	2002/01/02 18:47:55
*************** get_fde_encoding (struct dwarf_fde *f)
*** 291,304 ****
  
  /* Comparison routines.  Three variants of increasing complexity.  */
  
! static saddr
  fde_unencoded_compare (struct object *ob __attribute__((unused)),
  		       fde *x, fde *y)
  {
!   return *(saddr *)x->pc_begin - *(saddr *)y->pc_begin;
  }
  
! static saddr
  fde_single_encoding_compare (struct object *ob, fde *x, fde *y)
  {
    _Unwind_Ptr base, x_ptr, y_ptr;
--- 291,311 ----
  
  /* Comparison routines.  Three variants of increasing complexity.  */
  
! static int
  fde_unencoded_compare (struct object *ob __attribute__((unused)),
  		       fde *x, fde *y)
  {
!   _Unwind_Ptr x_ptr = *(_Unwind_Ptr *) x->pc_begin;
!   _Unwind_Ptr y_ptr = *(_Unwind_Ptr *) y->pc_begin;
! 
!   if (x_ptr > y_ptr)
!     return 1;
!   if (x_ptr < y_ptr)
!     return -1;
!   return 0;
  }
  
! static int
  fde_single_encoding_compare (struct object *ob, fde *x, fde *y)
  {
    _Unwind_Ptr base, x_ptr, y_ptr;
*************** fde_single_encoding_compare (struct obje
*** 307,316 ****
    read_encoded_value_with_base (ob->s.b.encoding, base, x->pc_begin, &x_ptr);
    read_encoded_value_with_base (ob->s.b.encoding, base, y->pc_begin, &y_ptr);
  
!   return x_ptr - y_ptr;
  }
  
! static saddr
  fde_mixed_encoding_compare (struct object *ob, fde *x, fde *y)
  {
    int x_encoding, y_encoding;
--- 314,327 ----
    read_encoded_value_with_base (ob->s.b.encoding, base, x->pc_begin, &x_ptr);
    read_encoded_value_with_base (ob->s.b.encoding, base, y->pc_begin, &y_ptr);
  
!   if (x_ptr > y_ptr)
!     return 1;
!   if (x_ptr < y_ptr)
!     return -1;
!   return 0;
  }
  
! static int
  fde_mixed_encoding_compare (struct object *ob, fde *x, fde *y)
  {
    int x_encoding, y_encoding;
*************** fde_mixed_encoding_compare (struct objec
*** 324,333 ****
    read_encoded_value_with_base (y_encoding, base_from_object (y_encoding, ob),
  				y->pc_begin, &y_ptr);
  
!   return x_ptr - y_ptr;
  }
  
! typedef saddr (*fde_compare_t) (struct object *, fde *, fde *);
  
  
  /* This is a special mix of insertion sort and heap sort, optimized for
--- 335,348 ----
    read_encoded_value_with_base (y_encoding, base_from_object (y_encoding, ob),
  				y->pc_begin, &y_ptr);
  
!   if (x_ptr > y_ptr)
!     return 1;
!   if (x_ptr < y_ptr)
!     return -1;
!   return 0;
  }
  
! typedef int (*fde_compare_t) (struct object *, fde *, fde *);
  
  
  /* This is a special mix of insertion sort and heap sort, optimized for



More information about the Gcc-patches mailing list