[PATCH]Unload EH frames in ~MCJIT

Yaron Keren yaron.keren at gmail.com
Sat Oct 12 05:20:33 PDT 2013


There is an additional detail to .eh_frame registration you may wish to
consider while preparing  the multi-module patch.

With executable files, the linker combines .eh frames with four zero bytes
from crtend to marking .eh_frame section end. See
http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-April/061768.html
As Rafael writes, this can't be done in codegen since it's a linker
function done when all .eh_frames are combined.

The dynamic linker must perform the same function, else
__register_frame(eh_frame) might continue processing after .eh_frame,
depending if there were four zero bytes - or not - by chance.

Possibly RuntimeDyldELF::registerEHFrames() will allocate a new buffer for
the .eh_frame, four bytes larger set to zeros, and send this to MemMgr.
Then decide who and when will free this allocation, while considering
module unloading too.

Yaron



2013/10/9 Kaylor, Andrew <andrew.kaylor at intel.com>

>  Hi Yaron,****
>
> ** **
>
> I’m in the process of updating the EH frame support in MCJIT and
> RuntimeDyld to handle registration of multiple generated or loaded
> objects.  These changes involve an update to the memory manager and
> RuntimeDyld interfaces for registering EH frame data.  They will also
> highlight complications which would need to be considered in your patch
> with regard to deregistration of frame data.****
>
> ** **
>
> In addition, I would prefer to have a separate “deregister” function
> rather than overloading the behavior of the registerFrames function.****
>
> ** **
>
> I’m attaching my current patch so you can see where this is going.  Also
> feel free to provide feedback on the patch.****
>
> ** **
>
> Please wait for my multiple object patch to be committed.  After that we
> can discuss the details of how deregistration should work.****
>
> ** **
>
> Thanks,****
>
> Andy****
>
> ** **
>
> ** **
>
> *From:* llvm-commits-bounces at cs.uiuc.edu [mailto:
> llvm-commits-bounces at cs.uiuc.edu] *On Behalf Of *Yaron Keren
> *Sent:* Wednesday, October 09, 2013 10:22 AM
> *To:* llvm-commits at cs.uiuc.edu
> *Subject:* [PATCH]Unload EH frames in ~MCJIT****
>
> ** **
>
> Module loaded with MCJIT register its EH frames with __register_frame to
> the runtime library. After MCJIT destructs and the module unloaded,  the
> runtime stays with invalid frames of the module, leading to faulty EH
> behaviour next time.****
>
> ** **
>
> This patch calls __deregister_frame upon MCJIT destruction to keep proper
> runtime library EH state.****
>
> ** **
>
> Yaron****
>
> ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131012/992ee373/attachment.html>


More information about the llvm-commits mailing list