Allowable characters in linker scripts

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 14:46:42 PST 2016


> On Jan 22, 2016, at 2:44 PM, Rui Ueyama <ruiu at google.com> wrote:
> 
> LGTM with the following style change.
> 
> Instead of adding backslashes and double-quotes, we can use single-quotes to quote a string.
> 
> For example, instead of
> 
> RUN: echo "GROUP(\""%t2.so"\" \""%t3.so"\" \""%t4.so"\")" > %t.script
> 
> we can write like this
> 
> RUN: echo 'GROUP("' %t2.so '"" "' %t3.so '" "' %t4.so '")" > %t.script
Thats much better!  Thanks for the suggestion.
> 
> Thank you for doing this!
No problem :)  Thanks for the quick review.

Will commit with those changes.
Pete
> 
> On Fri, Jan 22, 2016 at 2:34 PM, Pete Cooper <peter_cooper at apple.com <mailto:peter_cooper at apple.com>> wrote:
> Hi Rui
> 
> I looked in to relative paths.  Unfortunately relative paths don’t get generated by lit.  When you do %t for example, you get the absolute path to that temp file.
> 
> Attached is a patch which therefore goes the other route, and wraps all the paths in quotes.  Feedback much appreciated.
> 
> Also, I did find a bug in tokenize with this change.  Turns out that the call to substr takes the length of the substring as the second argument, not the end of the range.  So we need to subtract 1 as we start from an index of 1.  The test changes here are hopefully more than sufficient to ensure that doesn’t regress, given the number of quotes I had to add.
> 
> Thanks,
> Pete
> 
> 
> 
>> On Jan 22, 2016, at 1:11 PM, Pete Cooper via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> 
>> Hi Rui
>>> On Jan 22, 2016, at 1:06 PM, Rui Ueyama <ruiu at google.com <mailto:ruiu at google.com>> wrote:
>>> 
>>> Hi Pete,
>>> 
>>> Looks like both ld and gold don't think that @ is a valid character in a token, so I think we shouldn't, too.
>> Ah, thanks for testing that.
>>> $ ld -script <(echo 'SEARCH_DIR( /Volumes/Data/apple-lld-stage1 at 2/ )')
>>> ld:/dev/fd/63:1: ignoring invalid character `@' in expression
>>> ld:/dev/fd/63:1: syntax error
>>> Do you think you can fix the tests by using relative path instead of absolute path?
>> Yep, i’ll try do that now and send out a patch.
>> 
>> Thanks,
>> Pete
>>> 
>>> On Fri, Jan 22, 2016 at 12:48 PM, Pete Cooper <peter_cooper at apple.com <mailto:peter_cooper at apple.com>> wrote:
>>> Hi Rui, Rafael
>>> 
>>> I have a jenkins bot building lld.  Due to a plugin called ‘shared workspaces’ its common to have @’s in paths.
>>> 
>>> This bot is then failing on 3 ELF tests (ELF/as-needed.s, ELF/linkerscript.s, ELF/linkerscript2.s)
>>> 
>>> I’ve diagnosed the issue on linkerscript.s and its down to @ not being in the set of unquoted tokens in LinkerScript::tokenize.
>>> 
>>> I’d like to propose a patch, but first I’d like to double check what the preferred solution is.  I think its either:
>>> - Add @ to the allowable characters in a token, or
>>> - Change the test to quote the path
>>> 
>>> Which would you prefer?
>>> 
>>> Thanks,
>>> Pete
>>> 
>>> PS, the linkerscipt.s script contains this entry which is the cause of the failure: "SEARCH_DIR( /Volumes/Data/apple-lld-stage1 at 2/build/tools/lld/test/ELF/Output/linkerscript2.s.tmp.dir )"
>>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160122/ebd5e757/attachment.html>


More information about the llvm-commits mailing list