[llvm-dev] Opt plugin linkage

mayuyu.io via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 15 23:12:21 PDT 2019


Ooops didn’t read that clearly. I assume it’s due to your pass now uses the cl:: infrastructure in it’s own Core, not the opt’s. Try linking the components separately 

Zhang

> 在 2019年4月16日,04:37,Viktor Was BSc via llvm-dev <llvm-dev at lists.llvm.org> 写道:
> 
> 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev





More information about the llvm-dev mailing list