From f4784cce544408ad81d64d423eeea11f9a947d73 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sun, 31 May 2015 20:20:37 +0000 Subject: [PATCH] COFF: /libpath should not take precedence over the current directory. llvm-svn: 238683 --- lld/COFF/Driver.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index a73c11b..8c3d664 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -209,9 +209,11 @@ bool LinkerDriver::link(int Argc, const char *Argv[]) { 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()); + 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()); + } // Handle /nodefaultlib: for (auto *Arg : Args->filtered(OPT_nodefaultlib)) -- 2.7.4