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 class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div><div><font class="Apple-style-span" face="'courier new', monospace">add_library(reflector SHARED ${REFLECT_SOURCES} ${COMMON_HEADERS} ${REFLECT_HEADERS})</font></div></div></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace">target_link_libraries(reflector</font></div>
</div></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace"> linker_common</font></div></div></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace"> ${LLVM_TARGET}</font></div>
</div></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace"> ${LLVM_CORE}</font></div></div></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace"> ${LLVM_SUPPORT}</font></div>
</div></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace"> ${LLVM_SYSTEM}</font></div></div></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace"> )</font></div>
</div></div></blockquote><div><div><br></div><div>Any advice on this?</div><div><br></div>-- <br>-- Talin<br>
</div>