Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jan 2000 14:51:00 -0500 (EST)
From:      "Alexander N. Kabaev" <ak03@gte.com>
To:        "David O'Brien" <obrien@nuxi.com>
Cc:        current@FreeBSD.ORG, Maxim Sobolev <sobomax@altavista.net>
Subject:   Re: C++ exceptions doesn't work in shared libraries
Message-ID:  <XFMail.000117145100.ak03@gte.com>
In-Reply-To: <20000117110814.J7184@dragon.nuxi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
As I already pointed out in private message, this bug is in fact i386 specific
and it was wrong to fix it in gcc/except.c file. The real problem is that
default builtin_setjmp implementation does not restore any registers except for
stack pointers when doing nonlocal jump. This means, that every platform, that
needs to store/restore some other state between jumps, has to provide
appropriate definitions for builtin_setjmp_setup and builtin_setjmp_receiver RTL
expansions.

Every plaftorm which needs to do some additional processing at setjmp
receive point, such as restoring additional information previously saved by 
builtin_setjmp_setup, can provide definition for builtin_setjmp_receiver RTL
expansion. That is exactly what I do in a second (improved, I hope) patch I
have sent to David yesterday. The i386 code compiled with -fpic flag requires
the value of PIC register (EBX) to be restored in order to function properly. I
do not provide expansion for builtin_setjmp_setup because GCC documentation
explicitly states that values should be recalculated if possibe, rather than
stored in setjmp buffer and proper value for EBX can easlity be determined from
the current EIP contents. Since the patch is extremely small and simple, I am
attaching it below for those who want to test it. Of course, I would greatly
appreciate if you will let me know the results.

I am aware that my English is far from perfect and asking for your patience.
----------------------------------
E-Mail: Alexander N. Kabaev <ak03@gte.com>
Date: 17-Jan-00
Time: 14:11:19
----------------------------------

Index: config/i386/i386.md
===================================================================
RCS file: /home/ncvs/src/contrib/gcc/config/i386/i386.md,v
retrieving revision 1.5
diff -u -r1.5 i386.md
--- config/i386/i386.md 1999/11/15 04:28:55     1.5
+++ config/i386/i386.md 2000/01/16 04:21:02
@@ -8195,3 +8195,13 @@
   load_pic_register (1);
   DONE;
 }")
+
+(define_expand "builtin_setjmp_receiver"
+  [(label_ref (match_operand 0 "" ""))]
+  "flag_pic"
+  "
+{
+  load_pic_register (1);
+  DONE;
+}")
+



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.000117145100.ak03>