From owner-freebsd-current Mon Jan 17 11:51:40 2000 Delivered-To: freebsd-current@freebsd.org Received: from h132-197-97-45.gte.com (h132-197-97-45.gte.com [132.197.97.45]) by hub.freebsd.org (Postfix) with ESMTP id 0970714BC6 for ; Mon, 17 Jan 2000 11:51:36 -0800 (PST) (envelope-from ak03@gte.com) Received: (from ak03@localhost) by h132-197-97-45.gte.com (8.9.3/8.9.3) id OAA29506; Mon, 17 Jan 2000 14:51:00 -0500 (EST) (envelope-from ak03) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20000117110814.J7184@dragon.nuxi.com> Date: Mon, 17 Jan 2000 14:51:00 -0500 (EST) Organization: GTE Laboratories Inc. From: "Alexander N. Kabaev" To: "David O'Brien" Subject: Re: C++ exceptions doesn't work in shared libraries Cc: current@FreeBSD.ORG, Maxim Sobolev Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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