<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On May 8, 2013, at 7:43 PM, Giacomo Tagliabue <<a href="mailto:giacomo.tag@gmail.com">giacomo.tag@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;"><div class="gmail_default">Hello,<br>I am building a loop pass following these instructions: <a href="http://llvm.org/docs/WritingAnLLVMPass.html" target="_blank" style="font-family: arial;">http://llvm.org/docs/WritingAnLLVMPass.html</a><br>Everything works fine, I did it many times for Function Passes, but in the runOnLoopmethod, whenever I call a method of the loop L passed as argument, for example L->begin(), I get the following error:</div><div class="gmail_default"><br></div><div class="gmail_default" style="font-size: 13px; font-family: arial, sans-serif;"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><font face="arial, helvetica, sans-serif">opt: symbol lookup error: /home/giacomo/llvmcsfv/Debug+Asserts/lib/Acsl.so: undefined symbol: _ZNK4llvm8LoopBaseINS_10BasicBlockENS_4LoopEE5beginEv</font></blockquote><br>Where Acsl is the name of the loadable module. If I remove all the instructions from <span style="font-family: arial, helvetica, sans-serif;">runOnPass but a debug print, it works fine (it prints it), so the problem is not the module.<br>Does anybody have any Idea?</span></div><div class="gmail_default" style="font-size: 13px; font-family: arial, sans-serif;"><span style="font-family: arial, helvetica, sans-serif;">Thank you very much,<br>Giacomo</span></div></div></div></div></blockquote><br></div><div>I'm not sure why your dynamic linker looks in Acsl.so. llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::begin() is explicitly instantiated in LoopInfo.cpp. With a debug build on darwin, that symbol is undefined in my dynamically loaded module, but exported by the opt binary. So a dynamically loaded loop pass as you described works fine for me.</div><div><br></div><div>Someone else should try this on linux with shared libs.</div><div><br></div><div>You can also try removing these lines from LoopInfo.h, which seem superfluous to me:</div><div><div><br></div><div><div>__extension__ extern template class LoopBase<BasicBlock, Loop>;</div></div><div><div>__extension__ extern template class LoopInfoBase<BasicBlock, Loop>;</div><div><br></div></div><div>-Andy</div><div><br></div></div></body></html>