setjmp/longjmp exception handling: how?

Dear list,

I want to add SJLJ exception handling to my frontend. Unfortunately,
there doesn't seem to be any examples in the documentation as to how
to use the intrinsics

@llvm.eh.sjlj.setjmp
@llvm.eh.sjlj.longjmp
@llvm.eh.sjlj.lsda
@llvm.eh.sjlj.callsite

Is there a way to force Clang to use SJLJ exception handling for C++? That
way I would be able to look at its output to learn how to use them correctly.

Otherwise, how should I go about finding out how to implement SJLJ exception
handling in my frontend?

Thanks!
Nicolas

I strongly advise you not to use SjLj exception handling. Use zero-cost-exceptions via DWARF instead.

If you really want to pursue sjlj anyway, look at the ARM backend. It uses them for darwin targets.

-Jim

Jim Grosbach <grosbach@apple.com> writes:

I strongly advise you not to use SjLj exception handling. Use
zero-cost-exceptions via DWARF instead.

On Windows, DWARF EH doesn't work when there are stack frames not
compiled with DWARF EH support (i.e. OS code that invokes user-provided
callbacks, a common practice on Windows.)

You can also use the patches available on the list with support for Win64 EH and you will not have that problem, though 32-bits is still a problem.