<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 2/25/2014 2:03 AM, Chandler Carruth
wrote:<br>
</div>
<blockquote
cite="mid:CAGCO0KgPmTcek2F6r1QbiOwSs_BOBpHvgeXLj5rF2zmajU5sgw@mail.gmail.com"
type="cite">
<pre wrap="">On Mon, Feb 24, 2014 at 11:38 PM, Rui Ueyama <a class="moz-txt-link-rfc2396E" href="mailto:ruiu@google.com"><ruiu@google.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Mon, Feb 24, 2014 at 11:24 PM, Shankar Easwaran <
<a class="moz-txt-link-abbreviated" href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 2/25/2014 1:14 AM, Rui Ueyama wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Mon, Feb 24, 2014 at 10:52 PM, Shankar Easwaran
<a class="moz-txt-link-rfc2396E" href="mailto:shankare@codeaurora.org"><shankare@codeaurora.org></a>wrote:
Hi Chandler, Rui,
</pre>
<blockquote type="cite">
<pre wrap="">
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 wrap="">
</pre>
</blockquote>
<pre wrap="">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 wrap="">
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 wrap="">
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>
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<br>
ld.gold: fatal error: no input files<br>
<br>
<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>
<br>
Thanks<br>
<br>
Shankar Easwaran<br>
<pre class="moz-signature" cols="72">--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation</pre>
</body>
</html>