[LLVMdev] LoopPass symbol error

Andrew Trick atrick at apple.com
Wed May 8 23:05:07 PDT 2013


On May 8, 2013, at 7:43 PM, Giacomo Tagliabue <giacomo.tag at gmail.com> wrote:

> Hello,
> I am building a loop pass following these instructions: http://llvm.org/docs/WritingAnLLVMPass.html
> 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:
> 
> opt: symbol lookup error: /home/giacomo/llvmcsfv/Debug+Asserts/lib/Acsl.so: undefined symbol: _ZNK4llvm8LoopBaseINS_10BasicBlockENS_4LoopEE5beginEv
> 
> Where Acsl is the name of the loadable module. If I remove all the instructions from runOnPass but a debug print, it works fine (it prints it), so the problem is not the module.
> Does anybody have any Idea?
> Thank you very much,
> Giacomo

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.

Someone else should try this on linux with shared libs.

You can also try removing these lines from LoopInfo.h, which seem superfluous to me:

__extension__ extern template class LoopBase<BasicBlock, Loop>;
__extension__ extern template class LoopInfoBase<BasicBlock, Loop>;

-Andy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130508/e11e2f44/attachment.html>


More information about the llvm-dev mailing list