<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 25, 2014 at 12:23 AM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div><div class="h5">
    <div>On 2/25/2014 2:03 AM, Chandler Carruth
      wrote:<br>
    </div>
    <blockquote type="cite">
      <pre>On Mon, Feb 24, 2014 at 11:38 PM, Rui Ueyama <a href="mailto:ruiu@google.com" target="_blank"><ruiu@google.com></a> wrote:

</pre>
      <blockquote type="cite">
        <pre>On Mon, Feb 24, 2014 at 11:24 PM, Shankar Easwaran <
<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>> wrote:

</pre>
        <blockquote type="cite">
          <pre>On 2/25/2014 1:14 AM, Rui Ueyama wrote:

</pre>
          <blockquote type="cite">
            <pre>On Mon, Feb 24, 2014 at 10:52 PM, Shankar Easwaran
<a href="mailto:shankare@codeaurora.org" target="_blank"><shankare@codeaurora.org></a>wrote:

 Hi Chandler, Rui,
</pre>
            <blockquote type="cite">
              <pre>For example :-

OUTPUT_FORMAT(x, "y", "z")

We need to display an error for the above case, while

OUTPUT_FORMAT("x", "y", "z") produces no error.

 Both gave me error...
</pre>
            </blockquote>
            <pre></pre>
          </blockquote>
          <pre>I am not sure about your ld version, but here it is :-

$cat x
OUTPUT_FORMAT(x, "y", "z");

$ld -T x
ld:x:1: syntax error
$cat y
OUTPUT_FORMAT("x", "y", "z");
$ld -T y
ld: no input files
</pre>
        </blockquote>
        <pre>OUTPUT_FORMAT( x , "y", "z");

does not print an error (x with surrounding whitespaces). It's not a
matter of double quotes? I found that some parentheses in Linux's libc.so
are surrounded by whitespace characters too, so something may be wrong with
"(" handling in GNU LD, but it seems to be different issue from quoted
string.

</pre>
      </blockquote>
      <pre>I think the errors from OUTPUT_FORMAT with a string which is not a bfdname
are red herrings. I don't think either GNU LD or Gold correctly recover
from random strings used here.</pre>
    </blockquote>
    <br></div></div>
    With proper strings, here is the behavior thats consistent with
    gold/ld.<br>
    <br>
    <u><b>Good case</b></u><br>
    <br>
    $cat x1 <br>
    OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64");<br>
    <br>
    $ld -T x1<br>
    ld: no input files<br>
    <br>
    $ld.gold -T x1<div class=""><br>
    ld.gold: fatal error: no input files<br>
    <br>
    </div><u><b>Bad case </b></u><br>
    $cat y1<br>
    OUTPUT_FORMAT(elf64-x86-64, "elf64-x86-64", "elf64-x86-64");<br>
    <br>
    $ld.gold -T y1<br>
    ld.gold: error: y1:1:29: syntax error, unexpected QUOTED_STRING,
    expecting ')' or ','<br>
    ld.gold: fatal error: unable to parse script file y1<br>
    <br>
    $ld -T y1<br>
    ld:y1:1: syntax error<br>
    <br>
    I want to remain consistent with this behavior in the case of lld as
    well, and fix the GNU ld bugs in lld as well so that behavior is
    consistent when you use a arbitrary mix of quoted/unquoted strings.<br></div></blockquote><div><br></div><div>As I said many times in this thread, please add surrounding whitespaces around the first argument. Both GNU LD and GOLD accepts it. If you make LLD to reject such expression because the first argument not quoted by doublequotes, it's going to be inconsistent with GNU LD/GOLD. It's worse than accept-invalid because it's going to be an reject-valid issue.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    <br>
    Thanks<span class="HOEnZb"><font color="#888888"><br>
    <br>
    Shankar Easwaran</font></span><div class=""><br>
    <pre cols="72">-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation</pre>
  </div></div>

</blockquote></div><br></div></div>