Exception handling code works with JIT but not when compiled offline to object files.

I've generated a lot of exception handling code that works perfectly when I JIT the code or write it out as bitcode, load it back in to my executable and JIT it.

However, when I compile the bitcode files to object files with llc and then link them into a bundle with ld and load the bundle back into my executable the exception handling occasionally fails.

I'm running this on OS X 10.8.

Has anyone seen this problem before?

The test case is large and I'd be happy to provide it or more details if you need more details.



Christian Schafmeister
Associate Professor
Chemistry Department
Temple University

I had this problem with my exception handling code as well. I was
testing on Linux but perhaps a similar issue exists. What I discovered
is that for some reason the exception handling in JIT is more lenient
than in a compiled executable. That is, I discovered two things in my
exception code which were wrong but nonetheless working in the JIT.

1. In some cases I was calling Unwind_Resume even though I wasn't
technically in an exception anymore (I had reported it was already handled).

2. For cleanup code I wasn't setting the selector correctly (the value
you pass to Unwind_SetGR in regno(1)). I'm still not positive why this
caused it to fail, but it did.