<div dir="ltr">Hi Davide,<div><br></div><div>-plugin-opt is passed when the user attempts to change the LTO behaviour - for example overriding the codegen option level, or passing a backend option to LLVM. It being ignored silently will surely cause much head scratching down the line.</div><div><br></div><div>Can we at least get a diagnostic with the intended alternative listed?</div><div><br></div><div>Cheers,</div><div><br></div><div>James</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, 19 Mar 2016 at 01:45 Davide Italiano via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davide<br>
Date: Fri Mar 18 19:40:09 2016<br>
New Revision: 263862<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=263862&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=263862&view=rev</a><br>
Log:<br>
[LTO] Ignore -plugin/-plugin-opt options.<br>
<br>
This is required to get 'clang -flto' to work transparently<br>
with lld. Please refer to the short comment in the code<br>
for a more detailed explanation.<br>
<br>
Modified:<br>
    lld/trunk/ELF/Options.td<br>
<br>
Modified: lld/trunk/ELF/Options.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=263862&r1=263861&r2=263862&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=263862&r1=263861&r2=263862&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Options.td (original)<br>
+++ lld/trunk/ELF/Options.td Fri Mar 18 19:40:09 2016<br>
@@ -181,6 +181,16 @@ def end_group_paren: Flag<["-"], ")">;<br>
 def start_group : Flag<["--"], "start-group">;<br>
 def start_group_paren: Flag<["-"], "(">;<br>
<br>
+// Ignore LTO plugin-related options.<br>
+// clang -flto passes -plugin and -plugin-opt to the linker. This is required<br>
+// for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't<br>
+// rely on a plugin. Instead of detecting which linker is used on clang side we<br>
+// just ignore the option on lld side as it's easier. In fact, the linker could<br>
+// be called 'ld' and understanding which linker is used would require parsing of<br>
+// --version output.<br>
+def plugin : Separate<["-"], "plugin">;<br>
+def plugin_opt : Joined<["-"], "plugin-opt=">;<br>
+<br>
 // Options listed below are silently ignored for now for compatibility.<br>
 def fatal_warnings : Flag<["--"], "fatal-warnings">;<br>
 def no_add_needed : Flag<["--"], "no-add-needed">;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>