[LLVMdev] Question about compiling plugins for LLVM tools

Talin viridia at gmail.com
Thu Jan 27 01:27:44 PST 2011


When I load my plugin into opt or llc, I get a bunch of warnings:

llc: CommandLine Error: Argument 'use-unknown-locations' defined more than
once!
llc: CommandLine Error: Argument 'disable-debug-info-print' defined more
than once!
llc: CommandLine Error: Argument 'print-dbgscope' defined more than once!
llc: CommandLine Error: Argument 'disable-sched-hazard' defined more than
once!
llc: CommandLine Error: Argument 'verify-dom-info' defined more than once!
llc: CommandLine Error: Argument 'time-passes' defined more than once!
llc: CommandLine Error: Argument 'print-after-all' defined more than once!
llc: CommandLine Error: Argument 'print-before-all' defined more than once!
llc: CommandLine Error: Argument 'print-after' defined more than once!
llc: CommandLine Error: Argument 'print-before' defined more than once!
llc: CommandLine Error: Argument 'debug-pass' defined more than once!
llc: CommandLine Error: Argument 'version' defined more than once!
llc: CommandLine Error: Argument 'help-hidden' defined more than once!
llc: CommandLine Error: Argument 'help' defined more than once!
llc: CommandLine Error: Argument 'debug-only' defined more than once!
llc: CommandLine Error: Argument 'debug-buffer-size' defined more than once!
llc: CommandLine Error: Argument 'debug' defined more than once!
llc: CommandLine Error: Argument 'stats' defined more than once!
llc: CommandLine Error: Argument 'info-output-file' defined more than once!
llc: CommandLine Error: Argument 'track-memory' defined more than once!

I'm guessing the reason this happens is because the plugin is a shared
library that is linking against the LLVM libraries, and so what happens is
that the various command-line objects, which are statically constructed, are
getting loaded twice, once for the tool itself, and once for the plugin.

However, I'm not sure how to create my plugin any differently. I'm using
cmake's 'add_library(name SHARED ...)' to create the plugin like so:

add_library(reflector SHARED ${REFLECT_SOURCES} ${COMMON_HEADERS}
${REFLECT_HEADERS})
target_link_libraries(reflector
    linker_common
    ${LLVM_TARGET}
    ${LLVM_CORE}
    ${LLVM_SUPPORT}
    ${LLVM_SYSTEM}
    )


Any advice on this?

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110127/349a59f5/attachment.html>


More information about the llvm-dev mailing list