[LLVMdev] object file/linking is missing my exception handlers

Duncan Sands baldrick at free.fr
Thu Apr 11 06:38:40 PDT 2013


Hi,

On 11/04/13 06:06, edA-qa mort-ora-y wrote:
> I have some exception handling which works fine using the JIT. Now I am
> producing object files and linking them, but the exception handling
> tables seem to be missing. I call _Unwind_RaiseException and get
> _URC_END_OF_STACK as a result.

you will get this if no catch clauses match (eg because there are no catch
clauses, perhaps because you only have cleanups).  Maybe the JIT wraps the
program in a big catch-all clause?  That would cause cleanups to run, and
would explain things if you don't have any catch clauses and instead do all
the work in cleanups.

> I produce my object file using TargetMachine::addPassesToEmitFile and
> then I link my resulting files with:

Are you using standard dwarf tables, or something of your own invention
(as discussed in a previous email)?

>
> gcc -o prog input.o -fexceptions

This just calls the linker, the -fexceptions option will be ignored.  In any
case, the big question is whether the exception table is in input.o already or
not.  You can disassemble it and take a look.

> I'm sure I'm just missing some option to generate the Dwarf tables, but
> I can't figure out what it is. For the JIT version I set
> JITExceptionHandling and JITEmitDebugInfo on TargetOptions.

You don't have to do anything AFAIK: by default the code generators will
produce an exception table.

Probably you should send in your IR and the .o file.

Ciao, Duncan.



More information about the llvm-dev mailing list