[LLVMdev] [PATCH] Seh exceptions on Win64

Kai Nacke kai.nacke at redstar.de
Thu Apr 17 10:10:30 PDT 2014


Hi,

On 15.04.2014 23:44, Vadim Chugunov wrote:
> Hi,
> I am curious - how does clang deal with epilogue-less functions that
> result from _Raise_Exception being marked 'noreturn'?
> I've also been playing with Kai's patch, and discovered that this tends
> to greatly confuse Windows stack unwinder in cases when noreturn call is
> at the end of a function, so execution appears to flow directly into the
> prologue of the next function.

Yes, that's true. The patch has a problem if the epilogue is dead code 
and eliminated.

> It looks like MSVC solves this problem by inserting 'int 3' after calls
> to noreturns.  This is actually the prime motivation for me wanting to
> emit code for 'unreachable'
> <http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-April/072145.html> ...
>
> Vadim

Yaron also pointed out that

int main() { throw 1; }

generates two .seh_endprologue instructions. I still did not fix this bug.

Regards,
Kai


>
>
> On Tue, Apr 15, 2014 at 11:43 AM, Martell Malone
> <martellmalone at gmail.com <mailto:martellmalone at gmail.com>> wrote:
>
>     Hi,
>
>     I'd like to submit a patch to match the clang patch on the front end.
>     http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140414/103257.html
>
>     The front end doesn't need this patch to work but it's still important.
>     This is mostly based on work done by kai from redstar.de
>     <http://redstar.de>
>
>     Could I get some feedback on this?
>     I'm not sure if the emitting of the register names will effect msvc.
>
>     Many Thanks
>
>     Martell Malone
>
>     _______________________________________________
>     LLVM Developers mailing list
>     LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu
>     http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list