[ELF2] Implement linker script SEARCH_DIR() directive.

llvm-svn: 249707
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index a2b4fa5..cf1b646 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -41,6 +41,7 @@
   void readGroup();
   void readOutput();
   void readOutputFormat();
+  void readSearchDir();
 
   std::vector<StringRef> Tokens;
   size_t Pos = 0;
@@ -58,6 +59,8 @@
       readOutput();
     } else if (Tok == "OUTPUT_FORMAT") {
       readOutputFormat();
+    } else if (Tok == "SEARCH_DIR") {
+      readSearchDir();
     } else {
       error("unknown directive: " + Tok);
     }
@@ -173,6 +176,12 @@
   expect(")");
 }
 
+void LinkerScript::readSearchDir() {
+  expect("(");
+  Config->InputSearchPaths.push_back(next());
+  expect(")");
+}
+
 // Entry point. The other functions or classes are private to this file.
 void lld::elf2::readLinkerScript(MemoryBufferRef MB) {
   LinkerScript(MB.getBuffer()).run();