<div dir="ltr">Hi Stefan,<div><br></div><div>You're right! Fixed in r314436 -- sorry for the delay!</div><div><br></div><div>Cheers,</div><div>Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 24, 2017 at 5:29 AM, Stefan Gränitz <span dir="ltr"><<a href="mailto:stefan.graenitz@gmail.com" target="_blank">stefan.graenitz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all, hi Lang<br>
<br>
It's a little late to report issues for release_50, but I just found<br>
that thing while porting my JitFromScratch examples to 5.0.<br>
This is a really nifty detail, but (if I'm not mistaken) the function<br>
signature of RTDyldObjectLinkingLayer::<wbr>NotifyLoadedFtor is incorrect:<br>
<br>
$ grep -h -r -A 1 "using NotifyLoadedFtor"<br>
./include/llvm/<wbr>ExecutionEngine/Orc/<wbr>RTDyldObjectLinkingLayer.h<br>
  using NotifyLoadedFtor = std::function<void(ObjHandleT, const<br>
ObjectPtr &Obj,<br>
                              <wbr>                const LoadedObjectInfo &)>;<br>
                                                    ^^^^^^^^^^^^^^^^<br>
It refers to llvm::LoadedObjectInfo base class in llvm/DebugInfo/DIContext.h<br>
instead of   llvm::RuntimeDyld::<wbr>LoadedObjectInfo in<br>
llvm/ExecutionEngine/<wbr>RuntimeDyld.h<br>
<br>
I think it should actually use the derived<br>
RuntimeDyld::LoadedObjectInfo, as this is what listeners expect:<br>
<br>
$ grep -h -r -A 1 "NotifyObjectEmitted("<br>
./include/llvm/<wbr>ExecutionEngine/<wbr>JITEventListener.h<br>
  virtual void NotifyObjectEmitted(const object::ObjectFile &Obj,<br>
                              <wbr>     const RuntimeDyld::LoadedObjectInfo<br>
&L) {}<br>
<br>
It doesn't break OrcMCJITReplacement as it duplicates the issue and the<br>
Info parameter remains unused:<br>
<br>
$ grep -h -r -A 4 -B 2 "const LoadedObjectInfo &Info"<br>
./lib/ExecutionEngine/Orc/<wbr>OrcMCJITReplacement.h<br>
    void operator()(<wbr>RTDyldObjectLinkingLayerBase::<wbr>ObjHandleT H,<br>
                    const RTDyldObjectLinkingLayer::<wbr>ObjectPtr &Obj,<br>
                    const LoadedObjectInfo &Info) const {<br>
      M.UnfinalizedSections[H] =<br>
std::move(M.<wbr>SectionsAllocatedSinceLastLoad<wbr>);<br>
      M.<wbr>SectionsAllocatedSinceLastLoad = SectionAddrSet();<br>
      M.MemMgr->notifyObjectLoaded(&<wbr>M, *Obj->getBinary());<br>
    }<br>
<br>
OrcLazyJIT in lli on the other hand doesn't make use of the<br>
notification.It can however be reproducedthere too:<br>
<br>
diff --git a/tools/lli/OrcLazyJIT.h b/tools/lli/OrcLazyJIT.h<br>
index 47a2acc4d7e..41a7c99413b 100644<br>
--- a/tools/lli/OrcLazyJIT.h<br>
+++ b/tools/lli/OrcLazyJIT.h<br>
@@ -62,7 +62,11 @@ public:<br>
              bool InlineStubs)<br>
       : TM(std::move(TM)), DL(this->TM->createDataLayout(<wbr>)),<br>
        CCMgr(std::move(CCMgr)),<br>
-       ObjectLayer([]() { return<br>
std::make_shared<<wbr>SectionMemoryManager>(); }),<br>
+       ObjectLayer([]() { return<br>
std::make_shared<<wbr>SectionMemoryManager>(); },<br>
+              [this](llvm::orc::<wbr>RTDyldObjectLinkingLayerBase::<wbr>ObjHandleT,<br>
+                     const<br>
llvm::orc::<wbr>RTDyldObjectLinkingLayerBase::<wbr>ObjectPtr &obj,<br>
+                     const llvm::RuntimeDyld::<wbr>LoadedObjectInfo &info) {<br>
+              }),<br>
         CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)<wbr>),<br>
         IRDumpLayer(CompileLayer, createDebugDumper()),<br>
         CODLayer(IRDumpLayer, extractSingleFunction, *this->CCMgr,<br>
<br>
Diagnostic message:<br>
error: no matching constructor for initialization of 'ObjLayerT' (aka<br>
'llvm::orc::<wbr>RTDyldObjectLinkingLayer')<br>
        ObjectLayer([]() { return<br>
std::make_shared<<wbr>SectionMemoryManager>(); },<br>
        ^          <br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
In file included from /llvm50/llvm/tools/lli/<wbr>OrcLazyJIT.cpp:10:<br>
In file included from /llvm50/llvm/tools/lli/<wbr>OrcLazyJIT.h:28:<br>
/llvm50/llvm/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>RTDyldObjectLinkingLayer.h:<wbr>237:3:<br>
note: candidate constructor not viable: no known conversion from<br>
'(lambda at /llvm50/llvm/tools/lli/<wbr>OrcLazyJIT.h:66:15)' to<br>
'NotifyLoadedFtor' (aka 'function<void ([...], [...], const<br>
llvm::LoadedObjectInfo &)>') for 2nd argument<br>
<br>
<br>
Can it still be fixed? The patch is a 13 character one-liner:<br>
<br>
diff --git a/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>RTDyldObjectLinkingLayer.h<br>
b/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>RTDyldObjectLinkingLayer.h<br>
index e1016ef95f0..fcf00fbc462 100644<br>
--- a/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>RTDyldObjectLinkingLayer.h<br>
+++ b/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>RTDyldObjectLinkingLayer.h<br>
@@ -100,7 +100,7 @@ public:<br>
 <br>
   /// @brief Functor for receiving object-loaded notifications.<br>
   using NotifyLoadedFtor = std::function<void(ObjHandleT, const<br>
ObjectPtr &Obj,<br>
-                             <wbr>                 const LoadedObjectInfo &)>;<br>
+                             <wbr>                 const<br>
RuntimeDyld::LoadedObjectInfo &)>;<br>
 <br>
   /// @brief Functor for receiving finalization notifications.<br>
   using NotifyFinalizedFtor = std::function<void(ObjHandleT)<wbr>>;<br>
diff --git a/tools/lli/OrcLazyJIT.h b/tools/lli/OrcLazyJIT.h<br>
index 47a2acc4d7e..41a7c99413b 100644<br>
<br>
Opinions?<br>
<br>
Cheers,<br>
Stefan<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
<a href="https://weliveindetail.github.io/blog/" rel="noreferrer" target="_blank">https://weliveindetail.github.<wbr>io/blog/</a><br>
<a href="https://cryptup.org/pub/stefan.graenitz@gmail.com" rel="noreferrer" target="_blank">https://cryptup.org/pub/<wbr>stefan.graenitz@gmail.com</a><br>
<br>
</font></span></blockquote></div><br></div>