[PATCH] D27831: [ELF] - Linkerscript: Fall back to search paths when INCLUDE not found

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 15:47:15 PST 2016


arichardson removed rL LLVM as the repository for this revision.
arichardson updated this revision to Diff 81682.
arichardson added a comment.

address comments


https://reviews.llvm.org/D27831

Files:
  ELF/LinkerScript.cpp


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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27831.81682.patch
Type: text/x-patch
Size: 734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161215/c5e2a553/attachment.bin>


More information about the llvm-commits mailing list