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]

[RFA:] Fix fatal DW_EH_PE_absptr EH failure in fde_unencoded_compare:derefer pc_begin


The 1.13 change to unwind-dw2-fde.c removed a dereference in
fde_unencoded_compare, resulting in massive EH regressions for targets
with the default DW_EH_PE_absptr pointer encoding.

The bug is somewhat obvious looking at the 1.12 .. 1.13 diff.

The pc_begin member of struct object (first struct in unwind-dw2-fde.h
with a member by that name) is "void *pc_begin" (comparable with
less/greater operators in GNU C), but in struct dwarf_fde which is what we
use here, it is "unsigned char pc_begin[]".  So after that change, we
started comparing addresses of the pc_begin fields in the EH structures
instead of the contents of those fields for targets with DW_EH_PE_absptr
pointer encoding.  It would be nice if when hacking EH and touching
pointer encoding areas, people could check DW_EH_PE_absptr targets using
EH frame rather than sjlj.  Unfortunately there are no available simulator
targets (as in simtest-howto.html) that do that.  Most use sjlj for some
reason.  However, both cris-* and mmix-knuth-mmixware are such targets.
(Uh-oh, see the connection? ;-)

Plug: Here's a reason to consider accepting the mmix-knuth-mmixware port;
it'd be just about as easy to run as the targets on simtest-howto.html.

Tested on mmix-knuth-mmixware and cris-axis-linux-gnu, fixes the EH
regressions as expected.

Ok to commit?

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

Index: unwind-dw2-fde.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/unwind-dw2-fde.c,v
retrieving revision 1.13
diff -p -c -r1.13 unwind-dw2-fde.c
*** unwind-dw2-fde.c	2001/10/10 19:53:29	1.13
--- unwind-dw2-fde.c	2001/10/21 23:34:34
*************** static int
*** 297,305 ****
  fde_unencoded_compare (struct object *ob __attribute__((unused)),
  		       fde *x, fde *y)
  {
!   if (x->pc_begin > y->pc_begin)
      return 1;
!   if (x->pc_begin < y->pc_begin)
      return -1;
    return 0;
  }
--- 297,308 ----
  fde_unencoded_compare (struct object *ob __attribute__((unused)),
  		       fde *x, fde *y)
  {
!   saddr xpc = *(saddr *) x->pc_begin;
!   saddr ypc = *(saddr *) y->pc_begin;
!
!   if (xpc > ypc)
      return 1;
!   if (xpc < ypc)
      return -1;
    return 0;
  }

brgds, H-P


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