From owner-freebsd-current Mon Jan 17 12:51:34 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 CFEB914EDB for ; Mon, 17 Jan 2000 12:51:31 -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 PAA29739; Mon, 17 Jan 2000 15:49:43 -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: <20000117115648.C53965@relay.nuxi.com> Date: Mon, 17 Jan 2000 15:49:43 -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: Maxim Sobolev , current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Well, I cannot comment on OpenBSD or Solaris, since I do not have access to them right now. My guess is that OpenBSD and Solaris x86 either 1. do not use sjlj exception propagation, or 2. do not use _builtin_setjmp Linux does not use sjlj exceptions for sure and as a result it is not affected by this bug. In case when they do not use sjlj exceptions, appropriate EBX restoration code is provided by the exception_receiver RTL. Unfortunately, G++ only emits exception_receiver when using non-sjlj exceptions. In my first patch I tried to force exception_receiver to be emitted in for sjlj exceptions too, but only when GCC uses builtin{setjmp|longjmp} implementations. Standard C library setjmp/longjmp should have EBX preserved correctly already and thus do not need any special code. I have looked at Aplha backend and found out, that Alpha does the right thing and tries to restore its equivalent of PIC register on setjmp receive point, so apparently, GCC expects _builtin_setjmp and builtin_longjmp to do all necessary register preservations. i386 backend clearly fails to do that. On 17-Jan-00 David O'Brien wrote: > On Mon, Jan 17, 2000 at 02:51:00PM -0500, Alexander N. Kabaev wrote: >> 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. > > Why doesn't OpenBSD, Linux, or Solaris x86 need this patch? > >> That is exactly what I do in a second (improved, I hope) patch I have >> sent to David yesterday. > > I may go with this patch, but I need to understand more why it is needed > before I take a file off the vendor branch. Any help would be > appreciated. > > -- > -- David (obrien@NUXI.com) ---------------------------------- E-Mail: Alexander N. Kabaev Date: 17-Jan-00 Time: 14:57:58 ---------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message