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>
On Thu, Jan 27, 2011 at 1:27 AM, Talin <viridia at gmail.com> wrote:> 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? >Still trying to puzzle this one out...what I think I need is to link my plugin such that it doesn't include the LLVM libs in the plugin, but only refer to them as external symbols - but I'm not enough of a unix expert to know how to do that. -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110201/fc7fafe8/attachment.html>
Duncan Sands
2011-Feb-02 07:55 UTC
[LLVMdev] Question about compiling plugins for LLVM tools
Hi Talin, my auto-simplifier uses a plugin (harvest.so) to harvest interesting code sequences from bitcode. You might want to take a look at how it is built. You can get it from svn://topo.math.u-psud.fr/harvest Ciao, Duncan.> On Thu, Jan 27, 2011 at 1:27 AM, Talin <viridia at gmail.com > <mailto:viridia at gmail.com>> wrote: > > 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? > > > Still trying to puzzle this one out...what I think I need is to link my plugin > such that it doesn't include the LLVM libs in the plugin, but only refer to them > as external symbols - but I'm not enough of a unix expert to know how to do that. > > -- Talin > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev