<br><br><div class="gmail_quote">On Thu, Jan 27, 2011 at 1:27 AM, Talin <span dir="ltr"><<a href="mailto:viridia@gmail.com">viridia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

When I load my plugin into opt or llc, I get a bunch of warnings:<div><br></div><div><div>llc: CommandLine Error: Argument 'use-unknown-locations' defined more than once!</div><div>llc: CommandLine Error: Argument 'disable-debug-info-print' defined more than once!</div>


<div>llc: CommandLine Error: Argument 'print-dbgscope' defined more than once!</div><div>llc: CommandLine Error: Argument 'disable-sched-hazard' defined more than once!</div><div>llc: CommandLine Error: Argument 'verify-dom-info' defined more than once!</div>


<div>llc: CommandLine Error: Argument 'time-passes' defined more than once!</div><div>llc: CommandLine Error: Argument 'print-after-all' defined more than once!</div><div>llc: CommandLine Error: Argument 'print-before-all' defined more than once!</div>


<div>llc: CommandLine Error: Argument 'print-after' defined more than once!</div><div>llc: CommandLine Error: Argument 'print-before' defined more than once!</div><div>llc: CommandLine Error: Argument 'debug-pass' defined more than once!</div>


<div>llc: CommandLine Error: Argument 'version' defined more than once!</div><div>llc: CommandLine Error: Argument 'help-hidden' defined more than once!</div><div>llc: CommandLine Error: Argument 'help' defined more than once!</div>


<div>llc: CommandLine Error: Argument 'debug-only' defined more than once!</div><div>llc: CommandLine Error: Argument 'debug-buffer-size' defined more than once!</div><div>llc: CommandLine Error: Argument 'debug' defined more than once!</div>


<div>llc: CommandLine Error: Argument 'stats' defined more than once!</div><div>llc: CommandLine Error: Argument 'info-output-file' defined more than once!</div><div>llc: CommandLine Error: Argument 'track-memory' defined more than once!</div>


<div><br></div><div>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.</div>


<div><br></div><div>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:</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">


<div><div><div><font face="'courier new', monospace">add_library(reflector SHARED ${REFLECT_SOURCES} ${COMMON_HEADERS} ${REFLECT_HEADERS})</font></div></div></div><div><div><div><font face="'courier new', monospace">target_link_libraries(reflector</font></div>


</div></div><div><div><div><font face="'courier new', monospace">    linker_common</font></div></div></div><div><div><div><font face="'courier new', monospace">    ${LLVM_TARGET}</font></div>
</div></div><div><div><div><font face="'courier new', monospace">    ${LLVM_CORE}</font></div></div></div><div><div><div><font face="'courier new', monospace">    ${LLVM_SUPPORT}</font></div>
</div></div><div><div><div><font face="'courier new', monospace">    ${LLVM_SYSTEM}</font></div></div></div><div><div><div><font face="'courier new', monospace">    )</font></div>
</div></div></blockquote><div><div><br></div><div>Any advice on this?</div><div></div></div></blockquote></div><div><br></div><div>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.</div>

<div><br></div><div>-- Talin</div><div><br></div>