[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
Hi,
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:
cmake -G "Sublime Text 2 - Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON -DLLVM_BUILD_TESTS=ON -DLLVM_BUILD_EXAMPLES=ON -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_TOOL_CLANG_BUILD=ON -DLLVM_TOOL_CLANG_TOOLS_EXTRA=ON -DLLVM_OPTIMIZED_TABLEGEN=ON -DCLANG_BUILD_EXAMPLES=ON -DCLANG_PLUGIN_SUPPORT=ON
Hope someone can help me out.
Viktor
-------------- 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