[llvm-dev] Opt plugin linkage

Viktor Was BSc via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 15 20:37:54 PDT 2019

I have a dynamically loaded llvm pass built in-tree with ninja (generated with cmake, basically a copy of the hallo pass plugin, linux, llvm/clang version 6.0.1).
It uses the ExecutionEngine.
Building it without linking against LLVMExecutionEngine library results in an undefined symbol to the vtable of the EngineBuilder when loaded to opt. Linking the plugin with LLVMExecutionEngine results in the pass simply not being executable with giving "opt: Unkown command line argument '-passArg'." 
For a minimal example add set(LLVM_LINK_COMPONENTS Core) to the CMakeLists.txt of the Hello llvm pass. 

There is no error or warning at any point when linking or loading a plugin linked against someĀ  libs. 
How do I find out which llvm libs I can't link with a dynamically loaded plugin?
How can I use the EngineBuilder in my plugin with proper symbol resolution?

For reproductivity:

Hope someone can help me out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190416/5d782e46/attachment.html>

More information about the llvm-dev mailing list