[PATCH] D15027: [ELF] Lookup INPUT argument in the current directory

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


atanasyan created this revision.
atanasyan added a reviewer: ruiu.
atanasyan added a subscriber: llvm-commits.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.

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.

Repository:
  rL LLVM

http://reviews.llvm.org/D15027

Files:
  ELF/LinkerScript.cpp

Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -180,10 +180,14 @@
   } else if (S.startswith("-l")) {
     Driver->addFile(searchLibrary(S.substr(2)));
   } else {
-    std::string Path = findFromSearchPaths(S);
-    if (Path.empty())
-      error("Unable to find " + S);
-    Driver->addFile(Saver.save(Path));
+    if (sys::fs::exists(S))
+      Driver->addFile(S);
+    else {
+      std::string Path = findFromSearchPaths(S);
+      if (Path.empty())
+        error("Unable to find " + S);
+      Driver->addFile(Saver.save(Path));
+    }
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15027.41260.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151126/1f891a42/attachment.bin>


More information about the llvm-commits mailing list