> Looks like I have to build a cross to a sjlj EH target ... Let's clear a common misconception here: the SJLJ EH scheme implemented in C++ doesn't explicitly use __builtin_setjmp/__buitin_longjmp so it won't help to understand how things work for the case at hand; it's instead a hybrid scheme, i.e. EH machinery and __builtin_setjmp/__buitin_longjmp at the RTL level.
If you want to experiment with __builtin_setjmp/__buitin_longjmp without writing them explicitly, you can use the SJLJ EH scheme implemented in Ada, because it is entirely piggybacked on __builtin_setjmp/__buitin_longjmp: gigi lowers all the EH constructs to use them (and consequently doesn't use the EH machinery at all, for example there is not a single EH edge in the CFG). And, of course, the canonical setjmp/longjmp are something else and are never turned into __builtin_setjmp/__buitin_longjmp because the semantics is not the same. They were recently changed to make use of the existing machinery for __builtin_setjmp/__buitin_longjmp under the hood (AB edges then AB dispatcher) but they are still optimization blockers because of cfun->calls_setjmp, which is set neither for __builtin_setjmp/__buitin_longjmp nor for SJLJ EH schemes. -- Eric Botcazou