[lld] r202111 - [LinkerScript] OUTPUT_FORMAT: Parse Quoted Strings

Chandler Carruth chandlerc at google.com
Tue Feb 25 01:20:08 PST 2014


On Tue, Feb 25, 2014 at 12:23 AM, Shankar Easwaran
<shankare at codeaurora.org>wrote:

> $ld.gold -T y1
> ld.gold: error: y1:1:29: syntax error, unexpected QUOTED_STRING, expecting
> ')' or ','
> ld.gold: fatal error: unable to parse script file y1
>
> $ld -T y1
> ld:y1:1: syntax error
>
> 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.
>

This is *not* because the quotes aren't allowed. The error is because
without the quotes, 'foo,' is lexed as the argument to the command. This is
why adding whitespace before the ',' fixes the issue, as Rui has repeatedly
pointed out.

Try this example:

OUTPUT_FORMAT("elf64-powerpc", elf64-powerpc, "elf64-powerpcle");

Here I get:
ld.gold: error: x:1:47: syntax error, unexpected QUOTED_STRING, expecting
','

Note that this points to the third argument's open " as the error. The
problem isn't that the first argument is quoted or the second argument
isn't quoted, it is that the ',' is considered part of the string. Adding
just a space before the ',' will fix this error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140225/5cc59998/attachment.html>


More information about the llvm-commits mailing list