Make elf::ScriptConfig a LinkerScript class member variable.

LinkerScript used to be a template class, so we couldn't instantiate
that class in elf::link. We instantiated ScriptConfig class earlier
instead so that the linker script parser can store configurations to
the object.

Now that LinkerScript is not a template, it doesn't make sense to
separate ScriptConfig from LinkerScript. This patch merges them.

llvm-svn: 298457
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 9c765fa..f98e689 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -53,6 +53,8 @@
 using namespace lld;
 using namespace lld::elf;
 
+LinkerScript *elf::Script;
+
 uint64_t ExprValue::getValue() const {
   if (Sec)
     return Sec->getOffset(Val) + Sec->getOutputSection()->Addr;
@@ -109,9 +111,6 @@
 static ExprValue bitNot(ExprValue A) { return ~A.getValue(); }
 static ExprValue minus(ExprValue A) { return -A.getValue(); }
 
-LinkerScript *elf::Script;
-ScriptConfiguration *elf::ScriptConfig;
-
 template <class ELFT> static SymbolBody *addRegular(SymbolAssignment *Cmd) {
   Symbol *Sym;
   uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT;
@@ -1102,7 +1101,6 @@
   std::pair<std::vector<SymbolVersion>, std::vector<SymbolVersion>>
   readSymbols();
 
-  ScriptConfiguration &Opt = *ScriptConfig;
   bool IsUnderSysroot;
 };
 
@@ -1150,7 +1148,7 @@
       continue;
 
     if (Tok == "ASSERT") {
-      Opt.Commands.emplace_back(new AssertCommand(readAssert()));
+      Script->Opt.Commands.emplace_back(new AssertCommand(readAssert()));
     } else if (Tok == "ENTRY") {
       readEntry();
     } else if (Tok == "EXTERN") {
@@ -1176,7 +1174,7 @@
     } else if (Tok == "VERSION") {
       readVersion();
     } else if (SymbolAssignment *Cmd = readProvideOrAssignment(Tok)) {
-      Opt.Commands.emplace_back(Cmd);
+      Script->Opt.Commands.emplace_back(Cmd);
     } else {
       setError("unknown directive: " + Tok);
     }
@@ -1303,9 +1301,9 @@
   expect("{");
   while (!Error && !consume("}")) {
     StringRef Tok = next();
-    Opt.PhdrsCommands.push_back(
+    Script->Opt.PhdrsCommands.push_back(
         {Tok, PT_NULL, false, false, UINT_MAX, nullptr});
-    PhdrsCommand &PhdrCmd = Opt.PhdrsCommands.back();
+    PhdrsCommand &PhdrCmd = Script->Opt.PhdrsCommands.back();
 
     PhdrCmd.Type = readPhdrType();
     do {
@@ -1339,7 +1337,7 @@
 }
 
 void ScriptParser::readSections() {
-  Opt.HasSections = true;
+  Script->Opt.HasSections = true;
   // -no-rosegment is used to avoid placing read only non-executable sections in
   // their own segment. We do the same if SECTIONS command is present in linker
   // script. See comment for computeFlags().
@@ -1355,7 +1353,7 @@
       else
         Cmd = readOutputSectionDescription(Tok);
     }
-    Opt.Commands.emplace_back(Cmd);
+    Script->Opt.Commands.emplace_back(Cmd);
   }
 }
 
@@ -1469,7 +1467,7 @@
     StringRef FilePattern = next();
     InputSectionDescription *Cmd = readInputSectionRules(FilePattern);
     expect(")");
-    Opt.KeptSections.push_back(Cmd);
+    Script->Opt.KeptSections.push_back(Cmd);
     return Cmd;
   }
   return readInputSectionRules(Tok);
@@ -2072,11 +2070,12 @@
     uint64_t Length = readMemoryAssignment("LENGTH", "len", "l");
 
     // Add the memory region to the region map (if it doesn't already exist).
-    auto It = Opt.MemoryRegions.find(Name);
-    if (It != Opt.MemoryRegions.end())
+    auto It = Script->Opt.MemoryRegions.find(Name);
+    if (It != Script->Opt.MemoryRegions.end())
       setError("region '" + Name + "' already defined");
     else
-      Opt.MemoryRegions[Name] = {Name, Origin, Length, Origin, Flags, NegFlags};
+      Script->Opt.MemoryRegions[Name] = {Name,   Origin, Length,
+                                         Origin, Flags,  NegFlags};
   }
 }