[LLVMdev] MCJIT + Win64 SEH handling problem (missing unwinding info)

Aliaksei Zasenka listhex at gmail.com
Wed Oct 29 13:51:19 PDT 2014


---------- Forwarded message ----------
From: Aliaksei Zasenka <listhex at gmail.com>
Date: 2014-10-29 0:54 GMT+02:00
Subject: Re: [LLVMdev] MCJIT + Win64 SEH handling problem (missing
unwinding info)
To: "Kaylor, Andrew" <andrew.kaylor at intel.com>


Andrew,

First of all thanks for your answer.

In general I understand what steps should be done. Firstly something like
RyntimeDyldCOFF should be implemented and supported. This class is
responsible for object file loading, resolving relocations and EH frames
registration. Then FunctionTable and unwind data located in COFF should be
introduced to system with RtlAddFunctionTable on finalizing.

I suppose lots of details may arise and to make quality product is not that
simple like it seems. But I think I'll try to make a prototype.

Would appreciate any help or advice.


Regards,
Aliaksei

2014-10-28 22:37 GMT+02:00 Kaylor, Andrew <andrew.kaylor at intel.com>:

 Hi Aliaksei,
>
>
>
> The MCJIT code is structured in such a way as to abstract the details of
> object file formats.  What is primarily lacking is a COFF implementation of
> the RuntimeDyld interface.  When we first implemented MCJIT on Windows
> using the ELF object format was sufficient for the applications we were
> aware of that intended to use MCJIT on Windows, so we used ELF-on-Windows
> as a sort of shortcut.
>
>
>
> I’m not aware of anything that would prevent MCJIT from working with COFF
> files if someone was willing to invest the effort to implement the
> RuntimeDyld support for COFF.  It’s likely that one or two small issues
> would arise, but I don’t think there would be any major design issues.
> However, even after basic MCJIT execution of COFF images is in place there
> may be additional work to be done to make exception handling work
> correctly.  I don’t know one way or the other about that.
>
>
>
> If you are interested in trying to implement the RuntimeDyld support for
> COFF I can provide you with some details of what is involved.
>
>
>
> -Andy
>
>
>
>
>
> *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On
> Behalf Of *Aliaksei Zasenka
> *Sent:* Tuesday, October 28, 2014 5:26 AM
> *To:* LLVMdev at cs.uiuc.edu
> *Subject:* [LLVMdev] MCJIT + Win64 SEH handling problem (missing
> unwinding info)
>
>
>
> Hi all,
>
>
> I'm using MCJIT for running the manually generated code under both Win32
> and Win64 environments.  Unfortunately catching exceptions under Win64
> doesn't work. As I understand the main problem is the lack of function
> table that is needed to unwind a call stack.
>
> Microsoft says
> <http://msdn.microsoft.com/en-us/library/windows/desktop/ms680595%28v=vs.85%29.aspx>
> *Function tables are used on 64-bit Windows to determine how to unwind or
> walk the stack. These tables are usually generated by the compiler and
> stored as part of the image. However, applications must provide the
> function table for dynamically generated code.*
>
> As I can see LLVM usually creates Function Table when generating COFF
> (Win64EH::UnwindEmitter). But MCJIT can load only ELF files.
>
> Is there any way to workaround the problem? Maybe it is already planned to
> implement COFF loading in MCJIT?
>
> Best regards,
> Aliaksei
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141029/9fe5517a/attachment.html>


More information about the llvm-dev mailing list