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

Kurt Harriman kharriman at greenplum.com
Mon Nov 21 14:50:49 PST 2005


I would like to build an x86 executable consisting of a number of
subsystems (mostly legacy C code).  One subsystem will be compiled
to native code using llvm.  It calls, and is called by, the other
subsystems, many of which have to be compiled using gcc because they
use small amounts of inline assembly.  All of the subsystems catch
and throw errors to one another using setjmp/longjmp.

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?

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.

... kurt

More information about the llvm-dev mailing list