<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 9, 2013, at 9:56 AM, 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;">Wow, commenting those two lines worked out fine for me, thanks!</div></div></div></blockquote><div><br></div><div>Would you mind filing a bug with more details on your development environment: compiler version, linker, platform? Also include you compile/link command lines. I think those "extern template" decls are meant to be a compile/link time optimization. But no one actually verified that it helps. If it won't always work with shared libs, they should be removed. OTOH, if it's a bug in your host compiler, maybe we just need better #ifdefs.</div><div><br></div><div>I would prefer to just remove those extern decls, but I don't know the rules for template instantiation and symbol linking well enough to make any strong claims.</div><div><br></div><div>-Andy</div><div><br></div><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 class="gmail_extra"><div class="gmail_quote">On 9 May 2013 09:34, Giacomo Tagliabue<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:giacomo.tag@gmail.com" target="_blank">giacomo.tag@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><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; position: static; z-index: auto;"><div dir="ltr"><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;">Thanks,<br>Also, every method inherited by LoopBase causes the same error, while Loop methods go smooth.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On 9 May 2013 01:05, Andrew Trick<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><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; position: static; z-index: auto;"><div style="word-wrap: break-word;"><div><br><div><div>On May 8, 2013, at 7:43 PM, Giacomo Tagliabue <<a href="mailto:giacomo.tag@gmail.com" target="_blank">giacomo.tag@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 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; position: static; z-index: auto;"><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><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>__extension__ extern template class LoopBase<BasicBlock, Loop>;</div><div><div>__extension__ extern template class LoopInfoBase<BasicBlock, Loop>;</div><div><br></div></div><div>-Andy</div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></blockquote></div><br></body></html>