[cfe-dev] Microsoft C++ exception handling.

r4start r4start at gmail.com
Fri Jul 27 23:52:16 PDT 2012

On 27/07/2012 21:11, John McCall wrote:
> On Jul 26, 2012, at 11:30 PM, r4start wrote:
>> On 27/07/2012 04:19, John McCall wrote:
>>> On Jul 26, 2012, at 3:42 AM, r4start wrote:
>>>> For C++ EH cl build stub __ehhandler$mangled_function_name (for each
>>>> function with EH).
>>>> This stub consist of 2 instructions:
>>>> __ehhandler$_main:
>>>> mov         eax,offset __TI1?AUmy_exception1@@+50h (address of __ehfuncinfo)
>>>> jmp         @ILT+395(___CxxFrameHandler3)
>>>> How can I implement this behavior?
>>> Is this for SEH or for Win64 exceptions?
>> Yes, this is SEH.
> We can't accept code to implement this.  If you want to work on this privately, that's your business, of course, but understand that the LLVM project cannot take any such code in our repository until we get legal sign-off.
>> This code does not use stack to forward __ehfuncinfo to CxxFrameHandler, so my problem is how can I tell llvm that I need store address in
>> eax and then jump to  CxxFrameHandler.
> If we ever implement SEH in clang — and my understanding is that all the relevant patents are within a few years of expiring, but that is not a legally informed opinion — then the appropriate design is to lower this in the backend.  We've tried to architect the IR for exceptions to support lowering to different formats;  of course, it's quite possible that we'll find that we've missed a few subtleties.
> John.

Thanks for clarification.

  - Dmitry Sokolov.

More information about the cfe-dev mailing list