<div dir="ltr">Thank you for reviewing. I haven't thought about non-ASCII paths so I guess it's broken not only at this place but also at other places. I'll try to fix.</div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Thu, Jul 18, 2013 at 8:54 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On Thu, Jul 18, 2013 at 11:27 PM, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> Author: ruiu<br>
> Date: Thu Jul 18 22:27:03 2013<br>
> New Revision: 186648<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=186648&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=186648&view=rev</a><br>
> Log:<br>
> [PECOFF][Driver] Interpret "LIB" environment variable.<br>
><br>
> Modified:<br>
>     lld/trunk/lib/Driver/WinLinkDriver.cpp<br>
>     lld/trunk/test/pecoff/importlib.test<br>
><br>
> Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=186648&r1=186647&r2=186648&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=186648&r1=186647&r2=186648&view=diff</a><br>


> ==============================================================================<br>
> --- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)<br>
> +++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Jul 18 22:27:03 2013<br>
> @@ -175,12 +175,32 @@ StringRef getDefaultOutputFileName(PECOF<br>
>    return info.allocateString(smallStr.str());<br>
>  }<br>
><br>
> +// Split the given string with the path separator.<br>
> +std::vector<StringRef> splitPathList(StringRef str) {<br>
> +  std::vector<StringRef> ret;<br>
> +  while (!str.empty()) {<br>
> +    StringRef path;<br>
> +    llvm::tie(path, str) = str.split(';');<br>
> +    ret.push_back(path);<br>
> +  }<br>
> +  return std::move(ret);<br>
> +}<br>
> +<br>
> +// Process "LIB" environment variable. The variable contains a list of<br>
> +// search paths separated by semicolons.<br>
> +void processLibEnvVar(PECOFFTargetInfo &info) {<br>
> +  if (char *envp = ::getenv("LIB"))<br>
<br>
</div></div>This really should be using _wgetenv when on Windows so that it<br>
supports non-ASCII paths.<br>
<div class="HOEnZb"><div class="h5"><br>
> +    for (StringRef path : splitPathList(envp))<br>
> +      info.appendInputSearchPath(info.allocateString(path));<br>
> +}<br>
> +<br>
>  } // namespace<br>
><br>
><br>
>  bool WinLinkDriver::linkPECOFF(int argc, const char *argv[],<br>
>                                 raw_ostream &diagnostics) {<br>
>    PECOFFTargetInfo info;<br>
> +  processLibEnvVar(info);<br>
>    if (parse(argc, argv, info, diagnostics))<br>
>      return true;<br>
>    return link(info, diagnostics);<br>
><br>
> Modified: lld/trunk/test/pecoff/importlib.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/importlib.test?rev=186648&r1=186647&r2=186648&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/importlib.test?rev=186648&r1=186647&r2=186648&view=diff</a><br>


> ==============================================================================<br>
> --- lld/trunk/test/pecoff/importlib.test (original)<br>
> +++ lld/trunk/test/pecoff/importlib.test Thu Jul 18 22:27:03 2013<br>
> @@ -8,6 +8,9 @@<br>
>  #<br>
>  # RUN: lld -flavor link -out %t1 -subsystem console -libpath %p/Inputs \<br>
>  # RUN:    -- %t.obj vars.lib && llvm-objdump -d %t1 | FileCheck %s<br>
> +#<br>
> +# RUN: LIB=%p/Inputs lld -flavor link -out %t1 -subsystem console \<br>
> +# RUN:    -- %t.obj vars.lib && llvm-objdump -d %t1 | FileCheck %s<br>
><br>
>  CHECK: Disassembly of section .text:<br>
>  CHECK: .text:<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">~Aaron<br>
</font></span></blockquote></div><br></div>