[lld] r240180 - COFF: Add search paths in the correct order.
Rui Ueyama
ruiu at google.com
Fri Jun 19 14:44:32 PDT 2015
Author: ruiu
Date: Fri Jun 19 16:44:32 2015
New Revision: 240180
URL: http://llvm.org/viewvc/llvm-project?rev=240180&view=rev
Log:
COFF: Add search paths in the correct order.
Previously, we added search paths in reverse order.
Added:
lld/trunk/test/COFF/libpath.test
Modified:
lld/trunk/COFF/Driver.cpp
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=240180&r1=240179&r2=240180&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Fri Jun 19 16:44:32 2015
@@ -288,11 +288,8 @@ bool LinkerDriver::link(int Argc, const
Config->MachineType = MTOrErr.get();
// Handle /libpath
- for (auto *Arg : Args->filtered(OPT_libpath)) {
- // Inserting at front of a vector is okay because it's short.
- // +1 because the first entry is always "." (current directory).
- SearchPaths.insert(SearchPaths.begin() + 1, Arg->getValue());
- }
+ for (auto *Arg : Args->filtered(OPT_libpath))
+ SearchPaths.push_back(Arg->getValue());
// Handle /nodefaultlib:<filename>
for (auto *Arg : Args->filtered(OPT_nodefaultlib))
Added: lld/trunk/test/COFF/libpath.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/libpath.test?rev=240180&view=auto
==============================================================================
--- lld/trunk/test/COFF/libpath.test (added)
+++ lld/trunk/test/COFF/libpath.test Fri Jun 19 16:44:32 2015
@@ -0,0 +1,26 @@
+# RUN: mkdir -p %t/a %t/b
+# RUN: cp %p/Inputs/std64.lib %t/a/
+# RUN: cp %p/Inputs/std64.lib %t/b/
+
+# RUN: env LIB=%t/a lld -flavor link2 /out:%t.exe /entry:main /verbose \
+# RUN: std64.lib /subsystem:console \
+# RUN: %p/Inputs/hello64.obj /libpath:%t/b >& %t.log
+# RUN: FileCheck -check-prefix=CHECK1 %s < %t.log
+
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /verbose std64.lib \
+# RUN: /subsystem:console %p/Inputs/hello64.obj \
+# RUN: /libpath:%t/a /libpath:%t/b >& %t.log
+# RUN: FileCheck -check-prefix=CHECK1 %s < %t.log
+
+CHECK1: Reading {{.*}}/a/std64.lib
+
+# RUN: env LIB=%t/b lld -flavor link2 /out:%t.exe /entry:main /verbose \
+# RUN: /subsystem:console std64.lib %p/Inputs/hello64.obj \
+# RUN: /libpath:%t/a >& %t.log
+# RUN: FileCheck -check-prefix=CHECK2 %s < %t.log
+
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /verbose /subsystem:console \
+# RUN: std64.lib %p/Inputs/hello64.obj /libpath:%t/b /libpath:%t/a >& %t.log
+# RUN: FileCheck -check-prefix=CHECK2 %s < %t.log
+
+CHECK2: Reading {{.*}}/b/std64.lib
More information about the llvm-commits
mailing list