[ELF] - Combine LinkerScriptBase and LinkerScript<ELFT>

Patch removes templated linkerscript class.

Unfortunately that required 2 additional static methods
findSymbol() and addRegularSymbol() because code
depends on Symtab<ELFT>::X

Differential revision: https://reviews.llvm.org/D30982

llvm-svn: 298241
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index ee08b27..a35d427 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -223,8 +223,6 @@
 
 class LinkerScriptBase {
 protected:
-  ~LinkerScriptBase() = default;
-
   void assignSymbol(SymbolAssignment *Cmd, bool InSec = false);
   void computeInputSections(InputSectionDescription *);
   void setDot(Expr E, const Twine &Loc, bool InSec = false);
@@ -265,8 +263,8 @@
   uint64_t getOutputSectionSize(StringRef S);
   void discard(ArrayRef<InputSectionBase *> V);
 
-  virtual ExprValue getSymbolValue(const Twine &Loc, StringRef S) = 0;
-  virtual bool isDefined(StringRef S) = 0;
+  ExprValue getSymbolValue(const Twine &Loc, StringRef S);
+  bool isDefined(StringRef S);
 
   std::vector<OutputSection *> *OutputSections;
   void addOrphanSections(OutputSectionFactory &Factory);
@@ -285,28 +283,13 @@
   void processNonSectionCommands();
   void assignAddresses(std::vector<PhdrEntry> &Phdrs);
   int getSectionIndex(StringRef Name);
-};
-
-// This is a runner of the linker script.
-template <class ELFT> class LinkerScript final : public LinkerScriptBase {
-public:
-  LinkerScript();
-  ~LinkerScript();
 
   void writeDataBytes(StringRef Name, uint8_t *Buf);
   void addSymbol(SymbolAssignment *Cmd);
   void processCommands(OutputSectionFactory &Factory);
-
-  ExprValue getSymbolValue(const Twine &Loc, StringRef S) override;
-  bool isDefined(StringRef S) override;
 };
 
-// Variable template is a C++14 feature, so we can't template
-// a global variable. Use a struct to workaround.
-template <class ELFT> struct Script { static LinkerScript<ELFT> *X; };
-template <class ELFT> LinkerScript<ELFT> *Script<ELFT>::X;
-
-extern LinkerScriptBase *ScriptBase;
+extern LinkerScriptBase *Script;
 
 } // end namespace elf
 } // end namespace lld