bug-libsigsegv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-libsigsegv] incompatible with libgc on Mac OS X?


From: Bruno Haible
Subject: Re: [bug-libsigsegv] incompatible with libgc on Mac OS X?
Date: Wed, 31 Aug 2011 09:32:07 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Hi,

William Lovas wrote:
> While trying to integrate libsigsegv's stack overflow handling into a
> custom introductory programming language at CMU, i ran into an issue:
> it looks like libsigsegv cannot be linked alongside the Boehm-Demers-
> Weiser conservative garbage collector for C, at least on Mac OS X, as
> both packages define a function catch_exception_raise.  On my MacBook
> i get the following:
> 
>     ld: duplicate symbol _catch_exception_raise in
>     /Users/wlovas/work/intro/15-122/c0/lib/libgc.a(os_dep.o) and
>     /Users/wlovas/work/intro/15-122/c0/lib/libsigsegv.a(handler.o)

Yes, if you want to have both libgc.a and libsigsegv.a in the same
application (I wonder why you need this? libsigsegv is mostly used for
defining a garbage collector, which libgc already provides), then you
need to combine the fault handling code of both libraries at the
source code level. The system cannot simply guess which of the two
should be notified first when there is a fault.

> My cursory exploration of the problem suggests that this is some kind
> of deficiency in the Mach exception handling mechanisms.

It is a natural limitation: There can only be one exception handler.
This also holds on Unix with the signal handlers: Both libgc and libsigsegv
install a handler for SIGSEGV. Only here, it will not lead to a link
error, but at runtime the last installed handler will be active.

> Can any of you suggest a workaround?

Combine the fault handling code on the source code level. This needs to be
done separately for MacOS X, Unix, and Win32.

Bruno
-- 
In memoriam Magomed Yevloyev <http://en.wikipedia.org/wiki/Magomed_Yevloyev>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]