Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -1184,8 +1184,14 @@ } void ScriptParser::readInclude() { - StringRef Tok = next(); - auto MBOrErr = MemoryBuffer::getFile(unquote(Tok)); + auto Tok = unquote(next()); + // 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(Tok); + if (!MBOrErr) + if (auto Path = findFromSearchPaths(Tok)) + MBOrErr = MemoryBuffer::getFile(*Path); if (!MBOrErr) { setError("cannot open " + Tok); return;