[llvm-dev] Opt plugin linkage

Viktor Was BSc via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 16 12:09:42 PDT 2019


How come the hello pass example is so totally useless as a starting point? Why is this not using any library/compontent which could conflict with opt or clang and showing how to handle this? I have no clue as to how I have to setup llvm to get this to work or why it doesn't work in the first place with the setup described in "Getting started" and "writing an llvm pass" pages etc. 
Also there is basically no documentation for the custom cmake commands. 

Can please somebody help me with this issue? How do I get dynamically loaded llvm pass plugins to work? Am I the only one ever having this issue? 

Thanks 
Viktor 

On Apr 16, 2019, 05:38, at 05:38, Viktor Was BSc via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190416/bb607580/attachment.html>


More information about the llvm-dev mailing list