[lld] r238682 - COFF: Add /libpath option.
Rui Ueyama
ruiu at google.com
Sun May 31 13:10:11 PDT 2015
Author: ruiu
Date: Sun May 31 15:10:11 2015
New Revision: 238682
URL: http://llvm.org/viewvc/llvm-project?rev=238682&view=rev
Log:
COFF: Add /libpath option.
Modified:
lld/trunk/COFF/Driver.cpp
lld/trunk/test/COFF/nodefaultlib.test
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=238682&r1=238681&r2=238682&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Sun May 31 15:10:11 2015
@@ -208,6 +208,11 @@ bool LinkerDriver::link(int Argc, const
}
Config->MachineType = MTOrErr.get();
+ // Handle /libpath
+ // (Inserting at front of a vector is okay because it's short.)
+ for (auto *Arg : Args->filtered(OPT_libpath))
+ SearchPaths.insert(SearchPaths.begin(), Arg->getValue());
+
// Handle /nodefaultlib:<filename>
for (auto *Arg : Args->filtered(OPT_nodefaultlib))
Config->NoDefaultLibs.insert(doFindLib(Arg->getValue()));
Modified: lld/trunk/test/COFF/nodefaultlib.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/nodefaultlib.test?rev=238682&r1=238681&r2=238682&view=diff
==============================================================================
--- lld/trunk/test/COFF/nodefaultlib.test (original)
+++ lld/trunk/test/COFF/nodefaultlib.test Sun May 31 15:10:11 2015
@@ -9,15 +9,12 @@
# RUN: hello64 /defaultlib:std64.lib >& %t.log
# RUN: FileCheck -check-prefix=CHECK2 %s < %t.log
-### On Windows, "env" command does not propagate subcommand exit status.
-### On Unix it does. "|| true" is a hack to deal with that.
-
-# RUN: env LIB=%T lld -flavor link2 /out:%t.exe /entry:main \
+# RUN: lld -flavor link2 /libpath:%T /out:%t.exe /entry:main \
# RUN: /subsystem:console hello64.obj /defaultlib:std64.lib \
# RUN: /nodefaultlib:std64.lib >& %t.log || true
# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log
-# RUN: env LIB=%T lld -flavor link2 /out:%t.exe /entry:main \
+# RUN: lld -flavor link2 /libpath:%T /out:%t.exe /entry:main \
# RUN: /subsystem:console hello64.obj /defaultlib:std64 \
# RUN: /nodefaultlib:std64.lib >& %t.log || true
# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log
@@ -26,5 +23,8 @@ CHECK1: hello64.obj: {{[Nn]}}o such file
CHECK2: hello64: {{[Nn]}}o such file or directory
CHECK3: undefined symbol: MessageBoxA
+# RUN: lld -flavor link2 /libpath:%T /out:%t.exe /entry:main \
+# RUN: /subsystem:console hello64.obj /defaultlib:std64.lib
+
# RUN: env LIB=%T lld -flavor link2 /out:%t.exe /entry:main \
# RUN: /subsystem:console hello64.obj /defaultlib:std64.lib
More information about the llvm-commits
mailing list