[lld] r186648 - [PECOFF][Driver] Interpret "LIB" environment variable.
罗勇刚(Yonggang Luo)
luoyonggang at gmail.com
Fri Jul 19 01:12:08 PDT 2013
在 2013-7-19 下午12:03,"Rui Ueyama" <ruiu at google.com>写道:
>
> 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.
I think it's should be platform neutral about getenv, so it's should be
implemented in support
>
>
> On Thu, Jul 18, 2013 at 8:54 PM, Aaron Ballman <aaron at aaronballman.com>
wrote:
>>
>> On Thu, Jul 18, 2013 at 11:27 PM, Rui Ueyama <ruiu at google.com> wrote:
>> > Author: ruiu
>> > Date: Thu Jul 18 22:27:03 2013
>> > New Revision: 186648
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=186648&view=rev
>> > Log:
>> > [PECOFF][Driver] Interpret "LIB" environment variable.
>> >
>> > Modified:
>> > lld/trunk/lib/Driver/WinLinkDriver.cpp
>> > lld/trunk/test/pecoff/importlib.test
>> >
>> > Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
>> > URL:
http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=186648&r1=186647&r2=186648&view=diff
>> >
==============================================================================
>> > --- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
>> > +++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Jul 18 22:27:03 2013
>> > @@ -175,12 +175,32 @@ StringRef getDefaultOutputFileName(PECOF
>> > return info.allocateString(smallStr.str());
>> > }
>> >
>> > +// Split the given string with the path separator.
>> > +std::vector<StringRef> splitPathList(StringRef str) {
>> > + std::vector<StringRef> ret;
>> > + while (!str.empty()) {
>> > + StringRef path;
>> > + llvm::tie(path, str) = str.split(';');
>> > + ret.push_back(path);
>> > + }
>> > + return std::move(ret);
>> > +}
>> > +
>> > +// Process "LIB" environment variable. The variable contains a list of
>> > +// search paths separated by semicolons.
>> > +void processLibEnvVar(PECOFFTargetInfo &info) {
>> > + if (char *envp = ::getenv("LIB"))
>>
>> This really should be using _wgetenv when on Windows so that it
>> supports non-ASCII paths.
>>
>> > + for (StringRef path : splitPathList(envp))
>> > + info.appendInputSearchPath(info.allocateString(path));
>> > +}
>> > +
>> > } // namespace
>> >
>> >
>> > bool WinLinkDriver::linkPECOFF(int argc, const char *argv[],
>> > raw_ostream &diagnostics) {
>> > PECOFFTargetInfo info;
>> > + processLibEnvVar(info);
>> > if (parse(argc, argv, info, diagnostics))
>> > return true;
>> > return link(info, diagnostics);
>> >
>> > Modified: lld/trunk/test/pecoff/importlib.test
>> > URL:
http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/importlib.test?rev=186648&r1=186647&r2=186648&view=diff
>> >
==============================================================================
>> > --- lld/trunk/test/pecoff/importlib.test (original)
>> > +++ lld/trunk/test/pecoff/importlib.test Thu Jul 18 22:27:03 2013
>> > @@ -8,6 +8,9 @@
>> > #
>> > # RUN: lld -flavor link -out %t1 -subsystem console -libpath
%p/Inputs \
>> > # RUN: -- %t.obj vars.lib && llvm-objdump -d %t1 | FileCheck %s
>> > +#
>> > +# RUN: LIB=%p/Inputs lld -flavor link -out %t1 -subsystem console \
>> > +# RUN: -- %t.obj vars.lib && llvm-objdump -d %t1 | FileCheck %s
>> >
>> > CHECK: Disassembly of section .text:
>> > CHECK: .text:
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> ~Aaron
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130719/0dc0e0d5/attachment.html>
More information about the llvm-commits
mailing list