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)); + } } }