[LLVMdev] setjmp/longjmp interoperable between llvm and gcc?

Chris Lattner sabre at nondot.org
Mon Nov 21 14:53:58 PST 2005

On Mon, 21 Nov 2005, Kurt Harriman wrote:
> When gcc-built code calls longjmp(), the destination might be a
> setjmp() in llvm-built code, and vice versa.  At present the
> gcc-built code uses the setjmp/longjmp implementations provided
> by the gnu C library; and presumably the llvm-built code will use
> llvm's setjmp/longjmp intrinsics.  Are the two implementations
> safely interoperable?

No, not right now.  EH in general doesn't interoperate.  This will be 
fixed in the future, but is problematic for the time being.

> Alternatives would be to force the llvm-built code to use the libgc
> setjmp/longjmp; force the gcc-built code to use a setjmp/longjmp
> borrowed from llvm; or perhaps make each setjmp tag the jmpbuf to
> show which flavor of longjmp is required.

I depends on what sort of thing you want to do.  Another option is to 
compile everything with LLVM if possible.



More information about the llvm-dev mailing list