[LLVMdev] LoopPass symbol error
atrick at apple.com
Thu May 9 10:40:15 PDT 2013
On May 9, 2013, at 9:56 AM, Giacomo Tagliabue <giacomo.tag at gmail.com> wrote:
> Wow, commenting those two lines worked out fine for me, thanks!
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.
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.
> On 9 May 2013 09:34, Giacomo Tagliabue <giacomo.tag at gmail.com> wrote:
> Also, every method inherited by LoopBase causes the same error, while Loop methods go smooth.
> On 9 May 2013 01:05, Andrew Trick <atrick at apple.com> wrote:
> On May 8, 2013, at 7:43 PM, Giacomo Tagliabue <giacomo.tag at gmail.com> wrote:
>> 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,
> 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>;
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev