[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?
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev