[lld] r254178 - [ELF] Lookup INPUT argument in the current directory

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 26 12:23:47 PST 2015


Author: atanasyan
Date: Thu Nov 26 14:23:46 2015
New Revision: 254178

URL: http://llvm.org/viewvc/llvm-project?rev=254178&view=rev
Log:
[ELF] Lookup INPUT argument in the current directory

If an argument of the INPUT directive is a regular path, linker should
lookup it in the current folder first.

The fix does not contain any test cases because I think it is not a good
idea to pollute a current folder (which in general might be arbitrary)
by test files.

Differential Revision: http://reviews.llvm.org/D15027

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=254178&r1=254177&r2=254178&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Nov 26 14:23:46 2015
@@ -179,6 +179,8 @@ void LinkerScript::addFile(StringRef S)
       Driver->addFile(Saver.save(Config->Sysroot + "/" + S.substr(1)));
   } else if (S.startswith("-l")) {
     Driver->addFile(searchLibrary(S.substr(2)));
+  } else if (sys::fs::exists(S)) {
+    Driver->addFile(S);
   } else {
     std::string Path = findFromSearchPaths(S);
     if (Path.empty())




More information about the llvm-commits mailing list