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

next in thread | previous in thread | raw e-mail | index | archive | help
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 <ak03@gte.com>
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




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