Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -1185,7 +1185,15 @@ void ScriptParser::readInclude() { StringRef Tok = next(); - auto MBOrErr = MemoryBuffer::getFile(unquote(Tok)); + auto Unquoted = unquote(Tok); + // https://sourceware.org/binutils/docs/ld/File-Commands.html: + // The file will be searched for in the current directory, and in any + // directory specified with the -L option. + auto MBOrErr = MemoryBuffer::getFile(Unquoted); + if (!MBOrErr) { + if (auto Path = findFromSearchPaths(Unquoted)) + MBOrErr = MemoryBuffer::getFile(*Path); + } if (!MBOrErr) { setError("cannot open " + Tok); return;