[ELF] - Devirtualize LinkerScriptBase::getOutputSection
It does not use ELFT templates so can be non-virtual.
llvm-svn: 297725
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 7da00fa..bbe0e45 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -79,6 +79,18 @@
   return false;
 }
 
+OutputSection *LinkerScriptBase::getOutputSection(const Twine &Loc,
+                                                  StringRef Name) {
+  static OutputSection FakeSec("", 0, 0);
+
+  for (OutputSection *Sec : *OutputSections)
+    if (Sec->Name == Name)
+      return Sec;
+
+  error(Loc + ": undefined section " + Name);
+  return &FakeSec;
+}
+
 template <class ELFT>
 void LinkerScript<ELFT>::setDot(Expr E, const Twine &Loc, bool InSec) {
   uint64_t Val = E();
@@ -902,19 +914,6 @@
   return INT_MAX;
 }
 
-template <class ELFT>
-OutputSection *LinkerScript<ELFT>::getOutputSection(const Twine &Loc,
-                                                    StringRef Name) {
-  static OutputSection FakeSec("", 0, 0);
-
-  for (OutputSection *Sec : *OutputSections)
-    if (Sec->Name == Name)
-      return Sec;
-
-  error(Loc + ": undefined section " + Name);
-  return &FakeSec;
-}
-
 // This function is essentially the same as getOutputSection(Name)->Size,
 // but it won't print out an error message if a given section is not found.
 //
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index 9452e77..51f8a06 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -240,13 +240,15 @@
 public:
   bool hasPhdrsCommands() { return !Opt.PhdrsCommands.empty(); }
   uint64_t getDot() { return Dot; }
+  OutputSection *getOutputSection(const Twine &Loc, StringRef S);
 
   virtual uint64_t getSymbolValue(const Twine &Loc, StringRef S) = 0;
   virtual bool isDefined(StringRef S) = 0;
   virtual bool isAbsolute(StringRef S) = 0;
   virtual OutputSection *getSymbolSection(StringRef S) = 0;
-  virtual OutputSection *getOutputSection(const Twine &Loc, StringRef S) = 0;
   virtual uint64_t getOutputSectionSize(StringRef S) = 0;
+
+  std::vector<OutputSection *> *OutputSections;
 };
 
 // This is a runner of the linker script.
@@ -275,11 +277,8 @@
   bool isDefined(StringRef S) override;
   bool isAbsolute(StringRef S) override;
   OutputSection *getSymbolSection(StringRef S) override;
-  OutputSection *getOutputSection(const Twine &Loc, StringRef S) override;
   uint64_t getOutputSectionSize(StringRef S) override;
 
-  std::vector<OutputSection *> *OutputSections;
-
   int getSectionIndex(StringRef Name);
 
 private: