summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/LinkerScript.cpp25
-rw-r--r--lld/ELF/LinkerScript.h7
2 files changed, 15 insertions, 17 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 7da00fa4224..bbe0e45816c 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -79,6 +79,18 @@ static bool isUnderSysroot(StringRef Path) {
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 @@ template <class ELFT> int LinkerScript<ELFT>::getSectionIndex(StringRef Name) {
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 9452e775aa0..51f8a06554f 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -240,13 +240,15 @@ protected:
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 @@ public:
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:
OpenPOWER on IntegriCloud